/* Generated by Cython 0.29.21 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "PygameShader\\Include\\Shaderlib.c"
        ],
        "extra_compile_args": [
            "/openmp",
            "/Qpar",
            "/fp:fast",
            "/O2",
            "/Oy",
            "/Ot"
        ],
        "include_dirs": [
            "PygameShader",
            ".\\PygameShader"
        ],
        "language": "c",
        "name": "PygameShader.shader",
        "sources": [
            "PygameShader/shader.pyx"
        ]
    },
    "module_name": "PygameShader.shader"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_21"
#define CYTHON_HEX_VERSION 0x001D15F0
#define CYTHON_FUTURE_DIVISION 0
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#define __PYX_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__PygameShader__shader
#define __PYX_HAVE_API__PygameShader__shader
/* Early includes */
#include "Include/Shaderlib.c"
#include <string.h>
#include <stdio.h>
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"

    /* NumPy API declarations from "numpy/__init__.pxd" */
    
#include "pythread.h"
#include <stdlib.h>
#include <math.h>
#include "pystate.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

/* Header.proto */
#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif


static const char *__pyx_f[] = {
  "PygameShader\\shader.pxd",
  "PygameShader\\shader.pyx",
  "__init__.pxd",
  "stringsource",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
};
/* MemviewSliceStruct.proto */
struct __pyx_memoryview_obj;
typedef struct {
  struct __pyx_memoryview_obj *memview;
  char *data;
  Py_ssize_t shape[8];
  Py_ssize_t strides[8];
  Py_ssize_t suboffsets[8];
} __Pyx_memviewslice;
#define __Pyx_MemoryView_Len(m)  (m.shape[0])

/* Atomics.proto */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __pyx_atomic_int_type int
#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
                    !defined(__i386__)
    #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
    #include <Windows.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type LONG
    #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
    #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
    #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
    #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using Intel atomics"
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif
typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
#if CYTHON_ATOMICS
    #define __pyx_add_acquisition_count(memview)\
             __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
#else
    #define __pyx_add_acquisition_count(memview)\
            __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#endif

/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* BufferFormatStructs.proto */
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name;
  struct __Pyx_StructField_* fields;
  size_t size;
  size_t arraysize[8];
  int ndim;
  char typegroup;
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;


/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":697
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":698
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":699
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":700
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":704
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":705
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":706
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":707
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":711
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":712
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":721
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":722
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":723
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":725
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":726
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":727
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":729
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":730
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":732
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":733
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":734
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);


/*--- Type declarations ---*/
struct __pyx_array_obj;
struct __pyx_MemviewEnum_obj;
struct __pyx_memoryview_obj;
struct __pyx_memoryviewslice_obj;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":736
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":737
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":738
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":740
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_opt_args_12PygameShader_4misc_create_horizontal_gradient_1d;
struct __pyx_opt_args_12PygameShader_4misc_horizontal_grad3d;

/* "PygameShader/misc.pxd":51
 * 
 * cpdef create_horizontal_gradient_1d(
 *         int value,             # <<<<<<<<<<<<<<
 *         tuple start_color=*,
 *         tuple end_color=*
 */
struct __pyx_opt_args_12PygameShader_4misc_create_horizontal_gradient_1d {
  int __pyx_n;
  PyObject *start_color;
  PyObject *end_color;
};

/* "PygameShader/misc.pxd":56
 * )
 * 
 * cpdef object horizontal_grad3d(             # <<<<<<<<<<<<<<
 *         int width,
 *         int height,
 */
struct __pyx_opt_args_12PygameShader_4misc_horizontal_grad3d {
  int __pyx_n;
  PyObject *start_color;
  PyObject *end_color;
};
struct __pyx_opt_args_12PygameShader_6shader_median_fast;
struct __pyx_opt_args_12PygameShader_6shader_median;
struct __pyx_opt_args_12PygameShader_6shader_median_grayscale;
struct __pyx_opt_args_12PygameShader_6shader_median_avg;
struct __pyx_opt_args_12PygameShader_6shader_color_reduction;
struct __pyx_opt_args_12PygameShader_6shader_sobel;
struct __pyx_opt_args_12PygameShader_6shader_sobel_fast;
struct __pyx_opt_args_12PygameShader_6shader_blur;
struct __pyx_opt_args_12PygameShader_6shader_plasma_config;
struct __pyx_opt_args_12PygameShader_6shader_brightness_exclude;
struct __pyx_opt_args_12PygameShader_6shader_brightness_bpf;
struct __pyx_opt_args_12PygameShader_6shader_bpf;
struct __pyx_opt_args_12PygameShader_6shader_bloom;
struct __pyx_opt_args_12PygameShader_6shader_tv_scan;
struct __pyx_opt_args_12PygameShader_6shader_rgb_split;
struct __pyx_opt_args_12PygameShader_6shader_rgb_split_clean;
struct __pyx_opt_args_12PygameShader_6shader_heatmap;
struct __pyx_opt_args_12PygameShader_6shader_predator_vision;
struct __pyx_opt_args_12PygameShader_6shader_fire_effect;
struct __pyx_opt_args_12PygameShader_6shader_cloud_effect;
struct __pyx_opt_args_12PygameShader_6shader_lateral_dampening;
struct __pyx_opt_args_12PygameShader_6shader_dampening;
struct __pyx_opt_args_12PygameShader_6shader_cartoon;
struct __pyx_opt_args_12PygameShader_6shader_dirt_lens;
struct __pyx_opt_args_12PygameShader_6shader_dithering;
struct __pyx_opt_args_12PygameShader_6shader_dithering_int;
struct __pyx_opt_args_12PygameShader_6shader_spectrum;
struct __pyx_opt_args_12PygameShader_6shader_emboss;
struct __pyx_opt_args_12PygameShader_6shader_gauss;
struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_heapsort_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_avg_inplace_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_inplace_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_fast_inplace_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_blur5x5_array24_inplace_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_plasma24bit_inplace_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_inplace_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_exclude_inplace_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_bpf_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_bpf24_inplace_c;
struct __pyx_opt_args_12PygameShader_6shader_bpf24_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_bloom_effect_array24_c;
struct __pyx_opt_args_12PygameShader_6shader_putmask_c;
struct __pyx_opt_args_12PygameShader_6shader_heat_map;
struct __pyx_opt_args_12PygameShader_6shader_custom_map;
struct __pyx_opt_args_12PygameShader_6shader_heatmap_convert;
struct __pyx_opt_args_12PygameShader_6shader_blue_map;
struct __pyx_opt_args_12PygameShader_6shader_red_map;
struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c;
struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c_border;
struct __pyx_opt_args_12PygameShader_6shader_shader_fire_effect_c;
struct __pyx_opt_args_12PygameShader_6shader_cloud_surface24_c;
struct __pyx_opt_args_12PygameShader_6shader_shader_cloud_effect_c;
struct __pyx_opt_args_12PygameShader_6shader_dirt_lens_c;
struct __pyx_opt_args_12PygameShader_6shader_spectrum_c;

/* "PygameShader/shader.pxd":100
 * cpdef void sepia(object surface_)
 * 
 * cdef void median_fast(object surface_, unsigned short int kernel_size_=*,             # <<<<<<<<<<<<<<
 *                       unsigned short int reduce_factor_=*)
 * cpdef void median(
 */
struct __pyx_opt_args_12PygameShader_6shader_median_fast {
  int __pyx_n;
  unsigned short kernel_size_;
  unsigned short reduce_factor_;
};

/* "PygameShader/shader.pxd":102
 * cdef void median_fast(object surface_, unsigned short int kernel_size_=*,
 *                       unsigned short int reduce_factor_=*)
 * cpdef void median(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned short int kernel_size_=*,
 */
struct __pyx_opt_args_12PygameShader_6shader_median {
  int __pyx_n;
  unsigned short kernel_size_;
  int fast_;
  unsigned short reduce_factor_;
};

/* "PygameShader/shader.pxd":107
 *         bint fast_=*,
 *         unsigned short int reduce_factor_=*)except *
 * cpdef void median_grayscale(object surface_, int kernel_size_=*)             # <<<<<<<<<<<<<<
 * cpdef void median_avg(object surface_, int kernel_size_=*)
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_median_grayscale {
  int __pyx_n;
  int kernel_size_;
};

/* "PygameShader/shader.pxd":108
 *         unsigned short int reduce_factor_=*)except *
 * cpdef void median_grayscale(object surface_, int kernel_size_=*)
 * cpdef void median_avg(object surface_, int kernel_size_=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef void color_reduction(object surface_, int color_=*)
 */
struct __pyx_opt_args_12PygameShader_6shader_median_avg {
  int __pyx_n;
  int kernel_size_;
};

/* "PygameShader/shader.pxd":110
 * cpdef void median_avg(object surface_, int kernel_size_=*)
 * 
 * cpdef void color_reduction(object surface_, int color_=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef void sobel(object surface_, int threshold_=*)
 */
struct __pyx_opt_args_12PygameShader_6shader_color_reduction {
  int __pyx_n;
  int color_;
};

/* "PygameShader/shader.pxd":112
 * cpdef void color_reduction(object surface_, int color_=*)
 * 
 * cpdef void sobel(object surface_, int threshold_=*)             # <<<<<<<<<<<<<<
 * cpdef void sobel_fast(object surface_, int threshold_=*,
 *                                        unsigned short factor_=*)
 */
struct __pyx_opt_args_12PygameShader_6shader_sobel {
  int __pyx_n;
  int threshold_;
};

/* "PygameShader/shader.pxd":113
 * 
 * cpdef void sobel(object surface_, int threshold_=*)
 * cpdef void sobel_fast(object surface_, int threshold_=*,             # <<<<<<<<<<<<<<
 *                                        unsigned short factor_=*)
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_sobel_fast {
  int __pyx_n;
  int threshold_;
  unsigned short factor_;
};

/* "PygameShader/shader.pxd":123
 *         unsigned char [:, :, :, ::1] rgb_model_)
 * 
 * cpdef void blur(object surface_, t_=*)             # <<<<<<<<<<<<<<
 * cpdef void wave(object surface_, float rad, int size)
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_blur {
  int __pyx_n;
  PyObject *t_;
};

/* "PygameShader/shader.pxd":129
 * cpdef void swirl2(object surface_, float degrees)
 * 
 * cpdef void plasma_config(object surface_, int frame,             # <<<<<<<<<<<<<<
 *                                       float hue_=*, float sat_=*, float value_=*,
 *                                       float a_=*, float b_=*, float c_=*)
 */
struct __pyx_opt_args_12PygameShader_6shader_plasma_config {
  int __pyx_n;
  float hue_;
  float sat_;
  float value_;
  float a_;
  float b_;
  float c_;
};

/* "PygameShader/shader.pxd":137
 * 
 * cpdef void brightness(object surface_, float shift_)
 * cpdef void brightness_exclude(object surface_, float shift_, color_=*)             # <<<<<<<<<<<<<<
 * cpdef void brightness_bpf(
 *         object surface_,
 */
struct __pyx_opt_args_12PygameShader_6shader_brightness_exclude {
  int __pyx_n;
  PyObject *color_;
};

/* "PygameShader/shader.pxd":138
 * cpdef void brightness(object surface_, float shift_)
 * cpdef void brightness_exclude(object surface_, float shift_, color_=*)
 * cpdef void brightness_bpf(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float shift_,
 */
struct __pyx_opt_args_12PygameShader_6shader_brightness_bpf {
  int __pyx_n;
  unsigned char bpf_threshold;
};

/* "PygameShader/shader.pxd":151
 * cpdef void horizontal_glitch(object surface_, float rad1_, float frequency_,
 *                                               float amplitude_)
 * cpdef void bpf(object surface_, int threshold = *)             # <<<<<<<<<<<<<<
 * cpdef void bloom(object surface_, int threshold_, bint fast_=*)
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_bpf {
  int __pyx_n;
  int threshold;
};

/* "PygameShader/shader.pxd":152
 *                                               float amplitude_)
 * cpdef void bpf(object surface_, int threshold = *)
 * cpdef void bloom(object surface_, int threshold_, bint fast_=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef fisheye_footprint(int w, int h)
 */
struct __pyx_opt_args_12PygameShader_6shader_bloom {
  int __pyx_n;
  int fast_;
};

/* "PygameShader/shader.pxd":161
 *                                          unsigned int [:, :, ::1] rain_fisheye_model)
 * 
 * cpdef void tv_scan(object surface_, int space=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef void rgb_split(object surface_, int offset_=*)
 */
struct __pyx_opt_args_12PygameShader_6shader_tv_scan {
  int __pyx_n;
  int space;
};

/* "PygameShader/shader.pxd":163
 * cpdef void tv_scan(object surface_, int space=*)
 * 
 * cpdef void rgb_split(object surface_, int offset_=*)             # <<<<<<<<<<<<<<
 * cpdef object rgb_split_clean(object surface_, int offset_=*)
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_rgb_split {
  int __pyx_n;
  int offset_;
};

/* "PygameShader/shader.pxd":164
 * 
 * cpdef void rgb_split(object surface_, int offset_=*)
 * cpdef object rgb_split_clean(object surface_, int offset_=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef tuple ripple(int rows_, int cols_, float [:, ::1] previous_, float [:, ::1] current_,
 */
struct __pyx_opt_args_12PygameShader_6shader_rgb_split_clean {
  int __pyx_n;
  int offset_;
};

/* "PygameShader/shader.pxd":181
 *                     unsigned char [::1] dest_array)
 * 
 * cpdef void heatmap(object surface_, bint rgb_=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef predator_vision(object surface_, unsigned int sobel_threshold=*,
 */
struct __pyx_opt_args_12PygameShader_6shader_heatmap {
  int __pyx_n;
  int rgb_;
};

/* "PygameShader/shader.pxd":183
 * cpdef void heatmap(object surface_, bint rgb_=*)
 * 
 * cpdef predator_vision(object surface_, unsigned int sobel_threshold=*,             # <<<<<<<<<<<<<<
 *                            unsigned int bpf_threshold=*, unsigned int bloom_threshold=*,
 *                            bint inv_colormap=*, bint fast=*, int blend=*)
 */
struct __pyx_opt_args_12PygameShader_6shader_predator_vision {
  int __pyx_n;
  unsigned int sobel_threshold;
  unsigned int bpf_threshold;
  unsigned int bloom_threshold;
  int inv_colormap;
  int fast;
  int blend;
};

/* "PygameShader/shader.pxd":198
 * 
 * cpdef fire_effect(
 *         int width_,             # <<<<<<<<<<<<<<
 *         int height_,
 *         float factor_,
 */
struct __pyx_opt_args_12PygameShader_6shader_fire_effect {
  int __pyx_n;
  unsigned short reduce_factor_;
  unsigned short fire_intensity_;
  int smooth_;
  int bloom_;
  int fast_bloom_;
  unsigned char bpf_threshold_;
  unsigned int low_;
  unsigned int high_;
  int brightness_;
  float brightness_intensity_;
  PyObject *surface_;
  int adjust_palette_;
  PyObject *hsl_;
  int transpose_;
  int border_;
  int blur_;
};

/* "PygameShader/shader.pxd":222
 * 
 * cpdef cloud_effect(
 *         int width_,             # <<<<<<<<<<<<<<
 *         int height_,
 *         float factor_,
 */
struct __pyx_opt_args_12PygameShader_6shader_cloud_effect {
  int __pyx_n;
  unsigned short reduce_factor_;
  unsigned short cloud_intensity_;
  int smooth_;
  int bloom_;
  int fast_bloom_;
  unsigned char bpf_threshold_;
  unsigned int low_;
  unsigned int high_;
  int brightness_;
  float brightness_intensity_;
  PyObject *surface_;
  int transpose_;
  int blur_;
};

/* "PygameShader/shader.pxd":245
 * cpdef void mirroring(object surface_)
 * 
 * cpdef float lateral_dampening(int frame_, float amplitude_=*, int duration_=*,             # <<<<<<<<<<<<<<
 *                                      float freq_=*)
 * cpdef tuple dampening(
 */
struct __pyx_opt_args_12PygameShader_6shader_lateral_dampening {
  int __pyx_n;
  float amplitude_;
  int duration_;
  float freq_;
};

/* "PygameShader/shader.pxd":247
 * cpdef float lateral_dampening(int frame_, float amplitude_=*, int duration_=*,
 *                                      float freq_=*)
 * cpdef tuple dampening(             # <<<<<<<<<<<<<<
 *         object surface_, int frame_, int display_width, int display_height_,
 *         float amplitude_=*, int duration_=*, float freq_=*)
 */
struct __pyx_opt_args_12PygameShader_6shader_dampening {
  int __pyx_n;
  float amplitude_;
  int duration_;
  float freq_;
};

/* "PygameShader/shader.pxd":256
 * # Added version 1.0.2
 * cpdef cartoon(
 *         object surface_,             # <<<<<<<<<<<<<<
 *         int sobel_threshold_ = *,
 *         int median_kernel_   = *,
 */
struct __pyx_opt_args_12PygameShader_6shader_cartoon {
  int __pyx_n;
  int sobel_threshold_;
  int median_kernel_;
  PyObject *color_;
  PyObject *flag_;
};

/* "PygameShader/shader.pxd":263
 * )
 * 
 * cpdef void dirt_lens(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         object lens_model_,
 */
struct __pyx_opt_args_12PygameShader_6shader_dirt_lens {
  int __pyx_n;
  int flag_;
  float light_;
};

/* "PygameShader/shader.pxd":270
 * )
 * 
 * cpdef object dithering(object surface_, int factor_=*)             # <<<<<<<<<<<<<<
 * cpdef void dithering_int(object surface_, int factor_=*)
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_dithering {
  int __pyx_n;
  int factor_;
};

/* "PygameShader/shader.pxd":271
 * 
 * cpdef object dithering(object surface_, int factor_=*)
 * cpdef void dithering_int(object surface_, int factor_=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef object spectrum(int width, int height, float gamma=*)
 */
struct __pyx_opt_args_12PygameShader_6shader_dithering_int {
  int __pyx_n;
  int factor_;
};

/* "PygameShader/shader.pxd":273
 * cpdef void dithering_int(object surface_, int factor_=*)
 * 
 * cpdef object spectrum(int width, int height, float gamma=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef void convert_27colors(object surface_)
 */
struct __pyx_opt_args_12PygameShader_6shader_spectrum {
  int __pyx_n;
  float gamma;
};

/* "PygameShader/shader.pxd":283
 * cpdef object bilateral(object image, float sigma_s, float sigma_i)
 * 
 * cpdef object emboss(object surface_, unsigned int flag=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef object pixelation(object surface_)
 */
struct __pyx_opt_args_12PygameShader_6shader_emboss {
  int __pyx_n;
  unsigned int flag;
};

/* "PygameShader/shader.pyx":2586
 * cdef float C1_ = <float>1.0 / <float>sqrt(M_2PI)
 * 
 * cdef inline float gauss(float x, float c, float sigma=1.0, float mu=0.0)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_gauss {
  int __pyx_n;
  float sigma;
  float mu;
};

/* "PygameShader/shader.pyx":2952
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_filter24_inplace_heapsort_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_heapsort_c {
  int __pyx_n;
  int kernel_size_;
};

/* "PygameShader/shader.pyx":3037
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_filter24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_c {
  int __pyx_n;
  int kernel_size_;
};

/* "PygameShader/shader.pyx":3134
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_filter24_avg_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_avg_inplace_c {
  int __pyx_n;
  int kernel_size_;
};

/* "PygameShader/shader.pyx":3231
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_grayscale_filter24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c {
  int __pyx_n;
  int kernel_size_;
};

/* "PygameShader/shader.pyx":3381
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_sobel24_inplace_c(unsigned char [:, :, :] rgb_array, float threshold=20.0):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER SOBEL (EDGE DETECTION)
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_inplace_c {
  int __pyx_n;
  float threshold;
};

/* "PygameShader/shader.pyx":3531
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_sobel24_fast_inplace_c(             # <<<<<<<<<<<<<<
 *         surface_, int threshold_=20, unsigned short factor_=1):
 *     """
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_fast_inplace_c {
  int __pyx_n;
  int threshold_;
  unsigned short factor_;
};

/* "PygameShader/shader.pyx":3692
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_blur5x5_array24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, mask=None, t=1):
 *     """
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_blur5x5_array24_inplace_c {
  int __pyx_n;
  PyObject *mask;
  PyObject *t;
};

/* "PygameShader/shader.pyx":4011
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef inline void shader_plasma24bit_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         int frame,
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_plasma24bit_inplace_c {
  int __pyx_n;
  float hue_;
  float sat_;
  float value_;
  float a_;
  float b_;
  float c_;
};

/* "PygameShader/shader.pyx":4352
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float shift_=0):
 *     """
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_inplace_c {
  int __pyx_n;
  float shift_;
};

/* "PygameShader/shader.pyx":4413
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness24_exclude_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float shift_=0.0, color_=(0, 0, 0)):
 *     """
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_exclude_inplace_c {
  int __pyx_n;
  float shift_;
  PyObject *color_;
};

/* "PygameShader/shader.pyx":4475
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness24_bpf_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float shift_=0.0,
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_bpf_c {
  int __pyx_n;
  float shift_;
  unsigned char bpf_treshold_;
};

/* "PygameShader/shader.pyx":4782
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_bpf24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int threshold = 128, bint transpose=False):
 *     """
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_bpf24_inplace_c {
  int __pyx_n;
  int threshold;
  int transpose;
};

/* "PygameShader/shader.pyx":4838
 * @cython.cdivision(True)
 * cdef inline bpf24_c(
 *         unsigned char [:, :, :] input_array_,             # <<<<<<<<<<<<<<
 *         int threshold = 128,
 *         bint transpose=False):
 */
struct __pyx_opt_args_12PygameShader_6shader_bpf24_c {
  int __pyx_n;
  int threshold;
  int transpose;
};

/* "PygameShader/shader.pyx":4894
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_bloom_effect_array24_c(             # <<<<<<<<<<<<<<
 *         surface_,
 *         int threshold_,
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_bloom_effect_array24_c {
  int __pyx_n;
  int fast_;
};

/* "PygameShader/shader.pyx":5425
 * 
 * 
 * cpdef inline void putmask_c(             # <<<<<<<<<<<<<<
 *         int [:, :, :] array_, Py_ssize_t rows_, Py_ssize_t cols_, int v_=0)nogil:
 *     """
 */
struct __pyx_opt_args_12PygameShader_6shader_putmask_c {
  int __pyx_n;
  int v_;
};

/* "PygameShader/shader.pyx":5868
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple heat_map(int wavelength, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH
 */
struct __pyx_opt_args_12PygameShader_6shader_heat_map {
  int __pyx_n;
  float gamma;
};

/* "PygameShader/shader.pyx":5901
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple custom_map(int wavelength, int [:] color_array_, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A CUSTOM WAVELENGTH
 */
struct __pyx_opt_args_12PygameShader_6shader_custom_map {
  int __pyx_n;
  float gamma;
};

/* "PygameShader/shader.pyx":5961
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void heatmap_convert(object surface_, bint rgb_=True):             # <<<<<<<<<<<<<<
 *     """
 *     TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT
 */
struct __pyx_opt_args_12PygameShader_6shader_heatmap_convert {
  int __pyx_n;
  int rgb_;
};

/* "PygameShader/shader.pyx":6026
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple blue_map(int wavelength, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH
 */
struct __pyx_opt_args_12PygameShader_6shader_blue_map {
  int __pyx_n;
  float gamma;
};

/* "PygameShader/shader.pyx":6111
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple red_map(int wavelength, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH
 */
struct __pyx_opt_args_12PygameShader_6shader_red_map {
  int __pyx_n;
  float gamma;
};

/* "PygameShader/shader.pyx":6447
 * @cython.cdivision(False)
 * cdef fire_surface24_c(
 *         int width,             # <<<<<<<<<<<<<<
 *         int height,
 *         float factor,
 */
struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c {
  int __pyx_n;
  int intensity;
  int low;
  int high;
};

/* "PygameShader/shader.pyx":6542
 * @cython.cdivision(False)
 * cdef fire_surface24_c_border(
 *         int width,             # <<<<<<<<<<<<<<
 *         int height,
 * 
 */
struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c_border {
  int __pyx_n;
  int intensity;
  int low;
  int high;
};

/* "PygameShader/shader.pyx":6674
 * @cython.cdivision(True)
 * cdef inline shader_fire_effect_c(
 *         int width_,             # <<<<<<<<<<<<<<
 *         int height_,
 *         float factor_,
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_fire_effect_c {
  int __pyx_n;
  unsigned short reduce_factor_;
  unsigned short fire_intensity_;
  int smooth_;
  int bloom_;
  int fast_bloom_;
  unsigned char bpf_threshold_;
  unsigned int low_;
  unsigned int high_;
  int brightness_;
  float brightness_intensity_;
  PyObject *surface_;
  int adjust_palette_;
  PyObject *hsl_;
  int transpose_;
  int border_;
  int blur_;
};

/* "PygameShader/shader.pyx":6987
 * @cython.cdivision(False)
 * cdef cloud_surface24_c(
 *         int width,             # <<<<<<<<<<<<<<
 *         int height,
 *         float factor,
 */
struct __pyx_opt_args_12PygameShader_6shader_cloud_surface24_c {
  int __pyx_n;
  int intensity;
  int low;
  int high;
};

/* "PygameShader/shader.pyx":7115
 * @cython.cdivision(False)
 * cdef inline shader_cloud_effect_c(
 *         int width_,             # <<<<<<<<<<<<<<
 *         int height_,
 *         float factor_,
 */
struct __pyx_opt_args_12PygameShader_6shader_shader_cloud_effect_c {
  int __pyx_n;
  unsigned short reduce_factor_;
  unsigned short cloud_intensity_;
  int smooth_;
  int bloom_;
  int fast_bloom_;
  unsigned short bpf_threshold_;
  unsigned int low_;
  unsigned int high_;
  int brightness_;
  float brightness_intensity_;
  PyObject *surface_;
  int transpose_;
  int blur_;
};

/* "PygameShader/shader.pyx":7842
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void dirt_lens_c(             # <<<<<<<<<<<<<<
 *         object source_,
 *         object lens_model_,
 */
struct __pyx_opt_args_12PygameShader_6shader_dirt_lens_c {
  int __pyx_n;
  float light_;
};

/* "PygameShader/shader.pyx":8064
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef object spectrum_c(int width, int height, float gamma=1.0):             # <<<<<<<<<<<<<<
 * 
 *     """
 */
struct __pyx_opt_args_12PygameShader_6shader_spectrum_c {
  int __pyx_n;
  float gamma;
};

/* "View.MemoryView":105
 * 
 * @cname("__pyx_array")
 * cdef class array:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_array_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_array *__pyx_vtab;
  char *data;
  Py_ssize_t len;
  char *format;
  int ndim;
  Py_ssize_t *_shape;
  Py_ssize_t *_strides;
  Py_ssize_t itemsize;
  PyObject *mode;
  PyObject *_format;
  void (*callback_free_data)(void *);
  int free_data;
  int dtype_is_object;
};


/* "View.MemoryView":279
 * 
 * @cname('__pyx_MemviewEnum')
 * cdef class Enum(object):             # <<<<<<<<<<<<<<
 *     cdef object name
 *     def __init__(self, name):
 */
struct __pyx_MemviewEnum_obj {
  PyObject_HEAD
  PyObject *name;
};


/* "View.MemoryView":330
 * 
 * @cname('__pyx_memoryview')
 * cdef class memoryview(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef object obj
 */
struct __pyx_memoryview_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_memoryview *__pyx_vtab;
  PyObject *obj;
  PyObject *_size;
  PyObject *_array_interface;
  PyThread_type_lock lock;
  __pyx_atomic_int acquisition_count[2];
  __pyx_atomic_int *acquisition_count_aligned_p;
  Py_buffer view;
  int flags;
  int dtype_is_object;
  __Pyx_TypeInfo *typeinfo;
};


/* "View.MemoryView":965
 * 
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
 *     "Internal class for passing memoryview slices to Python"
 * 
 */
struct __pyx_memoryviewslice_obj {
  struct __pyx_memoryview_obj __pyx_base;
  __Pyx_memviewslice from_slice;
  PyObject *from_object;
  PyObject *(*to_object_func)(char *);
  int (*to_dtype_func)(char *, PyObject *);
};



/* "View.MemoryView":105
 * 
 * @cname("__pyx_array")
 * cdef class array:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_array {
  PyObject *(*get_memview)(struct __pyx_array_obj *);
};
static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;


/* "View.MemoryView":330
 * 
 * @cname('__pyx_memoryview')
 * cdef class memoryview(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef object obj
 */

struct __pyx_vtabstruct_memoryview {
  char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
  PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
};
static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;


/* "View.MemoryView":965
 * 
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
 *     "Internal class for passing memoryview slices to Python"
 * 
 */

struct __pyx_vtabstruct__memoryviewslice {
  struct __pyx_vtabstruct_memoryview __pyx_base;
};
static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* MemviewSliceInit.proto */
#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
#define __Pyx_MEMVIEW_DIRECT   1
#define __Pyx_MEMVIEW_PTR      2
#define __Pyx_MEMVIEW_FULL     4
#define __Pyx_MEMVIEW_CONTIG   8
#define __Pyx_MEMVIEW_STRIDED  16
#define __Pyx_MEMVIEW_FOLLOW   32
#define __Pyx_IS_C_CONTIG 1
#define __Pyx_IS_F_CONTIG 2
static int __Pyx_init_memviewslice(
                struct __pyx_memoryview_obj *memview,
                int ndim,
                __Pyx_memviewslice *memviewslice,
                int memview_is_new_reference);
static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* ListExtend.proto */
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* None.proto */
static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname);

/* None.proto */
static CYTHON_INLINE float __Pyx_mod_float(float, float);

/* None.proto */
static CYTHON_INLINE long __Pyx_mod_long(long, long);

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* None.proto */
static CYTHON_INLINE int __Pyx_mod_int(int, int);

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* None.proto */
static CYTHON_INLINE long __Pyx_div_long(long, long);

/* UnaryNegOverflows.proto */
#define UNARY_NEG_WOULD_OVERFLOW(x)\
        (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* IncludeStringH.proto */
#include <string.h>

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

/* StringJoin.proto */
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION < 3
    #define __Pyx_PyBytes_Join _PyString_Join
    #else
    #define __Pyx_PyBytes_Join _PyBytes_Join
    #endif
#else
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
#endif

/* PyObject_Unicode.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
#else
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
#endif

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

/* PyObjectGetAttrStrNoError.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

#if PY_MAJOR_VERSION < 3
    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
    static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
    #define __Pyx_GetBuffer PyObject_GetBuffer
    #define __Pyx_ReleaseBuffer PyBuffer_Release
#endif


/* BufferStructDeclare.proto */
typedef struct {
  Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
  size_t refcount;
  Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
  __Pyx_Buffer *rcbuffer;
  char *data;
  __Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;

/* MemviewSliceIsContig.proto */
static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);

/* OverlappingSlices.proto */
static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
                                __Pyx_memviewslice *slice2,
                                int ndim, size_t itemsize);

/* Capsule.proto */
static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);

/* IsLittleEndian.proto */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);

/* BufferFormatCheck.proto */
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type);

/* TypeInfoCompare.proto */
static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);

/* MemviewSliceValidateAndInit.proto */
static int __Pyx_ValidateAndInit_memviewslice(
                int *axes_specs,
                int c_or_f_flag,
                int buf_flags,
                int ndim,
                __Pyx_TypeInfo *dtype,
                __Pyx_BufFmt_StackElem stack[],
                __Pyx_memviewslice *memviewslice,
                PyObject *original_obj);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_float(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_unsigned_char(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_float(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_unsigned_char(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_int(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_int(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_int(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_int(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *, int writable_flag);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *obj);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_unsigned_char(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_unsigned_char(const char *itemp, PyObject *obj);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_unsigned_int(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_unsigned_int(const char *itemp, PyObject *obj);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_short(unsigned short value);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj);

static PyObject* __pyx_convert__to_py_struct__rgb(struct rgb s);
/* None.proto */
static CYTHON_INLINE long __Pyx_pow_long(long, long);

/* RealImag.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(__cplusplus) && CYTHON_CCOMPLEX\
        && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_float(a, b)   ((a)==(b))
    #define __Pyx_c_sum_float(a, b)  ((a)+(b))
    #define __Pyx_c_diff_float(a, b) ((a)-(b))
    #define __Pyx_c_prod_float(a, b) ((a)*(b))
    #define __Pyx_c_quot_float(a, b) ((a)/(b))
    #define __Pyx_c_neg_float(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
    #define __Pyx_c_conj_float(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (::std::abs(z))
        #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_float(z) ((z)==0)
    #define __Pyx_c_conj_float(z)    (conjf(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (cabsf(z))
        #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_double(a, b)   ((a)==(b))
    #define __Pyx_c_sum_double(a, b)  ((a)+(b))
    #define __Pyx_c_diff_double(a, b) ((a)-(b))
    #define __Pyx_c_prod_double(a, b) ((a)*(b))
    #define __Pyx_c_quot_double(a, b) ((a)/(b))
    #define __Pyx_c_neg_double(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
    #define __Pyx_c_conj_double(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (::std::abs(z))
        #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_double(z) ((z)==0)
    #define __Pyx_c_conj_double(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (cabs(z))
        #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);

/* MemviewSliceCopyTemplate.proto */
static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                 const char *mode, int ndim,
                                 size_t sizeof_dtype, int contig_flag,
                                 int dtype_is_object);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned short __Pyx_PyInt_As_unsigned_short(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);

/* TypeInfoToFormat.proto */
struct __pyx_typeinfo_string {
    char string[3];
};
static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_float(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_float(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(PyObject *, int writable_flag);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* VoidPtrExport.proto */
static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig);

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

/* FunctionImport.proto */
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_char(PyObject *, int writable_flag);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/

/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'cpython.version' */

/* Module declarations from 'cpython.exc' */

/* Module declarations from 'cpython.module' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'cpython.tuple' */

/* Module declarations from 'cpython.list' */

/* Module declarations from 'cpython.sequence' */

/* Module declarations from 'cpython.mapping' */

/* Module declarations from 'cpython.iterator' */

/* Module declarations from 'cpython.number' */

/* Module declarations from 'cpython.int' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.bool' */
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;

/* Module declarations from 'cpython.long' */

/* Module declarations from 'cpython.float' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.complex' */
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;

/* Module declarations from 'cpython.string' */

/* Module declarations from 'cpython.unicode' */

/* Module declarations from 'cpython.dict' */

/* Module declarations from 'cpython.instance' */

/* Module declarations from 'cpython.function' */

/* Module declarations from 'cpython.method' */

/* Module declarations from 'cpython.weakref' */

/* Module declarations from 'cpython.getargs' */

/* Module declarations from 'cpython.pythread' */

/* Module declarations from 'cpython.pystate' */

/* Module declarations from 'cpython.cobject' */

/* Module declarations from 'cpython.oldbuffer' */

/* Module declarations from 'cpython.set' */

/* Module declarations from 'cpython.bytes' */

/* Module declarations from 'cpython.pycapsule' */

/* Module declarations from 'cpython' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/

/* Module declarations from 'cython.view' */
static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/

/* Module declarations from 'cython' */

/* Module declarations from 'PygameShader.misc' */
static struct rgb (*__pyx_f_12PygameShader_4misc_color_diff_hsv)(struct rgb, __Pyx_memviewslice, Py_ssize_t); /*proto*/
static struct rgb (*__pyx_f_12PygameShader_4misc_color_diff_hsl)(struct rgb, __Pyx_memviewslice, Py_ssize_t); /*proto*/
static struct rgb (*__pyx_f_12PygameShader_4misc_close_color)(struct rgb, __Pyx_memviewslice, Py_ssize_t); /*proto*/

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'libc.math' */

/* Module declarations from 'PygameShader.shader' */
static PyTypeObject *__pyx_array_type = 0;
static PyTypeObject *__pyx_MemviewEnum_type = 0;
static PyTypeObject *__pyx_memoryview_type = 0;
static PyTypeObject *__pyx_memoryviewslice_type = 0;
static float __pyx_v_12PygameShader_6shader_M_PI;
static float __pyx_v_12PygameShader_6shader_M_PI2;
static float __pyx_v_12PygameShader_6shader_M_2PI;
static float __pyx_v_12PygameShader_6shader_RAD_TO_DEG;
static float __pyx_v_12PygameShader_6shader_DEG_TO_RAD;
static int __pyx_v_12PygameShader_6shader_THREADS;
static float __pyx_v_12PygameShader_6shader_C1;
static float __pyx_v_12PygameShader_6shader_C2;
static float __pyx_v_12PygameShader_6shader_C3;
static float __pyx_v_12PygameShader_6shader_C4;
static float __pyx_v_12PygameShader_6shader_COS_TABLE[0x168];
static float __pyx_v_12PygameShader_6shader_SIN_TABLE[0x168];
static int __pyx_v_12PygameShader_6shader_ANGLE;
static __Pyx_memviewslice __pyx_v_12PygameShader_6shader_COLORS_CPC64_C = { 0, 0, { 0 }, { 0 }, { 0 } };
static float __pyx_v_12PygameShader_6shader_C1_;
static float __pyx_v_12PygameShader_6shader_ONE_255;
static __Pyx_memviewslice __pyx_v_12PygameShader_6shader_GY = { 0, 0, { 0 }, { 0 }, { 0 } };
static __Pyx_memviewslice __pyx_v_12PygameShader_6shader_GX = { 0, 0, { 0 }, { 0 }, { 0 } };
static unsigned short __pyx_v_12PygameShader_6shader_KERNEL_HALF;
static float __pyx_v_12PygameShader_6shader_GAUSS_KERNEL[5];
static __Pyx_memviewslice __pyx_v_12PygameShader_6shader_IMAGE_FISHEYE_MODEL = { 0, 0, { 0 }, { 0 }, { 0 } };
static int __pyx_v_12PygameShader_6shader_i;
static float __pyx_v_12PygameShader_6shader_f_map;
static __Pyx_memviewslice __pyx_v_12PygameShader_6shader_heatmap_array = { 0, 0, { 0 }, { 0 }, { 0 } };
static PyObject *__pyx_v_12PygameShader_6shader_t = 0;
static float __pyx_v_12PygameShader_6shader_f_bluemap;
static __Pyx_memviewslice __pyx_v_12PygameShader_6shader_bluemap_array = { 0, 0, { 0 }, { 0 }, { 0 } };
static float __pyx_v_12PygameShader_6shader_f_redmap;
static __Pyx_memviewslice __pyx_v_12PygameShader_6shader_redmap_array = { 0, 0, { 0 }, { 0 }, { 0 } };
static __Pyx_memviewslice __pyx_v_12PygameShader_6shader_SHARPEN_KERNEL = { 0, 0, { 0 }, { 0 }, { 0 } };
static int __pyx_v_12PygameShader_6shader_HALF_KERNEL;
static PyObject *generic = 0;
static PyObject *strided = 0;
static PyObject *indirect = 0;
static PyObject *contiguous = 0;
static PyObject *indirect_contiguous = 0;
static int __pyx_memoryview_thread_locks_used;
static PyThread_type_lock __pyx_memoryview_thread_locks[8];
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rgb_to_bgr(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rgb_to_brg(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_greyscale(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sepia(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median_fast(PyObject *, struct __pyx_opt_args_12PygameShader_6shader_median_fast *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median_grayscale(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median_grayscale *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median_avg(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median_avg *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_color_reduction(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_color_reduction *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sobel(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_sobel *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sobel_fast(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_sobel_fast *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_invert(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_hsl_effect(PyObject *, float, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_hsl_fast(PyObject *, float, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_blur(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_blur *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_wave(PyObject *, float, int, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_swirl(PyObject *, float, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_swirl2(PyObject *, float, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_plasma_config(PyObject *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_plasma_config *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_plasma(PyObject *, float, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_rgb_to_hsl_model(int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_hsl_to_rgb_model(int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness(PyObject *, float, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness_exclude(PyObject *, float, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_brightness_exclude *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness_bpf(PyObject *, float, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_brightness_bpf *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness_model(PyObject *, float, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_saturation(PyObject *, float, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heatwave_vertical(PyObject *, __Pyx_memviewslice, float, float, float, float, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_horizontal_glitch(PyObject *, float, float, float, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bpf(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_bpf *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bloom(PyObject *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_bloom *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_fisheye_footprint(int, int, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_fisheye(PyObject *, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_rain_footprint(int, int, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rain_fisheye(PyObject *, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_tv_scan(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_tv_scan *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rgb_split(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_rgb_split *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_rgb_split_clean(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_rgb_split_clean *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_ripple(int, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_tunnel_modeling32(Py_ssize_t, Py_ssize_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_tunnel_render32(int, Py_ssize_t, Py_ssize_t, int, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heatmap(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_heatmap *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_predator_vision(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_predator_vision *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_blood(PyObject *, __Pyx_memviewslice, float, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_make_palette(int, float, float, float, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bluescale(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_redscale(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_fire_sub(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_fire_effect(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_fire_effect *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_cloud_effect(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_cloud_effect *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_mirroring_array(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_mirroring(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE float __pyx_f_12PygameShader_6shader_lateral_dampening(int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_lateral_dampening *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_dampening(PyObject *, int, int, int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dampening *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_blend(PyObject *, PyObject *, float, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_cartoon(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_cartoon *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dirt_lens(PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dirt_lens *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_dithering(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dithering *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dithering_int(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dithering_int *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_spectrum(int, int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_spectrum *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_convert_27colors(PyObject *, int __pyx_skip_dispatch); /*proto*/
static void __pyx_f_12PygameShader_6shader_palette_change(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_bilateral(PyObject *, float, float, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_emboss(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_emboss *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_pixelation(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sharpen(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_end_game(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_level_clear(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_zoom_in(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_electric(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_filmstrips(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_cubism(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_code_listing(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_ascii_char(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_explode(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE float __pyx_f_12PygameShader_6shader_damped_oscillation(float); /*proto*/
static CYTHON_INLINE float __pyx_f_12PygameShader_6shader_gauss(float, float, struct __pyx_opt_args_12PygameShader_6shader_gauss *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rgb_to_bgr_inplace_c(__Pyx_memviewslice); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rgb_to_brg_inplace_c(__Pyx_memviewslice); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_greyscale_luminosity24_inplace_c(__Pyx_memviewslice); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sepia24_inplace_c(__Pyx_memviewslice); /*proto*/
static CYTHON_INLINE int __pyx_f_12PygameShader_6shader_partition(__Pyx_memviewslice, int, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader__quick_sort(__Pyx_memviewslice, int, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heapify(__Pyx_memviewslice, int, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heap_sort(__Pyx_memviewslice, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_c(__Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_filter24_avg_inplace_c(__Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_avg_inplace_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c(__Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_color_reduction24_inplace_c(__Pyx_memviewslice, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sobel24_inplace_c(__Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_inplace_c *__pyx_optional_args); /*proto*/
static __Pyx_memviewslice __pyx_f_12PygameShader_6shader_scale_array24_c(__Pyx_memviewslice, int, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sobel24_fast_inplace_c(PyObject *, struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_fast_inplace_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_invert_surface_24bit_inplace_c(__Pyx_memviewslice); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_blur5x5_array24_inplace_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_wave24bit_inplace_c(__Pyx_memviewslice, float, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_swirl24bit_inplace_c(__Pyx_memviewslice, float); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_swirl24bit_inplace_c1(__Pyx_memviewslice, float); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_plasma24bit_inplace_c(__Pyx_memviewslice, int, struct __pyx_opt_args_12PygameShader_6shader_shader_plasma24bit_inplace_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_plasma_c(PyObject *, float, __Pyx_memviewslice); /*proto*/
static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_rgb_to_hsl_model_c(void); /*proto*/
static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_hsl_to_rgb_model_c(void); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_hsl_surface24bit_inplace_c(__Pyx_memviewslice, float); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_hsl_surface24bit_fast_inplace_c(__Pyx_memviewslice, float, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness24_inplace_c(__Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_inplace_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness24_exclude_inplace_c(__Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_exclude_inplace_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness24_bpf_c(__Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_bpf_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness_24_inplace1_c(__Pyx_memviewslice, float, __Pyx_memviewslice); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_saturation_array24_inplace_c(__Pyx_memviewslice, float); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_heatwave24_vertical_inplace_c(__Pyx_memviewslice, __Pyx_memviewslice, float, float, float, float); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_horizontal_glitch24_inplace_c(__Pyx_memviewslice, float, float, float); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_bpf24_inplace_c(__Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_bpf24_inplace_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_bpf24_c(__Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_bpf24_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(PyObject *, int, struct __pyx_opt_args_12PygameShader_6shader_shader_bloom_effect_array24_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_fisheye24_footprint_c(Py_ssize_t, Py_ssize_t); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_fisheye24_inplace_c(__Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_rain_footprint_inplace_c(Py_ssize_t, Py_ssize_t); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rain_fisheye24_inplace_c(__Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_tv_scanline_inplace_c(__Pyx_memviewslice, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rgb_split_inplace_c(PyObject *, int); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_shader_rgb_split_c(PyObject *, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_putmask_c(__Pyx_memviewslice, Py_ssize_t, Py_ssize_t, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_putmask_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_ripple_c(Py_ssize_t, Py_ssize_t, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_heat_map(int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_heat_map *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_custom_map(int, __Pyx_memviewslice, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_custom_map *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heatmap_convert(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_heatmap_convert *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_blue_map(int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_blue_map *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_red_map(int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_red_map *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_blood_inplace_c(__Pyx_memviewslice, __Pyx_memviewslice, float); /*proto*/
static CYTHON_INLINE unsigned int __pyx_f_12PygameShader_6shader_rgb_to_int(int, int, int, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE struct rgb __pyx_f_12PygameShader_6shader_int_to_rgb(unsigned int, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_make_palette_c(int, float, float, float); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_fire_surface24_c(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_fire_surface24_c_border(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c_border *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_fire_effect_c(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_fire_effect_c *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_cloud_surface24_c(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_cloud_surface24_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_cloud_effect_c(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_12PygameShader_6shader_shader_cloud_effect_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_mirroring_c(__Pyx_memviewslice); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_mirroring_inplace_c(__Pyx_memviewslice); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sharpen_filter_inplace_c(__Pyx_memviewslice); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_cartoon_effect(PyObject *, int, int, int, int); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_blending(PyObject *, PyObject *, float); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dirt_lens_c(PyObject *, PyObject *, int, struct __pyx_opt_args_12PygameShader_6shader_dirt_lens_c *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_dithering_c(__Pyx_memviewslice, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dithering_int_c(__Pyx_memviewslice, int); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_convert_27colors_c(__Pyx_memviewslice); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_spectrum_c(int, int, struct __pyx_opt_args_12PygameShader_6shader_spectrum_c *__pyx_optional_args); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_palette_change_c(__Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
static float __pyx_f_12PygameShader_6shader_distance_(float, float, float, float); /*proto*/
static float __pyx_f_12PygameShader_6shader_gaussian_(float, float); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_bilateral_filter24_c(__Pyx_memviewslice, float, float); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_emboss5x5_c(__Pyx_memviewslice); /*proto*/
static CYTHON_INLINE PyObject *__Pyx_carray_to_py_float(float *, Py_ssize_t); /*proto*/
static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_float(float *, Py_ssize_t); /*proto*/
static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
static void *__pyx_align_pointer(void *, size_t); /*proto*/
static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
static PyObject *_unellipsify(PyObject *, int); /*proto*/
static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_char = { "unsigned char", NULL, sizeof(unsigned char), { 0 }, 0, IS_UNSIGNED(unsigned char) ? 'U' : 'I', IS_UNSIGNED(unsigned char), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_int = { "unsigned int", NULL, sizeof(unsigned int), { 0 }, 0, IS_UNSIGNED(unsigned int) ? 'U' : 'I', IS_UNSIGNED(unsigned int), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_short = { "short", NULL, sizeof(short), { 0 }, 0, IS_UNSIGNED(short) ? 'U' : 'I', IS_UNSIGNED(short), 0 };
#define __Pyx_MODULE_NAME "PygameShader.shader"
extern int __pyx_module_is_main_PygameShader__shader;
int __pyx_module_is_main_PygameShader__shader = 0;

/* Implementation of 'PygameShader.shader' */
static PyObject *__pyx_builtin_FutureWarning;
static PyObject *__pyx_builtin_RuntimeWarning;
static PyObject *__pyx_builtin_ImportWarning;
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_DeprecationWarning;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_IndexError;
static const char __pyx_k_3[] = "3";
static const char __pyx_k_C[] = "C";
static const char __pyx_k_O[] = "O";
static const char __pyx_k_T[] = "T{";
  static const char __pyx_k_a[] = "a_";
  static const char __pyx_k_b[] = "b_";
  static const char __pyx_k_c[] = "c_";
  static const char __pyx_k_g[] = "g";
  static const char __pyx_k_h[] = "h";
  static const char __pyx_k_r[] = "r";
  static const char __pyx_k_s[] = "(%s)";
  static const char __pyx_k_t[] = "t_";
  static const char __pyx_k_v[] = "v_";
  static const char __pyx_k_w[] = "w";
  static const char __pyx_k_fh[] = "fh";
  static const char __pyx_k_fl[] = "fl";
  static const char __pyx_k_fs[] = "fs";
  static const char __pyx_k_id[] = "id";
  static const char __pyx_k_mu[] = "mu_";
  static const char __pyx_k_RGB[] = "RGB";
  static const char __pyx_k__50[] = "^";
  static const char __pyx_k__51[] = "";
  static const char __pyx_k__52[] = ":";
static const char __pyx_k__53[] = "}";
static const char __pyx_k__54[] = ",";
static const char __pyx_k_b_2[] = "b";
static const char __pyx_k_c_2[] = "c";
static const char __pyx_k_hsl[] = "hsl_";
static const char __pyx_k_hue[] = "hue_";
static const char __pyx_k_low[] = "low_";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_obj[] = "obj";
static const char __pyx_k_rad[] = "rad";
static const char __pyx_k_red[] = "red";
static const char __pyx_k_rgb[] = "rgb_";
static const char __pyx_k_sat[] = "sat_";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_t_2[] = "t";
static const char __pyx_k_M_PI[] = "M_PI";
static const char __pyx_k_QUIT[] = "QUIT";
static const char __pyx_k_RGBA[] = "RGBA";
static const char __pyx_k_Rect[] = "Rect";
static const char __pyx_k_base[] = "base";
static const char __pyx_k_blit[] = "blit";
static const char __pyx_k_blue[] = "blue";
static const char __pyx_k_blur[] = "blur_";
static const char __pyx_k_cols[] = "cols_";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_fast[] = "fast_";
static const char __pyx_k_fire[] = "fire";
static const char __pyx_k_flag[] = "flag_";
static const char __pyx_k_freq[] = "freq_";
static const char __pyx_k_high[] = "high_";
static const char __pyx_k_int8[] = "int8";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_load[] = "load";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mask[] = "mask";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_ndim[] = "ndim";
static const char __pyx_k_pack[] = "pack";
static const char __pyx_k_perc[] = "perc_";
static const char __pyx_k_rad1[] = "rad1_";
static const char __pyx_k_rows[] = "rows_";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_step[] = "step";
static const char __pyx_k_stop[] = "stop";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_uint[] = "uint";
static const char __pyx_k_warn[] = "warn";
static const char __pyx_k_1_0_3[] = "1.0.3";
static const char __pyx_k_ASCII[] = "ASCII";
static const char __pyx_k_Color[] = "Color";
static const char __pyx_k_M_2PI[] = "M_2PI";
static const char __pyx_k_M_PI2[] = "M_PI2";
static const char __pyx_k_array[] = "array_";
static const char __pyx_k_blend[] = "blend";
static const char __pyx_k_bloom[] = "bloom_";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_cloud[] = "cloud_";
static const char __pyx_k_color[] = "color_";
static const char __pyx_k_dtype[] = "dtype";
static const char __pyx_k_empty[] = "empty";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_frame[] = "frame";
static const char __pyx_k_gamma[] = "gamma";
static const char __pyx_k_green[] = "green";
static const char __pyx_k_image[] = "image";
static const char __pyx_k_int16[] = "int16";
static const char __pyx_k_int32[] = "int32";
static const char __pyx_k_light[] = "light_";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_order[] = "order";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_scale[] = "scale";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_shift[] = "shift_";
static const char __pyx_k_sigma[] = "sigma_";
static const char __pyx_k_space[] = "space";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_uint8[] = "uint8";
static const char __pyx_k_value[] = "value_";
static const char __pyx_k_width[] = "width";
static const char __pyx_k_zeros[] = "zeros";
static const char __pyx_k_REDMAP[] = "REDMAP";
static const char __pyx_k_angles[] = "angles";
static const char __pyx_k_astype[] = "astype";
static const char __pyx_k_border[] = "border_";
static const char __pyx_k_center[] = "center_";
static const char __pyx_k_divide[] = "divide";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_factor[] = "factor_";
static const char __pyx_k_fast_2[] = "fast";
static const char __pyx_k_fire_2[] = "fire_";
static const char __pyx_k_flag_2[] = "flag";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_height[] = "height";
static const char __pyx_k_ignore[] = "ignore";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_mask_2[] = "mask_";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_offset[] = "offset_";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_pygame[] = "pygame";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_rotate[] = "rotate";
static const char __pyx_k_shades[] = "shades";
static const char __pyx_k_size_2[] = "size_";
static const char __pyx_k_smooth[] = "smooth_";
static const char __pyx_k_source[] = "source_";
static const char __pyx_k_struct[] = "struct";
static const char __pyx_k_uint16[] = "uint16";
static const char __pyx_k_uint32[] = "uint32";
static const char __pyx_k_unpack[] = "unpack";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_BLUEMAP[] = "BLUEMAP";
static const char __pyx_k_HEATMAP[] = "HEATMAP";
static const char __pyx_k_HWACCEL[] = "HWACCEL";
static const char __pyx_k_K_SPACE[] = "K_SPACE";
static const char __pyx_k_Surface[] = "Surface";
static const char __pyx_k_THREADS[] = "THREADS";
static const char __pyx_k_VERSION[] = "__VERSION__";
static const char __pyx_k_Vector2[] = "Vector2";
static const char __pyx_k_array3d[] = "array3d";
static const char __pyx_k_array_2[] = "array";
static const char __pyx_k_asarray[] = "asarray";
static const char __pyx_k_convert[] = "convert";
static const char __pyx_k_current[] = "current_";
static const char __pyx_k_degrees[] = "degrees";
static const char __pyx_k_float32[] = "float32";
static const char __pyx_k_fortran[] = "fortran";
static const char __pyx_k_frame_2[] = "frame_";
static const char __pyx_k_memview[] = "memview";
static const char __pyx_k_ndarray[] = "ndarray";
static const char __pyx_k_palette[] = "palette_";
static const char __pyx_k_scale2x[] = "scale2x";
static const char __pyx_k_sigma_i[] = "sigma_i";
static const char __pyx_k_sigma_s[] = "sigma_s";
static const char __pyx_k_surface[] = "surface_";
static const char __pyx_k_width_2[] = "width_";
static const char __pyx_k_Ellipsis[] = "Ellipsis";
static const char __pyx_k_RLEACCEL[] = "RLEACCEL";
static const char __pyx_k_SRCALPHA[] = "SRCALPHA";
static const char __pyx_k_category[] = "category";
static const char __pyx_k_duration[] = "duration_";
static const char __pyx_k_factor_2[] = "factor";
static const char __pyx_k_freetype[] = "_freetype";
static const char __pyx_k_get_size[] = "get_size";
static const char __pyx_k_get_view[] = "get_view";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_height_2[] = "height_";
static const char __pyx_k_itemsize[] = "itemsize";
static const char __pyx_k_linspace[] = "linspace";
static const char __pyx_k_multiply[] = "multiply";
static const char __pyx_k_pixels3d[] = "pixels3d";
static const char __pyx_k_previous[] = "previous_";
static const char __pyx_k_pyx_capi[] = "__pyx_capi__";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_scr_data[] = "scr_data";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_tostring[] = "tostring";
static const char __pyx_k_warnings[] = "warnings";
static const char __pyx_k_HWSURFACE[] = "HWSURFACE";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_amplitude[] = "amplitude_";
static const char __pyx_k_distances[] = "distances";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_frequency[] = "frequency_";
static const char __pyx_k_get_width[] = "get_width";
static const char __pyx_k_hsl_model[] = "hsl_model_";
static const char __pyx_k_palette_2[] = "palette";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_rgb_model[] = "rgb_model_";
static const char __pyx_k_screen_h2[] = "screen_h2";
static const char __pyx_k_screen_w2[] = "screen_w2";
static const char __pyx_k_threshold[] = "threshold_";
static const char __pyx_k_transpose[] = "transpose_";
static const char __pyx_k_DEG_TO_RAD[] = "DEG_TO_RAD";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_RAD_TO_DEG[] = "RAD_TO_DEG";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_blit_array[] = "blit_array";
static const char __pyx_k_brightness[] = "brightness_";
static const char __pyx_k_dest_array[] = "dest_array";
static const char __pyx_k_fast_bloom[] = "fast_bloom_";
static const char __pyx_k_frombuffer[] = "frombuffer";
static const char __pyx_k_fromstring[] = "fromstring";
static const char __pyx_k_get_buffer[] = "get_buffer";
static const char __pyx_k_get_height[] = "get_height";
static const char __pyx_k_lens_model[] = "lens_model_";
static const char __pyx_k_percentage[] = "percentage_";
static const char __pyx_k_pixels_red[] = "pixels_red";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_wavelength[] = "wavelength";
static const char __pyx_k_BufferProxy[] = "BufferProxy";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_array_alpha[] = "array_alpha";
static const char __pyx_k_color_array[] = "color_array_";
static const char __pyx_k_destination[] = "destination_";
static const char __pyx_k_get_bitsize[] = "get_bitsize";
static const char __pyx_k_kernel_size[] = "kernel_size_";
static const char __pyx_k_pixels_blue[] = "pixels_blue";
static const char __pyx_k_pygame_math[] = "pygame.math";
static const char __pyx_k_smoothscale[] = "smoothscale";
static const char __pyx_k_threshold_2[] = "threshold";
static const char __pyx_k_transpose_2[] = "transpose";
static const char __pyx_k_COLORS_CPC64[] = "COLORS_CPC64";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_STYLE_NORMAL[] = "STYLE_NORMAL";
static const char __pyx_k_STYLE_STRONG[] = "STYLE_STRONG";
static const char __pyx_k_get_bytesize[] = "get_bytesize";
static const char __pyx_k_inv_colormap[] = "inv_colormap";
static const char __pyx_k_make_surface[] = "make_surface";
static const char __pyx_k_pixels_alpha[] = "pixels_alpha";
static const char __pyx_k_pixels_green[] = "pixels_green";
static const char __pyx_k_pygame_image[] = "pygame.image";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_screen_width[] = "screen_width";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_BLEND_RGB_ADD[] = "BLEND_RGB_ADD";
static const char __pyx_k_BLEND_RGB_MAX[] = "BLEND_RGB_MAX";
static const char __pyx_k_BLEND_RGB_MIN[] = "BLEND_RGB_MIN";
static const char __pyx_k_EMBOSS_KERNEL[] = "EMBOSS_KERNEL";
static const char __pyx_k_FutureWarning[] = "FutureWarning";
static const char __pyx_k_ImportWarning[] = "ImportWarning";
static const char __pyx_k_bpf_threshold[] = "bpf_threshold";
static const char __pyx_k_display_width[] = "display_width";
static const char __pyx_k_fisheye_model[] = "fisheye_model";
static const char __pyx_k_median_kernel[] = "median_kernel_";
static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_reduce_factor[] = "reduce_factor_";
static const char __pyx_k_screen_height[] = "screen_height";
static const char __pyx_k_special_flags[] = "special_flags";
static const char __pyx_k_RuntimeWarning[] = "RuntimeWarning";
static const char __pyx_k_adjust_palette[] = "adjust_palette_";
static const char __pyx_k_display_height[] = "display_height_";
static const char __pyx_k_filterwarnings[] = "filterwarnings";
static const char __pyx_k_fire_intensity[] = "fire_intensity_";
static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
static const char __pyx_k_bloom_threshold[] = "bloom_threshold";
static const char __pyx_k_bpf_threshold_2[] = "bpf_threshold_";
static const char __pyx_k_cloud_intensity[] = "cloud_intensity_";
static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_sobel_threshold[] = "sobel_threshold";
static const char __pyx_k_array_to_surface[] = "array_to_surface";
static const char __pyx_k_pygame__freetype[] = "pygame._freetype";
static const char __pyx_k_pygame_pixelcopy[] = "pygame.pixelcopy";
static const char __pyx_k_pygame_surfarray[] = "pygame.surfarray";
static const char __pyx_k_pygame_transform[] = "pygame.transform";
static const char __pyx_k_rgb_to_hsl_model[] = "rgb_to_hsl_model";
static const char __pyx_k_Assets_space1_jpg[] = "../Assets/space1.jpg";
static const char __pyx_k_ascontiguousarray[] = "ascontiguousarray";
static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
static const char __pyx_k_sobel_threshold_2[] = "sobel_threshold_";
static const char __pyx_k_DeprecationWarning[] = "DeprecationWarning";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_rain_fisheye_model[] = "rain_fisheye_model";
static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_Argument_h_must_be_0[] = "Argument h must be > 0";
static const char __pyx_k_Argument_w_must_be_0[] = "Argument w must be > 0";
static const char __pyx_k_brightness_intensity[] = "brightness_intensity_";
static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
static const char __pyx_k_Argument_h2_cannot_be_0[] = "Argument h2 cannot be <=0";
static const char __pyx_k_Argument_size_must_be_0[] = "Argument size must be > 0";
static const char __pyx_k_Argument_w2_cannot_be_0[] = "Argument w2 cannot be <=0";
static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
static const char __pyx_k_Argument_freq__must_be_0[] = "Argument freq_ must be > 0";
static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
static const char __pyx_k_canny_blur5x5_surface24_c[] = "canny_blur5x5_surface24_c";
static const char __pyx_k_Argument_factor__must_be_1[] = "Argument factor_ must be > 1";
static const char __pyx_k_Argument_low__must_be_high[] = "Argument low_ must be < high_";
static const char __pyx_k_Argument_space_cannot_be_0[] = "Argument space cannot be <=0";
static const char __pyx_k_Argument_high_must_be_width[] = "Argument high must be <= width";
static const char __pyx_k_Argument_t__must_be_0_got_s[] = "\nArgument t_ must be > 0, got %s ";
static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
static const char __pyx_k_Argument_duration__must_be_0[] = "Argument duration_ must be > 0";
static const char __pyx_k_Argument_screen_h2_must_be_0[] = "Argument screen_h2 must be > 0";
static const char __pyx_k_Argument_screen_w2_must_be_0[] = "Argument screen_w2 must be > 0";
static const char __pyx_k_PygameShader_gaussianBlur5x5[] = "PygameShader.gaussianBlur5x5";
static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
static const char __pyx_k_Argument_array_must_be_a_numpy[] = "\nArgument array must be a numpy.ndarray type got %s ";
static const char __pyx_k_Argument_fisheye_model_must_be[] = "\nArgument fisheye_model must be a numpy.ndarray or a cython.view.memoryview  type, got %s ";
static const char __pyx_k_Argument_lens_model__must_be_a[] = "\nArgument lens_model_ must be a pygame.Surface type, got %s ";
static const char __pyx_k_Argument_mask__must_be_a_numpy[] = "\nArgument mask_ must be a numpy.ndarray or cython memoryview types got %s ";
static const char __pyx_k_Cannot_reference_source_pixels[] = "\nCannot reference source pixels into a 3d array.\n %s ";
static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
static const char __pyx_k_Argument_bpf_threshold__must_be[] = "Argument bpf_threshold_ must be in range [0 ... 256] got %s ";
static const char __pyx_k_Argument_color_number_must_be_0[] = "Argument color_number must be > 0";
static const char __pyx_k_Argument_current_must_be_a_nump[] = "\nArgument current must be a numpy.ndarray type got %s ";
static const char __pyx_k_Argument_destination__must_be_a[] = "Argument destination_ must be a pygame.Surface got %s ";
static const char __pyx_k_Argument_factor__cannot_be_null[] = "Argument factor_ cannot be null or < 0";
static const char __pyx_k_Argument_factor__must_be_an_int[] = "Argument factor_ must be an int got %s ";
static const char __pyx_k_Argument_factor__must_be_in_ran[] = "\nArgument factor_ must be in range [1 ... 8]";
static const char __pyx_k_Argument_flag__must_be_a_int_ty[] = "\nArgument flag_ must be a int type, got %s ";
static const char __pyx_k_Argument_hsl_model__must_be_a_n[] = "\nArgument hsl_model_ must be a numpy.ndarray or memoryview type, got %s ";
static const char __pyx_k_Argument_kernel_size__cannot_be[] = "\nArgument kernel_size_ cannot be <= 0";
static const char __pyx_k_Argument_light__must_be_a_float[] = "\nArgument light_ must be a float type, got %s ";
static const char __pyx_k_Argument_mask_must_be_a_numpy_a[] = "\nArgument mask must be a numpy.array or memoryview type, got %s ";
static const char __pyx_k_Argument_offset__must_be_an_int[] = "\nArgument offset_ must be an int type, got %s";
static const char __pyx_k_Argument_previous_must_be_a_num[] = "\nArgument previous must be a numpy.ndarray type got %s ";
static const char __pyx_k_Argument_rain_fisheye_model_mus[] = "\nArgument rain_fisheye_model must be a numpy.ndarray or a cython memoryview type, got %s ";
static const char __pyx_k_Argument_reduce_factor__must_be[] = "\nArgument reduce_factor_ must be in range [1 ... 8] ";
static const char __pyx_k_Argument_rgb_model__must_be_a_n[] = "\nArgument rgb_model_ must be a numpy.ndarray or memoryview type, got %s ";
static const char __pyx_k_Argument_screen_width_must_be_0[] = "Argument screen_width must be > 0";
static const char __pyx_k_Argument_shift__must_be_in_rang[] = "\nArgument shift_ must be in range [-1.0 ... 1.0]";
static const char __pyx_k_Argument_shift_must_be_in_range[] = "Argument shift must be in range[-1.0 ... 1.0]";
static const char __pyx_k_Argument_surface__must_be_a_pyg[] = "\nArgument surface_ must be a pygame.Surface type, got %s ";
static const char __pyx_k_Argument_threshold_must_be_an_i[] = "\nArgument threshold must be an integer in range [0 ... 255]";
static const char __pyx_k_Argument_width_or_height_cannot[] = "Argument width or height cannot be null or < 0";
static const char __pyx_k_Array_sizes_mismatch_previous_w[] = "\n Array sizes mismatch (previous w: %s, h: %s; current w: %s, h: %s; array_ w: %s, h: %s ";
static const char __pyx_k_Cannot_reference_destination_pi[] = "\nCannot reference destination pixels into a 3d array.\n %s ";
static const char __pyx_k_GNU_GENERAL_PUBLIC_LICENSE_Vers[] = "\n                 GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\nCopyright Yoann Berenguer\n";
static const char __pyx_k_Incorrect_value_for_argument_pe[] = "\nIncorrect value for argument percentage should be [0.0 ... 100.0] got %s ";
static const char __pyx_k_Pygame_library_is_missing_on_yo[] = "\n<Pygame> library is missing on your system.\nTry: \n   C:\\pip install pygame on a window command prompt.";
static const char __pyx_k_Source_and_Destination_surfaces[] = "Source and Destination surfaces must have same dimensions: Source (w:%s, h:%s), destination (w:%s, h:%s).";
static const char __pyx_k_Surface_size_and_mask_size_mism[] = "\nSurface size and mask size mismatch";
static const char __pyx_k_Texture_image_is_not_compatible[] = "\nTexture/image is not compatible.";
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
static const char __pyx_k_numpy_library_is_missing_on_you[] = "\n<numpy> library is missing on your system.\nTry: \n   C:\\pip install numpy on a window command prompt.";
static const char __pyx_k_perc__variable_must_be_in_range[] = "perc_ variable must be in range[0.0 ... 1.0] got %s ";
static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
static const char __pyx_k_Argument_brightness_intensity_mu[] = "Argument brightness intensity must be in range [-1.0 ... 1.0]";
static const char __pyx_k_Argument_fire_intensity__must_be[] = "Argument fire_intensity_ must be in range [0 ... 32] got %s";
static const char __pyx_k_Argument_image_must_be_a_valid_S[] = "Argument image must be a valid Surface, got %s ";
static const char __pyx_k_Argument_reduce_factor_must_be_i[] = "Argument reduce factor must be in range 0 ... 4 \n reduce_factor_ = 1 correspond to dividing the image size by 2\n reduce_factor_ = 2 correspond to dividing the image size by 4";
static const char __pyx_k_Argument_screen_height_must_be_0[] = "Argument screen_height must be > 0";
static const char __pyx_k_Argument_shift__must_be_in_range[] = "Argument shift_ must be in range[-1.0 ... 1.0]";
static const char __pyx_k_Argument_sigma_i_must_be_a_valid[] = "Argument sigma_i must be a valid Surface, got %s ";
static const char __pyx_k_Argument_sigma_s_must_be_a_valid[] = "Argument sigma_s must be a valid Surface, got %s ";
static const char __pyx_k_Argument_source__must_be_a_pygam[] = "Argument source_ must be a pygame.Surface got %s ";
static const char __pyx_k_Argument_surface__must_be_a_Surf[] = "Argument surface_ must be a Surface type got %s ";
static const char __pyx_k_Argument_surface__must_be_a_pyga[] = "Argument surface_ must be a pygame.Surface got %s ";
static const char __pyx_k_Argument_surface__must_be_a_vali[] = "Argument surface_ must be a valid Surface, got %s ";
static const char __pyx_k_Argument_threshold_must_be_in_ra[] = "Argument threshold must be in range [0 ... 255]";
static const char __pyx_k_Argument_width_should_be_0_got_s[] = "Argument width should be > 0, got %s ";
static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
static const char __pyx_k_Cloud_array_size_mismatch_the_te[] = "Cloud array size mismatch the texture size.\nSet cloud array to numpy.empty((%s, %s), dtype=numpy.float32)";
static const char __pyx_k_Deprecated_version_use_shader_br[] = "Deprecated version, use shader_brightness_24_inplace (fastest version)";
static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
static const char __pyx_k_Fire_array_size_mismatch_the_tex[] = "Fire array size mismatch the texture size.\nSet fire_ array to numpy.empty((%s, %s), dtype=numpy.float32)";
static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
static const char __pyx_k_Surface_argument_has_incorrect_d[] = "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\nSet argument surface_ to None to avoid this error message";
static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
static PyObject *__pyx_kp_s_1_0_3;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_n_s_ASCII;
static PyObject *__pyx_kp_s_Argument_array_must_be_a_numpy;
static PyObject *__pyx_kp_s_Argument_bpf_threshold__must_be;
static PyObject *__pyx_kp_s_Argument_brightness_intensity_mu;
static PyObject *__pyx_kp_s_Argument_color_number_must_be_0;
static PyObject *__pyx_kp_s_Argument_current_must_be_a_nump;
static PyObject *__pyx_kp_s_Argument_destination__must_be_a;
static PyObject *__pyx_kp_s_Argument_duration__must_be_0;
static PyObject *__pyx_kp_s_Argument_factor__cannot_be_null;
static PyObject *__pyx_kp_s_Argument_factor__must_be_1;
static PyObject *__pyx_kp_s_Argument_factor__must_be_an_int;
static PyObject *__pyx_kp_s_Argument_factor__must_be_in_ran;
static PyObject *__pyx_kp_s_Argument_fire_intensity__must_be;
static PyObject *__pyx_kp_s_Argument_fisheye_model_must_be;
static PyObject *__pyx_kp_s_Argument_flag__must_be_a_int_ty;
static PyObject *__pyx_kp_s_Argument_freq__must_be_0;
static PyObject *__pyx_kp_s_Argument_h2_cannot_be_0;
static PyObject *__pyx_kp_s_Argument_h_must_be_0;
static PyObject *__pyx_kp_s_Argument_high_must_be_width;
static PyObject *__pyx_kp_s_Argument_hsl_model__must_be_a_n;
static PyObject *__pyx_kp_s_Argument_image_must_be_a_valid_S;
static PyObject *__pyx_kp_s_Argument_kernel_size__cannot_be;
static PyObject *__pyx_kp_s_Argument_lens_model__must_be_a;
static PyObject *__pyx_kp_s_Argument_light__must_be_a_float;
static PyObject *__pyx_kp_s_Argument_low__must_be_high;
static PyObject *__pyx_kp_s_Argument_mask__must_be_a_numpy;
static PyObject *__pyx_kp_s_Argument_mask_must_be_a_numpy_a;
static PyObject *__pyx_kp_s_Argument_offset__must_be_an_int;
static PyObject *__pyx_kp_s_Argument_previous_must_be_a_num;
static PyObject *__pyx_kp_s_Argument_rain_fisheye_model_mus;
static PyObject *__pyx_kp_s_Argument_reduce_factor__must_be;
static PyObject *__pyx_kp_s_Argument_reduce_factor_must_be_i;
static PyObject *__pyx_kp_s_Argument_rgb_model__must_be_a_n;
static PyObject *__pyx_kp_s_Argument_screen_h2_must_be_0;
static PyObject *__pyx_kp_s_Argument_screen_height_must_be_0;
static PyObject *__pyx_kp_s_Argument_screen_w2_must_be_0;
static PyObject *__pyx_kp_s_Argument_screen_width_must_be_0;
static PyObject *__pyx_kp_s_Argument_shift__must_be_in_rang;
static PyObject *__pyx_kp_s_Argument_shift__must_be_in_range;
static PyObject *__pyx_kp_s_Argument_shift_must_be_in_range;
static PyObject *__pyx_kp_s_Argument_sigma_i_must_be_a_valid;
static PyObject *__pyx_kp_s_Argument_sigma_s_must_be_a_valid;
static PyObject *__pyx_kp_s_Argument_size_must_be_0;
static PyObject *__pyx_kp_s_Argument_source__must_be_a_pygam;
static PyObject *__pyx_kp_s_Argument_space_cannot_be_0;
static PyObject *__pyx_kp_s_Argument_surface__must_be_a_Surf;
static PyObject *__pyx_kp_s_Argument_surface__must_be_a_pyg;
static PyObject *__pyx_kp_s_Argument_surface__must_be_a_pyga;
static PyObject *__pyx_kp_s_Argument_surface__must_be_a_vali;
static PyObject *__pyx_kp_s_Argument_t__must_be_0_got_s;
static PyObject *__pyx_kp_s_Argument_threshold_must_be_an_i;
static PyObject *__pyx_kp_s_Argument_threshold_must_be_in_ra;
static PyObject *__pyx_kp_s_Argument_w2_cannot_be_0;
static PyObject *__pyx_kp_s_Argument_w_must_be_0;
static PyObject *__pyx_kp_s_Argument_width_or_height_cannot;
static PyObject *__pyx_kp_s_Argument_width_should_be_0_got_s;
static PyObject *__pyx_kp_s_Array_sizes_mismatch_previous_w;
static PyObject *__pyx_kp_s_Assets_space1_jpg;
static PyObject *__pyx_n_s_BLEND_RGB_ADD;
static PyObject *__pyx_n_s_BLEND_RGB_MAX;
static PyObject *__pyx_n_s_BLEND_RGB_MIN;
static PyObject *__pyx_n_s_BLUEMAP;
static PyObject *__pyx_n_s_BufferProxy;
static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
static PyObject *__pyx_n_s_C;
static PyObject *__pyx_n_s_COLORS_CPC64;
static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
static PyObject *__pyx_kp_s_Cannot_reference_destination_pi;
static PyObject *__pyx_kp_s_Cannot_reference_source_pixels;
static PyObject *__pyx_kp_s_Cloud_array_size_mismatch_the_te;
static PyObject *__pyx_n_s_Color;
static PyObject *__pyx_n_s_DEG_TO_RAD;
static PyObject *__pyx_kp_s_Deprecated_version_use_shader_br;
static PyObject *__pyx_n_s_DeprecationWarning;
static PyObject *__pyx_n_s_EMBOSS_KERNEL;
static PyObject *__pyx_n_s_Ellipsis;
static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
static PyObject *__pyx_kp_s_Fire_array_size_mismatch_the_tex;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
static PyObject *__pyx_n_s_FutureWarning;
static PyObject *__pyx_n_s_HEATMAP;
static PyObject *__pyx_n_s_HWACCEL;
static PyObject *__pyx_n_s_HWSURFACE;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_ImportWarning;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
static PyObject *__pyx_kp_s_Incorrect_value_for_argument_pe;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
static PyObject *__pyx_n_s_K_SPACE;
static PyObject *__pyx_n_s_M_2PI;
static PyObject *__pyx_n_s_M_PI;
static PyObject *__pyx_n_s_M_PI2;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
static PyObject *__pyx_kp_s_MemoryView_of_r_object;
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_n_b_O;
static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_n_s_PygameShader_gaussianBlur5x5;
static PyObject *__pyx_kp_s_Pygame_library_is_missing_on_yo;
static PyObject *__pyx_n_s_QUIT;
static PyObject *__pyx_n_s_RAD_TO_DEG;
static PyObject *__pyx_n_s_REDMAP;
static PyObject *__pyx_n_s_RGB;
static PyObject *__pyx_n_s_RGBA;
static PyObject *__pyx_n_s_RLEACCEL;
static PyObject *__pyx_n_s_Rect;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_RuntimeWarning;
static PyObject *__pyx_n_s_SRCALPHA;
static PyObject *__pyx_n_s_STYLE_NORMAL;
static PyObject *__pyx_n_s_STYLE_STRONG;
static PyObject *__pyx_kp_s_Source_and_Destination_surfaces;
static PyObject *__pyx_n_s_Surface;
static PyObject *__pyx_kp_s_Surface_argument_has_incorrect_d;
static PyObject *__pyx_kp_s_Surface_size_and_mask_size_mism;
static PyObject *__pyx_kp_b_T;
static PyObject *__pyx_n_s_THREADS;
static PyObject *__pyx_kp_s_Texture_image_is_not_compatible;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
static PyObject *__pyx_n_s_VERSION;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_Vector2;
static PyObject *__pyx_n_s_View_MemoryView;
static PyObject *__pyx_kp_b__50;
static PyObject *__pyx_kp_b__51;
static PyObject *__pyx_kp_b__52;
static PyObject *__pyx_kp_b__53;
static PyObject *__pyx_kp_u__54;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_adjust_palette;
static PyObject *__pyx_n_s_allocate_buffer;
static PyObject *__pyx_n_s_amplitude;
static PyObject *__pyx_n_s_angles;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_array3d;
static PyObject *__pyx_n_s_array_2;
static PyObject *__pyx_n_s_array_alpha;
static PyObject *__pyx_n_s_array_to_surface;
static PyObject *__pyx_n_s_asarray;
static PyObject *__pyx_n_s_ascontiguousarray;
static PyObject *__pyx_n_s_astype;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_b_2;
static PyObject *__pyx_n_s_base;
static PyObject *__pyx_n_s_blend;
static PyObject *__pyx_n_s_blit;
static PyObject *__pyx_n_s_blit_array;
static PyObject *__pyx_n_s_bloom;
static PyObject *__pyx_n_s_bloom_threshold;
static PyObject *__pyx_n_s_blue;
static PyObject *__pyx_n_s_blur;
static PyObject *__pyx_n_s_border;
static PyObject *__pyx_n_s_bpf_threshold;
static PyObject *__pyx_n_s_bpf_threshold_2;
static PyObject *__pyx_n_s_brightness;
static PyObject *__pyx_n_s_brightness_intensity;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_s_c_2;
static PyObject *__pyx_n_u_c_2;
static PyObject *__pyx_n_s_canny_blur5x5_surface24_c;
static PyObject *__pyx_n_s_category;
static PyObject *__pyx_n_s_center;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_cloud;
static PyObject *__pyx_n_s_cloud_intensity;
static PyObject *__pyx_n_s_color;
static PyObject *__pyx_n_s_color_array;
static PyObject *__pyx_n_s_cols;
static PyObject *__pyx_kp_s_contiguous_and_direct;
static PyObject *__pyx_kp_s_contiguous_and_indirect;
static PyObject *__pyx_n_s_convert;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_current;
static PyObject *__pyx_n_s_degrees;
static PyObject *__pyx_n_s_dest_array;
static PyObject *__pyx_n_s_destination;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_display_height;
static PyObject *__pyx_n_s_display_width;
static PyObject *__pyx_n_s_distances;
static PyObject *__pyx_n_s_divide;
static PyObject *__pyx_n_s_dtype;
static PyObject *__pyx_n_s_dtype_is_object;
static PyObject *__pyx_n_s_duration;
static PyObject *__pyx_n_s_empty;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_factor;
static PyObject *__pyx_n_s_factor_2;
static PyObject *__pyx_n_s_fast;
static PyObject *__pyx_n_s_fast_2;
static PyObject *__pyx_n_s_fast_bloom;
static PyObject *__pyx_n_s_fh;
static PyObject *__pyx_n_s_filterwarnings;
static PyObject *__pyx_n_s_fire;
static PyObject *__pyx_n_s_fire_2;
static PyObject *__pyx_n_s_fire_intensity;
static PyObject *__pyx_n_s_fisheye_model;
static PyObject *__pyx_n_s_fl;
static PyObject *__pyx_n_s_flag;
static PyObject *__pyx_n_s_flag_2;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_s_float32;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_fortran;
static PyObject *__pyx_n_u_fortran;
static PyObject *__pyx_n_s_frame;
static PyObject *__pyx_n_s_frame_2;
static PyObject *__pyx_n_s_freetype;
static PyObject *__pyx_n_s_freq;
static PyObject *__pyx_n_s_frequency;
static PyObject *__pyx_n_s_frombuffer;
static PyObject *__pyx_n_s_fromstring;
static PyObject *__pyx_n_s_fs;
static PyObject *__pyx_n_s_g;
static PyObject *__pyx_n_s_gamma;
static PyObject *__pyx_n_s_get_bitsize;
static PyObject *__pyx_n_s_get_buffer;
static PyObject *__pyx_n_s_get_bytesize;
static PyObject *__pyx_n_s_get_height;
static PyObject *__pyx_n_s_get_size;
static PyObject *__pyx_n_s_get_view;
static PyObject *__pyx_n_s_get_width;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
static PyObject *__pyx_n_s_green;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_n_s_height;
static PyObject *__pyx_n_s_height_2;
static PyObject *__pyx_n_s_high;
static PyObject *__pyx_n_s_hsl;
static PyObject *__pyx_n_s_hsl_model;
static PyObject *__pyx_n_s_hue;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_s_ignore;
static PyObject *__pyx_n_s_image;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_int16;
static PyObject *__pyx_n_s_int32;
static PyObject *__pyx_n_s_int8;
static PyObject *__pyx_n_s_inv_colormap;
static PyObject *__pyx_n_s_itemsize;
static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_kernel_size;
static PyObject *__pyx_n_s_lens_model;
static PyObject *__pyx_n_s_light;
static PyObject *__pyx_n_s_linspace;
static PyObject *__pyx_n_s_load;
static PyObject *__pyx_n_s_low;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_make_surface;
static PyObject *__pyx_n_s_mask;
static PyObject *__pyx_n_s_mask_2;
static PyObject *__pyx_n_s_median_kernel;
static PyObject *__pyx_n_s_memview;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_mu;
static PyObject *__pyx_n_s_multiply;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_ndarray;
static PyObject *__pyx_n_s_ndim;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
static PyObject *__pyx_kp_s_numpy_library_is_missing_on_you;
static PyObject *__pyx_n_s_obj;
static PyObject *__pyx_n_s_offset;
static PyObject *__pyx_n_s_order;
static PyObject *__pyx_n_s_pack;
static PyObject *__pyx_n_s_palette;
static PyObject *__pyx_n_s_palette_2;
static PyObject *__pyx_n_s_perc;
static PyObject *__pyx_kp_s_perc__variable_must_be_in_range;
static PyObject *__pyx_n_s_percentage;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_pixels3d;
static PyObject *__pyx_n_s_pixels_alpha;
static PyObject *__pyx_n_s_pixels_blue;
static PyObject *__pyx_n_s_pixels_green;
static PyObject *__pyx_n_s_pixels_red;
static PyObject *__pyx_n_s_previous;
static PyObject *__pyx_n_s_pygame;
static PyObject *__pyx_n_s_pygame__freetype;
static PyObject *__pyx_n_s_pygame_image;
static PyObject *__pyx_n_s_pygame_math;
static PyObject *__pyx_n_s_pygame_pixelcopy;
static PyObject *__pyx_n_s_pygame_surfarray;
static PyObject *__pyx_n_s_pygame_transform;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_capi;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_getbuffer;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_Enum;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_n_s_rad;
static PyObject *__pyx_n_s_rad1;
static PyObject *__pyx_n_s_rain_fisheye_model;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_red;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_reduce_factor;
static PyObject *__pyx_n_s_rgb;
static PyObject *__pyx_n_s_rgb_model;
static PyObject *__pyx_n_s_rgb_to_hsl_model;
static PyObject *__pyx_n_s_rotate;
static PyObject *__pyx_n_s_rows;
static PyObject *__pyx_kp_u_s;
static PyObject *__pyx_n_s_sat;
static PyObject *__pyx_n_s_scale;
static PyObject *__pyx_n_s_scale2x;
static PyObject *__pyx_n_s_scr_data;
static PyObject *__pyx_n_s_screen_h2;
static PyObject *__pyx_n_s_screen_height;
static PyObject *__pyx_n_s_screen_w2;
static PyObject *__pyx_n_s_screen_width;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_shades;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_n_s_shift;
static PyObject *__pyx_n_s_sigma;
static PyObject *__pyx_n_s_sigma_i;
static PyObject *__pyx_n_s_sigma_s;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_size_2;
static PyObject *__pyx_n_s_smooth;
static PyObject *__pyx_n_s_smoothscale;
static PyObject *__pyx_n_s_sobel_threshold;
static PyObject *__pyx_n_s_sobel_threshold_2;
static PyObject *__pyx_n_s_source;
static PyObject *__pyx_n_s_space;
static PyObject *__pyx_n_s_special_flags;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_step;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_kp_s_strided_and_direct;
static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
static PyObject *__pyx_kp_s_strided_and_indirect;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_struct;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_surface;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_t_2;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_threshold;
static PyObject *__pyx_n_s_threshold_2;
static PyObject *__pyx_n_s_tostring;
static PyObject *__pyx_n_s_transpose;
static PyObject *__pyx_n_s_transpose_2;
static PyObject *__pyx_n_s_uint;
static PyObject *__pyx_n_s_uint16;
static PyObject *__pyx_n_s_uint32;
static PyObject *__pyx_n_s_uint8;
static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_n_s_unpack;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_warn;
static PyObject *__pyx_n_s_warnings;
static PyObject *__pyx_n_s_wavelength;
static PyObject *__pyx_n_s_width;
static PyObject *__pyx_n_s_width_2;
static PyObject *__pyx_n_s_zeros;
static PyObject *__pyx_pf_12PygameShader_6shader_rgb_to_bgr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_2rgb_to_brg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_4greyscale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_6sepia(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_8median(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, unsigned short __pyx_v_kernel_size_, int __pyx_v_fast_, unsigned short __pyx_v_reduce_factor_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_10median_grayscale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_kernel_size_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_12median_avg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_kernel_size_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_14color_reduction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_color_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_16sobel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_18sobel_fast(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold_, unsigned short __pyx_v_factor_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_20invert(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_22hsl_effect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_24hsl_fast(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_hsl_model_, __Pyx_memviewslice __pyx_v_rgb_model_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_26blur(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_t_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_28wave(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_rad, int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_30swirl(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_degrees); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_32swirl2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_degrees); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_34plasma_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_frame, float __pyx_v_hue_, float __pyx_v_sat_, float __pyx_v_value_, float __pyx_v_a_, float __pyx_v_b_, float __pyx_v_c_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_36plasma(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_frame, __Pyx_memviewslice __pyx_v_palette_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_38rgb_to_hsl_model(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_40hsl_to_rgb_model(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_42brightness(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_44brightness_exclude(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, PyObject *__pyx_v_color_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_46brightness_bpf(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, unsigned char __pyx_v_bpf_threshold); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_48brightness_model(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_rgb_to_hsl_model); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_50saturation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_52heatwave_vertical(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_mask, float __pyx_v_factor_, float __pyx_v_center_, float __pyx_v_sigma_, float __pyx_v_mu_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_54horizontal_glitch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_rad1_, float __pyx_v_frequency_, float __pyx_v_amplitude_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_56bpf(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_58bloom(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold_, int __pyx_v_fast_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_60fisheye_footprint(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_w, int __pyx_v_h); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_62fisheye(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_fisheye_model); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_64rain_footprint(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_w, int __pyx_v_h); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_66rain_fisheye(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_rain_fisheye_model); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_68tv_scan(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_space); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_70rgb_split(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_offset_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_72rgb_split_clean(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_offset_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_74ripple(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_rows_, int __pyx_v_cols_, __Pyx_memviewslice __pyx_v_previous_, __Pyx_memviewslice __pyx_v_current_, __Pyx_memviewslice __pyx_v_array_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_76heatmap(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_rgb_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_78predator_vision(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, unsigned int __pyx_v_sobel_threshold, unsigned int __pyx_v_bpf_threshold, unsigned int __pyx_v_bloom_threshold, int __pyx_v_inv_colormap, int __pyx_v_fast, int __pyx_v_blend); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_80blood(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_mask_, float __pyx_v_perc_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_82make_palette(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width, float __pyx_v_fh, float __pyx_v_fs, float __pyx_v_fl); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_84fire_sub(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_fire); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_86fire_effect(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_fire_, unsigned short __pyx_v_reduce_factor_, unsigned short __pyx_v_fire_intensity_, int __pyx_v_smooth_, int __pyx_v_bloom_, int __pyx_v_fast_bloom_, unsigned char __pyx_v_bpf_threshold_, unsigned int __pyx_v_low_, unsigned int __pyx_v_high_, int __pyx_v_brightness_, float __pyx_v_brightness_intensity_, PyObject *__pyx_v_surface_, int __pyx_v_adjust_palette_, PyObject *__pyx_v_hsl_, int __pyx_v_transpose_, int __pyx_v_border_, int __pyx_v_blur_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_88cloud_effect(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_cloud_, unsigned short __pyx_v_reduce_factor_, unsigned short __pyx_v_cloud_intensity_, int __pyx_v_smooth_, int __pyx_v_bloom_, int __pyx_v_fast_bloom_, unsigned char __pyx_v_bpf_threshold_, unsigned int __pyx_v_low_, unsigned int __pyx_v_high_, int __pyx_v_brightness_, float __pyx_v_brightness_intensity_, PyObject *__pyx_v_surface_, int __pyx_v_transpose_, int __pyx_v_blur_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_90mirroring_array(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_92mirroring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_94sharpen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_96dirt_lens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_lens_model_, int __pyx_v_flag_, float __pyx_v_light_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_98end_game(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_100level_clear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_102dithering(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_factor_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_104dithering_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_factor_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_106pixelation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_108zoom_in(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_110electric(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_112filmstrips(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_114cubism(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_116code_listing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_size_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_118ascii_char(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_120blend(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source_, PyObject *__pyx_v_destination_, float __pyx_v_percentage_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_122cartoon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_sobel_threshold_, int __pyx_v_median_kernel_, PyObject *__pyx_v_color_, PyObject *__pyx_v_flag_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_124explode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_126spectrum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width, int __pyx_v_height, float __pyx_v_gamma); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_128convert_27colors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_130bilateral(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_image, float __pyx_v_sigma_s, float __pyx_v_sigma_i); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_132emboss(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, unsigned int __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_134palette_change(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_palette_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_136putmask_c(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_array_, Py_ssize_t __pyx_v_rows_, Py_ssize_t __pyx_v_cols_, int __pyx_v_v_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_138tunnel_modeling32(CYTHON_UNUSED PyObject *__pyx_self, Py_ssize_t __pyx_v_screen_width, Py_ssize_t __pyx_v_screen_height); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_140tunnel_render32(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_t, Py_ssize_t __pyx_v_screen_width, Py_ssize_t __pyx_v_screen_height, int __pyx_v_screen_w2, int __pyx_v_screen_h2, __Pyx_memviewslice __pyx_v_distances, __Pyx_memviewslice __pyx_v_angles, __Pyx_memviewslice __pyx_v_shades, __Pyx_memviewslice __pyx_v_scr_data, __Pyx_memviewslice __pyx_v_dest_array); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_142heat_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, float __pyx_v_gamma); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_144custom_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, __Pyx_memviewslice __pyx_v_color_array_, float __pyx_v_gamma); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_146heatmap_convert(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_rgb_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_148blue_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, float __pyx_v_gamma); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_150bluescale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_152red_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, float __pyx_v_gamma); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_154redscale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_156rgb_to_int(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_red, int __pyx_v_green, int __pyx_v_blue); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_158int_to_rgb(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_160dampening(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_frame_, int __pyx_v_display_width, int __pyx_v_display_height_, float __pyx_v_amplitude_, int __pyx_v_duration_, float __pyx_v_freq_); /* proto */
static PyObject *__pyx_pf_12PygameShader_6shader_162lateral_dampening(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_frame_, float __pyx_v_amplitude_, int __pyx_v_duration_, float __pyx_v_freq_); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_float_1_8;
static PyObject *__pyx_float_255_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_32;
static PyObject *__pyx_int_45;
static PyObject *__pyx_int_80;
static PyObject *__pyx_int_90;
static PyObject *__pyx_int_128;
static PyObject *__pyx_int_130;
static PyObject *__pyx_int_255;
static PyObject *__pyx_int_256;
static PyObject *__pyx_int_370;
static PyObject *__pyx_int_800;
static PyObject *__pyx_int_1024;
static PyObject *__pyx_int_184977713;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_neg_2;
static PyObject *__pyx_int_neg_4;
static float __pyx_k__3;
static float __pyx_k__4;
static float __pyx_k__5;
static float __pyx_k__6;
static float __pyx_k__7;
static float __pyx_k__8;
static int __pyx_k__11;
static int __pyx_k__15;
static PyObject *__pyx_k__17;
static float __pyx_k__19;
static float __pyx_k__20;
static float __pyx_k__21;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_slice__24;
static PyObject *__pyx_slice__46;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_codeobj__68;
/* Late includes */

/* "PygameShader/shader.pyx":222
 * 
 * 
 * cpdef inline void rgb_to_bgr(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER RGB to BGR
 */

static PyObject *__pyx_pw_12PygameShader_6shader_1rgb_to_bgr(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rgb_to_bgr(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_to_bgr", 0);

  /* "PygameShader/shader.pyx":239
 *     :return             : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 239, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":240
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_rgb_to_bgr_inplace_c(pixels3d(surface_))
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 239, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":242
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_rgb_to_bgr_inplace_c(pixels3d(surface_))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 242, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_rgb_to_bgr_inplace_c(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":222
 * 
 * 
 * cpdef inline void rgb_to_bgr(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER RGB to BGR
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.rgb_to_bgr", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_1rgb_to_bgr(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_rgb_to_bgr[] = "  \n    SHADER RGB to BGR\n  \n    Convert your game display from RGB to BGR format\n    This algorithm can also be used to transform pygame texture in the equivalent bgr format\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n    new surface.\n\n    e.g:\n    rgb_to_bgr(surface)\n\n    :param surface_    : Pygame surface or display surface compatible (image 24-32 bit with or \n                         without per-pixel transparency / alpha channel)\n    :return             : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_1rgb_to_bgr(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rgb_to_bgr (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_rgb_to_bgr(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_rgb_to_bgr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_to_bgr", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_rgb_to_bgr(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.rgb_to_bgr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":245
 * 
 * 
 * cpdef inline void rgb_to_brg(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER RGB TO BRG
 */

static PyObject *__pyx_pw_12PygameShader_6shader_3rgb_to_brg(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rgb_to_brg(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_to_brg", 0);

  /* "PygameShader/shader.pyx":262
 *     :return: void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 262, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":263
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_rgb_to_brg_inplace_c(pixels3d(surface_))
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 262, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":265
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_rgb_to_brg_inplace_c(pixels3d(surface_))             # <<<<<<<<<<<<<<
 * 
 * cpdef inline void greyscale(object surface_):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 265, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_rgb_to_brg_inplace_c(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":245
 * 
 * 
 * cpdef inline void rgb_to_brg(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER RGB TO BRG
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.rgb_to_brg", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_3rgb_to_brg(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_2rgb_to_brg[] = "\n    SHADER RGB TO BRG\n\n    Convert your game display from RGB to BRG format.\n    This algorithm can also be used to transform pygame texture in the equivalent BRG format\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.\n    \n    e.g:\n    rgb_to_brg(surface)\n\n    :param surface_: Pygame surface or display surface compatible (image 24-32 bit with or without \n                     per-pixel transparency / alpha channel)\n    :return: void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_3rgb_to_brg(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rgb_to_brg (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_2rgb_to_brg(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_2rgb_to_brg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_to_brg", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_rgb_to_brg(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.rgb_to_brg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":267
 *     shader_rgb_to_brg_inplace_c(pixels3d(surface_))
 * 
 * cpdef inline void greyscale(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER GRAYSCALE (CONSERVE LUMINOSITY)
 */

static PyObject *__pyx_pw_12PygameShader_6shader_5greyscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_greyscale(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("greyscale", 0);

  /* "PygameShader/shader.pyx":286
 * 
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 286, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":287
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_greyscale_luminosity24_inplace_c(pixels3d(surface_))
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 286, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":289
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_greyscale_luminosity24_inplace_c(pixels3d(surface_))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 289, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_greyscale_luminosity24_inplace_c(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":267
 *     shader_rgb_to_brg_inplace_c(pixels3d(surface_))
 * 
 * cpdef inline void greyscale(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER GRAYSCALE (CONSERVE LUMINOSITY)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.greyscale", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_5greyscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_4greyscale[] = "\n    SHADER GRAYSCALE (CONSERVE LUMINOSITY)\n\n    This shader transform the game display on a grayscale video game effect\n    \n    * This shader can also be applied to pygame textures/surface to transform them into\n      an equivalent grayscale model\n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.\n\n    e.g:\n    greyscale(surface)\n\n    :param surface_  : Pygame surface or display surface compatible (image 24-32 bit with \n                       or without per-pixel transparency / alpha channel)\n    :return          : void\n    \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_5greyscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("greyscale (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_4greyscale(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_4greyscale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("greyscale", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_greyscale(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.greyscale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":292
 * 
 * 
 * cpdef inline void sepia(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER SEPIA MODEL
 */

static PyObject *__pyx_pw_12PygameShader_6shader_7sepia(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sepia(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sepia", 0);

  /* "PygameShader/shader.pyx":309
 *     :return:         : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 309, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":310
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_sepia24_inplace_c(pixels3d(surface_))
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 309, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":312
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_sepia24_inplace_c(pixels3d(surface_))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 312, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_sepia24_inplace_c(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":292
 * 
 * 
 * cpdef inline void sepia(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER SEPIA MODEL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.sepia", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_7sepia(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_6sepia[] = "\n    SHADER SEPIA MODEL\n\n    Transform your video game into an equivalent sepia model\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.\n\n    e.g:\n    sepia(surface)\n\n\n    :param surface_  : Pygame surface or display surface compatible (image 24-32 bit with \n                       or without per-pixel transparency / alpha channel)\n    :return:         : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_7sepia(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sepia (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_6sepia(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_6sepia(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sepia", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_sepia(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.sepia", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":319
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void median_fast(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned short int kernel_size_=2,
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median_fast(PyObject *__pyx_v_surface_, struct __pyx_opt_args_12PygameShader_6shader_median_fast *__pyx_optional_args) {
  unsigned short __pyx_v_kernel_size_ = ((unsigned short)2);
  unsigned short __pyx_v_reduce_factor_ = ((unsigned short)1);
  PyObject *__pyx_v_surface_cp = NULL;
  int __pyx_v_w;
  int __pyx_v_h;
  __Pyx_memviewslice __pyx_v_surface_cp_arr = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_i;
  int __pyx_v_j;
  __Pyx_memviewslice __pyx_v_org_surface = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_c __pyx_t_10;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("median_fast", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
      }
    }
  }

  /* "PygameShader/shader.pyx":333
 *     """
 * 
 *     surface_cp = surface_.copy()             # <<<<<<<<<<<<<<
 *     cdef:
 *         int w, h
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_surface_cp = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":336
 *     cdef:
 *         int w, h
 *     w, h = surface_cp.get_size()             # <<<<<<<<<<<<<<
 * 
 *     surface_cp = smoothscale(surface_cp, (w >> reduce_factor_, h >> reduce_factor_))
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_cp, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 336, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 336, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 336, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 336, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 336, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_w = __pyx_t_6;
  __pyx_v_h = __pyx_t_7;

  /* "PygameShader/shader.pyx":338
 *     w, h = surface_cp.get_size()
 * 
 *     surface_cp = smoothscale(surface_cp, (w >> reduce_factor_, h >> reduce_factor_))             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_w >> __pyx_v_reduce_factor_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_h >> __pyx_v_reduce_factor_)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface_cp, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 338, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface_cp, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 338, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_surface_cp);
    __Pyx_GIVEREF(__pyx_v_surface_cp);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_v_surface_cp);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_surface_cp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":341
 * 
 *     cdef:
 *         unsigned char [:, :, :] surface_cp_arr = pixels3d(surface_cp)             # <<<<<<<<<<<<<<
 *         int i, j
 *         unsigned char[:, :, :] org_surface = pixels3d(surface_)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surface_cp) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surface_cp);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 341, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_surface_cp_arr = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":343
 *         unsigned char [:, :, :] surface_cp_arr = pixels3d(surface_cp)
 *         int i, j
 *         unsigned char[:, :, :] org_surface = pixels3d(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_median_filter24_inplace_c(surface_cp_arr, kernel_size_)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 343, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_org_surface = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":345
 *         unsigned char[:, :, :] org_surface = pixels3d(surface_)
 * 
 *     shader_median_filter24_inplace_c(surface_cp_arr, kernel_size_)             # <<<<<<<<<<<<<<
 *     surface_cp_arr = scale_array24_c(surface_cp_arr, w, h)
 * 
 */
  __pyx_t_10.__pyx_n = 1;
  __pyx_t_10.kernel_size_ = __pyx_v_kernel_size_;
  __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_c(__pyx_v_surface_cp_arr, &__pyx_t_10); 

  /* "PygameShader/shader.pyx":346
 * 
 *     shader_median_filter24_inplace_c(surface_cp_arr, kernel_size_)
 *     surface_cp_arr = scale_array24_c(surface_cp_arr, w, h)             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_t_11 = __pyx_f_12PygameShader_6shader_scale_array24_c(__pyx_v_surface_cp_arr, __pyx_v_w, __pyx_v_h); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 346, __pyx_L1_error)
  __PYX_XDEC_MEMVIEW(&__pyx_v_surface_cp_arr, 1);
  __pyx_v_surface_cp_arr = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "PygameShader/shader.pyx":348
 *     surface_cp_arr = scale_array24_c(surface_cp_arr, w, h)
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w, schedule='static', num_threads=THREADS):
 *             for j in range(h):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":349
 * 
 *     with nogil:
 *         for i in prange(w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for j in range(h):
 *                 org_surface[i, j, 0] = surface_cp_arr[i, j, 0]
 */
        __pyx_t_7 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_12 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_12 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_12; __pyx_t_6++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_6);
                            /* Initialize private variables to invalid values */
                            __pyx_v_j = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":350
 *     with nogil:
 *         for i in prange(w, schedule='static', num_threads=THREADS):
 *             for j in range(h):             # <<<<<<<<<<<<<<
 *                 org_surface[i, j, 0] = surface_cp_arr[i, j, 0]
 *                 org_surface[i, j, 1] = surface_cp_arr[i, j, 1]
 */
                            __pyx_t_13 = __pyx_v_h;
                            __pyx_t_14 = __pyx_t_13;
                            for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
                              __pyx_v_j = __pyx_t_15;

                              /* "PygameShader/shader.pyx":351
 *         for i in prange(w, schedule='static', num_threads=THREADS):
 *             for j in range(h):
 *                 org_surface[i, j, 0] = surface_cp_arr[i, j, 0]             # <<<<<<<<<<<<<<
 *                 org_surface[i, j, 1] = surface_cp_arr[i, j, 1]
 *                 org_surface[i, j, 2] = surface_cp_arr[i, j, 2]
 */
                              __pyx_t_16 = __pyx_v_i;
                              __pyx_t_17 = __pyx_v_j;
                              __pyx_t_18 = 0;
                              __pyx_t_19 = __pyx_v_i;
                              __pyx_t_20 = __pyx_v_j;
                              __pyx_t_21 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_org_surface.data + __pyx_t_19 * __pyx_v_org_surface.strides[0]) ) + __pyx_t_20 * __pyx_v_org_surface.strides[1]) ) + __pyx_t_21 * __pyx_v_org_surface.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surface_cp_arr.data + __pyx_t_16 * __pyx_v_surface_cp_arr.strides[0]) ) + __pyx_t_17 * __pyx_v_surface_cp_arr.strides[1]) ) + __pyx_t_18 * __pyx_v_surface_cp_arr.strides[2]) )));

                              /* "PygameShader/shader.pyx":352
 *             for j in range(h):
 *                 org_surface[i, j, 0] = surface_cp_arr[i, j, 0]
 *                 org_surface[i, j, 1] = surface_cp_arr[i, j, 1]             # <<<<<<<<<<<<<<
 *                 org_surface[i, j, 2] = surface_cp_arr[i, j, 2]
 * 
 */
                              __pyx_t_18 = __pyx_v_i;
                              __pyx_t_17 = __pyx_v_j;
                              __pyx_t_16 = 1;
                              __pyx_t_21 = __pyx_v_i;
                              __pyx_t_20 = __pyx_v_j;
                              __pyx_t_19 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_org_surface.data + __pyx_t_21 * __pyx_v_org_surface.strides[0]) ) + __pyx_t_20 * __pyx_v_org_surface.strides[1]) ) + __pyx_t_19 * __pyx_v_org_surface.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surface_cp_arr.data + __pyx_t_18 * __pyx_v_surface_cp_arr.strides[0]) ) + __pyx_t_17 * __pyx_v_surface_cp_arr.strides[1]) ) + __pyx_t_16 * __pyx_v_surface_cp_arr.strides[2]) )));

                              /* "PygameShader/shader.pyx":353
 *                 org_surface[i, j, 0] = surface_cp_arr[i, j, 0]
 *                 org_surface[i, j, 1] = surface_cp_arr[i, j, 1]
 *                 org_surface[i, j, 2] = surface_cp_arr[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_16 = __pyx_v_i;
                              __pyx_t_17 = __pyx_v_j;
                              __pyx_t_18 = 2;
                              __pyx_t_19 = __pyx_v_i;
                              __pyx_t_20 = __pyx_v_j;
                              __pyx_t_21 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_org_surface.data + __pyx_t_19 * __pyx_v_org_surface.strides[0]) ) + __pyx_t_20 * __pyx_v_org_surface.strides[1]) ) + __pyx_t_21 * __pyx_v_org_surface.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surface_cp_arr.data + __pyx_t_16 * __pyx_v_surface_cp_arr.strides[0]) ) + __pyx_t_17 * __pyx_v_surface_cp_arr.strides[1]) ) + __pyx_t_18 * __pyx_v_surface_cp_arr.strides[2]) )));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":348
 *     surface_cp_arr = scale_array24_c(surface_cp_arr, w, h)
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w, schedule='static', num_threads=THREADS):
 *             for j in range(h):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "PygameShader/shader.pyx":319
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void median_fast(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned short int kernel_size_=2,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.median_fast", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_surface_cp);
  __PYX_XDEC_MEMVIEW(&__pyx_v_surface_cp_arr, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_org_surface, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":356
 * 
 * 
 * cpdef inline void median(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned short int kernel_size_=2,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_9median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median *__pyx_optional_args) {
  unsigned short __pyx_v_kernel_size_ = ((unsigned short)2);

  /* "PygameShader/shader.pyx":359
 *         object surface_,
 *         unsigned short int kernel_size_=2,
 *         bint fast_=True,             # <<<<<<<<<<<<<<
 *         unsigned short int reduce_factor_=1
 * ) except *:
 */
  int __pyx_v_fast_ = ((int)1);
  unsigned short __pyx_v_reduce_factor_ = ((unsigned short)1);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  struct __pyx_opt_args_12PygameShader_6shader_median_fast __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_c __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("median", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_fast_ = __pyx_optional_args->fast_;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":389
 *     :return:             : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 389, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":390
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     if kernel_size_ <= 0:
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 390, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 389, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":392
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     if kernel_size_ <= 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('\nArgument kernel_size_ cannot be <= 0')
 *     if not 0 < reduce_factor_ < 9:
 */
  __pyx_t_3 = ((__pyx_v_kernel_size_ <= 0) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "PygameShader/shader.pyx":393
 * 
 *     if kernel_size_ <= 0:
 *         raise ValueError('\nArgument kernel_size_ cannot be <= 0')             # <<<<<<<<<<<<<<
 *     if not 0 < reduce_factor_ < 9:
 *         raise ValueError('\nArgument reduce_factor_ must be in range [1 ... 8] ')
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 393, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 393, __pyx_L1_error)

    /* "PygameShader/shader.pyx":392
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     if kernel_size_ <= 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('\nArgument kernel_size_ cannot be <= 0')
 *     if not 0 < reduce_factor_ < 9:
 */
  }

  /* "PygameShader/shader.pyx":394
 *     if kernel_size_ <= 0:
 *         raise ValueError('\nArgument kernel_size_ cannot be <= 0')
 *     if not 0 < reduce_factor_ < 9:             # <<<<<<<<<<<<<<
 *         raise ValueError('\nArgument reduce_factor_ must be in range [1 ... 8] ')
 * 
 */
  __pyx_t_3 = (0 < __pyx_v_reduce_factor_);
  if (__pyx_t_3) {
    __pyx_t_3 = (__pyx_v_reduce_factor_ < 9);
  }
  __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "PygameShader/shader.pyx":395
 *         raise ValueError('\nArgument kernel_size_ cannot be <= 0')
 *     if not 0 < reduce_factor_ < 9:
 *         raise ValueError('\nArgument reduce_factor_ must be in range [1 ... 8] ')             # <<<<<<<<<<<<<<
 * 
 *     if fast_:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 395, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 395, __pyx_L1_error)

    /* "PygameShader/shader.pyx":394
 *     if kernel_size_ <= 0:
 *         raise ValueError('\nArgument kernel_size_ cannot be <= 0')
 *     if not 0 < reduce_factor_ < 9:             # <<<<<<<<<<<<<<
 *         raise ValueError('\nArgument reduce_factor_ must be in range [1 ... 8] ')
 * 
 */
  }

  /* "PygameShader/shader.pyx":397
 *         raise ValueError('\nArgument reduce_factor_ must be in range [1 ... 8] ')
 * 
 *     if fast_:             # <<<<<<<<<<<<<<
 *         median_fast(surface_, kernel_size_, reduce_factor_)
 *     else:
 */
  __pyx_t_4 = (__pyx_v_fast_ != 0);
  if (__pyx_t_4) {

    /* "PygameShader/shader.pyx":398
 * 
 *     if fast_:
 *         median_fast(surface_, kernel_size_, reduce_factor_)             # <<<<<<<<<<<<<<
 *     else:
 *         shader_median_filter24_inplace_c(pixels3d(surface_), kernel_size_)
 */
    __pyx_t_5.__pyx_n = 2;
    __pyx_t_5.kernel_size_ = __pyx_v_kernel_size_;
    __pyx_t_5.reduce_factor_ = __pyx_v_reduce_factor_;
    __pyx_f_12PygameShader_6shader_median_fast(__pyx_v_surface_, &__pyx_t_5); 

    /* "PygameShader/shader.pyx":397
 *         raise ValueError('\nArgument reduce_factor_ must be in range [1 ... 8] ')
 * 
 *     if fast_:             # <<<<<<<<<<<<<<
 *         median_fast(surface_, kernel_size_, reduce_factor_)
 *     else:
 */
    goto __pyx_L5;
  }

  /* "PygameShader/shader.pyx":400
 *         median_fast(surface_, kernel_size_, reduce_factor_)
 *     else:
 *         shader_median_filter24_inplace_c(pixels3d(surface_), kernel_size_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 400, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8.__pyx_n = 1;
    __pyx_t_8.kernel_size_ = __pyx_v_kernel_size_;
    __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_c(__pyx_t_7, &__pyx_t_8); 
    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
    __pyx_t_7.memview = NULL;
    __pyx_t_7.data = NULL;
  }
  __pyx_L5:;

  /* "PygameShader/shader.pyx":356
 * 
 * 
 * cpdef inline void median(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned short int kernel_size_=2,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_AddTraceback("PygameShader.shader.median", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_9median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_8median[] = "\n    SHADER MEDIAN FILTER COMPATIBLE 24-32 bit IMAGE\n\n    This shader cannot be used for real time display rendering as the performance \n    of the algorithm is not satisfactory < 50 fps. \n    The code would have to be changed and improved with C or assembler in order to\n    be adapted for a real time application. \n\n    In the state, this shader can be used for texture/surface transformation offline\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.  \n\n    :param surface_      : Pygame surface or display surface compatible (image 24-32 bit with \n                           or without per-pixel transparency / alpha channel)\n    :param kernel_size_  : integer; Kernel size or neighbourhood pixels to be included default is 2\n                           Increase the effect with kernel size > 2 (effect overall speed is \n                           degrading quickly with large kernel size e.g > 2)\n    :param fast_         : boolean; Flag for fast calculation (default True). Improve overall speed \n                           performance by using smaller texture sizes (see reduce_factor_ option)\n    :param reduce_factor_: integer; Int value to reduce the size of the original surface to \n                           process. A value of 1, divide the original surface by 2 and a value of 2\n                           reduce the surface by 4 (value of 1 and 2 are acceptable, over 2 the \n                           image quality is too pixelated and blur) default value is 1 (div by 2).\n                           This argument as no effect if flag fast_=False\n    :return:             : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_9median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  unsigned short __pyx_v_kernel_size_;
  int __pyx_v_fast_;
  unsigned short __pyx_v_reduce_factor_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("median (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_kernel_size,&__pyx_n_s_fast,&__pyx_n_s_reduce_factor,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kernel_size);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduce_factor);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "median") < 0)) __PYX_ERR(1, 356, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_kernel_size_ = __Pyx_PyInt_As_unsigned_short(values[1]); if (unlikely((__pyx_v_kernel_size_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 358, __pyx_L3_error)
    } else {
      __pyx_v_kernel_size_ = ((unsigned short)2);
    }
    if (values[2]) {
      __pyx_v_fast_ = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_fast_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 359, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":359
 *         object surface_,
 *         unsigned short int kernel_size_=2,
 *         bint fast_=True,             # <<<<<<<<<<<<<<
 *         unsigned short int reduce_factor_=1
 * ) except *:
 */
      __pyx_v_fast_ = ((int)1);
    }
    if (values[3]) {
      __pyx_v_reduce_factor_ = __Pyx_PyInt_As_unsigned_short(values[3]); if (unlikely((__pyx_v_reduce_factor_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 360, __pyx_L3_error)
    } else {
      __pyx_v_reduce_factor_ = ((unsigned short)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("median", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 356, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.median", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_8median(__pyx_self, __pyx_v_surface_, __pyx_v_kernel_size_, __pyx_v_fast_, __pyx_v_reduce_factor_);

  /* "PygameShader/shader.pyx":356
 * 
 * 
 * cpdef inline void median(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned short int kernel_size_=2,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_8median(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, unsigned short __pyx_v_kernel_size_, int __pyx_v_fast_, unsigned short __pyx_v_reduce_factor_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_median __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("median", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 3;
  __pyx_t_1.kernel_size_ = __pyx_v_kernel_size_;
  __pyx_t_1.fast_ = __pyx_v_fast_;
  __pyx_t_1.reduce_factor_ = __pyx_v_reduce_factor_;
  __pyx_f_12PygameShader_6shader_median(__pyx_v_surface_, 0, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 356, __pyx_L1_error)
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.median", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":403
 * 
 * 
 * cpdef inline void median_grayscale(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int kernel_size_=2
 */

static PyObject *__pyx_pw_12PygameShader_6shader_11median_grayscale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median_grayscale(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median_grayscale *__pyx_optional_args) {
  int __pyx_v_kernel_size_ = ((int)2);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("median_grayscale", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
    }
  }

  /* "PygameShader/shader.pyx":425
 *     :return: void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 425, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":426
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert kernel_size_ > 0, "\nArgument kernel_size_ cannot be <= 0"
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 425, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":428
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert kernel_size_ > 0, "\nArgument kernel_size_ cannot be <= 0"             # <<<<<<<<<<<<<<
 * 
 *     shader_median_grayscale_filter24_inplace_c(pixels3d(surface_), kernel_size_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_kernel_size_ > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_kernel_size__cannot_be);
      __PYX_ERR(1, 428, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":430
 *     assert kernel_size_ > 0, "\nArgument kernel_size_ cannot be <= 0"
 * 
 *     shader_median_grayscale_filter24_inplace_c(pixels3d(surface_), kernel_size_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.kernel_size_ = __pyx_v_kernel_size_;
  __pyx_f_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c(__pyx_t_5, &__pyx_t_6); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":403
 * 
 * 
 * cpdef inline void median_grayscale(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int kernel_size_=2
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.median_grayscale", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_11median_grayscale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_10median_grayscale[] = "\n    SHADER MEDIAN FILTER (GRAYSCALE)\n\n    This shader cannot be used for real time rendering as the performance of the algorithm are not\n    satisfactory. The code would have to be changed and improved with C or assembler in order to\n    be adapted for a real time application. \n\n    In the state, this shader can be used for texture/surface transformation offline\n\n    The surface is compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.  \n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit with or without alpha layer\n    :param kernel_size_: integer; Kernel size (must be > 0), default value = 2\n    :return: void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_11median_grayscale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_kernel_size_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("median_grayscale (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_kernel_size,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kernel_size);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "median_grayscale") < 0)) __PYX_ERR(1, 403, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_kernel_size_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_kernel_size_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 405, __pyx_L3_error)
    } else {
      __pyx_v_kernel_size_ = ((int)2);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("median_grayscale", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 403, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.median_grayscale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_10median_grayscale(__pyx_self, __pyx_v_surface_, __pyx_v_kernel_size_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_10median_grayscale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_kernel_size_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_median_grayscale __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("median_grayscale", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.kernel_size_ = __pyx_v_kernel_size_;
  __pyx_f_12PygameShader_6shader_median_grayscale(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.median_grayscale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":433
 * 
 * 
 * cpdef inline void median_avg(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int kernel_size_=2
 */

static PyObject *__pyx_pw_12PygameShader_6shader_13median_avg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median_avg(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median_avg *__pyx_optional_args) {
  int __pyx_v_kernel_size_ = ((int)2);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_avg_inplace_c __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("median_avg", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
    }
  }

  /* "PygameShader/shader.pyx":456
 *     """
 * 
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 456, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":457
 * 
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert kernel_size_ > 0, "\nArgument kernel_size_ cannot be <= 0"
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 456, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":459
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert kernel_size_ > 0, "\nArgument kernel_size_ cannot be <= 0"             # <<<<<<<<<<<<<<
 * 
 *     shader_median_filter24_avg_inplace_c(pixels3d(surface_), kernel_size_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_kernel_size_ > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_kernel_size__cannot_be);
      __PYX_ERR(1, 459, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":461
 *     assert kernel_size_ > 0, "\nArgument kernel_size_ cannot be <= 0"
 * 
 *     shader_median_filter24_avg_inplace_c(pixels3d(surface_), kernel_size_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 461, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.kernel_size_ = __pyx_v_kernel_size_;
  __pyx_f_12PygameShader_6shader_shader_median_filter24_avg_inplace_c(__pyx_t_5, &__pyx_t_6); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":433
 * 
 * 
 * cpdef inline void median_avg(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int kernel_size_=2
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.median_avg", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_13median_avg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_12median_avg[] = "\n    SHADER MEDIAN FILTER (AVERAGE)\n    \n    This shader cannot be used for real time rendering as the performance of the algorithm are not\n    satisfactory. The code would have to be changed and improved with C or assembler in order to\n    be adapted for a real time application. \n\n    In the state, this shader can be used for texture/surface transformation offline\n\n    The surface is compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.  \n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit with or without alpha layer\n    :param kernel_size_: integer; Kernel size (must be > 0), default value = 2\n    :return: void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_13median_avg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_kernel_size_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("median_avg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_kernel_size,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kernel_size);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "median_avg") < 0)) __PYX_ERR(1, 433, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_kernel_size_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_kernel_size_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 435, __pyx_L3_error)
    } else {
      __pyx_v_kernel_size_ = ((int)2);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("median_avg", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 433, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.median_avg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_12median_avg(__pyx_self, __pyx_v_surface_, __pyx_v_kernel_size_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_12median_avg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_kernel_size_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_median_avg __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("median_avg", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.kernel_size_ = __pyx_v_kernel_size_;
  __pyx_f_12PygameShader_6shader_median_avg(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.median_avg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":465
 * 
 * 
 * cpdef inline void color_reduction(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int color_=8
 */

static PyObject *__pyx_pw_12PygameShader_6shader_15color_reduction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_color_reduction(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_color_reduction *__pyx_optional_args) {
  int __pyx_v_color_ = ((int)8);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("color_reduction", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_color_ = __pyx_optional_args->color_;
    }
  }

  /* "PygameShader/shader.pyx":488
 *     :return: void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 488, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":489
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert color_ > 0, "Argument color_number must be > 0"
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 488, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":491
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert color_ > 0, "Argument color_number must be > 0"             # <<<<<<<<<<<<<<
 * 
 *     shader_color_reduction24_inplace_c(pixels3d(surface_), color_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_color_ > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_color_number_must_be_0);
      __PYX_ERR(1, 491, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":493
 *     assert color_ > 0, "Argument color_number must be > 0"
 * 
 *     shader_color_reduction24_inplace_c(pixels3d(surface_), color_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 493, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_color_reduction24_inplace_c(__pyx_t_5, __pyx_v_color_);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":465
 * 
 * 
 * cpdef inline void color_reduction(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int color_=8
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.color_reduction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_15color_reduction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_14color_reduction[] = "\n     COLOR REDUCTION SHADER\n\n    Decrease the amount of colors in the display or texture.\n    The method of color reduction is very simple: every color of the original picture is replaced\n    by an appropriate color from the limited palette that is accessible.\n    \n    The surface is compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.  \n      \n    e.g:\n    color_reduction(surface, 8)\n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit \n    :param color_: integer must be > 0 default 8\n    :return: void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_15color_reduction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_color_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("color_reduction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_color,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "color_reduction") < 0)) __PYX_ERR(1, 465, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_color_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_color_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 467, __pyx_L3_error)
    } else {
      __pyx_v_color_ = ((int)8);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("color_reduction", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 465, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.color_reduction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_14color_reduction(__pyx_self, __pyx_v_surface_, __pyx_v_color_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_14color_reduction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_color_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_color_reduction __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("color_reduction", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.color_ = __pyx_v_color_;
  __pyx_f_12PygameShader_6shader_color_reduction(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.color_reduction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":496
 * 
 * 
 * cpdef inline void sobel(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int threshold_ = 64
 */

static PyObject *__pyx_pw_12PygameShader_6shader_17sobel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sobel(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_sobel *__pyx_optional_args) {
  int __pyx_v_threshold_ = ((int)64);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_inplace_c __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sobel", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_threshold_ = __pyx_optional_args->threshold_;
    }
  }

  /* "PygameShader/shader.pyx":518
 *     :return:
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 518, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":519
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert -1 < threshold_ < 256, "\nArgument threshold must be an integer in range [0 ... 255]"
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 518, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":521
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert -1 < threshold_ < 256, "\nArgument threshold must be an integer in range [0 ... 255]"             # <<<<<<<<<<<<<<
 * 
 *     shader_sobel24_inplace_c(pixels3d(surface_), threshold_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (-1L < __pyx_v_threshold_);
    if (__pyx_t_3) {
      __pyx_t_3 = (__pyx_v_threshold_ < 0x100);
    }
    if (unlikely(!(__pyx_t_3 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_threshold_must_be_an_i);
      __PYX_ERR(1, 521, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":523
 *     assert -1 < threshold_ < 256, "\nArgument threshold must be an integer in range [0 ... 255]"
 * 
 *     shader_sobel24_inplace_c(pixels3d(surface_), threshold_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.threshold = __pyx_v_threshold_;
  __pyx_f_12PygameShader_6shader_shader_sobel24_inplace_c(__pyx_t_5, &__pyx_t_6); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":496
 * 
 * 
 * cpdef inline void sobel(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int threshold_ = 64
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.sobel", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_17sobel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_16sobel[] = "\n    SHADER SOBEL (EDGE DETECTION)\n\n    Transform the game display or a pygame surface into a sobel equivalent model\n    (surface edge detection)\n\n    The surface is compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    e.g:\n    sobel(surface, 64)\n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit \n    :param threshold_: integer; Value for detecting the edges default 64\n    :return:\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_17sobel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_threshold_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sobel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_threshold,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sobel") < 0)) __PYX_ERR(1, 496, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_threshold_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_threshold_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 498, __pyx_L3_error)
    } else {
      __pyx_v_threshold_ = ((int)64);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sobel", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 496, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.sobel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_16sobel(__pyx_self, __pyx_v_surface_, __pyx_v_threshold_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_16sobel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_sobel __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sobel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.threshold_ = __pyx_v_threshold_;
  __pyx_f_12PygameShader_6shader_sobel(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.sobel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":526
 * 
 * 
 * cpdef inline void sobel_fast(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int threshold_ = 64,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_19sobel_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sobel_fast(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_sobel_fast *__pyx_optional_args) {
  int __pyx_v_threshold_ = ((int)64);
  unsigned short __pyx_v_factor_ = ((unsigned short)1);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_fast_inplace_c __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sobel_fast", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_threshold_ = __pyx_optional_args->threshold_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_factor_ = __pyx_optional_args->factor_;
      }
    }
  }

  /* "PygameShader/shader.pyx":555
 *     :return:
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 555, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":556
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert -1 < threshold_ < 256, "\nArgument threshold must be an integer in range [0 ... 255]"
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 555, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":558
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert -1 < threshold_ < 256, "\nArgument threshold must be an integer in range [0 ... 255]"             # <<<<<<<<<<<<<<
 *     assert 0 < factor_ < 9, "\nArgument factor_ must be in range [1 ... 8]"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (-1L < __pyx_v_threshold_);
    if (__pyx_t_3) {
      __pyx_t_3 = (__pyx_v_threshold_ < 0x100);
    }
    if (unlikely(!(__pyx_t_3 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_threshold_must_be_an_i);
      __PYX_ERR(1, 558, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":559
 * 
 *     assert -1 < threshold_ < 256, "\nArgument threshold must be an integer in range [0 ... 255]"
 *     assert 0 < factor_ < 9, "\nArgument factor_ must be in range [1 ... 8]"             # <<<<<<<<<<<<<<
 * 
 *     shader_sobel24_fast_inplace_c(surface_, threshold_, factor_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (0 < __pyx_v_factor_);
    if (__pyx_t_3) {
      __pyx_t_3 = (__pyx_v_factor_ < 9);
    }
    if (unlikely(!(__pyx_t_3 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_factor__must_be_in_ran);
      __PYX_ERR(1, 559, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":561
 *     assert 0 < factor_ < 9, "\nArgument factor_ must be in range [1 ... 8]"
 * 
 *     shader_sobel24_fast_inplace_c(surface_, threshold_, factor_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4.__pyx_n = 2;
  __pyx_t_4.threshold_ = __pyx_v_threshold_;
  __pyx_t_4.factor_ = __pyx_v_factor_;
  __pyx_f_12PygameShader_6shader_shader_sobel24_fast_inplace_c(__pyx_v_surface_, &__pyx_t_4); 

  /* "PygameShader/shader.pyx":526
 * 
 * 
 * cpdef inline void sobel_fast(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int threshold_ = 64,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("PygameShader.shader.sobel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_19sobel_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_18sobel_fast[] = "\n    SHADER FAST SOBEL (EDGE DETECTION)\n\n    Transform the game display or a pygame surface into a sobel equivalent model\n    (surface edge detection).This version is slightly fastest than shader_sobel24_inplace_c as\n    it down-scale the array containing all the pixels and apply the sobel algorithm to a smaller\n    sample. When the processing is done, the array is re-scale to its original dimensions.\n    If this method is in theory faster than shader_sobel24_inplace_c, down-scaling and up-scaling\n    an array does have a side effect of decreasing the overall image definition\n    (jagged lines non-antialiasing)\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n      \n    e.g:\n    sobel_fast(surface, 64, factor_=1)\n\n    :param surface_: pygame.surface compatible 24-32 bit \n    :param threshold_: integer; default value is 24 \n    :param factor_: integer; default value is 1 (div by 2)\n    :return:\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_19sobel_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_threshold_;
  unsigned short __pyx_v_factor_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sobel_fast (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_threshold,&__pyx_n_s_factor,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sobel_fast") < 0)) __PYX_ERR(1, 526, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_threshold_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_threshold_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 528, __pyx_L3_error)
    } else {
      __pyx_v_threshold_ = ((int)64);
    }
    if (values[2]) {
      __pyx_v_factor_ = __Pyx_PyInt_As_unsigned_short(values[2]); if (unlikely((__pyx_v_factor_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 529, __pyx_L3_error)
    } else {
      __pyx_v_factor_ = ((unsigned short)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sobel_fast", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 526, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.sobel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_18sobel_fast(__pyx_self, __pyx_v_surface_, __pyx_v_threshold_, __pyx_v_factor_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_18sobel_fast(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold_, unsigned short __pyx_v_factor_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_sobel_fast __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sobel_fast", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 2;
  __pyx_t_1.threshold_ = __pyx_v_threshold_;
  __pyx_t_1.factor_ = __pyx_v_factor_;
  __pyx_f_12PygameShader_6shader_sobel_fast(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.sobel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":566
 * 
 * 
 * cpdef inline void invert(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER INVERT PIXELS
 */

static PyObject *__pyx_pw_12PygameShader_6shader_21invert(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_invert(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("invert", 0);

  /* "PygameShader/shader.pyx":583
 *     :return: void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 583, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":584
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_invert_surface_24bit_inplace_c(pixels3d(surface_))
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 583, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":586
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_invert_surface_24bit_inplace_c(pixels3d(surface_))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 586, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_invert_surface_24bit_inplace_c(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":566
 * 
 * 
 * cpdef inline void invert(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER INVERT PIXELS
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.invert", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_21invert(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_20invert[] = "\n    SHADER INVERT PIXELS\n    \n    Invert all pixels of the display or a given texture\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n    \n    e.g:\n    invert(surface)\n    \n    :param surface_: pygame.surface; compatible 24 - 32 bit surfaces\n    :return: void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_21invert(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("invert (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_20invert(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_20invert(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("invert", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_invert(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.invert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":590
 * 
 * 
 * cpdef inline void hsl_effect(object surface_, float shift_):             # <<<<<<<<<<<<<<
 *     """
 *     ROTATE THE HUE OF THE GAME DISPLAY OR GIVEN TEXTURE
 */

static PyObject *__pyx_pw_12PygameShader_6shader_23hsl_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_hsl_effect(PyObject *__pyx_v_surface_, float __pyx_v_shift_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hsl_effect", 0);

  /* "PygameShader/shader.pyx":606
 *     :return: void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 606, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":607
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert -1.0 <= shift_ <= 1.0, \
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 606, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":609
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert -1.0 <= shift_ <= 1.0, \             # <<<<<<<<<<<<<<
 *         "Argument shift must be in range[-1.0 ... 1.0]"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
    if (__pyx_t_3) {
      __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
    }
    if (unlikely(!(__pyx_t_3 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift_must_be_in_range);
      __PYX_ERR(1, 609, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":612
 *         "Argument shift must be in range[-1.0 ... 1.0]"
 * 
 *     shader_hsl_surface24bit_inplace_c(pixels3d(surface_), shift_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_hsl_surface24bit_inplace_c(__pyx_t_5, __pyx_v_shift_);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":590
 * 
 * 
 * cpdef inline void hsl_effect(object surface_, float shift_):             # <<<<<<<<<<<<<<
 *     """
 *     ROTATE THE HUE OF THE GAME DISPLAY OR GIVEN TEXTURE
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.hsl_effect", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_23hsl_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_22hsl_effect[] = "\n    ROTATE THE HUE OF THE GAME DISPLAY OR GIVEN TEXTURE\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n      \n    e.g:\n    hsl_effect(surface, 0.2)\n    \n    :param surface_: pygame.Surface; Compatible 24 - 32 bit surfaces\n    :param shift_: float; float value in range [-1.0 ... 1.0]\n    :return: void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_23hsl_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_shift_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hsl_effect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hsl_effect", 1, 2, 2, 1); __PYX_ERR(1, 590, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hsl_effect") < 0)) __PYX_ERR(1, 590, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 590, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hsl_effect", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 590, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.hsl_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_22hsl_effect(__pyx_self, __pyx_v_surface_, __pyx_v_shift_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_22hsl_effect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hsl_effect", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_hsl_effect(__pyx_v_surface_, __pyx_v_shift_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.hsl_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":616
 * 
 * # todo wiki
 * cpdef inline void hsl_fast(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float shift_,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_25hsl_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_hsl_fast(PyObject *__pyx_v_surface_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_hsl_model_, __Pyx_memviewslice __pyx_v_rgb_model_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hsl_fast", 0);

  /* "PygameShader/shader.pyx":645
 *     :return:
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     assert -1.0 <= shift_ <= 1.0, \
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 645, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":646
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 *     assert -1.0 <= shift_ <= 1.0, \
 *         "Argument shift must be in range[-1.0 ... 1.0]"
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 645, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":647
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     assert -1.0 <= shift_ <= 1.0, \             # <<<<<<<<<<<<<<
 *         "Argument shift must be in range[-1.0 ... 1.0]"
 *     assert PyObject_IsInstance(hsl_model_, (numpy.ndarray, cython.view.memoryview)), \
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
    if (__pyx_t_3) {
      __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
    }
    if (unlikely(!(__pyx_t_3 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift_must_be_in_range);
      __PYX_ERR(1, 647, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":649
 *     assert -1.0 <= shift_ <= 1.0, \
 *         "Argument shift must be in range[-1.0 ... 1.0]"
 *     assert PyObject_IsInstance(hsl_model_, (numpy.ndarray, cython.view.memoryview)), \             # <<<<<<<<<<<<<<
 *         "\nArgument hsl_model_ must be a numpy.ndarray or memoryview type, got %s " % type(
 *             hsl_model_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_hsl_model_, 4, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
    __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_memoryview_type));
    __pyx_t_4 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 649, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":651
 *     assert PyObject_IsInstance(hsl_model_, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument hsl_model_ must be a numpy.ndarray or memoryview type, got %s " % type(
 *             hsl_model_)             # <<<<<<<<<<<<<<
 *     assert PyObject_IsInstance(rgb_model_, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument rgb_model_ must be a numpy.ndarray or memoryview type, got %s " % type(
 */
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_hsl_model_, 4, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "PygameShader/shader.pyx":650
 *         "Argument shift must be in range[-1.0 ... 1.0]"
 *     assert PyObject_IsInstance(hsl_model_, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument hsl_model_ must be a numpy.ndarray or memoryview type, got %s " % type(             # <<<<<<<<<<<<<<
 *             hsl_model_)
 *     assert PyObject_IsInstance(rgb_model_, (numpy.ndarray, cython.view.memoryview)), \
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_hsl_model__must_be_a_n, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 650, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 649, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":652
 *         "\nArgument hsl_model_ must be a numpy.ndarray or memoryview type, got %s " % type(
 *             hsl_model_)
 *     assert PyObject_IsInstance(rgb_model_, (numpy.ndarray, cython.view.memoryview)), \             # <<<<<<<<<<<<<<
 *         "\nArgument rgb_model_ must be a numpy.ndarray or memoryview type, got %s " % type(
 *             rgb_model_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_rgb_model_, 4, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
    __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_memoryview_type));
    __pyx_t_4 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 652, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":654
 *     assert PyObject_IsInstance(rgb_model_, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument rgb_model_ must be a numpy.ndarray or memoryview type, got %s " % type(
 *             rgb_model_)             # <<<<<<<<<<<<<<
 * 
 *     shader_hsl_surface24bit_fast_inplace_c(pixels3d(surface_), shift_, hsl_model_, rgb_model_)
 */
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rgb_model_, 4, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 654, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "PygameShader/shader.pyx":653
 *             hsl_model_)
 *     assert PyObject_IsInstance(rgb_model_, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument rgb_model_ must be a numpy.ndarray or memoryview type, got %s " % type(             # <<<<<<<<<<<<<<
 *             rgb_model_)
 * 
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_rgb_model__must_be_a_n, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 653, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 652, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":656
 *             rgb_model_)
 * 
 *     shader_hsl_surface24bit_fast_inplace_c(pixels3d(surface_), shift_, hsl_model_, rgb_model_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 656, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_hsl_surface24bit_fast_inplace_c(__pyx_t_5, __pyx_v_shift_, __pyx_v_hsl_model_, __pyx_v_rgb_model_);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":616
 * 
 * # todo wiki
 * cpdef inline void hsl_fast(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float shift_,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.hsl_fast", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_25hsl_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_24hsl_fast[] = "    \n    ROTATE THE HUE OF AN IMAGE USING STORED HSL TO RGB AND RGB TO HSL VALUES\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    e.g:\n    rgb2hsl_model = hsl_to_rgb_model()\n    hsl2rgb_model = rgb_to_hsl_model()\n    hsl_fast(\n                image,\n                0.1,\n                hsl_model_=hsl2rgb_model,\n                rgb_model_=rgb2hsl_model)\n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit surfaces\n    :param shift_: float; value must be in range [ -1.0 ... + 1.0]\n    :param hsl_model_: 3d numpy.ndarray shape (256, 256, 256, 3) see hsl_to_rgb_model function \n    :param rgb_model_: 3d numpy.ndarray shape (256, 256, 256, 3) see rgb_to_hsl_model function\n    :return:\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_25hsl_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_shift_;
  __Pyx_memviewslice __pyx_v_hsl_model_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_rgb_model_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hsl_fast (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,&__pyx_n_s_hsl_model,&__pyx_n_s_rgb_model,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hsl_fast", 1, 4, 4, 1); __PYX_ERR(1, 616, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hsl_model)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hsl_fast", 1, 4, 4, 2); __PYX_ERR(1, 616, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rgb_model)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hsl_fast", 1, 4, 4, 3); __PYX_ERR(1, 616, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hsl_fast") < 0)) __PYX_ERR(1, 616, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 618, __pyx_L3_error)
    __pyx_v_hsl_model_ = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_float(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_hsl_model_.memview)) __PYX_ERR(1, 619, __pyx_L3_error)
    __pyx_v_rgb_model_ = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_unsigned_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rgb_model_.memview)) __PYX_ERR(1, 620, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hsl_fast", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 616, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.hsl_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_24hsl_fast(__pyx_self, __pyx_v_surface_, __pyx_v_shift_, __pyx_v_hsl_model_, __pyx_v_rgb_model_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_24hsl_fast(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_hsl_model_, __Pyx_memviewslice __pyx_v_rgb_model_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hsl_fast", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_hsl_model_.memview)) { __Pyx_RaiseUnboundLocalError("hsl_model_"); __PYX_ERR(1, 616, __pyx_L1_error) }
  if (unlikely(!__pyx_v_rgb_model_.memview)) { __Pyx_RaiseUnboundLocalError("rgb_model_"); __PYX_ERR(1, 616, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_hsl_fast(__pyx_v_surface_, __pyx_v_shift_, __pyx_v_hsl_model_, __pyx_v_rgb_model_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.hsl_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_hsl_model_, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_model_, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":659
 * 
 * 
 * cpdef inline void blur(object surface_, t_=1):             # <<<<<<<<<<<<<<
 *     """
 *     APPLY A GAUSSIAN BLUR EFFECT TO THE GAME DISPLAY OR TO A GIVEN TEXTURE (KERNEL 5x5)
 */

static PyObject *__pyx_pw_12PygameShader_6shader_27blur(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_blur(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_blur *__pyx_optional_args) {
  PyObject *__pyx_v_t_ = ((PyObject *)__pyx_int_1);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_blur5x5_array24_inplace_c __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blur", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_t_ = __pyx_optional_args->t_;
    }
  }

  /* "PygameShader/shader.pyx":682
 *     :return: void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     assert t_ > 0, \
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":683
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 *     assert t_ > 0, \
 *         "\nArgument t_ must be > 0, got %s " % t_
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 682, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":684
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     assert t_ > 0, \             # <<<<<<<<<<<<<<
 *         "\nArgument t_ must be > 0, got %s " % t_
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_t_, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 684, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 684, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) {

      /* "PygameShader/shader.pyx":685
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     assert t_ > 0, \
 *         "\nArgument t_ must be > 0, got %s " % t_             # <<<<<<<<<<<<<<
 * 
 *     shader_blur5x5_array24_inplace_c(pixels3d(surface_), None, t_)
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_t__must_be_0_got_s, __pyx_v_t_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 685, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 684, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":687
 *         "\nArgument t_ must be > 0, got %s " % t_
 * 
 *     shader_blur5x5_array24_inplace_c(pixels3d(surface_), None, t_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 687, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6.__pyx_n = 2;
  __pyx_t_6.mask = Py_None;
  __pyx_t_6.t = __pyx_v_t_;
  __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_5, &__pyx_t_6); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":659
 * 
 * 
 * cpdef inline void blur(object surface_, t_=1):             # <<<<<<<<<<<<<<
 *     """
 *     APPLY A GAUSSIAN BLUR EFFECT TO THE GAME DISPLAY OR TO A GIVEN TEXTURE (KERNEL 5x5)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.blur", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_27blur(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_26blur[] = "\n    APPLY A GAUSSIAN BLUR EFFECT TO THE GAME DISPLAY OR TO A GIVEN TEXTURE (KERNEL 5x5)\n\n    # Gaussian kernel 5x5\n        # |1   4   6   4  1|\n        # |4  16  24  16  4|\n        # |6  24  36  24  6|  x 1/256\n        # |4  16  24  16  4|\n        # |1  4    6   4  1|\n    This method is using convolution property and process the image in two passes,\n    first the horizontal convolution and last the vertical convolution\n    pixels convoluted outside image edges will be set to adjacent edge value\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit surfaces\n    :param t_      : integer; number if times must be >0\n    :return: void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_27blur(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  PyObject *__pyx_v_t_ = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blur (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_t,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blur") < 0)) __PYX_ERR(1, 659, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_t_ = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blur", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 659, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.blur", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_26blur(__pyx_self, __pyx_v_surface_, __pyx_v_t_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_26blur(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_t_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_blur __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blur", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.t_ = __pyx_v_t_;
  __pyx_f_12PygameShader_6shader_blur(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.blur", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":690
 * 
 * 
 * cpdef inline void wave(object surface_, float rad, int size):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A WAVE EFFECT TO THE GAME DISPLAY OR TO A GIVEN SURFACE
 */

static PyObject *__pyx_pw_12PygameShader_6shader_29wave(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_wave(PyObject *__pyx_v_surface_, float __pyx_v_rad, int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wave", 0);

  /* "PygameShader/shader.pyx":707
 *     :return        : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     assert size > 0, "Argument size must be > 0"
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 707, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":708
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 *     assert size > 0, "Argument size must be > 0"
 * 
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 707, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":709
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     assert size > 0, "Argument size must be > 0"             # <<<<<<<<<<<<<<
 * 
 *     shader_wave24bit_inplace_c(pixels3d(surface_), rad, size)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_size > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_size_must_be_0);
      __PYX_ERR(1, 709, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":711
 *     assert size > 0, "Argument size must be > 0"
 * 
 *     shader_wave24bit_inplace_c(pixels3d(surface_), rad, size)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 711, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_wave24bit_inplace_c(__pyx_t_5, __pyx_v_rad, __pyx_v_size);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":690
 * 
 * 
 * cpdef inline void wave(object surface_, float rad, int size):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A WAVE EFFECT TO THE GAME DISPLAY OR TO A GIVEN SURFACE
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.wave", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_29wave(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_28wave[] = "\n    CREATE A WAVE EFFECT TO THE GAME DISPLAY OR TO A GIVEN SURFACE\n\n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    e.g:\n    wave(surface, 8 * math.pi/180.0 + frame_number, 5)\n    \n    :param surface_: pygame.Surface; pygame surface compatible 24 - 32 bit  \n    :param rad     : float; angle in rad to rotate over time\n    :param size    : int; Number of sub-surfaces\n    :return        : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_29wave(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_rad;
  int __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wave (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_rad,&__pyx_n_s_size,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rad)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("wave", 1, 3, 3, 1); __PYX_ERR(1, 690, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("wave", 1, 3, 3, 2); __PYX_ERR(1, 690, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wave") < 0)) __PYX_ERR(1, 690, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_rad = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_rad == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 690, __pyx_L3_error)
    __pyx_v_size = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 690, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("wave", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 690, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_28wave(__pyx_self, __pyx_v_surface_, __pyx_v_rad, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_28wave(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_rad, int __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wave", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_wave(__pyx_v_surface_, __pyx_v_rad, __pyx_v_size, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":714
 * 
 * 
 * cpdef inline void swirl(object surface_, float degrees):             # <<<<<<<<<<<<<<
 *     """
 *     SWIRL AN IMAGE (ANGLE APPROXIMATION METHOD)
 */

static PyObject *__pyx_pw_12PygameShader_6shader_31swirl(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_swirl(PyObject *__pyx_v_surface_, float __pyx_v_degrees, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("swirl", 0);

  /* "PygameShader/shader.pyx":732
 *     :return        : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 732, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":733
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_swirl24bit_inplace_c(pixels3d(surface_), degrees)
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 733, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 732, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":735
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_swirl24bit_inplace_c(pixels3d(surface_), degrees)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 735, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_swirl24bit_inplace_c(__pyx_t_5, __pyx_v_degrees);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":714
 * 
 * 
 * cpdef inline void swirl(object surface_, float degrees):             # <<<<<<<<<<<<<<
 *     """
 *     SWIRL AN IMAGE (ANGLE APPROXIMATION METHOD)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.swirl", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_31swirl(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_30swirl[] = "\n    SWIRL AN IMAGE (ANGLE APPROXIMATION METHOD)\n\n    This algorithm uses a table of cos and sin.\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    e.g:\n    swirl(surface, 1.0)\n    \n    :param surface_: pygame.Surface, compatible 24 - 32 bit \n    :param degrees : float; angle in degrees \n    :return        : void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_31swirl(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_degrees;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("swirl (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_degrees,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_degrees)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("swirl", 1, 2, 2, 1); __PYX_ERR(1, 714, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "swirl") < 0)) __PYX_ERR(1, 714, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_degrees = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_degrees == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 714, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("swirl", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 714, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.swirl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_30swirl(__pyx_self, __pyx_v_surface_, __pyx_v_degrees);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_30swirl(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_degrees) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("swirl", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_swirl(__pyx_v_surface_, __pyx_v_degrees, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.swirl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":739
 * 
 * 
 * cpdef inline void swirl2(object surface_, float degrees):             # <<<<<<<<<<<<<<
 *     """
 *     SWIRL AN IMAGE WITHOUT ANGLE APPROXIMATION
 */

static PyObject *__pyx_pw_12PygameShader_6shader_33swirl2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_swirl2(PyObject *__pyx_v_surface_, float __pyx_v_degrees, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("swirl2", 0);

  /* "PygameShader/shader.pyx":755
 *     :return        : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 755, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":756
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_swirl24bit_inplace_c1(pixels3d(surface_), degrees)
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 756, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 755, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":758
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_swirl24bit_inplace_c1(pixels3d(surface_), degrees)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 758, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_swirl24bit_inplace_c1(__pyx_t_5, __pyx_v_degrees);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":739
 * 
 * 
 * cpdef inline void swirl2(object surface_, float degrees):             # <<<<<<<<<<<<<<
 *     """
 *     SWIRL AN IMAGE WITHOUT ANGLE APPROXIMATION
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.swirl2", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_33swirl2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_32swirl2[] = "\n    SWIRL AN IMAGE WITHOUT ANGLE APPROXIMATION\n\n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n      \n    e.g:\n    swirl(surface_, frame_number)\n    \n    :param surface_: pygame.Surface, compatible 24 - 32 bit \n    :param degrees : float; angle in degrees\n    :return        : void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_33swirl2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_degrees;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("swirl2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_degrees,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_degrees)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("swirl2", 1, 2, 2, 1); __PYX_ERR(1, 739, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "swirl2") < 0)) __PYX_ERR(1, 739, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_degrees = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_degrees == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 739, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("swirl2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 739, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.swirl2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_32swirl2(__pyx_self, __pyx_v_surface_, __pyx_v_degrees);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_32swirl2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_degrees) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("swirl2", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_swirl2(__pyx_v_surface_, __pyx_v_degrees, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.swirl2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":762
 * 
 * 
 * cpdef inline void plasma_config(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int frame,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_35plasma_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_plasma_config(PyObject *__pyx_v_surface_, int __pyx_v_frame, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_plasma_config *__pyx_optional_args) {
  float __pyx_v_hue_ = __pyx_k__3;
  float __pyx_v_sat_ = __pyx_k__4;
  float __pyx_v_value_ = __pyx_k__5;
  float __pyx_v_a_ = __pyx_k__6;
  float __pyx_v_b_ = __pyx_k__7;
  float __pyx_v_c_ = __pyx_k__8;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_plasma24bit_inplace_c __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("plasma_config", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_hue_ = __pyx_optional_args->hue_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_sat_ = __pyx_optional_args->sat_;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_value_ = __pyx_optional_args->value_;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_a_ = __pyx_optional_args->a_;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_b_ = __pyx_optional_args->b_;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_c_ = __pyx_optional_args->c_;
              }
            }
          }
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":794
 *     :return             : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 794, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":795
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_plasma24bit_inplace_c(pixels3d(surface_), frame, hue_, sat_, value_, a_, b_, c_)
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 795, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 794, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":797
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_plasma24bit_inplace_c(pixels3d(surface_), frame, hue_, sat_, value_, a_, b_, c_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 797, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6.__pyx_n = 6;
  __pyx_t_6.hue_ = __pyx_v_hue_;
  __pyx_t_6.sat_ = __pyx_v_sat_;
  __pyx_t_6.value_ = __pyx_v_value_;
  __pyx_t_6.a_ = __pyx_v_a_;
  __pyx_t_6.b_ = __pyx_v_b_;
  __pyx_t_6.c_ = __pyx_v_c_;
  __pyx_f_12PygameShader_6shader_shader_plasma24bit_inplace_c(__pyx_t_5, __pyx_v_frame, &__pyx_t_6); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":762
 * 
 * 
 * cpdef inline void plasma_config(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int frame,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.plasma_config", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_35plasma_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_34plasma_config[] = "\n\n    CREATE A BASIC PLASMA EFFECT ON THE TOP OF A PYGAME SURFACE\n\n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    e.g:\n    plasma_config(surface, frame_number)\n\n    :param a_           : float; default value 1.0/255.0 control the plasma equation\n    :param b_           : float; default value 1.0/12.0 control the plasma equation\n    :param c_           : float; default value 1.0/12.0 control the plasma equation\n    :param value_       : float; default value 1.0/8.0 value factor\n    :param sat_         : float; default value 1.0/6.0 saturation value\n    :param hue_         : float; default value 1.0/6.0 hue value factor\n    :param surface_     : pygame.surface; compatible 24 - 32 bit\n    :param frame        : integer; Variable that need to change over time\n    :return             : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_35plasma_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_frame;
  float __pyx_v_hue_;
  float __pyx_v_sat_;
  float __pyx_v_value_;
  float __pyx_v_a_;
  float __pyx_v_b_;
  float __pyx_v_c_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plasma_config (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_frame,&__pyx_n_s_hue,&__pyx_n_s_sat,&__pyx_n_s_value,&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_c,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plasma_config", 0, 2, 8, 1); __PYX_ERR(1, 762, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hue);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sat);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plasma_config") < 0)) __PYX_ERR(1, 762, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_frame = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_frame == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_hue_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_hue_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L3_error)
    } else {
      __pyx_v_hue_ = __pyx_k__3;
    }
    if (values[3]) {
      __pyx_v_sat_ = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_sat_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 766, __pyx_L3_error)
    } else {
      __pyx_v_sat_ = __pyx_k__4;
    }
    if (values[4]) {
      __pyx_v_value_ = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_value_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 767, __pyx_L3_error)
    } else {
      __pyx_v_value_ = __pyx_k__5;
    }
    if (values[5]) {
      __pyx_v_a_ = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_a_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 768, __pyx_L3_error)
    } else {
      __pyx_v_a_ = __pyx_k__6;
    }
    if (values[6]) {
      __pyx_v_b_ = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_b_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 769, __pyx_L3_error)
    } else {
      __pyx_v_b_ = __pyx_k__7;
    }
    if (values[7]) {
      __pyx_v_c_ = __pyx_PyFloat_AsFloat(values[7]); if (unlikely((__pyx_v_c_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 770, __pyx_L3_error)
    } else {
      __pyx_v_c_ = __pyx_k__8;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plasma_config", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 762, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.plasma_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_34plasma_config(__pyx_self, __pyx_v_surface_, __pyx_v_frame, __pyx_v_hue_, __pyx_v_sat_, __pyx_v_value_, __pyx_v_a_, __pyx_v_b_, __pyx_v_c_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_34plasma_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_frame, float __pyx_v_hue_, float __pyx_v_sat_, float __pyx_v_value_, float __pyx_v_a_, float __pyx_v_b_, float __pyx_v_c_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_plasma_config __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("plasma_config", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 6;
  __pyx_t_1.hue_ = __pyx_v_hue_;
  __pyx_t_1.sat_ = __pyx_v_sat_;
  __pyx_t_1.value_ = __pyx_v_value_;
  __pyx_t_1.a_ = __pyx_v_a_;
  __pyx_t_1.b_ = __pyx_v_b_;
  __pyx_t_1.c_ = __pyx_v_c_;
  __pyx_f_12PygameShader_6shader_plasma_config(__pyx_v_surface_, __pyx_v_frame, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.plasma_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":800
 * 
 * 
 * cpdef inline void plasma(surface_, float frame, unsigned int [::1] palette_):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A PLASMA EFFECT INPLACE
 */

static PyObject *__pyx_pw_12PygameShader_6shader_37plasma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_plasma(PyObject *__pyx_v_surface_, float __pyx_v_frame, __Pyx_memviewslice __pyx_v_palette_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("plasma", 0);

  /* "PygameShader/shader.pyx":812
 *     :return:
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     shader_plasma_c(surface_, frame, palette_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 812, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 812, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 812, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":813
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 *     shader_plasma_c(surface_, frame, palette_)
 * 
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 813, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 812, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":814
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     shader_plasma_c(surface_, frame, palette_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_f_12PygameShader_6shader_shader_plasma_c(__pyx_v_surface_, __pyx_v_frame, __pyx_v_palette_);

  /* "PygameShader/shader.pyx":800
 * 
 * 
 * cpdef inline void plasma(surface_, float frame, unsigned int [::1] palette_):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A PLASMA EFFECT INPLACE
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("PygameShader.shader.plasma", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_37plasma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_36plasma[] = "\n    CREATE A PLASMA EFFECT INPLACE\n\n    e.g:\n    plasma(surface, frame_number, palette_)\n    \n    :param surface_: pygame.Surface; compatible 24 - 32 bit \n    :param frame   : float; frame number\n    :param palette_: 1d array containing colors\n    :return:\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_37plasma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_frame;
  __Pyx_memviewslice __pyx_v_palette_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plasma (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_frame,&__pyx_n_s_palette,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plasma", 1, 3, 3, 1); __PYX_ERR(1, 800, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_palette)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plasma", 1, 3, 3, 2); __PYX_ERR(1, 800, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plasma") < 0)) __PYX_ERR(1, 800, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_frame = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_frame == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 800, __pyx_L3_error)
    __pyx_v_palette_ = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_palette_.memview)) __PYX_ERR(1, 800, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plasma", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 800, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.plasma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_36plasma(__pyx_self, __pyx_v_surface_, __pyx_v_frame, __pyx_v_palette_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_36plasma(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_frame, __Pyx_memviewslice __pyx_v_palette_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("plasma", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_palette_.memview)) { __Pyx_RaiseUnboundLocalError("palette_"); __PYX_ERR(1, 800, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_plasma(__pyx_v_surface_, __pyx_v_frame, __pyx_v_palette_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.plasma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_palette_, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":818
 * 
 * # todo wiki
 * cpdef inline float [:, :, :, ::1] rgb_to_hsl_model():             # <<<<<<<<<<<<<<
 *     """
 *     Create an HSL model containing all the values
 */

static PyObject *__pyx_pw_12PygameShader_6shader_39rgb_to_hsl_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_rgb_to_hsl_model(CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_to_hsl_model", 0);

  /* "PygameShader/shader.pyx":823
 *     :return: Return a cython.view.memoryview shape (256, 256, 256, 3)
 *     """
 *     return rgb_to_hsl_model_c()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_rgb_to_hsl_model_c(); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(1, 823, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":818
 * 
 * # todo wiki
 * cpdef inline float [:, :, :, ::1] rgb_to_hsl_model():             # <<<<<<<<<<<<<<
 *     """
 *     Create an HSL model containing all the values
 */

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("PygameShader.shader.rgb_to_hsl_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_39rgb_to_hsl_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12PygameShader_6shader_38rgb_to_hsl_model[] = "\n    Create an HSL model containing all the values\n    :return: Return a cython.view.memoryview shape (256, 256, 256, 3)\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_39rgb_to_hsl_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rgb_to_hsl_model (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_38rgb_to_hsl_model(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_38rgb_to_hsl_model(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_to_hsl_model", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_rgb_to_hsl_model(0); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(1, 818, __pyx_L1_error)
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 4, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.rgb_to_hsl_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":827
 * 
 * # todo wiki
 * cpdef inline unsigned char [:, :, :, ::1] hsl_to_rgb_model():             # <<<<<<<<<<<<<<
 *     """
 *     Create an RGB model containing all the values
 */

static PyObject *__pyx_pw_12PygameShader_6shader_41hsl_to_rgb_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_hsl_to_rgb_model(CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hsl_to_rgb_model", 0);

  /* "PygameShader/shader.pyx":832
 *     :return: Return a cython.view.memoryview shape (256, 256, 256, 3)
 *     """
 *     return hsl_to_rgb_model_c()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_hsl_to_rgb_model_c(); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(1, 832, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":827
 * 
 * # todo wiki
 * cpdef inline unsigned char [:, :, :, ::1] hsl_to_rgb_model():             # <<<<<<<<<<<<<<
 *     """
 *     Create an RGB model containing all the values
 */

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("PygameShader.shader.hsl_to_rgb_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_41hsl_to_rgb_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12PygameShader_6shader_40hsl_to_rgb_model[] = "\n    Create an RGB model containing all the values\n    :return: Return a cython.view.memoryview shape (256, 256, 256, 3)\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_41hsl_to_rgb_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hsl_to_rgb_model (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_40hsl_to_rgb_model(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_40hsl_to_rgb_model(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hsl_to_rgb_model", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_hsl_to_rgb_model(0); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(1, 827, __pyx_L1_error)
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 4, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.hsl_to_rgb_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":836
 * 
 * 
 * cpdef inline void brightness(object surface_, float shift_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER BRIGHTNESS
 */

static PyObject *__pyx_pw_12PygameShader_6shader_43brightness(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness(PyObject *__pyx_v_surface_, float __pyx_v_shift_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_inplace_c __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("brightness", 0);

  /* "PygameShader/shader.pyx":859
 *     :return         : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 859, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":860
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     if shift_ == 0.0:
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 859, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":862
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     if shift_ == 0.0:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_3 = ((__pyx_v_shift_ == 0.0) != 0);
  if (__pyx_t_3) {

    /* "PygameShader/shader.pyx":863
 * 
 *     if shift_ == 0.0:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"
 */
    goto __pyx_L0;

    /* "PygameShader/shader.pyx":862
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     if shift_ == 0.0:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "PygameShader/shader.pyx":865
 *         return
 * 
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"             # <<<<<<<<<<<<<<
 * 
 *     shader_brightness24_inplace_c(pixels3d(surface_), shift_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
    if (__pyx_t_3) {
      __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
    }
    if (unlikely(!(__pyx_t_3 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift__must_be_in_rang);
      __PYX_ERR(1, 865, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":867
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"
 * 
 *     shader_brightness24_inplace_c(pixels3d(surface_), shift_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 867, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.shift_ = __pyx_v_shift_;
  __pyx_f_12PygameShader_6shader_shader_brightness24_inplace_c(__pyx_t_5, &__pyx_t_6); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":836
 * 
 * 
 * cpdef inline void brightness(object surface_, float shift_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER BRIGHTNESS
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.brightness", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_43brightness(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_42brightness[] = "\n    SHADER BRIGHTNESS\n\n    This shader control the pygame display brightness level\n    It uses two external functions coded in C, struct_rgb_to_hsl & struct_hsl_to_rgb\n    \n    Parameter shift_ is a float value in range [ -1.0 ... 1.0]. with +1.0 for the \n    maximum brightness. A value of 0.0 will not perform any changes to the original \n    surface\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n      \n    e.g:\n    brightness(surface, 0.2)\n    \n    :param surface_ : pygame.surface; \n    :param shift_   : float must be in range [ -1.0 ... 1.0 ]\n    :return         : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_43brightness(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_shift_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("brightness (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("brightness", 1, 2, 2, 1); __PYX_ERR(1, 836, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "brightness") < 0)) __PYX_ERR(1, 836, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 836, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("brightness", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 836, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.brightness", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_42brightness(__pyx_self, __pyx_v_surface_, __pyx_v_shift_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_42brightness(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("brightness", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_brightness(__pyx_v_surface_, __pyx_v_shift_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.brightness", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":870
 * 
 * 
 * cpdef inline void brightness_exclude(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float shift_,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_45brightness_exclude(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness_exclude(PyObject *__pyx_v_surface_, float __pyx_v_shift_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_brightness_exclude *__pyx_optional_args) {

  /* "PygameShader/shader.pyx":873
 *         object surface_,
 *         float shift_,
 *         color_=(0, 0, 0)             # <<<<<<<<<<<<<<
 * ):
 *     """
 */
  PyObject *__pyx_v_color_ = ((PyObject *)__pyx_tuple__9);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_exclude_inplace_c __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("brightness_exclude", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_color_ = __pyx_optional_args->color_;
    }
  }

  /* "PygameShader/shader.pyx":894
 *     :return         : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 894, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":895
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     if shift_ == 0.0:
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 895, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 894, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":897
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     if shift_ == 0.0:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_3 = ((__pyx_v_shift_ == 0.0) != 0);
  if (__pyx_t_3) {

    /* "PygameShader/shader.pyx":898
 * 
 *     if shift_ == 0.0:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     assert -1.0 <= shift_ <= 1.0, \
 */
    goto __pyx_L0;

    /* "PygameShader/shader.pyx":897
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     if shift_ == 0.0:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "PygameShader/shader.pyx":900
 *         return
 * 
 *     assert -1.0 <= shift_ <= 1.0, \             # <<<<<<<<<<<<<<
 *         "Argument shift_ must be in range[-1.0 ... 1.0]"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
    if (__pyx_t_3) {
      __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
    }
    if (unlikely(!(__pyx_t_3 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift__must_be_in_range);
      __PYX_ERR(1, 900, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":903
 *         "Argument shift_ must be in range[-1.0 ... 1.0]"
 * 
 *     shader_brightness24_exclude_inplace_c(pixels3d(surface_), shift_, color_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 903, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6.__pyx_n = 2;
  __pyx_t_6.shift_ = __pyx_v_shift_;
  __pyx_t_6.color_ = __pyx_v_color_;
  __pyx_f_12PygameShader_6shader_shader_brightness24_exclude_inplace_c(__pyx_t_5, &__pyx_t_6); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":870
 * 
 * 
 * cpdef inline void brightness_exclude(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float shift_,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.brightness_exclude", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_45brightness_exclude(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_44brightness_exclude[] = "\n\n    INCREASE/DECREASE A SURFACE BRIGHTNESS (OPTIONAL EXCLUDE COLOR)\n    \n    The optional setting (color_) allow you to select a color that will not \n    be included in the processing. This can be useful if you know the background \n    color RGB values and do not wish the background to undergo a change in brightness    \n    \n    Parameter shift_ is a float value in range [ -1.0 ... 1.0]. with +1.0 for the \n    maximum brightness. A value of 0.0 will not perform any changes to the original \n    surface\n   \n    Parameter color_ is a tuple of RGB colors e.g (1, 1, 1) \n\n    :param surface_ : pygame.surface; \n    :param shift_   : float must be in range [ -1.0 ... 1.0 ]\n    :param color_   : tuple RGB to be excluded from the process\n    :return         : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_45brightness_exclude(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_shift_;
  PyObject *__pyx_v_color_ = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("brightness_exclude (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,&__pyx_n_s_color,0};
    PyObject* values[3] = {0,0,0};

    /* "PygameShader/shader.pyx":873
 *         object surface_,
 *         float shift_,
 *         color_=(0, 0, 0)             # <<<<<<<<<<<<<<
 * ):
 *     """
 */
    values[2] = ((PyObject *)__pyx_tuple__9);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("brightness_exclude", 0, 2, 3, 1); __PYX_ERR(1, 870, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "brightness_exclude") < 0)) __PYX_ERR(1, 870, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 872, __pyx_L3_error)
    __pyx_v_color_ = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("brightness_exclude", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 870, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.brightness_exclude", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_44brightness_exclude(__pyx_self, __pyx_v_surface_, __pyx_v_shift_, __pyx_v_color_);

  /* "PygameShader/shader.pyx":870
 * 
 * 
 * cpdef inline void brightness_exclude(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float shift_,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_44brightness_exclude(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, PyObject *__pyx_v_color_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_brightness_exclude __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("brightness_exclude", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.color_ = __pyx_v_color_;
  __pyx_f_12PygameShader_6shader_brightness_exclude(__pyx_v_surface_, __pyx_v_shift_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.brightness_exclude", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":907
 * 
 * 
 * cpdef inline void brightness_bpf(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float shift_,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_47brightness_bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness_bpf(PyObject *__pyx_v_surface_, float __pyx_v_shift_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_brightness_bpf *__pyx_optional_args) {
  unsigned char __pyx_v_bpf_threshold = ((unsigned char)64);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_bpf_c __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("brightness_bpf", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_bpf_threshold = __pyx_optional_args->bpf_threshold;
    }
  }

  /* "PygameShader/shader.pyx":930
 * 
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 930, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":931
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert -1.0 <= shift_ <= 1.0, \
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 931, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 930, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":933
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert -1.0 <= shift_ <= 1.0, \             # <<<<<<<<<<<<<<
 *         "Argument shift must be in range[-1.0 ... 1.0]"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
    if (__pyx_t_3) {
      __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
    }
    if (unlikely(!(__pyx_t_3 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift_must_be_in_range);
      __PYX_ERR(1, 933, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":936
 *         "Argument shift must be in range[-1.0 ... 1.0]"
 * 
 *     shader_brightness24_bpf_c(pixels3d(surface_), shift_, bpf_threshold)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 936, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6.__pyx_n = 2;
  __pyx_t_6.shift_ = __pyx_v_shift_;
  __pyx_t_6.bpf_treshold_ = __pyx_v_bpf_threshold;
  __pyx_f_12PygameShader_6shader_shader_brightness24_bpf_c(__pyx_t_5, &__pyx_t_6); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":907
 * 
 * 
 * cpdef inline void brightness_bpf(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float shift_,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.brightness_bpf", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_47brightness_bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_46brightness_bpf[] = "\n\n    INCREASE/DECREASE SURFACE BRIGHTNESS \n\n    bpf_threshold is an integer value in range [0..255] that \n    determines the pixels threshold for the brightness algorithm. \n    The sum RGB below this threshold will not be included in the process  \n    R + G + B < Threshold \n\n\n    :param surface_: Pygame.Surface compatible 24 - 32 bit \n\n    :param shift_: float, must be in range [-1.00 ... +1.00]\n\n    :param bpf_threshold : integer value in range [0 ... 255].\n    threshold RGB. Values R+G+B < threshold will not be included in the process\n    :return: void \n\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_47brightness_bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_shift_;
  unsigned char __pyx_v_bpf_threshold;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("brightness_bpf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,&__pyx_n_s_bpf_threshold,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("brightness_bpf", 0, 2, 3, 1); __PYX_ERR(1, 907, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bpf_threshold);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "brightness_bpf") < 0)) __PYX_ERR(1, 907, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 909, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_bpf_threshold = __Pyx_PyInt_As_unsigned_char(values[2]); if (unlikely((__pyx_v_bpf_threshold == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 910, __pyx_L3_error)
    } else {
      __pyx_v_bpf_threshold = ((unsigned char)64);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("brightness_bpf", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 907, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.brightness_bpf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_46brightness_bpf(__pyx_self, __pyx_v_surface_, __pyx_v_shift_, __pyx_v_bpf_threshold);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_46brightness_bpf(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, unsigned char __pyx_v_bpf_threshold) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_brightness_bpf __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("brightness_bpf", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.bpf_threshold = __pyx_v_bpf_threshold;
  __pyx_f_12PygameShader_6shader_brightness_bpf(__pyx_v_surface_, __pyx_v_shift_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.brightness_bpf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":939
 * 
 * 
 * cpdef inline void brightness_model(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float shift_,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_49brightness_model(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness_model(PyObject *__pyx_v_surface_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_rgb_to_hsl_model, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("brightness_model", 0);

  /* "PygameShader/shader.pyx":959
 *     :return : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 959, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":960
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     warnings.warn("Deprecated version, use shader_brightness_24_inplace (fastest version)",
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 960, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 959, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":962
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     warnings.warn("Deprecated version, use shader_brightness_24_inplace (fastest version)",             # <<<<<<<<<<<<<<
 *                   DeprecationWarning)
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_warnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":963
 * 
 *     warnings.warn("Deprecated version, use shader_brightness_24_inplace (fastest version)",
 *                   DeprecationWarning)             # <<<<<<<<<<<<<<
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":964
 *     warnings.warn("Deprecated version, use shader_brightness_24_inplace (fastest version)",
 *                   DeprecationWarning)
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"             # <<<<<<<<<<<<<<
 * 
 *     shader_brightness_24_inplace1_c(pixels3d(surface_), shift_, rgb_to_hsl_model)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
    if (__pyx_t_3) {
      __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
    }
    if (unlikely(!(__pyx_t_3 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift__must_be_in_rang);
      __PYX_ERR(1, 964, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":966
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"
 * 
 *     shader_brightness_24_inplace1_c(pixels3d(surface_), shift_, rgb_to_hsl_model)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 966, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_brightness_24_inplace1_c(__pyx_t_5, __pyx_v_shift_, __pyx_v_rgb_to_hsl_model);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":939
 * 
 * 
 * cpdef inline void brightness_model(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float shift_,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.brightness_model", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_49brightness_model(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_48brightness_model[] = "\n    \n    SHADER BRIGHTNESS (EXCLUDE A SPECIFIC COLOR FROM THE PROCESS, DEFAULT BLACK COLOR)\n\n    This shader control the pygame display brightness level\n    It uses two external functions coded in C, struct_rgb_to_hsl & struct_hsl_to_rgb\n\n    e.g:\n    brightness_exclude(surface, 0.2)\n    \n    :param surface_ : pygame.surface; compatible 24 - 32 bit \n    :param shift_   : float in range [-1.0 ... 1.0 ]\n    :param rgb_to_hsl_model : numpy.ndarray shape (256, 256, 256, 3)\n    :return : void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_49brightness_model(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_shift_;
  __Pyx_memviewslice __pyx_v_rgb_to_hsl_model = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("brightness_model (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,&__pyx_n_s_rgb_to_hsl_model,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("brightness_model", 1, 3, 3, 1); __PYX_ERR(1, 939, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rgb_to_hsl_model)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("brightness_model", 1, 3, 3, 2); __PYX_ERR(1, 939, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "brightness_model") < 0)) __PYX_ERR(1, 939, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 941, __pyx_L3_error)
    __pyx_v_rgb_to_hsl_model = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_float(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rgb_to_hsl_model.memview)) __PYX_ERR(1, 942, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("brightness_model", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 939, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.brightness_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_48brightness_model(__pyx_self, __pyx_v_surface_, __pyx_v_shift_, __pyx_v_rgb_to_hsl_model);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_48brightness_model(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_rgb_to_hsl_model) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("brightness_model", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_rgb_to_hsl_model.memview)) { __Pyx_RaiseUnboundLocalError("rgb_to_hsl_model"); __PYX_ERR(1, 939, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_brightness_model(__pyx_v_surface_, __pyx_v_shift_, __pyx_v_rgb_to_hsl_model, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.brightness_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_to_hsl_model, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":971
 * 
 * 
 * cpdef inline void saturation(object surface_, float shift_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER SATURATION
 */

static PyObject *__pyx_pw_12PygameShader_6shader_51saturation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_saturation(PyObject *__pyx_v_surface_, float __pyx_v_shift_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("saturation", 0);

  /* "PygameShader/shader.pyx":985
 *     :return:
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 985, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":986
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 986, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 985, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":988
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"             # <<<<<<<<<<<<<<
 * 
 *     shader_saturation_array24_inplace_c(pixels3d(surface_), shift_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
    if (__pyx_t_3) {
      __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
    }
    if (unlikely(!(__pyx_t_3 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift__must_be_in_rang);
      __PYX_ERR(1, 988, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":990
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"
 * 
 *     shader_saturation_array24_inplace_c(pixels3d(surface_), shift_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 990, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_saturation_array24_inplace_c(__pyx_t_5, __pyx_v_shift_);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":971
 * 
 * 
 * cpdef inline void saturation(object surface_, float shift_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER SATURATION
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.saturation", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_51saturation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_50saturation[] = "\n    SHADER SATURATION\n\n    This shader control the saturation level of the pygame display or surface/texture\n\n    e.g:\n    saturation(surface, 0.2)\n    \n    \n    :param surface_: pygame.Surface; compatible 24 - 32 bit\n    :param shift_  : float must be in range [ -1.0 ... 1.0] \n    :return:\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_51saturation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_shift_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("saturation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("saturation", 1, 2, 2, 1); __PYX_ERR(1, 971, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "saturation") < 0)) __PYX_ERR(1, 971, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 971, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("saturation", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 971, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.saturation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_50saturation(__pyx_self, __pyx_v_surface_, __pyx_v_shift_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_50saturation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("saturation", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_saturation(__pyx_v_surface_, __pyx_v_shift_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.saturation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":994
 * 
 * 
 * cpdef inline void heatwave_vertical(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned char [:, :] mask,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_53heatwave_vertical(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heatwave_vertical(PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_mask, float __pyx_v_factor_, float __pyx_v_center_, float __pyx_v_sigma_, float __pyx_v_mu_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("heatwave_vertical", 0);

  /* "PygameShader/shader.pyx":1019
 *     :param mu_       : float; mu value of the gauss equation
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1019, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1020
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(mask, (numpy.ndarray, cython.view.memoryview)), \
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1019, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1022
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert PyObject_IsInstance(mask, (numpy.ndarray, cython.view.memoryview)), \             # <<<<<<<<<<<<<<
 *         "\nArgument mask must be a numpy.array or memoryview type, got %s " % type(mask)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_mask, 2, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1022, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1022, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1022, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1022, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
    __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_memoryview_type));
    __pyx_t_4 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1022, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1023
 * 
 *     assert PyObject_IsInstance(mask, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument mask must be a numpy.array or memoryview type, got %s " % type(mask)             # <<<<<<<<<<<<<<
 * 
 *     shader_heatwave24_vertical_inplace_c(pixels3d(surface_), mask, factor_, center_, sigma_, mu_)
 */
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_mask, 2, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1023, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_mask_must_be_a_numpy_a, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1023, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1022, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1025
 *         "\nArgument mask must be a numpy.array or memoryview type, got %s " % type(mask)
 * 
 *     shader_heatwave24_vertical_inplace_c(pixels3d(surface_), mask, factor_, center_, sigma_, mu_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1025, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_heatwave24_vertical_inplace_c(__pyx_t_5, __pyx_v_mask, __pyx_v_factor_, __pyx_v_center_, __pyx_v_sigma_, __pyx_v_mu_);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":994
 * 
 * 
 * cpdef inline void heatwave_vertical(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned char [:, :] mask,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.heatwave_vertical", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_53heatwave_vertical(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_52heatwave_vertical[] = "\n\n    APPLY A GAUSSIAN TRANSFORMATION TO A SURFACE\n\n    This effect can be use to simulate air turbulence or heat flow/convection\n\n    :param surface_  : pygame.Surface; compatible 24 - 32 bit \n    :param mask      : numpy.ndarray shape (x, y) uint8, (values 255 or 0).\n                       Apply transformation to the original array\n                       if the value @(x, y) is 255 else remain unchanged.\n    :param factor_   : Control the maximum of the gaussian equation.\n                       No transformation if factor_ equal zero\n    :param center_   : Control the center of the gaussian equation (if center_ equal zero,\n                       the Gauss equation is centered\n                       at x=0 and maximum is 0.4 with amplitude_ = 1.0)\n    :param sigma_    : float; sigma value of the gauss equation\n    :param mu_       : float; mu value of the gauss equation\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_53heatwave_vertical(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  __Pyx_memviewslice __pyx_v_mask = { 0, 0, { 0 }, { 0 }, { 0 } };
  float __pyx_v_factor_;
  float __pyx_v_center_;
  float __pyx_v_sigma_;
  float __pyx_v_mu_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("heatwave_vertical (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_mask,&__pyx_n_s_factor,&__pyx_n_s_center,&__pyx_n_s_sigma,&__pyx_n_s_mu,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, 1); __PYX_ERR(1, 994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, 2); __PYX_ERR(1, 994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_center)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, 3); __PYX_ERR(1, 994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, 4); __PYX_ERR(1, 994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mu)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, 5); __PYX_ERR(1, 994, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "heatwave_vertical") < 0)) __PYX_ERR(1, 994, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_mask = __Pyx_PyObject_to_MemoryviewSlice_dsds_unsigned_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mask.memview)) __PYX_ERR(1, 996, __pyx_L3_error)
    __pyx_v_factor_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_factor_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 997, __pyx_L3_error)
    __pyx_v_center_ = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_center_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 998, __pyx_L3_error)
    __pyx_v_sigma_ = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_sigma_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 999, __pyx_L3_error)
    __pyx_v_mu_ = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_mu_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1000, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 994, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.heatwave_vertical", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_52heatwave_vertical(__pyx_self, __pyx_v_surface_, __pyx_v_mask, __pyx_v_factor_, __pyx_v_center_, __pyx_v_sigma_, __pyx_v_mu_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_52heatwave_vertical(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_mask, float __pyx_v_factor_, float __pyx_v_center_, float __pyx_v_sigma_, float __pyx_v_mu_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("heatwave_vertical", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_mask.memview)) { __Pyx_RaiseUnboundLocalError("mask"); __PYX_ERR(1, 994, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_heatwave_vertical(__pyx_v_surface_, __pyx_v_mask, __pyx_v_factor_, __pyx_v_center_, __pyx_v_sigma_, __pyx_v_mu_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.heatwave_vertical", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_mask, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1029
 * 
 * 
 * cpdef inline void horizontal_glitch(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float rad1_,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_55horizontal_glitch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_horizontal_glitch(PyObject *__pyx_v_surface_, float __pyx_v_rad1_, float __pyx_v_frequency_, float __pyx_v_amplitude_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("horizontal_glitch", 0);

  /* "PygameShader/shader.pyx":1046
 *     :return: void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1046, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1047
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_horizontal_glitch24_inplace_c(pixels3d(surface_), rad1_, frequency_, amplitude_)
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1046, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1049
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_horizontal_glitch24_inplace_c(pixels3d(surface_), rad1_, frequency_, amplitude_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1049, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_horizontal_glitch24_inplace_c(__pyx_t_5, __pyx_v_rad1_, __pyx_v_frequency_, __pyx_v_amplitude_);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":1029
 * 
 * 
 * cpdef inline void horizontal_glitch(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         float rad1_,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.horizontal_glitch", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_55horizontal_glitch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_54horizontal_glitch[] = "\n    SHADER GLITCH EFFECT\n\n    Deform the pygame display to create a glitch effect\n\n    :param surface_  : pygame.Surface; compatible 24 - 32 bit \n    :param rad1_     : float; Angle in radians, this value control the angle variation over the time\n    :param frequency_: float; signal frequency, factor that amplify the angle variation\n    :param amplitude_: float; cos amplitude value\n    :return: void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_55horizontal_glitch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  float __pyx_v_rad1_;
  float __pyx_v_frequency_;
  float __pyx_v_amplitude_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("horizontal_glitch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_rad1,&__pyx_n_s_frequency,&__pyx_n_s_amplitude,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rad1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("horizontal_glitch", 1, 4, 4, 1); __PYX_ERR(1, 1029, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frequency)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("horizontal_glitch", 1, 4, 4, 2); __PYX_ERR(1, 1029, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amplitude)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("horizontal_glitch", 1, 4, 4, 3); __PYX_ERR(1, 1029, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "horizontal_glitch") < 0)) __PYX_ERR(1, 1029, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_rad1_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_rad1_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1031, __pyx_L3_error)
    __pyx_v_frequency_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_frequency_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1032, __pyx_L3_error)
    __pyx_v_amplitude_ = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_amplitude_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1033, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("horizontal_glitch", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1029, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.horizontal_glitch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_54horizontal_glitch(__pyx_self, __pyx_v_surface_, __pyx_v_rad1_, __pyx_v_frequency_, __pyx_v_amplitude_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_54horizontal_glitch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_rad1_, float __pyx_v_frequency_, float __pyx_v_amplitude_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("horizontal_glitch", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_horizontal_glitch(__pyx_v_surface_, __pyx_v_rad1_, __pyx_v_frequency_, __pyx_v_amplitude_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.horizontal_glitch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1053
 * 
 * 
 * cpdef inline void bpf(object surface_, int threshold = 128):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_57bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bpf(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_bpf *__pyx_optional_args) {
  int __pyx_v_threshold = ((int)0x80);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_bpf24_inplace_c __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bpf", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_threshold = __pyx_optional_args->threshold;
    }
  }

  /* "PygameShader/shader.pyx":1064
 *     :return: void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1064, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1065
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_bpf24_inplace_c(pixels3d(surface_), threshold)
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1064, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1067
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_bpf24_inplace_c(pixels3d(surface_), threshold)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1067, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.threshold = __pyx_v_threshold;
  __pyx_f_12PygameShader_6shader_shader_bpf24_inplace_c(__pyx_t_5, &__pyx_t_6); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":1053
 * 
 * 
 * cpdef inline void bpf(object surface_, int threshold = 128):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.bpf", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_57bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_56bpf[] = "\n    \n    SHADER BRIGHT PASS FILTER (INPLACE)\n\n    Conserve only the brightest pixels in a surface\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :param threshold: integer; Bright pass threshold default 128\n    :return: void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_57bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_threshold;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bpf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_threshold_2,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold_2);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bpf") < 0)) __PYX_ERR(1, 1053, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_threshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_threshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1053, __pyx_L3_error)
    } else {
      __pyx_v_threshold = ((int)0x80);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bpf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1053, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.bpf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_56bpf(__pyx_self, __pyx_v_surface_, __pyx_v_threshold);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_56bpf(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_bpf __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bpf", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.threshold = __pyx_v_threshold;
  __pyx_f_12PygameShader_6shader_bpf(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.bpf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1071
 * 
 * 
 * cpdef inline void bloom(object surface_, int threshold_, bint fast_=False):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_59bloom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bloom(PyObject *__pyx_v_surface_, int __pyx_v_threshold_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_bloom *__pyx_optional_args) {
  int __pyx_v_fast_ = ((int)0);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  struct __pyx_opt_args_12PygameShader_6shader_shader_bloom_effect_array24_c __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bloom", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_fast_ = __pyx_optional_args->fast_;
    }
  }

  /* "PygameShader/shader.pyx":1091
 * 
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1091, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1092
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_bloom_effect_array24_c(surface_, threshold_, fast_)
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1092, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1091, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1094
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_bloom_effect_array24_c(surface_, threshold_, fast_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4.__pyx_n = 1;
  __pyx_t_4.fast_ = __pyx_v_fast_;
  __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(__pyx_v_surface_, __pyx_v_threshold_, &__pyx_t_4); 

  /* "PygameShader/shader.pyx":1071
 * 
 * 
 * cpdef inline void bloom(object surface_, int threshold_, bint fast_=False):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("PygameShader.shader.bloom", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_59bloom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_58bloom[] = "\n    \n    CREATE A BLOOM EFFECT\n\n    * Surface must be a pygame Surface 24-32 bit format\n\n    :param surface_     : pygame.Surface; Game display or texture\n    :param threshold_   : integer; Threshold value uint8 in range [0 ... 255].\n                          The threshold value is used by a bright\n                          pass filter to determine the bright pixels above the given threshold.\n                          Below 128 the bloom effect will be more\n                          noticeable and above 128 a bit less.\n    :param fast_        : bool; True | False; If True the bloom effect will be approximated\n                          and only the x16 subsurface\n                          will be processed to maximize the overall processing time, \n                          default is False).\n    :return             : void\n    \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_59bloom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_threshold_;
  int __pyx_v_fast_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bloom (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_threshold,&__pyx_n_s_fast,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bloom", 0, 2, 3, 1); __PYX_ERR(1, 1071, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bloom") < 0)) __PYX_ERR(1, 1071, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_threshold_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_threshold_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1071, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_fast_ = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_fast_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1071, __pyx_L3_error)
    } else {
      __pyx_v_fast_ = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bloom", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1071, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.bloom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_58bloom(__pyx_self, __pyx_v_surface_, __pyx_v_threshold_, __pyx_v_fast_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_58bloom(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold_, int __pyx_v_fast_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_bloom __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bloom", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.fast_ = __pyx_v_fast_;
  __pyx_f_12PygameShader_6shader_bloom(__pyx_v_surface_, __pyx_v_threshold_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.bloom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1098
 * 
 * 
 * cpdef inline fisheye_footprint(int w, int h):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_61fisheye_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_fisheye_footprint(int __pyx_v_w, int __pyx_v_h, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fisheye_footprint", 0);

  /* "PygameShader/shader.pyx":1106
 *     of all surface pixels passing through the fisheye lens model)
 *     """
 *     return shader_fisheye24_footprint_c(w, h)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_shader_fisheye24_footprint_c(__pyx_v_w, __pyx_v_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":1098
 * 
 * 
 * cpdef inline fisheye_footprint(int w, int h):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.fisheye_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_61fisheye_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_60fisheye_footprint[] = "\n\n    :param w: integer; width of the fisheye model\n    :param h: integer; height of the fisheye model\n    :return: Return a numpy.ndarray type (w, h, 2) representing the fisheye model (coordinates\n    of all surface pixels passing through the fisheye lens model)\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_61fisheye_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_w;
  int __pyx_v_h;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fisheye_footprint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_h,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fisheye_footprint", 1, 2, 2, 1); __PYX_ERR(1, 1098, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fisheye_footprint") < 0)) __PYX_ERR(1, 1098, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_w = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1098, __pyx_L3_error)
    __pyx_v_h = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1098, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fisheye_footprint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1098, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.fisheye_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_60fisheye_footprint(__pyx_self, __pyx_v_w, __pyx_v_h);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_60fisheye_footprint(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_w, int __pyx_v_h) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fisheye_footprint", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_fisheye_footprint(__pyx_v_w, __pyx_v_h, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.fisheye_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1111
 * 
 * 
 * cpdef inline void fisheye(             # <<<<<<<<<<<<<<
 *         object surface_, unsigned int [:, :, :] fisheye_model):
 *     """
 */

static PyObject *__pyx_pw_12PygameShader_6shader_63fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_fisheye(PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_fisheye_model, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fisheye", 0);

  /* "PygameShader/shader.pyx":1138
 * 
 *     # TODO EXPERIMENT WITH ORDER = 'C'
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1138, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1139
 *     # TODO EXPERIMENT WITH ORDER = 'C'
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(fisheye_model, (cython.view.memoryview, numpy.ndarray)), \
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1138, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1141
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert PyObject_IsInstance(fisheye_model, (cython.view.memoryview, numpy.ndarray)), \             # <<<<<<<<<<<<<<
 *         "\nArgument fisheye_model must be a numpy.ndarray or a cython.view.memoryview  type, " \
 *         "got %s " % type(fisheye_model)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
    __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_memoryview_type));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1141, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1143
 *     assert PyObject_IsInstance(fisheye_model, (cython.view.memoryview, numpy.ndarray)), \
 *         "\nArgument fisheye_model must be a numpy.ndarray or a cython.view.memoryview  type, " \
 *         "got %s " % type(fisheye_model)             # <<<<<<<<<<<<<<
 * 
 *     shader_fisheye24_inplace_c(pixels3d(surface_), fisheye_model)
 */
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_fisheye_model_must_be, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1141, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1145
 *         "got %s " % type(fisheye_model)
 * 
 *     shader_fisheye24_inplace_c(pixels3d(surface_), fisheye_model)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1145, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_fisheye24_inplace_c(__pyx_t_5, __pyx_v_fisheye_model);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":1111
 * 
 * 
 * cpdef inline void fisheye(             # <<<<<<<<<<<<<<
 *         object surface_, unsigned int [:, :, :] fisheye_model):
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_63fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_62fisheye[] = "\n    THIS SHADER CAN BE USE TO DISPLAY THE GAME THROUGH A LENS EFFECT\n\n    Display a fisheye effect in real time given a surface referencing the\n    pixels RGB. In order to accomplish a real time calculation, \n    this algorithm is using a pre-calculated transformation stored\n    in the array fisheye_model.\n    \n    The function shader_fisheye24_footprint_c has to be called prior\n    shader_fisheye24_inplace_c in order to store the transformation values.\n\n    This shader can be applied directly to the pygame display\n\n    :param fisheye_model    : numpy.ndarray shape (width, height, 2) int32, fisheye model\n    containing the pixels\n    coordinates after the fisheye transformation\n    :return                 : void\n    \n    :param surface_      : pygame.Surface; compatible 24 - 32 bit \n    :param fisheye_model : numpy.ndarray or cython memoryview shape (width, height, 2) int32, \n                           fisheye model containing the pixels\n    :return: void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_63fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  __Pyx_memviewslice __pyx_v_fisheye_model = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fisheye (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_fisheye_model,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fisheye_model)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fisheye", 1, 2, 2, 1); __PYX_ERR(1, 1111, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fisheye") < 0)) __PYX_ERR(1, 1111, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_fisheye_model = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fisheye_model.memview)) __PYX_ERR(1, 1112, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fisheye", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1111, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_62fisheye(__pyx_self, __pyx_v_surface_, __pyx_v_fisheye_model);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_62fisheye(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_fisheye_model) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fisheye", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_fisheye_model.memview)) { __Pyx_RaiseUnboundLocalError("fisheye_model"); __PYX_ERR(1, 1111, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_fisheye(__pyx_v_surface_, __pyx_v_fisheye_model, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_fisheye_model, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1150
 * 
 * # TODO DOC
 * cpdef inline tuple rain_footprint(int w, int h):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_65rain_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_rain_footprint(int __pyx_v_w, int __pyx_v_h, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rain_footprint", 0);

  /* "PygameShader/shader.pyx":1166
 *                   equivalent numpy.ndarray
 *     """
 *     return shader_rain_footprint_inplace_c(w, h)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_shader_rain_footprint_inplace_c(__pyx_v_w, __pyx_v_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":1150
 * 
 * # TODO DOC
 * cpdef inline tuple rain_footprint(int w, int h):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.rain_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_65rain_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_64rain_footprint[] = "\n    \n    CREATE A FISH EYE LENS DEFORMATION MAP/TEXTURE\n\n    * This function create a texture and its equivalent numpy.ndarray containing the coordinates\n      for each pixels after deformation.\n    * This method must be called once outside of your game main loop\n    * The model can be re-use to display your video game animation without being re-calculated for\n      each frame. This method allow a high FPS rate\n\n    :param w    : integer; Width of the fish eye effect\n    :param h    : integer; height of the fish eye effect\n    :return     : Pygame Surface representing the fish-eye effect and its\n                  equivalent numpy.ndarray\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_65rain_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_w;
  int __pyx_v_h;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rain_footprint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_h,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rain_footprint", 1, 2, 2, 1); __PYX_ERR(1, 1150, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rain_footprint") < 0)) __PYX_ERR(1, 1150, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_w = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1150, __pyx_L3_error)
    __pyx_v_h = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1150, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rain_footprint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1150, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.rain_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_64rain_footprint(__pyx_self, __pyx_v_w, __pyx_v_h);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_64rain_footprint(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_w, int __pyx_v_h) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rain_footprint", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_rain_footprint(__pyx_v_w, __pyx_v_h, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.rain_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1172
 * 
 * # TODO DOC
 * cpdef inline void rain_fisheye(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned int [:, :, ::1] rain_fisheye_model
 */

static PyObject *__pyx_pw_12PygameShader_6shader_67rain_fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rain_fisheye(PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_rain_fisheye_model, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rain_fisheye", 0);

  /* "PygameShader/shader.pyx":1208
 * 
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1208, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1209
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(rain_fisheye_model, (numpy.ndarray, cython.view.memoryview)), \
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1208, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1211
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert PyObject_IsInstance(rain_fisheye_model, (numpy.ndarray, cython.view.memoryview)), \             # <<<<<<<<<<<<<<
 *         "\nArgument rain_fisheye_model must be a " \
 *         "numpy.ndarray or a cython memoryview type, got %s " % type(rain_fisheye_model)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_rain_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
    __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_memoryview_type));
    __pyx_t_4 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1211, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1213
 *     assert PyObject_IsInstance(rain_fisheye_model, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument rain_fisheye_model must be a " \
 *         "numpy.ndarray or a cython memoryview type, got %s " % type(rain_fisheye_model)             # <<<<<<<<<<<<<<
 * 
 *     shader_rain_fisheye24_inplace_c(pixels3d(surface_), rain_fisheye_model)
 */
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rain_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1213, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_rain_fisheye_model_mus, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1213, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1211, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1215
 *         "numpy.ndarray or a cython memoryview type, got %s " % type(rain_fisheye_model)
 * 
 *     shader_rain_fisheye24_inplace_c(pixels3d(surface_), rain_fisheye_model)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1215, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_rain_fisheye24_inplace_c(__pyx_t_5, __pyx_v_rain_fisheye_model);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":1172
 * 
 * # TODO DOC
 * cpdef inline void rain_fisheye(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned int [:, :, ::1] rain_fisheye_model
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.rain_fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_67rain_fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_66rain_fisheye[] = "\n    THIS SHADER CAN BE USED TO SIMULATE RAIN DROPLET OR BUBBLE DISPLAYED ON THE TOP OF\n    THE SCREEN SURFACE.\n\n    Both surface and rain_fisheye_model must have the exact same size\n\n    1) Always call the method shader_rain_footprint_inplace_c before the main loop.\n       The transformation model doesn't have to be calculated every frames.\n       The above method will generate a pygame texture (24bit) containing the location\n       of each pixels after deformation. It does also return a numpy.ndarray equivalent\n       pixel format that can be used instead of the surface if needed.\n\n    It uses a fish eye lens deformation to reproduce the deformed background image onto\n    the final image. The operation apply inplace and the surface referenced by the rgb_array_\n    will be modified directly.\n    The fish-eye lens deformation will recreate you game scene into the rain droplet or bubble\n    and create the illusion of animation inside the bubble.\n\n    * This shader cannot be applied directly to the pygame display as the array passed to the\n    function is a scaled format of the pygame.display (copy not referencing directly the\n    surface pixels)\n\n    * This algorithm use a pre-calculated fish-eye lens deformation model to boost the overall\n    FPS performances, the texture pixel is then transformed with the model without any intensive\n    math calculation.\n\n    :param surface_             : pygame.Surface compatible 24 - 32 bit \n    :param rain_fisheye_model   : numpy.ndarray or memoryview type (w, h, 3) unsigned int \n                                  containing the the coordinate for each pixels\n    :return                     : void\n\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_67rain_fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  __Pyx_memviewslice __pyx_v_rain_fisheye_model = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rain_fisheye (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_rain_fisheye_model,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rain_fisheye_model)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rain_fisheye", 1, 2, 2, 1); __PYX_ERR(1, 1172, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rain_fisheye") < 0)) __PYX_ERR(1, 1172, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_rain_fisheye_model = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rain_fisheye_model.memview)) __PYX_ERR(1, 1174, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rain_fisheye", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1172, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.rain_fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_66rain_fisheye(__pyx_self, __pyx_v_surface_, __pyx_v_rain_fisheye_model);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_66rain_fisheye(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_rain_fisheye_model) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rain_fisheye", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_rain_fisheye_model.memview)) { __Pyx_RaiseUnboundLocalError("rain_fisheye_model"); __PYX_ERR(1, 1172, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_rain_fisheye(__pyx_v_surface_, __pyx_v_rain_fisheye_model, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.rain_fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rain_fisheye_model, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1220
 * 
 * 
 * cpdef inline void tv_scan(surface_, int space=5):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_69tv_scan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_tv_scan(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_tv_scan *__pyx_optional_args) {
  int __pyx_v_space = ((int)5);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tv_scan", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_space = __pyx_optional_args->space;
    }
  }

  /* "PygameShader/shader.pyx":1235
 *     # TODO SCANLINE VERTICAL | HORIZONTAL
 * 
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1235, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1236
 * 
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert space > 0, "Argument space cannot be <=0"
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1236, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1235, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1238
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert space > 0, "Argument space cannot be <=0"             # <<<<<<<<<<<<<<
 * 
 *     shader_tv_scanline_inplace_c(pixels3d(surface_), space)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_space > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_space_cannot_be_0);
      __PYX_ERR(1, 1238, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1240
 *     assert space > 0, "Argument space cannot be <=0"
 * 
 *     shader_tv_scanline_inplace_c(pixels3d(surface_), space)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_tv_scanline_inplace_c(__pyx_t_5, __pyx_v_space);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":1220
 * 
 * 
 * cpdef inline void tv_scan(surface_, int space=5):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.tv_scan", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_69tv_scan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_68tv_scan[] = "\n    \n    SHADER CREATING A TV SCANLINE EFFECT ON PYGAME SURFACE\n\n    The space between each scanline can by adjusted with the space value.\n    The scanline intensity/colors is lower that the original image\n\n    :param surface_     : pygame.Surface compatible 24-32 bit \n    :param space        : integer; space between the lines\n    :return             : void\n    \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_69tv_scan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_space;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tv_scan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_space,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tv_scan") < 0)) __PYX_ERR(1, 1220, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_space = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_space == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1220, __pyx_L3_error)
    } else {
      __pyx_v_space = ((int)5);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tv_scan", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1220, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.tv_scan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_68tv_scan(__pyx_self, __pyx_v_surface_, __pyx_v_space);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_68tv_scan(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_space) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_tv_scan __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tv_scan", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.space = __pyx_v_space;
  __pyx_f_12PygameShader_6shader_tv_scan(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.tv_scan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1245
 * 
 * 
 * cpdef inline void rgb_split(object surface_, int offset_=10):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_71rgb_split(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rgb_split(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_rgb_split *__pyx_optional_args) {
  int __pyx_v_offset_ = ((int)10);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_split", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_offset_ = __pyx_optional_args->offset_;
    }
  }

  /* "PygameShader/shader.pyx":1266
 * 
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1266, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1267
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_rgb_split_inplace_c(surface_, offset_)
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1267, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1266, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1269
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_rgb_split_inplace_c(surface_, offset_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_f_12PygameShader_6shader_shader_rgb_split_inplace_c(__pyx_v_surface_, __pyx_v_offset_);

  /* "PygameShader/shader.pyx":1245
 * 
 * 
 * cpdef inline void rgb_split(object surface_, int offset_=10):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("PygameShader.shader.rgb_split", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_71rgb_split(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_70rgb_split[] = "\n    \n    THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)\n    The transformation apply inplace\n\n    The original surface will be used and used for the subsurface blit operation.\n    Each channels will be blit sequentially in the following order RGB\n    Note that channel green and blue will be blit with an additional flag BLEND_RGB_ADD, to mix\n    the channel with the lower layers.\n\n    * FPS BOOST\n    In order to boost the fps frame rate the original surface to process can be downscale x2\n    and rescale after processing.\n\n\n    :param surface_ : pygame Surface to process (24bit format)\n    :param offset_  : integer; offset for (x, y) to add to each channels RGB\n    :return         : void\n    \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_71rgb_split(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_offset_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rgb_split (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_offset,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rgb_split") < 0)) __PYX_ERR(1, 1245, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_offset_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_offset_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1245, __pyx_L3_error)
    } else {
      __pyx_v_offset_ = ((int)10);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rgb_split", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1245, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.rgb_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_70rgb_split(__pyx_self, __pyx_v_surface_, __pyx_v_offset_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_70rgb_split(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_offset_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_rgb_split __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_split", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.offset_ = __pyx_v_offset_;
  __pyx_f_12PygameShader_6shader_rgb_split(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.rgb_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1273
 * 
 * 
 * cpdef object rgb_split_clean(object surface_, int offset_=10):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_73rgb_split_clean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_rgb_split_clean(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_rgb_split_clean *__pyx_optional_args) {
  int __pyx_v_offset_ = ((int)10);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_split_clean", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_offset_ = __pyx_optional_args->offset_;
    }
  }

  /* "PygameShader/shader.pyx":1286
 * 
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1286, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1287
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert isinstance(offset_, int), \
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1286, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1289
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert isinstance(offset_, int), \             # <<<<<<<<<<<<<<
 *         "\nArgument offset_ must be an int type, got %s" % type(offset_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyInt_Check(__pyx_t_2); 
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1290
 * 
 *     assert isinstance(offset_, int), \
 *         "\nArgument offset_ must be an int type, got %s" % type(offset_)             # <<<<<<<<<<<<<<
 * 
 *     if offset_==0:
 */
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_offset__must_be_an_int, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 1289, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1292
 *         "\nArgument offset_ must be an int type, got %s" % type(offset_)
 * 
 *     if offset_==0:             # <<<<<<<<<<<<<<
 *         return surface_
 * 
 */
  __pyx_t_3 = ((__pyx_v_offset_ == 0) != 0);
  if (__pyx_t_3) {

    /* "PygameShader/shader.pyx":1293
 * 
 *     if offset_==0:
 *         return surface_             # <<<<<<<<<<<<<<
 * 
 *     return shader_rgb_split_c(surface_, offset_)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_surface_);
    __pyx_r = __pyx_v_surface_;
    goto __pyx_L0;

    /* "PygameShader/shader.pyx":1292
 *         "\nArgument offset_ must be an int type, got %s" % type(offset_)
 * 
 *     if offset_==0:             # <<<<<<<<<<<<<<
 *         return surface_
 * 
 */
  }

  /* "PygameShader/shader.pyx":1295
 *         return surface_
 * 
 *     return shader_rgb_split_c(surface_, offset_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_shader_rgb_split_c(__pyx_v_surface_, __pyx_v_offset_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":1273
 * 
 * 
 * cpdef object rgb_split_clean(object surface_, int offset_=10):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.rgb_split_clean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_73rgb_split_clean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_72rgb_split_clean[] = "\n\n    THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)\n    The final image has a different width and height since the offset value is removed to keep only \n    the overlapping R, G, B channels \n    Setting the Offset_ to zero will have no effect to the original image.\n\n    :param surface_ : pygame Surface to process (24bit format)\n    :param offset_  : integer; offset for (x, y) to add to each channels RGB\n    :return         : void\n\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_73rgb_split_clean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_offset_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rgb_split_clean (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_offset,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rgb_split_clean") < 0)) __PYX_ERR(1, 1273, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_offset_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_offset_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1273, __pyx_L3_error)
    } else {
      __pyx_v_offset_ = ((int)10);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rgb_split_clean", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1273, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.rgb_split_clean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_72rgb_split_clean(__pyx_self, __pyx_v_surface_, __pyx_v_offset_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_72rgb_split_clean(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_offset_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_rgb_split_clean __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_split_clean", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.offset_ = __pyx_v_offset_;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_rgb_split_clean(__pyx_v_surface_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.rgb_split_clean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1300
 * 
 * 
 * cpdef inline tuple ripple(             # <<<<<<<<<<<<<<
 *         int rows_,
 *         int cols_,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_75ripple(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_ripple(int __pyx_v_rows_, int __pyx_v_cols_, __Pyx_memviewslice __pyx_v_previous_, __Pyx_memviewslice __pyx_v_current_, __Pyx_memviewslice __pyx_v_array_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_prev_w;
  Py_ssize_t __pyx_v_prev_h;
  Py_ssize_t __pyx_v_curr_w;
  Py_ssize_t __pyx_v_curr_h;
  Py_ssize_t __pyx_v_arr_w;
  Py_ssize_t __pyx_v_arr_h;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ripple", 0);

  /* "PygameShader/shader.pyx":1323
 * 
 *     """
 *     assert PyObject_IsInstance(previous_, (numpy.ndarray, cython.view.memoryview)), \             # <<<<<<<<<<<<<<
 *         "\nArgument previous must be a numpy.ndarray type got %s " % type(previous_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_previous_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
    __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_memoryview_type));
    __pyx_t_3 = 0;
    __pyx_t_4 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1323, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_4 != 0))) {

      /* "PygameShader/shader.pyx":1324
 *     """
 *     assert PyObject_IsInstance(previous_, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument previous must be a numpy.ndarray type got %s " % type(previous_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(current_, (numpy.ndarray, cython.view.memoryview)), \
 */
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_previous_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1324, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_previous_must_be_a_num, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1324, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 1323, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1326
 *         "\nArgument previous must be a numpy.ndarray type got %s " % type(previous_)
 * 
 *     assert PyObject_IsInstance(current_, (numpy.ndarray, cython.view.memoryview)), \             # <<<<<<<<<<<<<<
 *         "\nArgument current must be a numpy.ndarray type got %s " % type(current_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_current_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
    __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_memoryview_type));
    __pyx_t_3 = 0;
    __pyx_t_4 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_4 != 0))) {

      /* "PygameShader/shader.pyx":1327
 * 
 *     assert PyObject_IsInstance(current_, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument current must be a numpy.ndarray type got %s " % type(current_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(array_, (numpy.ndarray, cython.view.memoryview)), \
 */
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_current_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_current_must_be_a_nump, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 1326, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1329
 *         "\nArgument current must be a numpy.ndarray type got %s " % type(current_)
 * 
 *     assert PyObject_IsInstance(array_, (numpy.ndarray, cython.view.memoryview)), \             # <<<<<<<<<<<<<<
 *         "\nArgument array must be a numpy.ndarray type got %s " % type(array_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
    __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_memoryview_type));
    __pyx_t_3 = 0;
    __pyx_t_4 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1329, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_4 != 0))) {

      /* "PygameShader/shader.pyx":1330
 * 
 *     assert PyObject_IsInstance(array_, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument array must be a numpy.ndarray type got %s " % type(array_)             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t prev_w, prev_h
 */
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_array_must_be_a_numpy, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 1329, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1333
 * 
 *     cdef Py_ssize_t prev_w, prev_h
 *     prev_w, prev_h = previous_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t curr_w, curr_h
 */
  __pyx_t_5 = __pyx_v_previous_.shape;
  __pyx_t_6 = (__pyx_t_5[0]);
  __pyx_t_7 = (__pyx_t_5[1]);
  __pyx_v_prev_w = __pyx_t_6;
  __pyx_v_prev_h = __pyx_t_7;

  /* "PygameShader/shader.pyx":1336
 * 
 *     cdef Py_ssize_t curr_w, curr_h
 *     curr_w, curr_h = current_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t arr_w, arr_h
 */
  __pyx_t_5 = __pyx_v_current_.shape;
  __pyx_t_7 = (__pyx_t_5[0]);
  __pyx_t_6 = (__pyx_t_5[1]);
  __pyx_v_curr_w = __pyx_t_7;
  __pyx_v_curr_h = __pyx_t_6;

  /* "PygameShader/shader.pyx":1339
 * 
 *     cdef Py_ssize_t arr_w, arr_h
 *     arr_w, arr_h = array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     assert prev_w == curr_w and prev_w == arr_w \
 */
  __pyx_t_5 = __pyx_v_array_.shape;
  __pyx_t_6 = (__pyx_t_5[0]);
  __pyx_t_7 = (__pyx_t_5[1]);
  __pyx_v_arr_w = __pyx_t_6;
  __pyx_v_arr_h = __pyx_t_7;

  /* "PygameShader/shader.pyx":1341
 *     arr_w, arr_h = array_.shape[:2]
 * 
 *     assert prev_w == curr_w and prev_w == arr_w \             # <<<<<<<<<<<<<<
 *            and prev_h == curr_h and prev_h == arr_h, \
 *         "\n Array sizes mismatch (previous w: %s, h: %s; " \
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_8 = ((__pyx_v_prev_w == __pyx_v_curr_w) != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_4 = __pyx_t_8;
      goto __pyx_L3_bool_binop_done;
    }

    /* "PygameShader/shader.pyx":1342
 * 
 *     assert prev_w == curr_w and prev_w == arr_w \
 *            and prev_h == curr_h and prev_h == arr_h, \             # <<<<<<<<<<<<<<
 *         "\n Array sizes mismatch (previous w: %s, h: %s; " \
 *         "current w: %s, h: %s; array_ w: %s, h: %s " % (prev_w, prev_h, curr_w, curr_h,
 */
    __pyx_t_8 = ((__pyx_v_prev_w == __pyx_v_arr_w) != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_4 = __pyx_t_8;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_8 = ((__pyx_v_prev_h == __pyx_v_curr_h) != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_4 = __pyx_t_8;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_8 = ((__pyx_v_prev_h == __pyx_v_arr_h) != 0);
    __pyx_t_4 = __pyx_t_8;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_4)) {

      /* "PygameShader/shader.pyx":1344
 *            and prev_h == curr_h and prev_h == arr_h, \
 *         "\n Array sizes mismatch (previous w: %s, h: %s; " \
 *         "current w: %s, h: %s; array_ w: %s, h: %s " % (prev_w, prev_h, curr_w, curr_h,             # <<<<<<<<<<<<<<
 *         arr_w, arr_h)
 * 
 */
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_prev_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_prev_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_curr_w); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_curr_h); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "PygameShader/shader.pyx":1345
 *         "\n Array sizes mismatch (previous w: %s, h: %s; " \
 *         "current w: %s, h: %s; array_ w: %s, h: %s " % (prev_w, prev_h, curr_w, curr_h,
 *         arr_w, arr_h)             # <<<<<<<<<<<<<<
 * 
 *     return shader_ripple_c(rows_, cols_, previous_, current_, array_)
 */
      __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_arr_w); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyInt_FromSsize_t(__pyx_v_arr_h); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);

      /* "PygameShader/shader.pyx":1344
 *            and prev_h == curr_h and prev_h == arr_h, \
 *         "\n Array sizes mismatch (previous w: %s, h: %s; " \
 *         "current w: %s, h: %s; array_ w: %s, h: %s " % (prev_w, prev_h, curr_w, curr_h,             # <<<<<<<<<<<<<<
 *         arr_w, arr_h)
 * 
 */
      __pyx_t_12 = PyTuple_New(6); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_t_11);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_Array_sizes_mismatch_previous_w, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_11);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __PYX_ERR(1, 1341, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1347
 *         arr_w, arr_h)
 * 
 *     return shader_ripple_c(rows_, cols_, previous_, current_, array_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_11 = __pyx_f_12PygameShader_6shader_shader_ripple_c(__pyx_v_rows_, __pyx_v_cols_, __pyx_v_previous_, __pyx_v_current_, __pyx_v_array_); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_r = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":1300
 * 
 * 
 * cpdef inline tuple ripple(             # <<<<<<<<<<<<<<
 *         int rows_,
 *         int cols_,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("PygameShader.shader.ripple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_75ripple(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_74ripple[] = "\n    \n    THIS SHADER CREATE A WATER EFFECT ON A PYGAME SURFACE\n    This version does not include any background deformation to keep a reasonable FPS rate\n\n    * NOTE this shader cannot be apply to the screen directly (screen referencing\n    pygame.display.get_surface()),\n\n    :param rows_        : integer; Array width\n    :param cols_        : integer; Array height\n    :param previous_    : numpy.ndarray type (w, h) type float; array use for the transformation\n    :param current_     : numpy.ndarray type (w, h) type float; array use for the transformation\n    :param array_       : numpy.ndarray type (w, h, 3) type unsigned char\n    :return             : void\n    \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_75ripple(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_rows_;
  int __pyx_v_cols_;
  __Pyx_memviewslice __pyx_v_previous_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_current_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_array_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ripple (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_cols,&__pyx_n_s_previous,&__pyx_n_s_current,&__pyx_n_s_array,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rows)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cols)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ripple", 1, 5, 5, 1); __PYX_ERR(1, 1300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_previous)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ripple", 1, 5, 5, 2); __PYX_ERR(1, 1300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_current)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ripple", 1, 5, 5, 3); __PYX_ERR(1, 1300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_array)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ripple", 1, 5, 5, 4); __PYX_ERR(1, 1300, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ripple") < 0)) __PYX_ERR(1, 1300, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_rows_ = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_rows_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1301, __pyx_L3_error)
    __pyx_v_cols_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_cols_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1302, __pyx_L3_error)
    __pyx_v_previous_ = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_previous_.memview)) __PYX_ERR(1, 1303, __pyx_L3_error)
    __pyx_v_current_ = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_current_.memview)) __PYX_ERR(1, 1304, __pyx_L3_error)
    __pyx_v_array_ = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_array_.memview)) __PYX_ERR(1, 1305, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ripple", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1300, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.ripple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_74ripple(__pyx_self, __pyx_v_rows_, __pyx_v_cols_, __pyx_v_previous_, __pyx_v_current_, __pyx_v_array_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_74ripple(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_rows_, int __pyx_v_cols_, __Pyx_memviewslice __pyx_v_previous_, __Pyx_memviewslice __pyx_v_current_, __Pyx_memviewslice __pyx_v_array_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ripple", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_previous_.memview)) { __Pyx_RaiseUnboundLocalError("previous_"); __PYX_ERR(1, 1300, __pyx_L1_error) }
  if (unlikely(!__pyx_v_current_.memview)) { __Pyx_RaiseUnboundLocalError("current_"); __PYX_ERR(1, 1300, __pyx_L1_error) }
  if (unlikely(!__pyx_v_array_.memview)) { __Pyx_RaiseUnboundLocalError("array_"); __PYX_ERR(1, 1300, __pyx_L1_error) }
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_ripple(__pyx_v_rows_, __pyx_v_cols_, __pyx_v_previous_, __pyx_v_current_, __pyx_v_array_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.ripple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_previous_, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_current_, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_array_, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1352
 * 
 * 
 * cpdef inline void heatmap(object surface_, bint rgb_=True):             # <<<<<<<<<<<<<<
 *     """
 *     TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT
 */

static PyObject *__pyx_pw_12PygameShader_6shader_77heatmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heatmap(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_heatmap *__pyx_optional_args) {
  int __pyx_v_rgb_ = ((int)1);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  struct __pyx_opt_args_12PygameShader_6shader_heatmap_convert __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("heatmap", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_rgb_ = __pyx_optional_args->rgb_;
    }
  }

  /* "PygameShader/shader.pyx":1360
 *     :return         : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1360, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1361
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     heatmap_convert(surface_, rgb_)
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1361, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1360, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1363
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     heatmap_convert(surface_, rgb_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4.__pyx_n = 1;
  __pyx_t_4.rgb_ = __pyx_v_rgb_;
  __pyx_f_12PygameShader_6shader_heatmap_convert(__pyx_v_surface_, 0, &__pyx_t_4); 

  /* "PygameShader/shader.pyx":1352
 * 
 * 
 * cpdef inline void heatmap(object surface_, bint rgb_=True):             # <<<<<<<<<<<<<<
 *     """
 *     TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("PygameShader.shader.heatmap", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_77heatmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_76heatmap[] = "\n    TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT\n\n    :param surface_ : pygame.Surface\n    :param rgb_     : boolean; True transformed the image into a RGB heatmap model of False (BGR)\n    :return         : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_77heatmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_rgb_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("heatmap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_rgb,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rgb);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "heatmap") < 0)) __PYX_ERR(1, 1352, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_rgb_ = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_rgb_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1352, __pyx_L3_error)
    } else {
      __pyx_v_rgb_ = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("heatmap", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1352, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.heatmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_76heatmap(__pyx_self, __pyx_v_surface_, __pyx_v_rgb_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_76heatmap(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_rgb_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_heatmap __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("heatmap", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.rgb_ = __pyx_v_rgb_;
  __pyx_f_12PygameShader_6shader_heatmap(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.heatmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1369
 * 
 * 
 * cpdef inline predator_vision(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned int sobel_threshold=12,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_79predator_vision(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_predator_vision(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_predator_vision *__pyx_optional_args) {
  unsigned int __pyx_v_sobel_threshold = ((unsigned int)12);
  unsigned int __pyx_v_bpf_threshold = ((unsigned int)50);
  unsigned int __pyx_v_bloom_threshold = ((unsigned int)50);

  /* "PygameShader/shader.pyx":1374
 *         unsigned int bpf_threshold=50,
 *         unsigned int bloom_threshold=50,
 *         bint inv_colormap=False,             # <<<<<<<<<<<<<<
 *         bint fast=False,
 *         int blend=pygame.BLEND_RGB_ADD
 */
  int __pyx_v_inv_colormap = ((int)0);

  /* "PygameShader/shader.pyx":1375
 *         unsigned int bloom_threshold=50,
 *         bint inv_colormap=False,
 *         bint fast=False,             # <<<<<<<<<<<<<<
 *         int blend=pygame.BLEND_RGB_ADD
 * ):
 */
  int __pyx_v_fast = ((int)0);
  int __pyx_v_blend = __pyx_k__11;
  PyObject *__pyx_v_surface_copy = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  struct __pyx_opt_args_12PygameShader_6shader_sobel_fast __pyx_t_5;
  struct __pyx_opt_args_12PygameShader_6shader_sobel __pyx_t_6;
  struct __pyx_opt_args_12PygameShader_6shader_bpf __pyx_t_7;
  struct __pyx_opt_args_12PygameShader_6shader_shader_bloom_effect_array24_c __pyx_t_8;
  struct __pyx_opt_args_12PygameShader_6shader_heatmap_convert __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("predator_vision", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_sobel_threshold = __pyx_optional_args->sobel_threshold;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_bpf_threshold = __pyx_optional_args->bpf_threshold;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_bloom_threshold = __pyx_optional_args->bloom_threshold;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_inv_colormap = __pyx_optional_args->inv_colormap;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_fast = __pyx_optional_args->fast;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_blend = __pyx_optional_args->blend;
              }
            }
          }
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":1392
 *     """
 * 
 *     surface_copy = surface_.copy()             # <<<<<<<<<<<<<<
 * 
 *     if fast:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_surface_copy = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":1394
 *     surface_copy = surface_.copy()
 * 
 *     if fast:             # <<<<<<<<<<<<<<
 *         sobel_fast(surface_copy, sobel_threshold, factor_=1)
 *     else:
 */
  __pyx_t_4 = (__pyx_v_fast != 0);
  if (__pyx_t_4) {

    /* "PygameShader/shader.pyx":1395
 * 
 *     if fast:
 *         sobel_fast(surface_copy, sobel_threshold, factor_=1)             # <<<<<<<<<<<<<<
 *     else:
 *         sobel(surface_copy, sobel_threshold)
 */
    __pyx_t_5.__pyx_n = 2;
    __pyx_t_5.threshold_ = __pyx_v_sobel_threshold;
    __pyx_t_5.factor_ = 1;
    __pyx_f_12PygameShader_6shader_sobel_fast(__pyx_v_surface_copy, 0, &__pyx_t_5); 

    /* "PygameShader/shader.pyx":1394
 *     surface_copy = surface_.copy()
 * 
 *     if fast:             # <<<<<<<<<<<<<<
 *         sobel_fast(surface_copy, sobel_threshold, factor_=1)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "PygameShader/shader.pyx":1397
 *         sobel_fast(surface_copy, sobel_threshold, factor_=1)
 *     else:
 *         sobel(surface_copy, sobel_threshold)             # <<<<<<<<<<<<<<
 * 
 *     bpf(surface_, bpf_threshold)
 */
  /*else*/ {
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.threshold_ = __pyx_v_sobel_threshold;
    __pyx_f_12PygameShader_6shader_sobel(__pyx_v_surface_copy, 0, &__pyx_t_6); 
  }
  __pyx_L3:;

  /* "PygameShader/shader.pyx":1399
 *         sobel(surface_copy, sobel_threshold)
 * 
 *     bpf(surface_, bpf_threshold)             # <<<<<<<<<<<<<<
 *     shader_bloom_effect_array24_c(surface_, bloom_threshold, fast_=True)
 *     heatmap_convert(surface_, inv_colormap)
 */
  __pyx_t_7.__pyx_n = 1;
  __pyx_t_7.threshold = __pyx_v_bpf_threshold;
  __pyx_f_12PygameShader_6shader_bpf(__pyx_v_surface_, 0, &__pyx_t_7); 

  /* "PygameShader/shader.pyx":1400
 * 
 *     bpf(surface_, bpf_threshold)
 *     shader_bloom_effect_array24_c(surface_, bloom_threshold, fast_=True)             # <<<<<<<<<<<<<<
 *     heatmap_convert(surface_, inv_colormap)
 *     surface_.blit(surface_copy, (0, 0), special_flags=blend)
 */
  __pyx_t_8.__pyx_n = 1;
  __pyx_t_8.fast_ = 1;
  __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(__pyx_v_surface_, __pyx_v_bloom_threshold, &__pyx_t_8); 

  /* "PygameShader/shader.pyx":1401
 *     bpf(surface_, bpf_threshold)
 *     shader_bloom_effect_array24_c(surface_, bloom_threshold, fast_=True)
 *     heatmap_convert(surface_, inv_colormap)             # <<<<<<<<<<<<<<
 *     surface_.blit(surface_copy, (0, 0), special_flags=blend)
 * 
 */
  __pyx_t_9.__pyx_n = 1;
  __pyx_t_9.rgb_ = __pyx_v_inv_colormap;
  __pyx_f_12PygameShader_6shader_heatmap_convert(__pyx_v_surface_, 0, &__pyx_t_9); 

  /* "PygameShader/shader.pyx":1402
 *     shader_bloom_effect_array24_c(surface_, bloom_threshold, fast_=True)
 *     heatmap_convert(surface_, inv_colormap)
 *     surface_.blit(surface_copy, (0, 0), special_flags=blend)             # <<<<<<<<<<<<<<
 * 
 *     return surface_.convert()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_surface_copy);
  __Pyx_GIVEREF(__pyx_v_surface_copy);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_surface_copy);
  __Pyx_INCREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_tuple__12);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_blend); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_special_flags, __pyx_t_10) < 0) __PYX_ERR(1, 1402, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "PygameShader/shader.pyx":1404
 *     surface_.blit(surface_copy, (0, 0), special_flags=blend)
 * 
 *     return surface_.convert()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_convert); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_10 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_10;
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":1369
 * 
 * 
 * cpdef inline predator_vision(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned int sobel_threshold=12,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("PygameShader.shader.predator_vision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_surface_copy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_79predator_vision(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_78predator_vision[] = "\n    CONVERT A SURFACE OR DISPLAY TO AN EQUIVALENT PREDATOR MODE \n\n    :param surface_        : pygame.Surface; compatible 24 - 32 bit \n    :param sobel_threshold : integer; value for sobel edge detection, default is 12 \n    :param bpf_threshold   : integer; value for the bright pass filter pixel detection, \n                             default is 50\n    :param bloom_threshold : integer; Value for the bloom effect intensity default is 50\n    :param inv_colormap    : boolean True | False inverse the colormap aspect, default is False\n    :param fast            : boolean True | False for a fast process, default is False\n    :param blend           : boolean True | False; final blending mode (New in version 1.0.4)  \n    :return                : Return a pygame surface  \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_79predator_vision(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  unsigned int __pyx_v_sobel_threshold;
  unsigned int __pyx_v_bpf_threshold;
  unsigned int __pyx_v_bloom_threshold;
  int __pyx_v_inv_colormap;
  int __pyx_v_fast;
  int __pyx_v_blend;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("predator_vision (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_sobel_threshold,&__pyx_n_s_bpf_threshold,&__pyx_n_s_bloom_threshold,&__pyx_n_s_inv_colormap,&__pyx_n_s_fast_2,&__pyx_n_s_blend,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sobel_threshold);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bpf_threshold);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bloom_threshold);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inv_colormap);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast_2);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blend);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predator_vision") < 0)) __PYX_ERR(1, 1369, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_sobel_threshold = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_sobel_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1371, __pyx_L3_error)
    } else {
      __pyx_v_sobel_threshold = ((unsigned int)12);
    }
    if (values[2]) {
      __pyx_v_bpf_threshold = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_bpf_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1372, __pyx_L3_error)
    } else {
      __pyx_v_bpf_threshold = ((unsigned int)50);
    }
    if (values[3]) {
      __pyx_v_bloom_threshold = __Pyx_PyInt_As_unsigned_int(values[3]); if (unlikely((__pyx_v_bloom_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1373, __pyx_L3_error)
    } else {
      __pyx_v_bloom_threshold = ((unsigned int)50);
    }
    if (values[4]) {
      __pyx_v_inv_colormap = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_inv_colormap == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1374, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1374
 *         unsigned int bpf_threshold=50,
 *         unsigned int bloom_threshold=50,
 *         bint inv_colormap=False,             # <<<<<<<<<<<<<<
 *         bint fast=False,
 *         int blend=pygame.BLEND_RGB_ADD
 */
      __pyx_v_inv_colormap = ((int)0);
    }
    if (values[5]) {
      __pyx_v_fast = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_fast == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1375, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1375
 *         unsigned int bloom_threshold=50,
 *         bint inv_colormap=False,
 *         bint fast=False,             # <<<<<<<<<<<<<<
 *         int blend=pygame.BLEND_RGB_ADD
 * ):
 */
      __pyx_v_fast = ((int)0);
    }
    if (values[6]) {
      __pyx_v_blend = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_blend == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1376, __pyx_L3_error)
    } else {
      __pyx_v_blend = __pyx_k__11;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("predator_vision", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1369, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.predator_vision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_78predator_vision(__pyx_self, __pyx_v_surface_, __pyx_v_sobel_threshold, __pyx_v_bpf_threshold, __pyx_v_bloom_threshold, __pyx_v_inv_colormap, __pyx_v_fast, __pyx_v_blend);

  /* "PygameShader/shader.pyx":1369
 * 
 * 
 * cpdef inline predator_vision(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned int sobel_threshold=12,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_78predator_vision(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, unsigned int __pyx_v_sobel_threshold, unsigned int __pyx_v_bpf_threshold, unsigned int __pyx_v_bloom_threshold, int __pyx_v_inv_colormap, int __pyx_v_fast, int __pyx_v_blend) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_predator_vision __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("predator_vision", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 6;
  __pyx_t_2.sobel_threshold = __pyx_v_sobel_threshold;
  __pyx_t_2.bpf_threshold = __pyx_v_bpf_threshold;
  __pyx_t_2.bloom_threshold = __pyx_v_bloom_threshold;
  __pyx_t_2.inv_colormap = __pyx_v_inv_colormap;
  __pyx_t_2.fast = __pyx_v_fast;
  __pyx_t_2.blend = __pyx_v_blend;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_predator_vision(__pyx_v_surface_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.predator_vision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1409
 * 
 * 
 * cpdef inline blood(object surface_, float [:, :] mask_, float perc_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER 2D GAME "HURT EFFECT"
 */

static PyObject *__pyx_pw_12PygameShader_6shader_81blood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_blood(PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_mask_, float __pyx_v_perc_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  Py_ssize_t __pyx_v_mask_w;
  Py_ssize_t __pyx_v_mask_h;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t *__pyx_t_9;
  int __pyx_t_10;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blood", 0);

  /* "PygameShader/shader.pyx":1422
 * 
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1422, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1423
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(mask_, (numpy.ndarray, cython.view.memoryview)), \
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1422, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1425
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert PyObject_IsInstance(mask_, (numpy.ndarray, cython.view.memoryview)), \             # <<<<<<<<<<<<<<
 *         "\nArgument mask_ must be a numpy.ndarray or cython memoryview types got %s " % type(mask_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_mask_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
    __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_memoryview_type));
    __pyx_t_4 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1425, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1426
 * 
 *     assert PyObject_IsInstance(mask_, (numpy.ndarray, cython.view.memoryview)), \
 *         "\nArgument mask_ must be a numpy.ndarray or cython memoryview types got %s " % type(mask_)             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t w, h
 */
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_mask_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_mask__must_be_a_numpy, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1425, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1429
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = surface_.get_size()             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t mask_w, mask_h
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 1429, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(1, 1429, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 1429, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1429, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1429, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_w = __pyx_t_7;
  __pyx_v_h = __pyx_t_8;

  /* "PygameShader/shader.pyx":1432
 * 
 *     cdef Py_ssize_t mask_w, mask_h
 *     mask_w, mask_h = mask_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     assert w == mask_w and h == mask_h, "\nSurface size and mask size mismatch"
 */
  __pyx_t_9 = __pyx_v_mask_.shape;
  __pyx_t_8 = (__pyx_t_9[0]);
  __pyx_t_7 = (__pyx_t_9[1]);
  __pyx_v_mask_w = __pyx_t_8;
  __pyx_v_mask_h = __pyx_t_7;

  /* "PygameShader/shader.pyx":1434
 *     mask_w, mask_h = mask_.shape[:2]
 * 
 *     assert w == mask_w and h == mask_h, "\nSurface size and mask size mismatch"             # <<<<<<<<<<<<<<
 * 
 *     shader_blood_inplace_c(pixels3d(surface_), mask_, perc_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_10 = ((__pyx_v_w == __pyx_v_mask_w) != 0);
    if (__pyx_t_10) {
    } else {
      __pyx_t_3 = __pyx_t_10;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_10 = ((__pyx_v_h == __pyx_v_mask_h) != 0);
    __pyx_t_3 = __pyx_t_10;
    __pyx_L5_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Surface_size_and_mask_size_mism);
      __PYX_ERR(1, 1434, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1436
 *     assert w == mask_w and h == mask_h, "\nSurface size and mask size mismatch"
 * 
 *     shader_blood_inplace_c(pixels3d(surface_), mask_, perc_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 1436, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_blood_inplace_c(__pyx_t_11, __pyx_v_mask_, __pyx_v_perc_);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "PygameShader/shader.pyx":1409
 * 
 * 
 * cpdef inline blood(object surface_, float [:, :] mask_, float perc_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER 2D GAME "HURT EFFECT"
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_AddTraceback("PygameShader.shader.blood", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_81blood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_80blood[] = "\n    SHADER 2D GAME \"HURT EFFECT\"\n    \n    This effect is used in 2D game when the player is being hurt\n    THE MASK DETERMINE THE CONTOUR USED FOR THE BLOOD EFFECT.\n\n    :param surface_ : pygame.Surface; compatible surface 24 - 32 bit\n    :param mask_    : numpy.ndarray shape (w, h) of float values in range [0.0...1.0]\n    :param perc_    : Percentage value in range [0.0 ... 1.0] with 1.0 being 100%\n    :return         : void\n    \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_81blood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  __Pyx_memviewslice __pyx_v_mask_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  float __pyx_v_perc_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blood (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_mask_2,&__pyx_n_s_perc,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("blood", 1, 3, 3, 1); __PYX_ERR(1, 1409, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("blood", 1, 3, 3, 2); __PYX_ERR(1, 1409, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blood") < 0)) __PYX_ERR(1, 1409, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_mask_ = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mask_.memview)) __PYX_ERR(1, 1409, __pyx_L3_error)
    __pyx_v_perc_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_perc_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1409, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blood", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1409, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.blood", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_80blood(__pyx_self, __pyx_v_surface_, __pyx_v_mask_, __pyx_v_perc_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_80blood(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_mask_, float __pyx_v_perc_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blood", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_mask_.memview)) { __Pyx_RaiseUnboundLocalError("mask_"); __PYX_ERR(1, 1409, __pyx_L1_error) }
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_blood(__pyx_v_surface_, __pyx_v_mask_, __pyx_v_perc_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.blood", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_mask_, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1440
 * 
 * # TODO DOC
 * cpdef inline object make_palette(int width, float fh, float fs, float fl):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_83make_palette(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_make_palette(int __pyx_v_width, float __pyx_v_fh, float __pyx_v_fs, float __pyx_v_fl, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_palette", 0);

  /* "PygameShader/shader.pyx":1459
 *     """
 * 
 *     return make_palette_c(width, fh, fs, fl)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_make_palette_c(__pyx_v_width, __pyx_v_fh, __pyx_v_fs, __pyx_v_fl); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":1440
 * 
 * # TODO DOC
 * cpdef inline object make_palette(int width, float fh, float fs, float fl):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.make_palette", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_83make_palette(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_82make_palette[] = "\n    \n    CREATE A PALETTE OF RGB COLORS\n\n    e.g:\n        # below: palette of 256 colors & surface (width=256, height=50).\n        # hue * 6, saturation = 255.0, lightness * 2.0\n        palette, surf = make_palette(256, 50, 6, 255, 2)\n        palette, surf = make_palette(256, 50, 4, 255, 2)\n\n    :param width  : integer, Palette width\n    :param fh     : float, hue factor\n    :param fs     : float, saturation factor\n    :param fl     : float, lightness factor\n    :return       : Return a 1D array palette\n\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_83make_palette(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_width;
  float __pyx_v_fh;
  float __pyx_v_fs;
  float __pyx_v_fl;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_palette (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width,&__pyx_n_s_fh,&__pyx_n_s_fs,&__pyx_n_s_fl,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fh)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("make_palette", 1, 4, 4, 1); __PYX_ERR(1, 1440, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("make_palette", 1, 4, 4, 2); __PYX_ERR(1, 1440, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("make_palette", 1, 4, 4, 3); __PYX_ERR(1, 1440, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "make_palette") < 0)) __PYX_ERR(1, 1440, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_width = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1440, __pyx_L3_error)
    __pyx_v_fh = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_fh == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1440, __pyx_L3_error)
    __pyx_v_fs = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_fs == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1440, __pyx_L3_error)
    __pyx_v_fl = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_fl == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1440, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("make_palette", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1440, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.make_palette", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_82make_palette(__pyx_self, __pyx_v_width, __pyx_v_fh, __pyx_v_fs, __pyx_v_fl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_82make_palette(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width, float __pyx_v_fh, float __pyx_v_fs, float __pyx_v_fl) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_palette", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_make_palette(__pyx_v_width, __pyx_v_fh, __pyx_v_fs, __pyx_v_fl, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.make_palette", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1463
 * 
 * # todo develop DOC
 * cpdef inline fire_sub(             # <<<<<<<<<<<<<<
 *         int width,
 *         int height,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_85fire_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_fire_sub(int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_fire, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fire_sub", 0);

  /* "PygameShader/shader.pyx":1484
 *     """
 * 
 *     return fire_surface24_c(width, height, factor, palette, fire)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_fire_surface24_c(__pyx_v_width, __pyx_v_height, __pyx_v_factor, __pyx_v_palette, __pyx_v_fire, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":1463
 * 
 * # todo develop DOC
 * cpdef inline fire_sub(             # <<<<<<<<<<<<<<
 *         int width,
 *         int height,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.fire_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_85fire_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_84fire_sub[] = "\n\n    CREATE A FIRE EFFECT\n\n    :param width    : integer; max width of the effect\n    :param height   : integer; max height of the effect\n    :param factor   : float; factor to reduce the flame effect\n    :param palette  : ndarray; Color palette 1d numpy array (colors buffer unsigned int values)\n    :param fire     : ndarray; 2d array (x, y) (contiguous) containing float values\n    :return         : Return a numpy array containing the fire effect array shape\n     (w, h, 3) of RGB pixels\n     \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_85fire_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_width;
  int __pyx_v_height;
  float __pyx_v_factor;
  __Pyx_memviewslice __pyx_v_palette = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fire = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fire_sub (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_factor_2,&__pyx_n_s_palette_2,&__pyx_n_s_fire,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fire_sub", 1, 5, 5, 1); __PYX_ERR(1, 1463, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fire_sub", 1, 5, 5, 2); __PYX_ERR(1, 1463, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_palette_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fire_sub", 1, 5, 5, 3); __PYX_ERR(1, 1463, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fire)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fire_sub", 1, 5, 5, 4); __PYX_ERR(1, 1463, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fire_sub") < 0)) __PYX_ERR(1, 1463, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_width = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1464, __pyx_L3_error)
    __pyx_v_height = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1465, __pyx_L3_error)
    __pyx_v_factor = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1466, __pyx_L3_error)
    __pyx_v_palette = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_palette.memview)) __PYX_ERR(1, 1467, __pyx_L3_error)
    __pyx_v_fire = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fire.memview)) __PYX_ERR(1, 1468, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fire_sub", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1463, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.fire_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_84fire_sub(__pyx_self, __pyx_v_width, __pyx_v_height, __pyx_v_factor, __pyx_v_palette, __pyx_v_fire);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_84fire_sub(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_fire) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fire_sub", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_palette.memview)) { __Pyx_RaiseUnboundLocalError("palette"); __PYX_ERR(1, 1463, __pyx_L1_error) }
  if (unlikely(!__pyx_v_fire.memview)) { __Pyx_RaiseUnboundLocalError("fire"); __PYX_ERR(1, 1463, __pyx_L1_error) }
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_fire_sub(__pyx_v_width, __pyx_v_height, __pyx_v_factor, __pyx_v_palette, __pyx_v_fire, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.fire_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_palette, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fire, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1489
 * 
 * 
 * cpdef inline fire_effect(             # <<<<<<<<<<<<<<
 *         int width_,
 *         int height_,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_87fire_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_fire_effect(int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_fire_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_fire_effect *__pyx_optional_args) {
  unsigned short __pyx_v_reduce_factor_ = ((unsigned short)3);
  unsigned short __pyx_v_fire_intensity_ = ((unsigned short)32);

  /* "PygameShader/shader.pyx":1499
 *         unsigned short int reduce_factor_ = 3,
 *         unsigned short int fire_intensity_= 32,
 *         bint smooth_                      = True,             # <<<<<<<<<<<<<<
 *         bint bloom_                       = True,
 *         bint fast_bloom_                  = True,
 */
  int __pyx_v_smooth_ = ((int)1);

  /* "PygameShader/shader.pyx":1500
 *         unsigned short int fire_intensity_= 32,
 *         bint smooth_                      = True,
 *         bint bloom_                       = True,             # <<<<<<<<<<<<<<
 *         bint fast_bloom_                  = True,
 *         unsigned char bpf_threshold_      = 0,
 */
  int __pyx_v_bloom_ = ((int)1);

  /* "PygameShader/shader.pyx":1501
 *         bint smooth_                      = True,
 *         bint bloom_                       = True,
 *         bint fast_bloom_                  = True,             # <<<<<<<<<<<<<<
 *         unsigned char bpf_threshold_      = 0,
 *         unsigned int low_                 = 0,
 */
  int __pyx_v_fast_bloom_ = ((int)1);
  unsigned char __pyx_v_bpf_threshold_ = ((unsigned char)0);
  unsigned int __pyx_v_low_ = ((unsigned int)0);
  unsigned int __pyx_v_high_ = ((unsigned int)0x258);

  /* "PygameShader/shader.pyx":1505
 *         unsigned int low_                 = 0,
 *         unsigned int high_                = 600,
 *         bint brightness_                  = True,             # <<<<<<<<<<<<<<
 *         float brightness_intensity_       = 0.15,
 *         object surface_                   = None,
 */
  int __pyx_v_brightness_ = ((int)1);
  float __pyx_v_brightness_intensity_ = ((float)0.15);

  /* "PygameShader/shader.pyx":1507
 *         bint brightness_                  = True,
 *         float brightness_intensity_       = 0.15,
 *         object surface_                   = None,             # <<<<<<<<<<<<<<
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),
 */
  PyObject *__pyx_v_surface_ = ((PyObject *)Py_None);

  /* "PygameShader/shader.pyx":1508
 *         float brightness_intensity_       = 0.15,
 *         object surface_                   = None,
 *         bint adjust_palette_              = False,             # <<<<<<<<<<<<<<
 *         tuple hsl_                        = (10, 80, 1.8),
 *         bint transpose_                   = False,
 */
  int __pyx_v_adjust_palette_ = ((int)0);

  /* "PygameShader/shader.pyx":1509
 *         object surface_                   = None,
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),             # <<<<<<<<<<<<<<
 *         bint transpose_                   = False,
 *         bint border_                      = False,
 */
  PyObject *__pyx_v_hsl_ = ((PyObject*)__pyx_tuple__13);

  /* "PygameShader/shader.pyx":1510
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),
 *         bint transpose_                   = False,             # <<<<<<<<<<<<<<
 *         bint border_                      = False,
 *         bint blur_                        = True
 */
  int __pyx_v_transpose_ = ((int)0);

  /* "PygameShader/shader.pyx":1511
 *         tuple hsl_                        = (10, 80, 1.8),
 *         bint transpose_                   = False,
 *         bint border_                      = False,             # <<<<<<<<<<<<<<
 *         bint blur_                        = True
 *         ):
 */
  int __pyx_v_border_ = ((int)0);

  /* "PygameShader/shader.pyx":1512
 *         bint transpose_                   = False,
 *         bint border_                      = False,
 *         bint blur_                        = True             # <<<<<<<<<<<<<<
 *         ):
 *     """
 */
  int __pyx_v_blur_ = ((int)1);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  struct __pyx_opt_args_12PygameShader_6shader_shader_fire_effect_c __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fire_effect", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_fire_intensity_ = __pyx_optional_args->fire_intensity_;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_smooth_ = __pyx_optional_args->smooth_;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_bloom_ = __pyx_optional_args->bloom_;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_fast_bloom_ = __pyx_optional_args->fast_bloom_;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_bpf_threshold_ = __pyx_optional_args->bpf_threshold_;
                if (__pyx_optional_args->__pyx_n > 6) {
                  __pyx_v_low_ = __pyx_optional_args->low_;
                  if (__pyx_optional_args->__pyx_n > 7) {
                    __pyx_v_high_ = __pyx_optional_args->high_;
                    if (__pyx_optional_args->__pyx_n > 8) {
                      __pyx_v_brightness_ = __pyx_optional_args->brightness_;
                      if (__pyx_optional_args->__pyx_n > 9) {
                        __pyx_v_brightness_intensity_ = __pyx_optional_args->brightness_intensity_;
                        if (__pyx_optional_args->__pyx_n > 10) {
                          __pyx_v_surface_ = __pyx_optional_args->surface_;
                          if (__pyx_optional_args->__pyx_n > 11) {
                            __pyx_v_adjust_palette_ = __pyx_optional_args->adjust_palette_;
                            if (__pyx_optional_args->__pyx_n > 12) {
                              __pyx_v_hsl_ = __pyx_optional_args->hsl_;
                              if (__pyx_optional_args->__pyx_n > 13) {
                                __pyx_v_transpose_ = __pyx_optional_args->transpose_;
                                if (__pyx_optional_args->__pyx_n > 14) {
                                  __pyx_v_border_ = __pyx_optional_args->border_;
                                  if (__pyx_optional_args->__pyx_n > 15) {
                                    __pyx_v_blur_ = __pyx_optional_args->blur_;
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":1712
 *     # todo reduce_factor=0 and border = True crash
 * 
 *     assert reduce_factor_ in (0, 1, 2, 3, 4), \             # <<<<<<<<<<<<<<
 *         "Argument reduce factor must be in range 0 ... 4 " \
 *         "\n reduce_factor_ = 1 correspond to dividing the image size by 2" \
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    switch (__pyx_v_reduce_factor_) {
      case 0:
      case 1:
      case 2:
      case 3:
      case 4:
      __pyx_t_1 = 1;
      break;
      default:
      __pyx_t_1 = 0;
      break;
    }
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_reduce_factor_must_be_i);
      __PYX_ERR(1, 1712, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1716
 *         "\n reduce_factor_ = 1 correspond to dividing the image size by 2" \
 *         "\n reduce_factor_ = 2 correspond to dividing the image size by 4"
 *     assert 0 <= fire_intensity_ < 33, \             # <<<<<<<<<<<<<<
 *         "Argument fire_intensity_ must be in range [0 ... 32] got %s" % fire_intensity_
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (0 <= __pyx_v_fire_intensity_);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_fire_intensity_ < 33);
    }
    if (unlikely(!(__pyx_t_1 != 0))) {

      /* "PygameShader/shader.pyx":1717
 *         "\n reduce_factor_ = 2 correspond to dividing the image size by 4"
 *     assert 0 <= fire_intensity_ < 33, \
 *         "Argument fire_intensity_ must be in range [0 ... 32] got %s" % fire_intensity_             # <<<<<<<<<<<<<<
 * 
 *     assert width_ > 0 and height_ > 0, "Argument width or height cannot be null or < 0"
 */
      __pyx_t_2 = __Pyx_PyInt_From_unsigned_short(__pyx_v_fire_intensity_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Argument_fire_intensity__must_be, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 1716, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1719
 *         "Argument fire_intensity_ must be in range [0 ... 32] got %s" % fire_intensity_
 * 
 *     assert width_ > 0 and height_ > 0, "Argument width or height cannot be null or < 0"             # <<<<<<<<<<<<<<
 *     assert factor_ > 0, "Argument factor_ cannot be null or < 0"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_width_ > 0) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_1 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_height_ > 0) != 0);
    __pyx_t_1 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_width_or_height_cannot);
      __PYX_ERR(1, 1719, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1720
 * 
 *     assert width_ > 0 and height_ > 0, "Argument width or height cannot be null or < 0"
 *     assert factor_ > 0, "Argument factor_ cannot be null or < 0"             # <<<<<<<<<<<<<<
 * 
 *     return shader_fire_effect_c(
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_factor_ > 0.0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_factor__cannot_be_null);
      __PYX_ERR(1, 1720, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1722
 *     assert factor_ > 0, "Argument factor_ cannot be null or < 0"
 * 
 *     return shader_fire_effect_c(             # <<<<<<<<<<<<<<
 *         width_, height_, factor_, palette_, fire_,
 *         reduce_factor_, fire_intensity_, smooth_,
 */
  __Pyx_XDECREF(__pyx_r);

  /* "PygameShader/shader.pyx":1727
 *         bloom_, fast_bloom_, bpf_threshold_, low_, high_, brightness_,
 *         brightness_intensity_, surface_, adjust_palette_,
 *         hsl_, transpose_, border_, blur_             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_5.__pyx_n = 16;
  __pyx_t_5.reduce_factor_ = __pyx_v_reduce_factor_;
  __pyx_t_5.fire_intensity_ = __pyx_v_fire_intensity_;
  __pyx_t_5.smooth_ = __pyx_v_smooth_;
  __pyx_t_5.bloom_ = __pyx_v_bloom_;
  __pyx_t_5.fast_bloom_ = __pyx_v_fast_bloom_;
  __pyx_t_5.bpf_threshold_ = __pyx_v_bpf_threshold_;
  __pyx_t_5.low_ = __pyx_v_low_;
  __pyx_t_5.high_ = __pyx_v_high_;
  __pyx_t_5.brightness_ = __pyx_v_brightness_;
  __pyx_t_5.brightness_intensity_ = __pyx_v_brightness_intensity_;
  __pyx_t_5.surface_ = __pyx_v_surface_;
  __pyx_t_5.adjust_palette_ = __pyx_v_adjust_palette_;
  __pyx_t_5.hsl_ = __pyx_v_hsl_;
  __pyx_t_5.transpose_ = __pyx_v_transpose_;
  __pyx_t_5.border_ = __pyx_v_border_;
  __pyx_t_5.blur_ = __pyx_v_blur_;
  __pyx_t_3 = __pyx_f_12PygameShader_6shader_shader_fire_effect_c(__pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_fire_, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":1489
 * 
 * 
 * cpdef inline fire_effect(             # <<<<<<<<<<<<<<
 *         int width_,
 *         int height_,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("PygameShader.shader.fire_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_87fire_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_86fire_effect[] = "\n    FIRE SHADER EFFECT \n\n    * FIRE TEXTURE SIZES \n    \n    input width_  : integer,  \n    input height_ : integer\n    \n    width_ and height_ values define the size of the texture e.g Surface(width x height)\n\n    * FIRE ASPECT (CONTROL OVER THE WIDTH): \n    \n    inputs low_ : integer  \n    input high_ : integer \n    \n    Optional arguments low_ & high_ (integer values) define the width 's limits of the fire effect. \n    low_ for the starting point and high_ for the ending of the effect.\n    e.g low_ = 10 and high_ = 200. The fire effect will be contain within width = 10 and 200\n    low_ & high_ values must be in range [0 ... width_]  \n        \n    * FIRE HEIGHT:\n    \n    input factor_ : float\n    \n    The fire maximum height can be adjust with the variable factor_ (float value)\n    value > 3.95 will contain the effect within the display \n    value < 3.95 will enlarge the effect over the display height  \n    Recommended value is 3.95 with reduce_factor_ = 3 otherwise adjust the value manually \n    to contain the fire effect within the display\n        \n    * SPEED CONSIDERATION\n    \n    input reduce_factor_ : integer\n    \n    The argument reduce_factor_ control the size of the texture to be processed \n    e.g : a value of 2, divide by 4 the pygame surface define by the values (width_ & height_)\n    Smaller texture improve the overall performances but will slightly degrade the fire aspect, \n    especially if the blur and smooth option are not enabled.\n    Recommended value for reduce_factor_ is 3 (fast process)   \n    reduce_factor_ values must be an integer in range [ 0 ... 4] \n    The reduce_factor_ value will have a significant impact on the fire effect maximum height, \n    adjust the argument factor_ accordingly\n\n    * FIRE INTENSITY AT THE SOURCE\n    \n    input fire_intensity_: integer\n    \n    Set the fire intensity with the variable fire_intensity_, 0 low flame,\n    32 maximum flame effect\n    Values must be an ""int in range [0 ... 32] \n\n    * SMOOTHING THE EFFECT\n    \n    input smooth_: True | False\n    \n    When smooth_ is True the algorithm will use the pygame function smoothscale (bi-linear \n    filtering) or False the final texture will be adjust with the scale function.\n    Set this variable to False if you need the best performance for the effect or if you require\n    a pixelated fire effect. Otherwise set the variable to True for a more realistic effect. \n\n    \n    * BLOOM EFFECT \n    \n    input bloom_         : True | False\n    input fast_bloom_    : True | False\n    input bpf_threshold_ : integer\n       \n    Fire effect produce a bright and smooth light effect to the background texture where the fire \n    intensity is at its maximum.\n    Use the flag fast_bloom_ for a compromise between a realistic effect and the best performances\n    The flag fast_bloom_ define a very fast bloom algo using only the smallest texture \n    to create a bloom effect (all the intermediate textures will be bypassed). See the bloom effect \n    project for more details.\n    When fast_bloom is False, all the sub-surfaces will be blit to the final effect and will \n    produce a more realistic fire effect (this will slightly degrade the overall performances). \n    If the fire effect is too bright, you can always adjust the bright pass filter value\n    bpf_threshold_(this will adjust the bloom intensity)\n    bpf_threshold_ value must be in range [ 0 ... 255]   \n    Below 128 the bloom effect will be more noticeable and above 128 only the brightest\n    area will be enhanced.\n\n    * LIGHT EFFECT INTENSITY\n\n    input brightness_            : True | False\n    input brightness_intensity_  : float\n\n    When the flag is set to True, the algorithm will use an external function, \n    <shader_brightness24_exclude_inplace_c> to increase the brightness of the effect / texture\n    A custom color can be passed to the function defining the pixels to be ignored during t""he \n    process (default is black color).\n    the value must be in range [-1.0 ... 1.0]. Values below zero will decrease the brightness \n    of the flame effect and positive values will increase the brightness of the effect (causing\n    bright white patches on the fire texture). \n    Values below -0.4 will cause the fire effect to be translucent and this effect can also be \n    used for simulating ascending heat convection effects on a background texture.\n    \n    \n    * OPTIONAL SURFACE\n      \n    input surface_ : pygame.Surface\n      \n    This is an optional surface that can be passed to the shader to improve the performances \n    and to avoid a new surface to be generated every iterations. The surface size must match \n    exactly the reduce texture dimensions otherwise an exception will be raise. \n    see reduce_factor_ option to determine the fire texture size that will be processed.\n    \n    * COLOR PALETTE ADJUSTMENT  \n    \n    input adjust_palette_ : True | False\n    input hsl_            : (10, 80, 1.8)\n\n    Set this flag to True to modify the color palette of the fire texture. \n    This allow the HSL color model to be apply to the palette values\n    You can redefine the palette when the flag is True and by customizing a tuple of 3 float \n    values, default is (10, 80, 1.8). \n    The first value control the palette hue value, the second is for the saturation and last, \n    the palette color lightness. \n    With the variable hsl_ you can rotate the palette colors and define a new flame\n    aspect/color/intensity\n    If adjust_palette_ is True the original palette define by the argument palette_, will \n    be disregarded.Instead a new palette will be created with the hsl values\n\n    * FLAME ORIENTATION / DIRECTION & BORDER FLAME EFFECT\n     \n    input transpose_ = True | False,\n    input border_    = True | False,\n    \n    transpose_ = True, this will transpose the final array \n    for e.g :  \n    If the final fire tex""ture is (w, h) after setting the transpose flag, the final \n    fire texture will become (h, w). As a result the fire effect will be transversal (starting \n    from the right of the display to the left side). \n    You can always transpose / flip the texture to get the right flame orientation  \n    BORDER FLAME EFFECT \n    border_ = True to create a flame effect burning the edge of the display. This version is only\n    compatible with symmetrical display or textures (same width & height). If the display \n    is asymmetric, the final border fire effect will be shown within the display and not neccessary \n    on the frame border \n    \n    * FINAL TOUCH\n    \n    input blur_ : True | False\n    \n    This will will blur the fire effect for a more realistic appearance, remove all the jagged \n    edge when and pixelated effect\n    \n    \n    :param width_           : integer; Size (width) of the surface or display in pixels\n    :param height_          : integer; size (height) of the surface or display in pixels\n    :param factor_          : float; Value controlling the fire height value\n                              must be in range [3.95 ... 4.2].\n                              The value 3.95 gives the highest flame effect\n    :param palette_         : numpy.ndarray, buffer containing mapped RGB colors (uint values)\n    :param fire_            : numpy.ndarray shape (w, h) containing float values (fire intensity).\n                              For better performance it is advised to set the array to the size \n                              of the texture after applying the reduction_factor_.\n                              For example if the reduction_factor_ is 2, the texture would have \n                              width >> 1 and height >> 1 and the fire_array should be set to \n                              numpy.empty((height >> 1, width >> 1), float32)\n    :param reduce_factor_   : unsigned short int ; Can be either 0, 1, 2, 3, 4. \n            ""                  2 and 3 provide the best performance and the best looking effect.\n    :param fire_intensity_  : Integer; Control the original amount of energy at the\n                              bottom of the fire, must be in range of [0 ... 32]. \n                              32 being the maximum value and the maximum fire intensity\n    :param smooth_          : boolean; True smoothscale (bi-linear filtering) or\n                              scale algorithm jagged edges (mush faster)\n    :param bloom_           : boolean; True or False, True apply a bloom effect to the fire effect\n    :param fast_bloom_      : boolean; Fastest bloom. This reduce the amount of calculation\n    :param bpf_threshold_   : integer; control the bright pass filter threshold\n                              value, must be in range [0 ... 255].\n                              Maximum brightness amplification with threshold = 0, \n                              when bpf_threshold_ = 255, no change.\n    :param low_             : integer; Starting position x for the fire effect\n    :param high_            : integer; Ending position x for the fire effect\n    :param brightness_      : boolean; True apply a bright filter shader to the array.\n                              Increase overall brightness of the effect\n    :param brightness_intensity_: float; must be in range [-1.0 ... 1.0] control\n                              the brightness intensity\n                              of the effect\n    :param surface_         : pygame.Surface. Pass a surface to the shader for\n                              better performance, otherwise a new surface will be created each \n                              calls.\n    :param adjust_palette_  : boolean; True adjust the palette setting HSL\n                              (hue, saturation, luminescence).\n                              Be aware that if adjust_palette is True, the optional palette \n                              passed to the Shader wil""l be disregarded\n    :param hsl_             : tuple; float values of hue, saturation and luminescence.\n                              Hue in range [0.0 ... 100],  saturation [0...100], \n                              luminescence [0.0 ... 2.0]\n    :param transpose_       : boolean; Transpose the array (w, h) become (h, w).\n                              The fire effect will start from the left and move to the right\n    :param border_          : boolean; Flame effect affect the border of the texture\n    :param blur_            : boolean; Blur the fire effect\n    :return                 : Return a pygame surface that can be blit directly to the game display\n\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_87fire_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_width_;
  int __pyx_v_height_;
  float __pyx_v_factor_;
  __Pyx_memviewslice __pyx_v_palette_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fire_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned short __pyx_v_reduce_factor_;
  unsigned short __pyx_v_fire_intensity_;
  int __pyx_v_smooth_;
  int __pyx_v_bloom_;
  int __pyx_v_fast_bloom_;
  unsigned char __pyx_v_bpf_threshold_;
  unsigned int __pyx_v_low_;
  unsigned int __pyx_v_high_;
  int __pyx_v_brightness_;
  float __pyx_v_brightness_intensity_;
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_adjust_palette_;
  PyObject *__pyx_v_hsl_ = 0;
  int __pyx_v_transpose_;
  int __pyx_v_border_;
  int __pyx_v_blur_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fire_effect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width_2,&__pyx_n_s_height_2,&__pyx_n_s_factor,&__pyx_n_s_palette,&__pyx_n_s_fire_2,&__pyx_n_s_reduce_factor,&__pyx_n_s_fire_intensity,&__pyx_n_s_smooth,&__pyx_n_s_bloom,&__pyx_n_s_fast_bloom,&__pyx_n_s_bpf_threshold_2,&__pyx_n_s_low,&__pyx_n_s_high,&__pyx_n_s_brightness,&__pyx_n_s_brightness_intensity,&__pyx_n_s_surface,&__pyx_n_s_adjust_palette,&__pyx_n_s_hsl,&__pyx_n_s_transpose,&__pyx_n_s_border,&__pyx_n_s_blur,0};
    PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

    /* "PygameShader/shader.pyx":1507
 *         bint brightness_                  = True,
 *         float brightness_intensity_       = 0.15,
 *         object surface_                   = None,             # <<<<<<<<<<<<<<
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),
 */
    values[15] = ((PyObject *)Py_None);

    /* "PygameShader/shader.pyx":1509
 *         object surface_                   = None,
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),             # <<<<<<<<<<<<<<
 *         bint transpose_                   = False,
 *         bint border_                      = False,
 */
    values[17] = ((PyObject*)__pyx_tuple__14);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        CYTHON_FALLTHROUGH;
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        CYTHON_FALLTHROUGH;
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fire_effect", 0, 5, 21, 1); __PYX_ERR(1, 1489, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fire_effect", 0, 5, 21, 2); __PYX_ERR(1, 1489, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_palette)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fire_effect", 0, 5, 21, 3); __PYX_ERR(1, 1489, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fire_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fire_effect", 0, 5, 21, 4); __PYX_ERR(1, 1489, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduce_factor);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fire_intensity);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_smooth);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bloom);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast_bloom);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bpf_threshold_2);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_low);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_high);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_brightness);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_brightness_intensity);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface);
          if (value) { values[15] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_adjust_palette);
          if (value) { values[16] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hsl);
          if (value) { values[17] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transpose);
          if (value) { values[18] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 19:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_border);
          if (value) { values[19] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 20:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blur);
          if (value) { values[20] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fire_effect") < 0)) __PYX_ERR(1, 1489, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        CYTHON_FALLTHROUGH;
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        CYTHON_FALLTHROUGH;
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_width_ = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1490, __pyx_L3_error)
    __pyx_v_height_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_height_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1491, __pyx_L3_error)
    __pyx_v_factor_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_factor_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1492, __pyx_L3_error)
    __pyx_v_palette_ = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_palette_.memview)) __PYX_ERR(1, 1493, __pyx_L3_error)
    __pyx_v_fire_ = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fire_.memview)) __PYX_ERR(1, 1494, __pyx_L3_error)
    if (values[5]) {
      __pyx_v_reduce_factor_ = __Pyx_PyInt_As_unsigned_short(values[5]); if (unlikely((__pyx_v_reduce_factor_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 1497, __pyx_L3_error)
    } else {
      __pyx_v_reduce_factor_ = ((unsigned short)3);
    }
    if (values[6]) {
      __pyx_v_fire_intensity_ = __Pyx_PyInt_As_unsigned_short(values[6]); if (unlikely((__pyx_v_fire_intensity_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 1498, __pyx_L3_error)
    } else {
      __pyx_v_fire_intensity_ = ((unsigned short)32);
    }
    if (values[7]) {
      __pyx_v_smooth_ = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_smooth_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1499, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1499
 *         unsigned short int reduce_factor_ = 3,
 *         unsigned short int fire_intensity_= 32,
 *         bint smooth_                      = True,             # <<<<<<<<<<<<<<
 *         bint bloom_                       = True,
 *         bint fast_bloom_                  = True,
 */
      __pyx_v_smooth_ = ((int)1);
    }
    if (values[8]) {
      __pyx_v_bloom_ = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_bloom_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1500, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1500
 *         unsigned short int fire_intensity_= 32,
 *         bint smooth_                      = True,
 *         bint bloom_                       = True,             # <<<<<<<<<<<<<<
 *         bint fast_bloom_                  = True,
 *         unsigned char bpf_threshold_      = 0,
 */
      __pyx_v_bloom_ = ((int)1);
    }
    if (values[9]) {
      __pyx_v_fast_bloom_ = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_fast_bloom_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1501, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1501
 *         bint smooth_                      = True,
 *         bint bloom_                       = True,
 *         bint fast_bloom_                  = True,             # <<<<<<<<<<<<<<
 *         unsigned char bpf_threshold_      = 0,
 *         unsigned int low_                 = 0,
 */
      __pyx_v_fast_bloom_ = ((int)1);
    }
    if (values[10]) {
      __pyx_v_bpf_threshold_ = __Pyx_PyInt_As_unsigned_char(values[10]); if (unlikely((__pyx_v_bpf_threshold_ == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 1502, __pyx_L3_error)
    } else {
      __pyx_v_bpf_threshold_ = ((unsigned char)0);
    }
    if (values[11]) {
      __pyx_v_low_ = __Pyx_PyInt_As_unsigned_int(values[11]); if (unlikely((__pyx_v_low_ == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1503, __pyx_L3_error)
    } else {
      __pyx_v_low_ = ((unsigned int)0);
    }
    if (values[12]) {
      __pyx_v_high_ = __Pyx_PyInt_As_unsigned_int(values[12]); if (unlikely((__pyx_v_high_ == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1504, __pyx_L3_error)
    } else {
      __pyx_v_high_ = ((unsigned int)0x258);
    }
    if (values[13]) {
      __pyx_v_brightness_ = __Pyx_PyObject_IsTrue(values[13]); if (unlikely((__pyx_v_brightness_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1505, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1505
 *         unsigned int low_                 = 0,
 *         unsigned int high_                = 600,
 *         bint brightness_                  = True,             # <<<<<<<<<<<<<<
 *         float brightness_intensity_       = 0.15,
 *         object surface_                   = None,
 */
      __pyx_v_brightness_ = ((int)1);
    }
    if (values[14]) {
      __pyx_v_brightness_intensity_ = __pyx_PyFloat_AsFloat(values[14]); if (unlikely((__pyx_v_brightness_intensity_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1506, __pyx_L3_error)
    } else {
      __pyx_v_brightness_intensity_ = ((float)0.15);
    }
    __pyx_v_surface_ = values[15];
    if (values[16]) {
      __pyx_v_adjust_palette_ = __Pyx_PyObject_IsTrue(values[16]); if (unlikely((__pyx_v_adjust_palette_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1508, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1508
 *         float brightness_intensity_       = 0.15,
 *         object surface_                   = None,
 *         bint adjust_palette_              = False,             # <<<<<<<<<<<<<<
 *         tuple hsl_                        = (10, 80, 1.8),
 *         bint transpose_                   = False,
 */
      __pyx_v_adjust_palette_ = ((int)0);
    }
    __pyx_v_hsl_ = ((PyObject*)values[17]);
    if (values[18]) {
      __pyx_v_transpose_ = __Pyx_PyObject_IsTrue(values[18]); if (unlikely((__pyx_v_transpose_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1510, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1510
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),
 *         bint transpose_                   = False,             # <<<<<<<<<<<<<<
 *         bint border_                      = False,
 *         bint blur_                        = True
 */
      __pyx_v_transpose_ = ((int)0);
    }
    if (values[19]) {
      __pyx_v_border_ = __Pyx_PyObject_IsTrue(values[19]); if (unlikely((__pyx_v_border_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1511, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1511
 *         tuple hsl_                        = (10, 80, 1.8),
 *         bint transpose_                   = False,
 *         bint border_                      = False,             # <<<<<<<<<<<<<<
 *         bint blur_                        = True
 *         ):
 */
      __pyx_v_border_ = ((int)0);
    }
    if (values[20]) {
      __pyx_v_blur_ = __Pyx_PyObject_IsTrue(values[20]); if (unlikely((__pyx_v_blur_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1512, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1512
 *         bint transpose_                   = False,
 *         bint border_                      = False,
 *         bint blur_                        = True             # <<<<<<<<<<<<<<
 *         ):
 *     """
 */
      __pyx_v_blur_ = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fire_effect", 0, 5, 21, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1489, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.fire_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hsl_), (&PyTuple_Type), 1, "hsl_", 1))) __PYX_ERR(1, 1509, __pyx_L1_error)
  __pyx_r = __pyx_pf_12PygameShader_6shader_86fire_effect(__pyx_self, __pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_fire_, __pyx_v_reduce_factor_, __pyx_v_fire_intensity_, __pyx_v_smooth_, __pyx_v_bloom_, __pyx_v_fast_bloom_, __pyx_v_bpf_threshold_, __pyx_v_low_, __pyx_v_high_, __pyx_v_brightness_, __pyx_v_brightness_intensity_, __pyx_v_surface_, __pyx_v_adjust_palette_, __pyx_v_hsl_, __pyx_v_transpose_, __pyx_v_border_, __pyx_v_blur_);

  /* "PygameShader/shader.pyx":1489
 * 
 * 
 * cpdef inline fire_effect(             # <<<<<<<<<<<<<<
 *         int width_,
 *         int height_,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_86fire_effect(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_fire_, unsigned short __pyx_v_reduce_factor_, unsigned short __pyx_v_fire_intensity_, int __pyx_v_smooth_, int __pyx_v_bloom_, int __pyx_v_fast_bloom_, unsigned char __pyx_v_bpf_threshold_, unsigned int __pyx_v_low_, unsigned int __pyx_v_high_, int __pyx_v_brightness_, float __pyx_v_brightness_intensity_, PyObject *__pyx_v_surface_, int __pyx_v_adjust_palette_, PyObject *__pyx_v_hsl_, int __pyx_v_transpose_, int __pyx_v_border_, int __pyx_v_blur_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_fire_effect __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fire_effect", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_palette_.memview)) { __Pyx_RaiseUnboundLocalError("palette_"); __PYX_ERR(1, 1489, __pyx_L1_error) }
  if (unlikely(!__pyx_v_fire_.memview)) { __Pyx_RaiseUnboundLocalError("fire_"); __PYX_ERR(1, 1489, __pyx_L1_error) }
  __pyx_t_2.__pyx_n = 16;
  __pyx_t_2.reduce_factor_ = __pyx_v_reduce_factor_;
  __pyx_t_2.fire_intensity_ = __pyx_v_fire_intensity_;
  __pyx_t_2.smooth_ = __pyx_v_smooth_;
  __pyx_t_2.bloom_ = __pyx_v_bloom_;
  __pyx_t_2.fast_bloom_ = __pyx_v_fast_bloom_;
  __pyx_t_2.bpf_threshold_ = __pyx_v_bpf_threshold_;
  __pyx_t_2.low_ = __pyx_v_low_;
  __pyx_t_2.high_ = __pyx_v_high_;
  __pyx_t_2.brightness_ = __pyx_v_brightness_;
  __pyx_t_2.brightness_intensity_ = __pyx_v_brightness_intensity_;
  __pyx_t_2.surface_ = __pyx_v_surface_;
  __pyx_t_2.adjust_palette_ = __pyx_v_adjust_palette_;
  __pyx_t_2.hsl_ = __pyx_v_hsl_;
  __pyx_t_2.transpose_ = __pyx_v_transpose_;
  __pyx_t_2.border_ = __pyx_v_border_;
  __pyx_t_2.blur_ = __pyx_v_blur_;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_fire_effect(__pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_fire_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.fire_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_palette_, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fire_, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1732
 * 
 * 
 * cpdef inline cloud_effect(             # <<<<<<<<<<<<<<
 *         int width_,
 *         int height_,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_89cloud_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_cloud_effect(int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_cloud_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_cloud_effect *__pyx_optional_args) {
  unsigned short __pyx_v_reduce_factor_ = ((unsigned short)2);
  unsigned short __pyx_v_cloud_intensity_ = ((unsigned short)16);

  /* "PygameShader/shader.pyx":1742
 *         unsigned short int reduce_factor_   = 2,
 *         unsigned short int cloud_intensity_ = 16,
 *         bint smooth_                        = True,             # <<<<<<<<<<<<<<
 *         bint bloom_                         = False,
 *         bint fast_bloom_                    = True,
 */
  int __pyx_v_smooth_ = ((int)1);

  /* "PygameShader/shader.pyx":1743
 *         unsigned short int cloud_intensity_ = 16,
 *         bint smooth_                        = True,
 *         bint bloom_                         = False,             # <<<<<<<<<<<<<<
 *         bint fast_bloom_                    = True,
 *         unsigned char bpf_threshold_        = 128,
 */
  int __pyx_v_bloom_ = ((int)0);

  /* "PygameShader/shader.pyx":1744
 *         bint smooth_                        = True,
 *         bint bloom_                         = False,
 *         bint fast_bloom_                    = True,             # <<<<<<<<<<<<<<
 *         unsigned char bpf_threshold_        = 128,
 *         unsigned int low_                   = 0,
 */
  int __pyx_v_fast_bloom_ = ((int)1);
  unsigned char __pyx_v_bpf_threshold_ = ((unsigned char)0x80);
  unsigned int __pyx_v_low_ = ((unsigned int)0);
  unsigned int __pyx_v_high_ = ((unsigned int)0);

  /* "PygameShader/shader.pyx":1748
 *         unsigned int low_                   = 0,
 *         unsigned int high_                  = 0,
 *         bint brightness_                    = False,             # <<<<<<<<<<<<<<
 *         float brightness_intensity_         = 0.0,
 *         object surface_                     = None,
 */
  int __pyx_v_brightness_ = ((int)0);
  float __pyx_v_brightness_intensity_ = ((float)0.0);

  /* "PygameShader/shader.pyx":1750
 *         bint brightness_                    = False,
 *         float brightness_intensity_         = 0.0,
 *         object surface_                     = None,             # <<<<<<<<<<<<<<
 *         bint transpose_                     = False,
 *         bint blur_                          = True
 */
  PyObject *__pyx_v_surface_ = ((PyObject *)Py_None);

  /* "PygameShader/shader.pyx":1751
 *         float brightness_intensity_         = 0.0,
 *         object surface_                     = None,
 *         bint transpose_                     = False,             # <<<<<<<<<<<<<<
 *         bint blur_                          = True
 *         ):
 */
  int __pyx_v_transpose_ = ((int)0);

  /* "PygameShader/shader.pyx":1752
 *         object surface_                     = None,
 *         bint transpose_                     = False,
 *         bint blur_                          = True             # <<<<<<<<<<<<<<
 *         ):
 *     """
 */
  int __pyx_v_blur_ = ((int)1);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_shader_cloud_effect_c __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cloud_effect", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_cloud_intensity_ = __pyx_optional_args->cloud_intensity_;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_smooth_ = __pyx_optional_args->smooth_;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_bloom_ = __pyx_optional_args->bloom_;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_fast_bloom_ = __pyx_optional_args->fast_bloom_;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_bpf_threshold_ = __pyx_optional_args->bpf_threshold_;
                if (__pyx_optional_args->__pyx_n > 6) {
                  __pyx_v_low_ = __pyx_optional_args->low_;
                  if (__pyx_optional_args->__pyx_n > 7) {
                    __pyx_v_high_ = __pyx_optional_args->high_;
                    if (__pyx_optional_args->__pyx_n > 8) {
                      __pyx_v_brightness_ = __pyx_optional_args->brightness_;
                      if (__pyx_optional_args->__pyx_n > 9) {
                        __pyx_v_brightness_intensity_ = __pyx_optional_args->brightness_intensity_;
                        if (__pyx_optional_args->__pyx_n > 10) {
                          __pyx_v_surface_ = __pyx_optional_args->surface_;
                          if (__pyx_optional_args->__pyx_n > 11) {
                            __pyx_v_transpose_ = __pyx_optional_args->transpose_;
                            if (__pyx_optional_args->__pyx_n > 12) {
                              __pyx_v_blur_ = __pyx_optional_args->blur_;
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":1929
 *     """
 * 
 *     assert reduce_factor_ in (0, 1, 2, 3, 4), \             # <<<<<<<<<<<<<<
 *         "Argument reduce factor must be in range 0 ... 4 " \
 *         "\n reduce_factor_ = 1 correspond to dividing the image size by 2" \
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    switch (__pyx_v_reduce_factor_) {
      case 0:
      case 1:
      case 2:
      case 3:
      case 4:
      __pyx_t_1 = 1;
      break;
      default:
      __pyx_t_1 = 0;
      break;
    }
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_reduce_factor_must_be_i);
      __PYX_ERR(1, 1929, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1934
 *         "\n reduce_factor_ = 2 correspond to dividing the image size by 4"
 * 
 *     assert width_ > 0 and height_ > 0, "Argument width or height cannot be null or < 0"             # <<<<<<<<<<<<<<
 *     assert factor_ > 0, "Argument factor_ cannot be null or < 0"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = ((__pyx_v_width_ > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_height_ > 0) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_width_or_height_cannot);
      __PYX_ERR(1, 1934, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1935
 * 
 *     assert width_ > 0 and height_ > 0, "Argument width or height cannot be null or < 0"
 *     assert factor_ > 0, "Argument factor_ cannot be null or < 0"             # <<<<<<<<<<<<<<
 * 
 *     return shader_cloud_effect_c(
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_factor_ > 0.0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_factor__cannot_be_null);
      __PYX_ERR(1, 1935, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1937
 *     assert factor_ > 0, "Argument factor_ cannot be null or < 0"
 * 
 *     return shader_cloud_effect_c(             # <<<<<<<<<<<<<<
 *         width_, height_, factor_, palette_, cloud_,
 *         reduce_factor_, cloud_intensity_, smooth_,
 */
  __Pyx_XDECREF(__pyx_r);

  /* "PygameShader/shader.pyx":1941
 *         reduce_factor_, cloud_intensity_, smooth_,
 *         bloom_, fast_bloom_, bpf_threshold_, low_, high_, brightness_,
 *         brightness_intensity_, surface_, transpose_, blur_             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_4.__pyx_n = 13;
  __pyx_t_4.reduce_factor_ = __pyx_v_reduce_factor_;
  __pyx_t_4.cloud_intensity_ = __pyx_v_cloud_intensity_;
  __pyx_t_4.smooth_ = __pyx_v_smooth_;
  __pyx_t_4.bloom_ = __pyx_v_bloom_;
  __pyx_t_4.fast_bloom_ = __pyx_v_fast_bloom_;
  __pyx_t_4.bpf_threshold_ = __pyx_v_bpf_threshold_;
  __pyx_t_4.low_ = __pyx_v_low_;
  __pyx_t_4.high_ = __pyx_v_high_;
  __pyx_t_4.brightness_ = __pyx_v_brightness_;
  __pyx_t_4.brightness_intensity_ = __pyx_v_brightness_intensity_;
  __pyx_t_4.surface_ = __pyx_v_surface_;
  __pyx_t_4.transpose_ = __pyx_v_transpose_;
  __pyx_t_4.blur_ = __pyx_v_blur_;
  __pyx_t_3 = __pyx_f_12PygameShader_6shader_shader_cloud_effect_c(__pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_cloud_, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":1732
 * 
 * 
 * cpdef inline cloud_effect(             # <<<<<<<<<<<<<<
 *         int width_,
 *         int height_,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("PygameShader.shader.cloud_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_89cloud_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_88cloud_effect[] = "\n    GENERATE CLOUD /SMOKE ON THE GAME DISPLAY \n    \n    * CLOUD TEXTURE SIZES \n    \n    input width_  : integer,  \n    input height_ : integer\n    \n    width_ and height_ values define the size of the texture e.g Surface(width x height)\n\n    * CLOUD ASPECT (CONTROL OVER THE WIDTH): \n    \n    inputs low_ : integer  \n    input high_ : integer \n    \n    Optional arguments low_ & high_ (integer values) define the width 's limits of the cloud \n    effect. low_ for the starting point and high_ for the ending of the effect.\n    e.g low_ = 10 and high_ = 200. The cloud effect will be contain within width = 10 and 200\n    low_ & high_ values must be in range [0 ... width_]  \n        \n    * CLOUD HEIGHT:\n    \n    input factor_ : float\n    \n    The cloud maximum height can be adjust with the variable factor_ (float value)\n    value > 3.95 will contain the effect within the display \n    value < 3.95 will enlarge the effect over the display height  \n    Recommended value is 3.95 with reduce_factor_ = 3 otherwise adjust the value manually \n    to contain the cloud effect within the display\n        \n    * SPEED CONSIDERATION\n    \n    input reduce_factor_ : integer\n    \n    The argument reduce_factor_ control the size of the texture to be processed \n    e.g : a value of 2, divide by 4 the pygame surface define by the values (width_ & height_)\n    Smaller texture improve the overall performances but will slightly degrade the cloud aspect, \n    especially if the blur and smooth option are not enabled.\n    Recommended value for reduce_factor_ is 3 (fast process)   \n    reduce_factor_ values must be an integer in range [ 0 ... 4] \n    The reduce_factor_ value will have a significant impact on the cloud effect maximum height, \n    adjust the argument factor_ accordingly\n\n    * CLOUD INTENSITY AT THE SOURCE\n    \n    input cloud_intensity_: integer\n    \n    Set the cloud intensity with the variable cloud_intensity_, 0 low flame,\n    32 maxi""mum flame effect\n    Values must be an int in range [0 ... 32] \n\n    * SMOOTHING THE EFFECT\n    \n    input smooth_: True | False\n    \n    When smooth_ is True the algorithm will use the pygame function smoothscale (bi-linear \n    filtering) or False the final texture will be adjust with the scale function.\n    Set this variable to False if you need the best performance for the effect or if you require\n    a pixelated cloud effect. Otherwise set the variable to True for a more realistic effect. \n   \n    * BLOOM EFFECT \n    \n    input bloom_         : True | False\n    input fast_bloom_    : True | False\n    input bpf_threshold_ : integer\n       \n    Bloom effect produce a bright and smooth light effect to the background texture where the cloud \n    intensity is at its maximum.\n    Use the flag fast_bloom_ for a compromise between a realistic effect and the best performances\n    The flag fast_bloom_ define a very fast bloom algo using only the smallest texture \n    to create a bloom effect (all the intermediate textures will be bypassed). See the bloom effect \n    project for more details.\n    When fast_bloom is False, all the sub-surfaces will be blit to the final effect and will \n    produce a more realistic cloud effect (this will slightly degrade the overall performances). \n    If the cloud effect is too bright, you can always adjust the bright pass filter value\n    bpf_threshold_(this will adjust the bloom intensity)\n    bpf_threshold_ value must be in range [ 0 ... 255]   \n    Below 128 the bloom effect will be more noticeable and above 128 only the brightest\n    area will be enhanced.\n\n    * LIGHT EFFECT INTENSITY\n\n    input brightness_            : True | False\n    input brightness_intensity_  : float\n\n    When the flag is set to True, the algorithm will use an external function, \n    <shader_brightness24_exclude_inplace_c> to increase the brightness of the effect / texture\n    A custom color can be passed to the function ""defining the pixels to be ignored during the \n    process (default is black color).\n    the value must be in range [-1.0 ... 1.0]. Values below zero will decrease the brightness \n    of the cloud effect and positive values will increase the brightness of the effect (causing\n    bright white patches on the cloud texture). \n    Values below -0.4 will cause the cloud effect to be translucent \n    \n    \n    * OPTIONAL SURFACE\n      \n    input surface_ : pygame.Surface\n      \n    This is an optional surface that can be passed to the shader to improve the performances \n    and to avoid a new surface to be generated every iterations. The surface size must match \n    exactly the reduce texture dimensions otherwise an exception will be raise. \n    see reduce_factor_ option to determine the cloud texture size that will be processed.\n    \n\n    * CLOUD ORIENTATION / DIRECTION \n     \n    input transpose_ = True | False,\n    \n    transpose_ = True, this will transpose the final array \n    for e.g :  \n    If the final cloud texture is (w, h) after setting the transpose flag, the final \n    cloud texture will become (h, w). As a result the cloud effect will be transversal (starting \n    from the right of the display to the left side). \n    You can always transpose / flip the texture to get the right cloud orientation  \n    \n    * FINAL TOUCH\n    \n    input blur_ : True | False\n    \n    This will will blur the cloud effect for a more realistic appearance, remove all the jagged \n    edge when and pixelated effect\n    \n    :param width_               : integer; Texture size (width) \n    :param height_              : integer; Texture size (height)\n    :param factor_              : float; Floating value used to control the size of the cloud\n                                  effect. Value must be in range [3.95 ... 4.2]. Value > 3.95 \n                                  will contain the smoke/ cloud effect within the display. \n                      ""            Values < 3.95 will enlarge the smoke effect.                              \n    :param palette_             : numpy.ndarray or cython memoryview containing the color for the \n                                  cloud effect (buffer containing mapped RGB colors (uint values))\n    :param cloud_               : numpy.ndarray shape (w, h) containing float values \n                                  (cloud intensity). For better performance it is advised to set the\n                                  array to the size of the texture after applying the \n                                  reduction_factor_. For example if the reduction_factor_ is 2, \n                                  the texture would have to be width >> 1 and height >> 1 and the \n                                  cloud_ array should be equivalent to numpy.empty((height >> 1, \n                                  width >> 1), float32)\n    :param reduce_factor_       : integer; unsigned short int ; Can be either 0, 1, 2, 3, 4. \n                                  2 and 3 provide the best performance and the best looking effect.\n    :param cloud_intensity_     : integer; Determine the amount of smoke the cloud\n                                  effect will generate at the base of the effect (value must be in \n                                  range [0 .. 260]). If you provide zero a random value between \n                                  0 ... 260 will be assigned. If you provide 250, a random value \n                                  between 250 and 260 will be set for the amount of smoke. \n                                  The highest the value, the more dense the cloud effect will be\n    :param smooth_              : boolean; True use a smoothscale (bi-linear filtering) or\n                                  False -> scale algorithm jagged edges (mush faster)\n    :param bloom_               : True | False, Add a bloom effect when the flag is set to True\n                                  Th""e bloom effect will smooth the cloud and create a dense smoke \n                                  areas where the cloud is the brightest.  \n    :param fast_bloom_          : True | False; This set a fast algorithm for the bloom effect (the \n                                  bloom effect will use the smallest texture)\n    :param bpf_threshold_       : integer; Bright pass filter value must be in range [ 0 ... 255]\n                                  0 produce the maximum bloom effect\n    :param low_                 : integer; must be in range [ 0 ... width_], left position of the \n                                  cloud effect \n    :param high_                : integer; must be in range [ 0 ... height_], right position of the\n                                  cloud effect\n    :param brightness_          : True | False; Increase the brightness of the cloud effect when \n                                  True\n    :param brightness_intensity_: float; Set the brightness intensity of the cloud. The value must \n                                  be in range [-1.0 ... +1.0]. Changing the value overtime will \n                                  generate a realistic cloud effect. Negative value will generate \n                                  translucent patch of smoke on the background image\n    :param surface_             : Pygame.Surface; Pass a surface to the shader for\n                                  better performance, otherwise a new surface will be created each \n                                  calls.\n    :param transpose_           : boolean; Transpose the array (w, h) become (h, w).\n                                  The cloud effect will start from the left and move to the right\n    :param blur_                : boolean; Blur the cloud effect\n    :return                     : Return a pygame surface that can be blit directly to the game \n                                  display\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_89cloud_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_width_;
  int __pyx_v_height_;
  float __pyx_v_factor_;
  __Pyx_memviewslice __pyx_v_palette_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_cloud_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned short __pyx_v_reduce_factor_;
  unsigned short __pyx_v_cloud_intensity_;
  int __pyx_v_smooth_;
  int __pyx_v_bloom_;
  int __pyx_v_fast_bloom_;
  unsigned char __pyx_v_bpf_threshold_;
  unsigned int __pyx_v_low_;
  unsigned int __pyx_v_high_;
  int __pyx_v_brightness_;
  float __pyx_v_brightness_intensity_;
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_transpose_;
  int __pyx_v_blur_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cloud_effect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width_2,&__pyx_n_s_height_2,&__pyx_n_s_factor,&__pyx_n_s_palette,&__pyx_n_s_cloud,&__pyx_n_s_reduce_factor,&__pyx_n_s_cloud_intensity,&__pyx_n_s_smooth,&__pyx_n_s_bloom,&__pyx_n_s_fast_bloom,&__pyx_n_s_bpf_threshold_2,&__pyx_n_s_low,&__pyx_n_s_high,&__pyx_n_s_brightness,&__pyx_n_s_brightness_intensity,&__pyx_n_s_surface,&__pyx_n_s_transpose,&__pyx_n_s_blur,0};
    PyObject* values[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

    /* "PygameShader/shader.pyx":1750
 *         bint brightness_                    = False,
 *         float brightness_intensity_         = 0.0,
 *         object surface_                     = None,             # <<<<<<<<<<<<<<
 *         bint transpose_                     = False,
 *         bint blur_                          = True
 */
    values[15] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("cloud_effect", 0, 5, 18, 1); __PYX_ERR(1, 1732, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("cloud_effect", 0, 5, 18, 2); __PYX_ERR(1, 1732, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_palette)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("cloud_effect", 0, 5, 18, 3); __PYX_ERR(1, 1732, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cloud)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("cloud_effect", 0, 5, 18, 4); __PYX_ERR(1, 1732, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduce_factor);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cloud_intensity);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_smooth);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bloom);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast_bloom);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bpf_threshold_2);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_low);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_high);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_brightness);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_brightness_intensity);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface);
          if (value) { values[15] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transpose);
          if (value) { values[16] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blur);
          if (value) { values[17] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cloud_effect") < 0)) __PYX_ERR(1, 1732, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_width_ = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1733, __pyx_L3_error)
    __pyx_v_height_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_height_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1734, __pyx_L3_error)
    __pyx_v_factor_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_factor_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1735, __pyx_L3_error)
    __pyx_v_palette_ = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_palette_.memview)) __PYX_ERR(1, 1736, __pyx_L3_error)
    __pyx_v_cloud_ = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cloud_.memview)) __PYX_ERR(1, 1737, __pyx_L3_error)
    if (values[5]) {
      __pyx_v_reduce_factor_ = __Pyx_PyInt_As_unsigned_short(values[5]); if (unlikely((__pyx_v_reduce_factor_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 1740, __pyx_L3_error)
    } else {
      __pyx_v_reduce_factor_ = ((unsigned short)2);
    }
    if (values[6]) {
      __pyx_v_cloud_intensity_ = __Pyx_PyInt_As_unsigned_short(values[6]); if (unlikely((__pyx_v_cloud_intensity_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 1741, __pyx_L3_error)
    } else {
      __pyx_v_cloud_intensity_ = ((unsigned short)16);
    }
    if (values[7]) {
      __pyx_v_smooth_ = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_smooth_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1742, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1742
 *         unsigned short int reduce_factor_   = 2,
 *         unsigned short int cloud_intensity_ = 16,
 *         bint smooth_                        = True,             # <<<<<<<<<<<<<<
 *         bint bloom_                         = False,
 *         bint fast_bloom_                    = True,
 */
      __pyx_v_smooth_ = ((int)1);
    }
    if (values[8]) {
      __pyx_v_bloom_ = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_bloom_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1743, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1743
 *         unsigned short int cloud_intensity_ = 16,
 *         bint smooth_                        = True,
 *         bint bloom_                         = False,             # <<<<<<<<<<<<<<
 *         bint fast_bloom_                    = True,
 *         unsigned char bpf_threshold_        = 128,
 */
      __pyx_v_bloom_ = ((int)0);
    }
    if (values[9]) {
      __pyx_v_fast_bloom_ = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_fast_bloom_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1744, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1744
 *         bint smooth_                        = True,
 *         bint bloom_                         = False,
 *         bint fast_bloom_                    = True,             # <<<<<<<<<<<<<<
 *         unsigned char bpf_threshold_        = 128,
 *         unsigned int low_                   = 0,
 */
      __pyx_v_fast_bloom_ = ((int)1);
    }
    if (values[10]) {
      __pyx_v_bpf_threshold_ = __Pyx_PyInt_As_unsigned_char(values[10]); if (unlikely((__pyx_v_bpf_threshold_ == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 1745, __pyx_L3_error)
    } else {
      __pyx_v_bpf_threshold_ = ((unsigned char)0x80);
    }
    if (values[11]) {
      __pyx_v_low_ = __Pyx_PyInt_As_unsigned_int(values[11]); if (unlikely((__pyx_v_low_ == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1746, __pyx_L3_error)
    } else {
      __pyx_v_low_ = ((unsigned int)0);
    }
    if (values[12]) {
      __pyx_v_high_ = __Pyx_PyInt_As_unsigned_int(values[12]); if (unlikely((__pyx_v_high_ == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1747, __pyx_L3_error)
    } else {
      __pyx_v_high_ = ((unsigned int)0);
    }
    if (values[13]) {
      __pyx_v_brightness_ = __Pyx_PyObject_IsTrue(values[13]); if (unlikely((__pyx_v_brightness_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1748, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1748
 *         unsigned int low_                   = 0,
 *         unsigned int high_                  = 0,
 *         bint brightness_                    = False,             # <<<<<<<<<<<<<<
 *         float brightness_intensity_         = 0.0,
 *         object surface_                     = None,
 */
      __pyx_v_brightness_ = ((int)0);
    }
    if (values[14]) {
      __pyx_v_brightness_intensity_ = __pyx_PyFloat_AsFloat(values[14]); if (unlikely((__pyx_v_brightness_intensity_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1749, __pyx_L3_error)
    } else {
      __pyx_v_brightness_intensity_ = ((float)0.0);
    }
    __pyx_v_surface_ = values[15];
    if (values[16]) {
      __pyx_v_transpose_ = __Pyx_PyObject_IsTrue(values[16]); if (unlikely((__pyx_v_transpose_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1751, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1751
 *         float brightness_intensity_         = 0.0,
 *         object surface_                     = None,
 *         bint transpose_                     = False,             # <<<<<<<<<<<<<<
 *         bint blur_                          = True
 *         ):
 */
      __pyx_v_transpose_ = ((int)0);
    }
    if (values[17]) {
      __pyx_v_blur_ = __Pyx_PyObject_IsTrue(values[17]); if (unlikely((__pyx_v_blur_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1752, __pyx_L3_error)
    } else {

      /* "PygameShader/shader.pyx":1752
 *         object surface_                     = None,
 *         bint transpose_                     = False,
 *         bint blur_                          = True             # <<<<<<<<<<<<<<
 *         ):
 *     """
 */
      __pyx_v_blur_ = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cloud_effect", 0, 5, 18, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1732, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.cloud_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_88cloud_effect(__pyx_self, __pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_cloud_, __pyx_v_reduce_factor_, __pyx_v_cloud_intensity_, __pyx_v_smooth_, __pyx_v_bloom_, __pyx_v_fast_bloom_, __pyx_v_bpf_threshold_, __pyx_v_low_, __pyx_v_high_, __pyx_v_brightness_, __pyx_v_brightness_intensity_, __pyx_v_surface_, __pyx_v_transpose_, __pyx_v_blur_);

  /* "PygameShader/shader.pyx":1732
 * 
 * 
 * cpdef inline cloud_effect(             # <<<<<<<<<<<<<<
 *         int width_,
 *         int height_,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_88cloud_effect(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_cloud_, unsigned short __pyx_v_reduce_factor_, unsigned short __pyx_v_cloud_intensity_, int __pyx_v_smooth_, int __pyx_v_bloom_, int __pyx_v_fast_bloom_, unsigned char __pyx_v_bpf_threshold_, unsigned int __pyx_v_low_, unsigned int __pyx_v_high_, int __pyx_v_brightness_, float __pyx_v_brightness_intensity_, PyObject *__pyx_v_surface_, int __pyx_v_transpose_, int __pyx_v_blur_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_cloud_effect __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cloud_effect", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_palette_.memview)) { __Pyx_RaiseUnboundLocalError("palette_"); __PYX_ERR(1, 1732, __pyx_L1_error) }
  if (unlikely(!__pyx_v_cloud_.memview)) { __Pyx_RaiseUnboundLocalError("cloud_"); __PYX_ERR(1, 1732, __pyx_L1_error) }
  __pyx_t_2.__pyx_n = 13;
  __pyx_t_2.reduce_factor_ = __pyx_v_reduce_factor_;
  __pyx_t_2.cloud_intensity_ = __pyx_v_cloud_intensity_;
  __pyx_t_2.smooth_ = __pyx_v_smooth_;
  __pyx_t_2.bloom_ = __pyx_v_bloom_;
  __pyx_t_2.fast_bloom_ = __pyx_v_fast_bloom_;
  __pyx_t_2.bpf_threshold_ = __pyx_v_bpf_threshold_;
  __pyx_t_2.low_ = __pyx_v_low_;
  __pyx_t_2.high_ = __pyx_v_high_;
  __pyx_t_2.brightness_ = __pyx_v_brightness_;
  __pyx_t_2.brightness_intensity_ = __pyx_v_brightness_intensity_;
  __pyx_t_2.surface_ = __pyx_v_surface_;
  __pyx_t_2.transpose_ = __pyx_v_transpose_;
  __pyx_t_2.blur_ = __pyx_v_blur_;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_cloud_effect(__pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_cloud_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.cloud_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_palette_, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_cloud_, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1946
 * 
 * 
 * cpdef inline mirroring_array(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_91mirroring_array(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_mirroring_array(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mirroring_array", 0);

  /* "PygameShader/shader.pyx":1959
 * 
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1959, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1960
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     return mirroring_c(pixels3d(surface_))
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1960, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1959, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1962
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     return mirroring_c(pixels3d(surface_))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1962, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_f_12PygameShader_6shader_mirroring_c(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":1946
 * 
 * 
 * cpdef inline mirroring_array(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_AddTraceback("PygameShader.shader.mirroring_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_91mirroring_array(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_90mirroring_array[] = "\n    \n    SHADER MIRRORING\n\n    This method create a mirror image \n    \n    Compatible 24 - 32 bit image / surface\n    \n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return         : returns a numpy ndarray shape (w, h, 3) \n    \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_91mirroring_array(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mirroring_array (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_90mirroring_array(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_90mirroring_array(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mirroring_array", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_mirroring_array(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.mirroring_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1967
 * 
 * 
 * cpdef inline void mirroring(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER MIRRORING (INPLACE)
 */

static PyObject *__pyx_pw_12PygameShader_6shader_93mirroring(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_mirroring(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mirroring", 0);

  /* "PygameShader/shader.pyx":1976
 *     :return : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1976, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1977
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     mirroring_inplace_c(pixels3d(surface_))
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1976, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1979
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     mirroring_inplace_c(pixels3d(surface_))             # <<<<<<<<<<<<<<
 * 
 * # cpdef inline transpose_inplace(object surface_):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1979, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_f_12PygameShader_6shader_mirroring_inplace_c(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":1967
 * 
 * 
 * cpdef inline void mirroring(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER MIRRORING (INPLACE)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.mirroring", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_93mirroring(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_92mirroring[] = "\n    SHADER MIRRORING (INPLACE)\n\n    This method create a mirror image \n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_93mirroring(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mirroring (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_92mirroring(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_92mirroring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mirroring", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_mirroring(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.mirroring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":1987
 * 
 * 
 * cpdef inline void sharpen(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_95sharpen(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sharpen(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sharpen", 0);

  /* "PygameShader/shader.pyx":1995
 *     :return         : void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1995, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":1996
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     shader_sharpen_filter_inplace_c(pixels3d(surface_))
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1996, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 1995, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":1998
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     shader_sharpen_filter_inplace_c(pixels3d(surface_))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1998, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1998, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1998, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_f_12PygameShader_6shader_shader_sharpen_filter_inplace_c(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":1987
 * 
 * 
 * cpdef inline void sharpen(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.sharpen", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_95sharpen(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_94sharpen[] = "\n    \n    SHARPEN IMAGE APPLYING THE BELOW 3 X 3 KERNEL OVER EVERY PIXELS.\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return         : void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_95sharpen(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sharpen (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_94sharpen(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_94sharpen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sharpen", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_sharpen(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.sharpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2001
 * 
 * 
 * cpdef inline void dirt_lens(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         object lens_model_,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_97dirt_lens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dirt_lens(PyObject *__pyx_v_surface_, PyObject *__pyx_v_lens_model_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dirt_lens *__pyx_optional_args) {
  int __pyx_v_flag_ = __pyx_k__15;
  float __pyx_v_light_ = ((float)0.0);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  struct __pyx_opt_args_12PygameShader_6shader_dirt_lens_c __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dirt_lens", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_flag_ = __pyx_optional_args->flag_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_light_ = __pyx_optional_args->light_;
      }
    }
  }

  /* "PygameShader/shader.pyx":2061
 *     :return: void
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2061, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2061, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2061, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":2062
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(lens_model_, pygame.Surface), \
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2062, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 2061, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2064
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     assert PyObject_IsInstance(lens_model_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument lens_model_ must be a pygame.Surface type, got %s " % type(lens_model_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pygame); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_lens_model_, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2064, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":2065
 * 
 *     assert PyObject_IsInstance(lens_model_, pygame.Surface), \
 *         "\nArgument lens_model_ must be a pygame.Surface type, got %s " % type(lens_model_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(light_, float), \
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_lens_model__must_be_a, ((PyObject *)Py_TYPE(__pyx_v_lens_model_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2064, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2067
 *         "\nArgument lens_model_ must be a pygame.Surface type, got %s " % type(lens_model_)
 * 
 *     assert PyObject_IsInstance(light_, float), \             # <<<<<<<<<<<<<<
 *         "\nArgument light_ must be a float type, got %s " % type(light_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_light_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2067, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, ((PyObject *)(&PyFloat_Type))); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2067, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":2068
 * 
 *     assert PyObject_IsInstance(light_, float), \
 *         "\nArgument light_ must be a float type, got %s " % type(light_)             # <<<<<<<<<<<<<<
 * 
 *     if light_ > 0.2:
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_light_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2068, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_light__must_be_a_float, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2068, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 2067, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2070
 *         "\nArgument light_ must be a float type, got %s " % type(light_)
 * 
 *     if light_ > 0.2:             # <<<<<<<<<<<<<<
 *         light_ = 0.2
 *     elif light_ < -1.0:
 */
  __pyx_t_3 = ((__pyx_v_light_ > 0.2) != 0);
  if (__pyx_t_3) {

    /* "PygameShader/shader.pyx":2071
 * 
 *     if light_ > 0.2:
 *         light_ = 0.2             # <<<<<<<<<<<<<<
 *     elif light_ < -1.0:
 *         light_ = 1.0
 */
    __pyx_v_light_ = 0.2;

    /* "PygameShader/shader.pyx":2070
 *         "\nArgument light_ must be a float type, got %s " % type(light_)
 * 
 *     if light_ > 0.2:             # <<<<<<<<<<<<<<
 *         light_ = 0.2
 *     elif light_ < -1.0:
 */
    goto __pyx_L3;
  }

  /* "PygameShader/shader.pyx":2072
 *     if light_ > 0.2:
 *         light_ = 0.2
 *     elif light_ < -1.0:             # <<<<<<<<<<<<<<
 *         light_ = 1.0
 * 
 */
  __pyx_t_3 = ((__pyx_v_light_ < -1.0) != 0);
  if (__pyx_t_3) {

    /* "PygameShader/shader.pyx":2073
 *         light_ = 0.2
 *     elif light_ < -1.0:
 *         light_ = 1.0             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(flag_, int), \
 */
    __pyx_v_light_ = 1.0;

    /* "PygameShader/shader.pyx":2072
 *     if light_ > 0.2:
 *         light_ = 0.2
 *     elif light_ < -1.0:             # <<<<<<<<<<<<<<
 *         light_ = 1.0
 * 
 */
  }
  __pyx_L3:;

  /* "PygameShader/shader.pyx":2075
 *         light_ = 1.0
 * 
 *     assert PyObject_IsInstance(flag_, int), \             # <<<<<<<<<<<<<<
 *         "\nArgument flag_ must be a int type, got %s " % type(flag_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_flag_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, ((PyObject *)(&PyInt_Type))); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2075, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":2076
 * 
 *     assert PyObject_IsInstance(flag_, int), \
 *         "\nArgument flag_ must be a int type, got %s " % type(flag_)             # <<<<<<<<<<<<<<
 * 
 *     dirt_lens_c(surface_, lens_model_, flag_, light_)
 */
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_flag_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2076, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_flag__must_be_a_int_ty, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2076, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2075, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2078
 *         "\nArgument flag_ must be a int type, got %s " % type(flag_)
 * 
 *     dirt_lens_c(surface_, lens_model_, flag_, light_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4.__pyx_n = 1;
  __pyx_t_4.light_ = __pyx_v_light_;
  __pyx_f_12PygameShader_6shader_dirt_lens_c(__pyx_v_surface_, __pyx_v_lens_model_, __pyx_v_flag_, &__pyx_t_4); 

  /* "PygameShader/shader.pyx":2001
 * 
 * 
 * cpdef inline void dirt_lens(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         object lens_model_,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("PygameShader.shader.dirt_lens", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_97dirt_lens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_96dirt_lens[] = "\n    DIRT LENS EFFECT \n    \n    This function display a dirt lens texture on the top of your game display to \n    simulate a camera artefact or realistic camera effect when the light from the\n    scene is oriented directly toward the camera. \n    \n    Choose a lens texture from the Assets directory (free textures provided in Assets directory \n    of this project). All textures are sizes 5184x3456 and would have to be re-sized to  \n    your game display and used by function `dirt_lens`. \n    The function dirt_lens will not resize the texture for you.\n    \n    The setting light_ is a float values cap between -1.0 to 0.2 and allow you to increase the \n    light source oriented toward the camera. Values <0.0 will decrease the lens dirt \n    effect and values >0.0 will increase the brightness of the display and increase the \n    amount of dirt on the camera lens (your display).\n    \n    Optionally the setting flag_ can be changed from BLEND_RGB_ADD to any other pygame optional \n    flags value. BLEND_RGB_ADD is the default setting and allow the pixels from the dirt lens \n    texture to be blended (added) to the display and provide the brightest and better looking \n    effect. \n    \n    This effect can be used for real time rendering for surfaces resolution 1024x768  \n    \n    Assets/Bokeh__Lens_Dirt_9.jpg\n    Assets/Bokeh__Lens_Dirt_38.jpg\n    Assets/Bokeh__Lens_Dirt_46.jpg\n    Assets/Bokeh__Lens_Dirt_50.jpg\n    Assets/Bokeh__Lens_Dirt_54.jpg\n    Assets/Bokeh__Lens_Dirt_67.jpg\n    \n    :param surface_   : Surface 24 - 32 bit represent the surface or the display \n    \n    :param lens_model_: Surface The Lens model is a pygame Surface. PygameShader provide a 6 \n     different surfaces that can be used as a layer to generate a dirt lens effect on your game \n     display. See above for the name of the free dirt lens textures. \n     The texture has to be loaded prior calling this effect and passed as an argument. By default \n     the textu""res sizes are 5184x3456 (width & height). The texture would have also to be re-scale \n     once to the game display dimensions (e.g 1027x768) or to the size of your texture.\n     \n    :param flag_      : integer; pygame flags such as BLEND_RGB_ADD, BLEND_RGB_MAX etc. These flags \n     will change the overall appearance of the effect blending the dirt lens\n     image with a different mathematical expression. BLEND_RGB_ADD is the \n     default flag and blend together the dirt_lens and the game display \n     providing a very bright aspect and vivid effect.\n    \n    :param light_     : float; Float value cap between [-1.0 ... 0.2] to increase or decrease \n     the overall brightness of the dirt lens texture. Tis setting can be used to simulate a \n     texture transition when sweeping the values from -1.0 toward 0.2 by a small increment.\n     Values < 0 will tend to diminish the effect and values > 0 will increase the brightness \n     and the dirt lens effect. \n     \n    :return: void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_97dirt_lens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  PyObject *__pyx_v_lens_model_ = 0;
  int __pyx_v_flag_;
  float __pyx_v_light_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dirt_lens (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_lens_model,&__pyx_n_s_flag,&__pyx_n_s_light,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lens_model)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dirt_lens", 0, 2, 4, 1); __PYX_ERR(1, 2001, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_light);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dirt_lens") < 0)) __PYX_ERR(1, 2001, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_lens_model_ = values[1];
    if (values[2]) {
      __pyx_v_flag_ = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_flag_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2004, __pyx_L3_error)
    } else {
      __pyx_v_flag_ = __pyx_k__15;
    }
    if (values[3]) {
      __pyx_v_light_ = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_light_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 2005, __pyx_L3_error)
    } else {
      __pyx_v_light_ = ((float)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dirt_lens", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2001, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.dirt_lens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_96dirt_lens(__pyx_self, __pyx_v_surface_, __pyx_v_lens_model_, __pyx_v_flag_, __pyx_v_light_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_96dirt_lens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_lens_model_, int __pyx_v_flag_, float __pyx_v_light_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_dirt_lens __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dirt_lens", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 2;
  __pyx_t_1.flag_ = __pyx_v_flag_;
  __pyx_t_1.light_ = __pyx_v_light_;
  __pyx_f_12PygameShader_6shader_dirt_lens(__pyx_v_surface_, __pyx_v_lens_model_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.dirt_lens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2088
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void end_game(object surface):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_99end_game(PyObject *__pyx_self, PyObject *__pyx_v_surface); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_end_game(CYTHON_UNUSED PyObject *__pyx_v_surface, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("end_game", 0);

  /* "PygameShader/shader.pyx":2094
 *     :return:
 *     """
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * @cython.binding(False)
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(1, 2094, __pyx_L1_error)

  /* "PygameShader/shader.pyx":2088
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void end_game(object surface):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PygameShader.shader.end_game", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_99end_game(PyObject *__pyx_self, PyObject *__pyx_v_surface); /*proto*/
static char __pyx_doc_12PygameShader_6shader_98end_game[] = "\n    \n    :param surface: \n    :return: \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_99end_game(PyObject *__pyx_self, PyObject *__pyx_v_surface) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("end_game (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_98end_game(__pyx_self, ((PyObject *)__pyx_v_surface));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_98end_game(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("end_game", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_end_game(__pyx_v_surface, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.end_game", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2101
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void level_clear(object surface):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_101level_clear(PyObject *__pyx_self, PyObject *__pyx_v_surface); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_level_clear(CYTHON_UNUSED PyObject *__pyx_v_surface, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("level_clear", 0);

  /* "PygameShader/shader.pyx":2107
 *     :return:
 *     """
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * @cython.binding(False)
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(1, 2107, __pyx_L1_error)

  /* "PygameShader/shader.pyx":2101
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void level_clear(object surface):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PygameShader.shader.level_clear", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_101level_clear(PyObject *__pyx_self, PyObject *__pyx_v_surface); /*proto*/
static char __pyx_doc_12PygameShader_6shader_100level_clear[] = "\n    \n    :param surface: \n    :return: \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_101level_clear(PyObject *__pyx_self, PyObject *__pyx_v_surface) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("level_clear (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_100level_clear(__pyx_self, ((PyObject *)__pyx_v_surface));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_100level_clear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("level_clear", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_level_clear(__pyx_v_surface, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.level_clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2114
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object dithering(object surface_, int factor_=2):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

static PyObject *__pyx_pw_12PygameShader_6shader_103dithering(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_dithering(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dithering *__pyx_optional_args) {
  int __pyx_v_factor_ = ((int)2);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dithering", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_factor_ = __pyx_optional_args->factor_;
    }
  }

  /* "PygameShader/shader.pyx":2135
 * 
 *     """
 *     assert PyObject_IsInstance(surface_, Surface), \             # <<<<<<<<<<<<<<
 *         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2135, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2136
 *     """
 *     assert PyObject_IsInstance(surface_, Surface), \
 *         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(factor_, int), \
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyga, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2136, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2135, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2138
 *         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)
 * 
 *     assert PyObject_IsInstance(factor_, int), \             # <<<<<<<<<<<<<<
 *         'Argument factor_ must be an int got %s ' % type(factor_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_factor_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_t_1, ((PyObject *)(&PyInt_Type))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2138, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2139
 * 
 *     assert PyObject_IsInstance(factor_, int), \
 *         'Argument factor_ must be an int got %s ' % type(factor_)             # <<<<<<<<<<<<<<
 * 
 *     assert factor_ > 1, \
 */
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_factor_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_factor__must_be_an_int, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 2138, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2141
 *         'Argument factor_ must be an int got %s ' % type(factor_)
 * 
 *     assert factor_ > 1, \             # <<<<<<<<<<<<<<
 *         "Argument factor_ must be > 1"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_factor_ > 1) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_factor__must_be_1);
      __PYX_ERR(1, 2141, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2144
 *         "Argument factor_ must be > 1"
 * 
 *     return dithering_c(numpy.divide(pixels3d(surface_), 255.0).astype(float32), factor_)             # <<<<<<<<<<<<<<
 * 
 * @cython.binding(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_divide); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_float_255_0};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2144, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_float_255_0};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2144, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_4);
    __Pyx_INCREF(__pyx_float_255_0);
    __Pyx_GIVEREF(__pyx_float_255_0);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_float_255_0);
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_float(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 2144, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_f_12PygameShader_6shader_dithering_c(__pyx_t_9, __pyx_v_factor_); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":2114
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object dithering(object surface_, int factor_=2):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __Pyx_AddTraceback("PygameShader.shader.dithering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_103dithering(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_102dithering[] = "\n    Dithering is used in computer graphics to create the illusion of \"color depth\" in images with\n    a limited color palette - a technique also known as color quantization. In a dithered image,\n    colors that are not available in the palette are approximated by a diffusion of colored pixels\n    from within the available palette. The human eye perceives the diffusion as a mixture of \n    the colors within it (see color vision). Dithered images, particularly those with relatively\n     few colors, can often be distinguished by a characteristic graininess or speckled appearance\n    \n    Take a pygame surface as argument format 24-32 bit and convert it to a 3d array format \n    (w, h, 3) type float (float32, single precision). \n    As the image is converted to a different data type format (uint8 to float32), \n    the transformation cannot be applied inplace. The image returned by the method dithering \n    is a copy of the original image.   \n    \n    :param surface_: Pygame surface format 24-32 bit \n    :param factor_ : integer; Value must be > 1 otherwise an exception will be thrown \n    :return        : Surface; \n    \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_103dithering(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_factor_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dithering (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_factor,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dithering") < 0)) __PYX_ERR(1, 2114, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_factor_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_factor_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2114, __pyx_L3_error)
    } else {
      __pyx_v_factor_ = ((int)2);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dithering", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2114, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.dithering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_102dithering(__pyx_self, __pyx_v_surface_, __pyx_v_factor_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_102dithering(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_factor_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_dithering __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dithering", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.factor_ = __pyx_v_factor_;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_dithering(__pyx_v_surface_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.dithering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2151
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void dithering_int(object surface_, int factor_=2):             # <<<<<<<<<<<<<<
 *     """
 *     Dithering is used in computer graphics to create the illusion of "color depth" in images with
 */

static PyObject *__pyx_pw_12PygameShader_6shader_105dithering_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dithering_int(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dithering_int *__pyx_optional_args) {
  int __pyx_v_factor_ = ((int)2);
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dithering_int", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_factor_ = __pyx_optional_args->factor_;
    }
  }

  /* "PygameShader/shader.pyx":2171
 * 
 *     """
 *     assert PyObject_IsInstance(surface_, Surface), \             # <<<<<<<<<<<<<<
 *         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2171, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2172
 *     """
 *     assert PyObject_IsInstance(surface_, Surface), \
 *         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(factor_, int), \
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyga, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2171, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2174
 *         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)
 * 
 *     assert PyObject_IsInstance(factor_, int), \             # <<<<<<<<<<<<<<
 *         'Argument factor_ must be an int got %s ' % type(factor_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_factor_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_t_1, ((PyObject *)(&PyInt_Type))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2174, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2175
 * 
 *     assert PyObject_IsInstance(factor_, int), \
 *         'Argument factor_ must be an int got %s ' % type(factor_)             # <<<<<<<<<<<<<<
 * 
 *     assert factor_ > 1, \
 */
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_factor_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2175, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_factor__must_be_an_int, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2175, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 2174, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2177
 *         'Argument factor_ must be an int got %s ' % type(factor_)
 * 
 *     assert factor_ > 1, \             # <<<<<<<<<<<<<<
 *         "Argument factor_ must be > 1"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_factor_ > 1) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_factor__must_be_1);
      __PYX_ERR(1, 2177, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2180
 *         "Argument factor_ must be > 1"
 * 
 *     dithering_int_c(pixels3d(surface_), factor_)             # <<<<<<<<<<<<<<
 * 
 * @cython.binding(False)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 2180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_f_12PygameShader_6shader_dithering_int_c(__pyx_t_5, __pyx_v_factor_);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":2151
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void dithering_int(object surface_, int factor_=2):             # <<<<<<<<<<<<<<
 *     """
 *     Dithering is used in computer graphics to create the illusion of "color depth" in images with
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.dithering_int", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_105dithering_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_104dithering_int[] = "\n    Dithering is used in computer graphics to create the illusion of \"color depth\" in images with\n    a limited color palette - a technique also known as color quantization. In a dithered image,\n    colors that are not available in the palette are approximated by a diffusion of colored pixels\n    from within the available palette. The human eye perceives the diffusion as a mixture of \n    the colors within it (see color vision). Dithered images, particularly those with relatively\n     few colors, can often be distinguished by a characteristic graininess or speckled appearance\n\n    Take a pygame surface as argument format 24-32 bit and convert it to a 3d array format \n    (w, h, 3) type float (float32, single precision). \n    As the image is converted to a different data type format (uint8 to float32), \n    the transformation cannot be applied inplace. The image returned by the method dithering \n    is a copy of the original image.   \n\n    :param surface_: Pygame surface format 24-32 bit \n    :param factor_ : integer; Value must be > 1 otherwise an exception will be thrown \n    :return        : Surface; \n\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_105dithering_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_factor_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dithering_int (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_factor,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dithering_int") < 0)) __PYX_ERR(1, 2151, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_factor_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_factor_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2151, __pyx_L3_error)
    } else {
      __pyx_v_factor_ = ((int)2);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dithering_int", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2151, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.dithering_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_104dithering_int(__pyx_self, __pyx_v_surface_, __pyx_v_factor_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_104dithering_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_factor_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_dithering_int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dithering_int", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.factor_ = __pyx_v_factor_;
  __pyx_f_12PygameShader_6shader_dithering_int(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.dithering_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2187
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object pixelation(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     Pixelate a pygame.Surface
 */

static PyObject *__pyx_pw_12PygameShader_6shader_107pixelation(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_pixelation(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  PyObject *__pyx_v_small = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pixelation", 0);

  /* "PygameShader/shader.pyx":2197
 *     :return: pixelated surface
 *     """
 *     assert PyObject_IsInstance(surface_, Surface), \             # <<<<<<<<<<<<<<
 *         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2197, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2198
 *     """
 *     assert PyObject_IsInstance(surface_, Surface), \
 *         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t w, h
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyga, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2197, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2202
 *     cdef Py_ssize_t w, h
 *     # todo percentage of pixelation
 *     w, h = surface_.get_size()             # <<<<<<<<<<<<<<
 *     cdef object small = smoothscale(surface_, (32, 32))
 *     return scale(small, (w, h))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 2202, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(1, 2202, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 2202, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 2202, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 2202, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_w = __pyx_t_7;
  __pyx_v_h = __pyx_t_8;

  /* "PygameShader/shader.pyx":2203
 *     # todo percentage of pixelation
 *     w, h = surface_.get_size()
 *     cdef object small = smoothscale(surface_, (32, 32))             # <<<<<<<<<<<<<<
 *     return scale(small, (w, h))
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_surface_, __pyx_tuple__16};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2203, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_surface_, __pyx_tuple__16};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2203, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_surface_);
    __Pyx_GIVEREF(__pyx_v_surface_);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_v_surface_);
    __Pyx_INCREF(__pyx_tuple__16);
    __Pyx_GIVEREF(__pyx_tuple__16);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_tuple__16);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_small = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":2204
 *     w, h = surface_.get_size()
 *     cdef object small = smoothscale(surface_, (32, 32))
 *     return scale(small, (w, h))             # <<<<<<<<<<<<<<
 * 
 * @cython.binding(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_scale); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 2204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3);
  __pyx_t_5 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_small, __pyx_t_10};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2204, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_small, __pyx_t_10};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2204, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_small);
    __Pyx_GIVEREF(__pyx_v_small);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_v_small);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":2187
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object pixelation(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     Pixelate a pygame.Surface
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("PygameShader.shader.pixelation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_small);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_107pixelation(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_106pixelation[] = "\n    Pixelate a pygame.Surface \n    \n    This method cannot be used for the game display as the change \n    is applied in a new Surface\n    \n    :param surface_: pygame.Surface; \n    :return: pixelated surface\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_107pixelation(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pixelation (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_106pixelation(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_106pixelation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pixelation", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_pixelation(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.pixelation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2211
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline zoom_in(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_109zoom_in(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_zoom_in(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("zoom_in", 0);

  /* "PygameShader/shader.pyx":2217
 *     :return:
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2217, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":2218
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     raise NotImplementedError
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2218, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 2217, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2220
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(1, 2220, __pyx_L1_error)

  /* "PygameShader/shader.pyx":2211
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline zoom_in(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.zoom_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_109zoom_in(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_108zoom_in[] = "\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return:\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_109zoom_in(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zoom_in (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_108zoom_in(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_108zoom_in(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("zoom_in", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_zoom_in(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.zoom_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2228
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline electric(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_111electric(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_electric(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("electric", 0);

  /* "PygameShader/shader.pyx":2234
 *     :return:
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2234, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":2235
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     raise NotImplementedError
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 2234, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2237
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(1, 2237, __pyx_L1_error)

  /* "PygameShader/shader.pyx":2228
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline electric(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.electric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_111electric(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_110electric[] = "\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return:\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_111electric(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("electric (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_110electric(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_110electric(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("electric", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_electric(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.electric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2245
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline filmstrips(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_113filmstrips(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_filmstrips(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filmstrips", 0);

  /* "PygameShader/shader.pyx":2251
 *     :return:
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2251, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":2252
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     raise NotImplementedError
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2252, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 2251, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2254
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(1, 2254, __pyx_L1_error)

  /* "PygameShader/shader.pyx":2245
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline filmstrips(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.filmstrips", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_113filmstrips(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_112filmstrips[] = "\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return:\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_113filmstrips(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filmstrips (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_112filmstrips(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_112filmstrips(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filmstrips", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_filmstrips(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.filmstrips", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2262
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef cubism(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_115cubism(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_cubism(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cubism", 0);

  /* "PygameShader/shader.pyx":2268
 *     :return:
 *     """
 *     assert isinstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     raise NotImplementedError
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2268, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2268, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2268, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":2269
 *     """
 *     assert isinstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 *     raise NotImplementedError
 * 
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2269, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 2268, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2270
 *     assert isinstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(1, 2270, __pyx_L1_error)

  /* "PygameShader/shader.pyx":2262
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef cubism(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.cubism", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_115cubism(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_114cubism[] = "\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return:\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_115cubism(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cubism (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_114cubism(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_114cubism(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cubism", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_cubism(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.cubism", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2278
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef code_listing(object surface_, size_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_117code_listing(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_code_listing(PyObject *__pyx_v_surface_, CYTHON_UNUSED PyObject *__pyx_v_size_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("code_listing", 0);

  /* "PygameShader/shader.pyx":2285
 *     :return:
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \             # <<<<<<<<<<<<<<
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!(__pyx_t_3 != 0))) {

      /* "PygameShader/shader.pyx":2286
 *     """
 *     assert PyObject_IsInstance(surface_, pygame.Surface), \
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     raise NotImplementedError
 */
      __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 2285, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2288
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * @cython.binding(False)
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(1, 2288, __pyx_L1_error)

  /* "PygameShader/shader.pyx":2278
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef code_listing(object surface_, size_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.code_listing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_117code_listing(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_116code_listing[] = "\n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit \n    :param size_:\n    :return:\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_117code_listing(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  PyObject *__pyx_v_size_ = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("code_listing (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_size_2,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("code_listing", 1, 2, 2, 1); __PYX_ERR(1, 2278, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "code_listing") < 0)) __PYX_ERR(1, 2278, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_size_ = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("code_listing", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2278, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.code_listing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_116code_listing(__pyx_self, __pyx_v_surface_, __pyx_v_size_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_116code_listing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_size_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("code_listing", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_code_listing(__pyx_v_surface_, __pyx_v_size_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.code_listing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2295
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef ascii_char(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_119ascii_char(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_ascii_char(CYTHON_UNUSED PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ascii_char", 0);

  /* "PygameShader/shader.pyx":2301
 *     :return:
 *     """
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * @cython.binding(False)
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(1, 2301, __pyx_L1_error)

  /* "PygameShader/shader.pyx":2295
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef ascii_char(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("PygameShader.shader.ascii_char", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_119ascii_char(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_118ascii_char[] = "\n    \n    :param surface_: \n    :return: \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_119ascii_char(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ascii_char (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_118ascii_char(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_118ascii_char(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ascii_char", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_ascii_char(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.ascii_char", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2308
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object blend(object source_, object destination_, float percentage_):             # <<<<<<<<<<<<<<
 *     """
 *     BLEND A SOURCE TEXTURE TOWARD A DESTINATION TEXTURE
 */

static PyObject *__pyx_pw_12PygameShader_6shader_121blend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_blend(PyObject *__pyx_v_source_, PyObject *__pyx_v_destination_, float __pyx_v_percentage_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blend", 0);

  /* "PygameShader/shader.pyx":2326
 *                          of the destination texture.
 *     """
 *     assert PyObject_IsInstance(source_, Surface), \             # <<<<<<<<<<<<<<
 *         'Argument source_ must be a pygame.Surface got %s ' % type(source_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_source_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2326, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2327
 *     """
 *     assert PyObject_IsInstance(source_, Surface), \
 *         'Argument source_ must be a pygame.Surface got %s ' % type(source_)             # <<<<<<<<<<<<<<
 * 
 *     assert PyObject_IsInstance(destination_, Surface), \
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_source__must_be_a_pygam, ((PyObject *)Py_TYPE(__pyx_v_source_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2326, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2329
 *         'Argument source_ must be a pygame.Surface got %s ' % type(source_)
 * 
 *     assert PyObject_IsInstance(destination_, Surface), \             # <<<<<<<<<<<<<<
 *         'Argument destination_ must be a pygame.Surface got %s ' % type(destination_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_destination_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2329, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2330
 * 
 *     assert PyObject_IsInstance(destination_, Surface), \
 *         'Argument destination_ must be a pygame.Surface got %s ' % type(destination_)             # <<<<<<<<<<<<<<
 * 
 *     assert 0.0 <= percentage_ <= 100.0, \
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_destination__must_be_a, ((PyObject *)Py_TYPE(__pyx_v_destination_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2329, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2332
 *         'Argument destination_ must be a pygame.Surface got %s ' % type(destination_)
 * 
 *     assert 0.0 <= percentage_ <= 100.0, \             # <<<<<<<<<<<<<<
 *         "\nIncorrect value for argument percentage should be [0.0 ... 100.0] got %s " % percentage_
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = (0.0 <= __pyx_v_percentage_);
    if (__pyx_t_2) {
      __pyx_t_2 = (__pyx_v_percentage_ <= 100.0);
    }
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2333
 * 
 *     assert 0.0 <= percentage_ <= 100.0, \
 *         "\nIncorrect value for argument percentage should be [0.0 ... 100.0] got %s " % percentage_             # <<<<<<<<<<<<<<
 * 
 *     if percentage_ == 0.0:
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_percentage_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Incorrect_value_for_argument_pe, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 2332, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2335
 *         "\nIncorrect value for argument percentage should be [0.0 ... 100.0] got %s " % percentage_
 * 
 *     if percentage_ == 0.0:             # <<<<<<<<<<<<<<
 *         return source_
 * 
 */
  __pyx_t_2 = ((__pyx_v_percentage_ == 0.0) != 0);
  if (__pyx_t_2) {

    /* "PygameShader/shader.pyx":2336
 * 
 *     if percentage_ == 0.0:
 *         return source_             # <<<<<<<<<<<<<<
 * 
 *     assert source_.get_size() == destination_.get_size(), \
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_source_);
    __pyx_r = __pyx_v_source_;
    goto __pyx_L0;

    /* "PygameShader/shader.pyx":2335
 *         "\nIncorrect value for argument percentage should be [0.0 ... 100.0] got %s " % percentage_
 * 
 *     if percentage_ == 0.0:             # <<<<<<<<<<<<<<
 *         return source_
 * 
 */
  }

  /* "PygameShader/shader.pyx":2338
 *         return source_
 * 
 *     assert source_.get_size() == destination_.get_size(), \             # <<<<<<<<<<<<<<
 *         'Source and Destination surfaces must have same dimensions: ' \
 *         'Source (w:%s, h:%s), destination (w:%s, h:%s).' % \
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_source_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_destination_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 2338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) {

      /* "PygameShader/shader.pyx":2341
 *         'Source and Destination surfaces must have same dimensions: ' \
 *         'Source (w:%s, h:%s), destination (w:%s, h:%s).' % \
 *         (*source_.get_size(), *destination_.get_size())             # <<<<<<<<<<<<<<
 * 
 *     return blending(source_, destination_, percentage_)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_source_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_destination_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__Pyx_PyList_Extend(__pyx_t_4, __pyx_t_1) < 0) __PYX_ERR(1, 2341, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {
        PyObject *__pyx_temp = PyList_AsTuple(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4);
        __pyx_t_4 = __pyx_temp; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2341, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }

      /* "PygameShader/shader.pyx":2340
 *     assert source_.get_size() == destination_.get_size(), \
 *         'Source and Destination surfaces must have same dimensions: ' \
 *         'Source (w:%s, h:%s), destination (w:%s, h:%s).' % \             # <<<<<<<<<<<<<<
 *         (*source_.get_size(), *destination_.get_size())
 * 
 */
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Source_and_Destination_surfaces, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2340, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2338, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2343
 *         (*source_.get_size(), *destination_.get_size())
 * 
 *     return blending(source_, destination_, percentage_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_blending(__pyx_v_source_, __pyx_v_destination_, __pyx_v_percentage_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":2308
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object blend(object source_, object destination_, float percentage_):             # <<<<<<<<<<<<<<
 *     """
 *     BLEND A SOURCE TEXTURE TOWARD A DESTINATION TEXTURE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("PygameShader.shader.blend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_121blend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_120blend[] = "\n    BLEND A SOURCE TEXTURE TOWARD A DESTINATION TEXTURE \n    \n    The shader create a new image from both source_ and destination_\n\n    * Video system must be initialised \n    * source_ & destination_ Textures must be same sizes\n    * Compatible with 24 - 32 bit surface\n    * Output create a new surface\n    * Image returned is converted for fast blit (convert())\n\n    :param source_     : pygame.Surface (Source)\n    :param destination_: pygame.Surface (Destination)\n    :param percentage_ : float; Percentage value between [0.0 ... 100.0]\n    :return: return    : Return a 24 bit pygame.Surface and blended with a percentage\n                         of the destination texture.\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_121blend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source_ = 0;
  PyObject *__pyx_v_destination_ = 0;
  float __pyx_v_percentage_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blend (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_destination,&__pyx_n_s_percentage,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destination)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("blend", 1, 3, 3, 1); __PYX_ERR(1, 2308, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_percentage)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("blend", 1, 3, 3, 2); __PYX_ERR(1, 2308, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blend") < 0)) __PYX_ERR(1, 2308, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_source_ = values[0];
    __pyx_v_destination_ = values[1];
    __pyx_v_percentage_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_percentage_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 2308, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blend", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2308, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.blend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_120blend(__pyx_self, __pyx_v_source_, __pyx_v_destination_, __pyx_v_percentage_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_120blend(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source_, PyObject *__pyx_v_destination_, float __pyx_v_percentage_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blend", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_blend(__pyx_v_source_, __pyx_v_destination_, __pyx_v_percentage_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.blend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2352
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef cartoon(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int sobel_threshold_ = 128,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_123cartoon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_cartoon(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_cartoon *__pyx_optional_args) {
  int __pyx_v_sobel_threshold_ = ((int)0x80);
  int __pyx_v_median_kernel_ = ((int)2);
  PyObject *__pyx_v_color_ = ((PyObject *)__pyx_int_8);
  PyObject *__pyx_v_flag_ = __pyx_k__17;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cartoon", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_sobel_threshold_ = __pyx_optional_args->sobel_threshold_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_median_kernel_ = __pyx_optional_args->median_kernel_;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_color_ = __pyx_optional_args->color_;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_flag_ = __pyx_optional_args->flag_;
          }
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":2377
 *     """
 * 
 *     return cartoon_effect(surface_, sobel_threshold_, median_kernel_, color_, flag_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_color_); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2377, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_flag_); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2377, __pyx_L1_error)
  __pyx_t_3 = __pyx_f_12PygameShader_6shader_cartoon_effect(__pyx_v_surface_, __pyx_v_sobel_threshold_, __pyx_v_median_kernel_, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":2352
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef cartoon(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int sobel_threshold_ = 128,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("PygameShader.shader.cartoon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_123cartoon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_122cartoon[] = "\n    CREATE A CARTOON EFFECT FROM A GIVEN SURFACE \n    \n    * This shader cannot be use online or real time due to the amout of \n      transformation. You can use this shader while editing your textures \n      befre the main loop \n    \n    * Compatible with 24 - 32 bit image \n    \n    :param surface_: pygame.Surface compatible 24 - 32 bit \n    :param sobel_threshold_: integer sobel threshold\n    :param median_kernel_  : integer median kernel  \n    :param color_          : integer; color reduction value (max color)\n    :param flag_           : integer; Blend flag e.g (BLEND_RGB_ADD, BLEND_RGB_SUB, \n                             BLEND_RGB_MULT, BLEND_RGB_MAX, BLEND_RGB_MIN  \n    :return                : Return a pygame Surface with the cartoon effect \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_123cartoon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_sobel_threshold_;
  int __pyx_v_median_kernel_;
  PyObject *__pyx_v_color_ = 0;
  PyObject *__pyx_v_flag_ = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cartoon (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_sobel_threshold_2,&__pyx_n_s_median_kernel,&__pyx_n_s_color,&__pyx_n_s_flag,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_int_8);
    values[4] = __pyx_k__17;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sobel_threshold_2);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_median_kernel);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cartoon") < 0)) __PYX_ERR(1, 2352, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_sobel_threshold_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_sobel_threshold_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2354, __pyx_L3_error)
    } else {
      __pyx_v_sobel_threshold_ = ((int)0x80);
    }
    if (values[2]) {
      __pyx_v_median_kernel_ = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_median_kernel_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2355, __pyx_L3_error)
    } else {
      __pyx_v_median_kernel_ = ((int)2);
    }
    __pyx_v_color_ = values[3];
    __pyx_v_flag_ = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cartoon", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2352, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.cartoon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_122cartoon(__pyx_self, __pyx_v_surface_, __pyx_v_sobel_threshold_, __pyx_v_median_kernel_, __pyx_v_color_, __pyx_v_flag_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_122cartoon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_sobel_threshold_, int __pyx_v_median_kernel_, PyObject *__pyx_v_color_, PyObject *__pyx_v_flag_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_cartoon __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cartoon", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 4;
  __pyx_t_2.sobel_threshold_ = __pyx_v_sobel_threshold_;
  __pyx_t_2.median_kernel_ = __pyx_v_median_kernel_;
  __pyx_t_2.color_ = __pyx_v_color_;
  __pyx_t_2.flag_ = __pyx_v_flag_;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_cartoon(__pyx_v_surface_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.cartoon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2385
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef explode(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static PyObject *__pyx_pw_12PygameShader_6shader_125explode(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_explode(CYTHON_UNUSED PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("explode", 0);

  /* "PygameShader/shader.pyx":2391
 *     :return:
 *     """
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * @cython.binding(False)
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(1, 2391, __pyx_L1_error)

  /* "PygameShader/shader.pyx":2385
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef explode(object surface_):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("PygameShader.shader.explode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_125explode(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_124explode[] = "\n\n    :param surface_: \n    :return: \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_125explode(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("explode (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_124explode(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_124explode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("explode", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_explode(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.explode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2398
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object spectrum(int width, int height, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A PYGAME SURFACE DISPLAYING THE LIGHT SPECTRUM 380-750 nm
 */

static PyObject *__pyx_pw_12PygameShader_6shader_127spectrum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_spectrum(int __pyx_v_width, int __pyx_v_height, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_spectrum *__pyx_optional_args) {
  float __pyx_v_gamma = ((float)1.0);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_spectrum_c __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("spectrum", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_gamma = __pyx_optional_args->gamma;
    }
  }

  /* "PygameShader/shader.pyx":2418
 *     """
 * 
 *     return spectrum_c(width, height, gamma)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.gamma = __pyx_v_gamma;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_spectrum_c(__pyx_v_width, __pyx_v_height, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":2398
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object spectrum(int width, int height, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A PYGAME SURFACE DISPLAYING THE LIGHT SPECTRUM 380-750 nm
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_127spectrum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_126spectrum[] = "\n    CREATE A PYGAME SURFACE DISPLAYING THE LIGHT SPECTRUM 380-750 nm\n\n    Color   Wavelength(nm) Frequency(THz)\n    Red     620-750        484-400\n    Orange  590-620        508-484\n    Yellow  570-590        526-508\n    Green   495-570        606-526\n    Blue    450-495        668-606\n    Violet  380-450        789-668\n\n    :param width: integer; width of the image\n    :param height: integer; height of the image\n    :param gamma: float; gamma value \n    :return: Return a pygame surface 24-bit (width, height) converted for fast \n    blit \n\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_127spectrum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_width;
  int __pyx_v_height;
  float __pyx_v_gamma;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("spectrum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_gamma,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spectrum", 0, 2, 3, 1); __PYX_ERR(1, 2398, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "spectrum") < 0)) __PYX_ERR(1, 2398, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_width = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2398, __pyx_L3_error)
    __pyx_v_height = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2398, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 2398, __pyx_L3_error)
    } else {
      __pyx_v_gamma = ((float)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("spectrum", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2398, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_126spectrum(__pyx_self, __pyx_v_width, __pyx_v_height, __pyx_v_gamma);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_126spectrum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width, int __pyx_v_height, float __pyx_v_gamma) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_spectrum __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("spectrum", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.gamma = __pyx_v_gamma;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_spectrum(__pyx_v_width, __pyx_v_height, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2425
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void convert_27colors(object surface_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

static PyObject *__pyx_pw_12PygameShader_6shader_129convert_27colors(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_convert_27colors(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_array_ = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_27colors", 0);

  /* "PygameShader/shader.pyx":2433
 *     :return: void
 *     """
 *     assert isinstance(surface_, Surface), \             # <<<<<<<<<<<<<<
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2433, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2434
 *     """
 *     assert isinstance(surface_, Surface), \
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_vali, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2433, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2436
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(surface_)
 * 
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "PygameShader/shader.pyx":2437
 * 
 *     try:
 *         array_ = pixels3d(surface_)             # <<<<<<<<<<<<<<
 * 
 *     except (pygame.error, ValueError):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2437, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2437, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_array_ = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "PygameShader/shader.pyx":2436
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(surface_)
 * 
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "PygameShader/shader.pyx":2439
 *         array_ = pixels3d(surface_)
 * 
 *     except (pygame.error, ValueError):             # <<<<<<<<<<<<<<
 *         raise ValueError('\nTexture/image is not compatible.')
 * 
 */
    __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pygame); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2439, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2439, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_9) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_builtin_ValueError);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_7);
    __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("PygameShader.shader.convert_27colors", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 2439, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_1);

      /* "PygameShader/shader.pyx":2440
 * 
 *     except (pygame.error, ValueError):
 *         raise ValueError('\nTexture/image is not compatible.')             # <<<<<<<<<<<<<<
 * 
 *     convert_27colors_c(array_)
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2440, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 2440, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "PygameShader/shader.pyx":2436
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(surface_)
 * 
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "PygameShader/shader.pyx":2442
 *         raise ValueError('\nTexture/image is not compatible.')
 * 
 *     convert_27colors_c(array_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2442, __pyx_L1_error)
  __pyx_f_12PygameShader_6shader_convert_27colors_c(__pyx_t_11);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "PygameShader/shader.pyx":2425
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void convert_27colors(object surface_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.convert_27colors", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array_);
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_129convert_27colors(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_128convert_27colors[] = "\n    THIS ALGORITHM CONVERT AN IMAGE USING 27 COLORS ONLY\n\n    :param surface_: numpy.ndarray; containing the pixels RGB. Array shape (w, h, 3)  \n    :return: void \n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_129convert_27colors(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert_27colors (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_128convert_27colors(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_128convert_27colors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_27colors", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_convert_27colors(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.convert_27colors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2450
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object bilateral(object image, float sigma_s, float sigma_i):             # <<<<<<<<<<<<<<
 *     """
 *     A bilateral filter is a non-linear, edge-preserving, and noise-reducing
 */

static PyObject *__pyx_pw_12PygameShader_6shader_131bilateral(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_bilateral(PyObject *__pyx_v_image, float __pyx_v_sigma_s, float __pyx_v_sigma_i, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_array_ = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bilateral", 0);

  /* "PygameShader/shader.pyx":2479
 *     """
 * 
 *     assert isinstance(image, Surface), \             # <<<<<<<<<<<<<<
 *         'Argument image must be a valid Surface, got %s ' % type(image)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_image, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2479, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2480
 * 
 *     assert isinstance(image, Surface), \
 *         'Argument image must be a valid Surface, got %s ' % type(image)             # <<<<<<<<<<<<<<
 * 
 *     assert isinstance(sigma_s, float), \
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_image_must_be_a_valid_S, ((PyObject *)Py_TYPE(__pyx_v_image))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2479, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2482
 *         'Argument image must be a valid Surface, got %s ' % type(image)
 * 
 *     assert isinstance(sigma_s, float), \             # <<<<<<<<<<<<<<
 *         'Argument sigma_s must be a valid Surface, got %s ' % type(sigma_s)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_sigma_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyFloat_Check(__pyx_t_1); 
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2483
 * 
 *     assert isinstance(sigma_s, float), \
 *         'Argument sigma_s must be a valid Surface, got %s ' % type(sigma_s)             # <<<<<<<<<<<<<<
 * 
 *     assert isinstance(sigma_i, float), \
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_sigma_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_sigma_s_must_be_a_valid, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 2482, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2485
 *         'Argument sigma_s must be a valid Surface, got %s ' % type(sigma_s)
 * 
 *     assert isinstance(sigma_i, float), \             # <<<<<<<<<<<<<<
 *         'Argument sigma_i must be a valid Surface, got %s ' % type(sigma_i)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sigma_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyFloat_Check(__pyx_t_3); 
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2486
 * 
 *     assert isinstance(sigma_i, float), \
 *         'Argument sigma_i must be a valid Surface, got %s ' % type(sigma_i)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sigma_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_sigma_i_must_be_a_valid, ((PyObject *)Py_TYPE(__pyx_t_3))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2485, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2488
 *         'Argument sigma_i must be a valid Surface, got %s ' % type(sigma_i)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(image)
 * 
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "PygameShader/shader.pyx":2489
 * 
 *     try:
 *         array_ = pixels3d(image)             # <<<<<<<<<<<<<<
 * 
 *     except (pygame.error, ValueError):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2489, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_v_image) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_image);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2489, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_array_ = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "PygameShader/shader.pyx":2488
 *         'Argument sigma_i must be a valid Surface, got %s ' % type(sigma_i)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(image)
 * 
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "PygameShader/shader.pyx":2491
 *         array_ = pixels3d(image)
 * 
 *     except (pygame.error, ValueError):             # <<<<<<<<<<<<<<
 *         raise ValueError('\nTexture/image is not compatible.')
 * 
 */
    __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_3, &__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pygame); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2491, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2491, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_9) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_builtin_ValueError);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_7);
    __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_7 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("PygameShader.shader.bilateral", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(1, 2491, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);

      /* "PygameShader/shader.pyx":2492
 * 
 *     except (pygame.error, ValueError):
 *         raise ValueError('\nTexture/image is not compatible.')             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2492, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 2492, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "PygameShader/shader.pyx":2488
 *         'Argument sigma_i must be a valid Surface, got %s ' % type(sigma_i)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(image)
 * 
 */
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "PygameShader/shader.pyx":2495
 * 
 * 
 *     return bilateral_filter24_c(array_, sigma_s, sigma_i)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2495, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_bilateral_filter24_c(__pyx_t_11, __pyx_v_sigma_s, __pyx_v_sigma_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":2450
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object bilateral(object image, float sigma_s, float sigma_i):             # <<<<<<<<<<<<<<
 *     """
 *     A bilateral filter is a non-linear, edge-preserving, and noise-reducing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_AddTraceback("PygameShader.shader.bilateral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array_);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_131bilateral(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_130bilateral[] = "\n    A bilateral filter is a non-linear, edge-preserving, and noise-reducing\n    smoothing filter for images. It replaces the intensity of each pixel with a\n    weighted average of intensity values from nearby pixels. This weight can be\n    based on a Gaussian distribution.\n\n    Here, the normalization factor and the range weight are new terms added to \n    the previous equation. sigma_s  denotes the spatial extent of the kernel, i.e. \n    the size of the neighborhood, and sigma_r  denotes the minimum amplitude of an edge.\n    It ensures that only those pixels with intensity values similar to that of the\n    central pixel are considered for blurring, while sharp intensity changes are maintained.\n    The smaller the value of sigma_i ( or sigma_r), the sharper the edge. As sigma_r  tends to \n    infinity, the equation tends to a Gaussian blur.\n       \n    e.g:\n    \n    bilateral(surface, sigma_s = 16, sigma_i = 18)\n    \n    :param image: Surface, Pygame Surface format 24-32 bit format (alpha channel will be ignored)\n    \n    :param sigma_s: float sigma_s : Spatial extent of the kernel, size of the \n    considered neighborhood\n    \n    :param sigma_i: float sigma_i (also call sigma_r) range kernel, minimum amplitude of an edge.\n    \n    :return: return a filtered Surface\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_131bilateral(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_image = 0;
  float __pyx_v_sigma_s;
  float __pyx_v_sigma_i;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bilateral (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_image,&__pyx_n_s_sigma_s,&__pyx_n_s_sigma_i,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_image)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bilateral", 1, 3, 3, 1); __PYX_ERR(1, 2450, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma_i)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bilateral", 1, 3, 3, 2); __PYX_ERR(1, 2450, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bilateral") < 0)) __PYX_ERR(1, 2450, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_image = values[0];
    __pyx_v_sigma_s = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_sigma_s == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 2450, __pyx_L3_error)
    __pyx_v_sigma_i = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_sigma_i == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 2450, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bilateral", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2450, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.bilateral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_130bilateral(__pyx_self, __pyx_v_image, __pyx_v_sigma_s, __pyx_v_sigma_i);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_130bilateral(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_image, float __pyx_v_sigma_s, float __pyx_v_sigma_i) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bilateral", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_bilateral(__pyx_v_image, __pyx_v_sigma_s, __pyx_v_sigma_i, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.bilateral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2501
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object emboss(object surface_, unsigned int flag=0):             # <<<<<<<<<<<<<<
 *     """
 *     EMBOSS A PYGAME SURFACE
 */

static PyObject *__pyx_pw_12PygameShader_6shader_133emboss(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_emboss(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_emboss *__pyx_optional_args) {
  unsigned int __pyx_v_flag = ((unsigned int)0);
  PyObject *__pyx_v_array_ = NULL;
  PyObject *__pyx_v_emb = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("emboss", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_flag = __pyx_optional_args->flag;
    }
  }

  /* "PygameShader/shader.pyx":2510
 *     """
 * 
 *     assert isinstance(surface_, Surface), \             # <<<<<<<<<<<<<<
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2510, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2511
 * 
 *     assert isinstance(surface_, Surface), \
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_vali, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2510, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2513
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(surface_)
 * 
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "PygameShader/shader.pyx":2514
 * 
 *     try:
 *         array_ = pixels3d(surface_)             # <<<<<<<<<<<<<<
 * 
 *     except (pygame.error, ValueError):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2514, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2514, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_array_ = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "PygameShader/shader.pyx":2513
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(surface_)
 * 
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "PygameShader/shader.pyx":2516
 *         array_ = pixels3d(surface_)
 * 
 *     except (pygame.error, ValueError):             # <<<<<<<<<<<<<<
 *         raise ValueError('\nTexture/image is not compatible.')
 * 
 */
    __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pygame); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2516, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2516, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_9) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_builtin_ValueError);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_7);
    __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("PygameShader.shader.emboss", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 2516, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_1);

      /* "PygameShader/shader.pyx":2517
 * 
 *     except (pygame.error, ValueError):
 *         raise ValueError('\nTexture/image is not compatible.')             # <<<<<<<<<<<<<<
 * 
 *     cdef object emb = emboss5x5_c(array_)
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2517, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 2517, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "PygameShader/shader.pyx":2513
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(surface_)
 * 
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "PygameShader/shader.pyx":2519
 *         raise ValueError('\nTexture/image is not compatible.')
 * 
 *     cdef object emb = emboss5x5_c(array_)             # <<<<<<<<<<<<<<
 * 
 *     if flag != 0:
 */
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2519, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_emboss5x5_c(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __pyx_v_emb = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":2521
 *     cdef object emb = emboss5x5_c(array_)
 * 
 *     if flag != 0:             # <<<<<<<<<<<<<<
 *         del array_
 *         surface_.blit(emb, (0, 0), special_flags=flag)
 */
  __pyx_t_2 = ((__pyx_v_flag != 0) != 0);
  if (__pyx_t_2) {

    /* "PygameShader/shader.pyx":2522
 * 
 *     if flag != 0:
 *         del array_             # <<<<<<<<<<<<<<
 *         surface_.blit(emb, (0, 0), special_flags=flag)
 *         return surface_
 */
    __Pyx_DECREF(__pyx_v_array_);
    __pyx_v_array_ = NULL;

    /* "PygameShader/shader.pyx":2523
 *     if flag != 0:
 *         del array_
 *         surface_.blit(emb, (0, 0), special_flags=flag)             # <<<<<<<<<<<<<<
 *         return surface_
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_emb);
    __Pyx_GIVEREF(__pyx_v_emb);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_emb);
    __Pyx_INCREF(__pyx_tuple__12);
    __Pyx_GIVEREF(__pyx_tuple__12);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_tuple__12);
    __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 2523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_flag); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_special_flags, __pyx_t_9) < 0) __PYX_ERR(1, 2523, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "PygameShader/shader.pyx":2524
 *         del array_
 *         surface_.blit(emb, (0, 0), special_flags=flag)
 *         return surface_             # <<<<<<<<<<<<<<
 * 
 *     return emboss5x5_c(array_)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_surface_);
    __pyx_r = __pyx_v_surface_;
    goto __pyx_L0;

    /* "PygameShader/shader.pyx":2521
 *     cdef object emb = emboss5x5_c(array_)
 * 
 *     if flag != 0:             # <<<<<<<<<<<<<<
 *         del array_
 *         surface_.blit(emb, (0, 0), special_flags=flag)
 */
  }

  /* "PygameShader/shader.pyx":2526
 *         return surface_
 * 
 *     return emboss5x5_c(array_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2526, __pyx_L1_error)
  __pyx_t_9 = __pyx_f_12PygameShader_6shader_emboss5x5_c(__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":2501
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef object emboss(object surface_, unsigned int flag=0):             # <<<<<<<<<<<<<<
 *     """
 *     EMBOSS A PYGAME SURFACE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_AddTraceback("PygameShader.shader.emboss", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array_);
  __Pyx_XDECREF(__pyx_v_emb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_133emboss(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_132emboss[] = "\n    EMBOSS A PYGAME SURFACE \n    \n    :param surface_: pygame.Surface; compatible 24-32 bit\n    :param flag    : integer; special pygame flag such as BLEND_RGB_ADD, BLEND_RGB_MULT etc\n    :return        : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_133emboss(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  unsigned int __pyx_v_flag;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("emboss (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_flag_2,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag_2);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "emboss") < 0)) __PYX_ERR(1, 2501, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_flag == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2501, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((unsigned int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("emboss", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2501, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.emboss", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_132emboss(__pyx_self, __pyx_v_surface_, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_132emboss(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, unsigned int __pyx_v_flag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_emboss __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("emboss", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.flag = __pyx_v_flag;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_emboss(__pyx_v_surface_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.emboss", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2536
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef void palette_change(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         object palette_):
 */

static PyObject *__pyx_pw_12PygameShader_6shader_135palette_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static void __pyx_f_12PygameShader_6shader_palette_change(PyObject *__pyx_v_surface_, PyObject *__pyx_v_palette_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_array_ = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("palette_change", 0);

  /* "PygameShader/shader.pyx":2554
 *     """
 * 
 *     assert isinstance(surface_, Surface), \             # <<<<<<<<<<<<<<
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2554, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2554, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2555
 * 
 *     assert isinstance(surface_, Surface), \
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)             # <<<<<<<<<<<<<<
 * 
 *     assert isinstance(palette_, numpy.ndarray), \
 */
      __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_vali, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2555, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 2554, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2557
 *         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)
 * 
 *     assert isinstance(palette_, numpy.ndarray), \             # <<<<<<<<<<<<<<
 *         'Argument surface_ must be a valid Surface, got %s ' % type(palette_)
 *     try:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_palette_, __pyx_t_3); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2557, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "PygameShader/shader.pyx":2558
 * 
 *     assert isinstance(palette_, numpy.ndarray), \
 *         'Argument surface_ must be a valid Surface, got %s ' % type(palette_)             # <<<<<<<<<<<<<<
 *     try:
 *         array_ = pixels3d(surface_)
 */
      __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_vali, ((PyObject *)Py_TYPE(__pyx_v_palette_))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 2557, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":2559
 *     assert isinstance(palette_, numpy.ndarray), \
 *         'Argument surface_ must be a valid Surface, got %s ' % type(palette_)
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(surface_)
 * 
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "PygameShader/shader.pyx":2560
 *         'Argument surface_ must be a valid Surface, got %s ' % type(palette_)
 *     try:
 *         array_ = pixels3d(surface_)             # <<<<<<<<<<<<<<
 * 
 *     except (pygame.error, ValueError):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2560, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2560, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_array_ = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "PygameShader/shader.pyx":2559
 *     assert isinstance(palette_, numpy.ndarray), \
 *         'Argument surface_ must be a valid Surface, got %s ' % type(palette_)
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(surface_)
 * 
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "PygameShader/shader.pyx":2562
 *         array_ = pixels3d(surface_)
 * 
 *     except (pygame.error, ValueError):             # <<<<<<<<<<<<<<
 *         raise ValueError('\nTexture/image is not compatible.')
 * 
 */
    __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_1, &__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pygame); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2562, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2562, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_9) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_builtin_ValueError);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_ErrRestore(__pyx_t_3, __pyx_t_1, __pyx_t_7);
    __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_7 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("PygameShader.shader.palette_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(1, 2562, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);

      /* "PygameShader/shader.pyx":2563
 * 
 *     except (pygame.error, ValueError):
 *         raise ValueError('\nTexture/image is not compatible.')             # <<<<<<<<<<<<<<
 * 
 *     palette_change_c(array_, palette_)
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2563, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 2563, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "PygameShader/shader.pyx":2559
 *     assert isinstance(palette_, numpy.ndarray), \
 *         'Argument surface_ must be a valid Surface, got %s ' % type(palette_)
 *     try:             # <<<<<<<<<<<<<<
 *         array_ = pixels3d(surface_)
 * 
 */
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "PygameShader/shader.pyx":2565
 *         raise ValueError('\nTexture/image is not compatible.')
 * 
 *     palette_change_c(array_, palette_)             # <<<<<<<<<<<<<<
 * 
 * # ******************************************************************
 */
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2565, __pyx_L1_error)
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_palette_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(1, 2565, __pyx_L1_error)
  __pyx_f_12PygameShader_6shader_palette_change_c(__pyx_t_11, __pyx_t_12);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "PygameShader/shader.pyx":2536
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef void palette_change(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         object palette_):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.palette_change", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array_);
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_135palette_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_134palette_change[] = "\n    CHANGE AN IMAGE BY CHANGING THE COLOR PALETTE \n    \n    LIST_PALETTES contains all the palettes available\n    in the project.\n    \n    e.g: \n    from PygameShader.Palette import LIST_PALETTES\n    print(LIST_PALETTES.keys())\n    \n    :param surface_: pygame.Surface; \n    :param palette_: numpy.ndarray containing all the RGB color values \n    :return: void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_135palette_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  PyObject *__pyx_v_palette_ = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("palette_change (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_palette,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_palette)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("palette_change", 1, 2, 2, 1); __PYX_ERR(1, 2536, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "palette_change") < 0)) __PYX_ERR(1, 2536, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_palette_ = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("palette_change", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2536, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.palette_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_134palette_change(__pyx_self, __pyx_v_surface_, __pyx_v_palette_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_134palette_change(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_palette_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("palette_change", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_palette_change(__pyx_v_surface_, __pyx_v_palette_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.palette_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2575
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline float damped_oscillation(float t)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static CYTHON_INLINE float __pyx_f_12PygameShader_6shader_damped_oscillation(float __pyx_v_t) {
  float __pyx_r;

  /* "PygameShader/shader.pyx":2581
 *     :return:
 *     """
 *     return <float>(exp(-t * 0.1) * <float>cos(M_PI * t))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((float)(exp(((-__pyx_v_t) * 0.1)) * ((float)cos((__pyx_v_12PygameShader_6shader_M_PI * __pyx_v_t)))));
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":2575
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline float damped_oscillation(float t)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2586
 * cdef float C1_ = <float>1.0 / <float>sqrt(M_2PI)
 * 
 * cdef inline float gauss(float x, float c, float sigma=1.0, float mu=0.0)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static CYTHON_INLINE float __pyx_f_12PygameShader_6shader_gauss(float __pyx_v_x, float __pyx_v_c, struct __pyx_opt_args_12PygameShader_6shader_gauss *__pyx_optional_args) {
  float __pyx_v_sigma = ((float)1.0);
  float __pyx_v_mu = ((float)0.0);
  float __pyx_r;
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_sigma = __pyx_optional_args->sigma;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_mu = __pyx_optional_args->mu;
      }
    }
  }

  /* "PygameShader/shader.pyx":2595
 *     :return:
 *     """
 *     x -= c             # <<<<<<<<<<<<<<
 *     return (1.0 / sigma * C1_) * exp(-0.5 * ((x - mu) * (x - mu)) / (sigma * sigma))
 * 
 */
  __pyx_v_x = (__pyx_v_x - __pyx_v_c);

  /* "PygameShader/shader.pyx":2596
 *     """
 *     x -= c
 *     return (1.0 / sigma * C1_) * exp(-0.5 * ((x - mu) * (x - mu)) / (sigma * sigma))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = (((1.0 / __pyx_v_sigma) * __pyx_v_12PygameShader_6shader_C1_) * exp(((-0.5 * ((__pyx_v_x - __pyx_v_mu) * (__pyx_v_x - __pyx_v_mu))) / (__pyx_v_sigma * __pyx_v_sigma))));
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":2586
 * cdef float C1_ = <float>1.0 / <float>sqrt(M_2PI)
 * 
 * cdef inline float gauss(float x, float c, float sigma=1.0, float mu=0.0)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2603
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_rgb_to_bgr_inplace_c(unsigned char [:, :, :] rgb_array):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER RGB to BGR
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rgb_to_bgr_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned char __pyx_v_tmp;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  __Pyx_RefNannySetupContext("shader_rgb_to_bgr_inplace_c", 0);

  /* "PygameShader/shader.pyx":2624
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":2627
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         unsigned char tmp
 * 
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":2630
 *         unsigned char tmp
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":2632
 *     with nogil:
 * 
 *         for j in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(w):
 *                 tmp = rgb_array[i, j, 0]  # keep the blue color
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_tmp) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_tmp = ((unsigned char)'?');

                            /* "PygameShader/shader.pyx":2633
 * 
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):             # <<<<<<<<<<<<<<
 *                 tmp = rgb_array[i, j, 0]  # keep the blue color
 *                 rgb_array[i, j, 0]  = rgb_array[i, j, 2]
 */
                            __pyx_t_5 = __pyx_v_w;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_i = __pyx_t_7;

                              /* "PygameShader/shader.pyx":2634
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 *                 tmp = rgb_array[i, j, 0]  # keep the blue color             # <<<<<<<<<<<<<<
 *                 rgb_array[i, j, 0]  = rgb_array[i, j, 2]
 *                 rgb_array[i, j, 2]  = tmp
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 0;
                              __pyx_v_tmp = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) )));

                              /* "PygameShader/shader.pyx":2635
 *             for i in range(w):
 *                 tmp = rgb_array[i, j, 0]  # keep the blue color
 *                 rgb_array[i, j, 0]  = rgb_array[i, j, 2]             # <<<<<<<<<<<<<<
 *                 rgb_array[i, j, 2]  = tmp
 * 
 */
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 2;
                              __pyx_t_11 = __pyx_v_i;
                              __pyx_t_12 = __pyx_v_j;
                              __pyx_t_13 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_11 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_12 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) )));

                              /* "PygameShader/shader.pyx":2636
 *                 tmp = rgb_array[i, j, 0]  # keep the blue color
 *                 rgb_array[i, j, 0]  = rgb_array[i, j, 2]
 *                 rgb_array[i, j, 2]  = tmp             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_tmp;
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":2630
 *         unsigned char tmp
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":2603
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_rgb_to_bgr_inplace_c(unsigned char [:, :, :] rgb_array):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER RGB to BGR
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":2643
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_rgb_to_brg_inplace_c(unsigned char [:, :, :] rgb_array):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rgb_to_brg_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned char __pyx_v_tmp_r;
  unsigned char __pyx_v_tmp_g;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  __Pyx_RefNannySetupContext("shader_rgb_to_brg_inplace_c", 0);

  /* "PygameShader/shader.pyx":2664
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":2667
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         unsigned char tmp_r, tmp_g
 *         unsigned char *r
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":2673
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":2675
 *     with nogil:
 * 
 *         for j in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(w):
 *                 tmp_r = rgb_array[i, j, 0]  # keep the red color
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_tmp_g) lastprivate(__pyx_v_tmp_r) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_tmp_g = ((unsigned char)'?');
                            __pyx_v_tmp_r = ((unsigned char)'?');

                            /* "PygameShader/shader.pyx":2676
 * 
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):             # <<<<<<<<<<<<<<
 *                 tmp_r = rgb_array[i, j, 0]  # keep the red color
 *                 tmp_g = rgb_array[i, j, 1]  # keep the green color
 */
                            __pyx_t_5 = __pyx_v_w;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_i = __pyx_t_7;

                              /* "PygameShader/shader.pyx":2677
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 *                 tmp_r = rgb_array[i, j, 0]  # keep the red color             # <<<<<<<<<<<<<<
 *                 tmp_g = rgb_array[i, j, 1]  # keep the green color
 *                 rgb_array[i, j, 0] = rgb_array[i, j, 2] # r-->b
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 0;
                              __pyx_v_tmp_r = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) )));

                              /* "PygameShader/shader.pyx":2678
 *             for i in range(w):
 *                 tmp_r = rgb_array[i, j, 0]  # keep the red color
 *                 tmp_g = rgb_array[i, j, 1]  # keep the green color             # <<<<<<<<<<<<<<
 *                 rgb_array[i, j, 0] = rgb_array[i, j, 2] # r-->b
 *                 rgb_array[i, j, 1] = tmp_r  # g --> r
 */
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 1;
                              __pyx_v_tmp_g = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) )));

                              /* "PygameShader/shader.pyx":2679
 *                 tmp_r = rgb_array[i, j, 0]  # keep the red color
 *                 tmp_g = rgb_array[i, j, 1]  # keep the green color
 *                 rgb_array[i, j, 0] = rgb_array[i, j, 2] # r-->b             # <<<<<<<<<<<<<<
 *                 rgb_array[i, j, 1] = tmp_r  # g --> r
 *                 rgb_array[i, j, 2] = tmp_g
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 2;
                              __pyx_t_11 = __pyx_v_i;
                              __pyx_t_12 = __pyx_v_j;
                              __pyx_t_13 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_11 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_12 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) )));

                              /* "PygameShader/shader.pyx":2680
 *                 tmp_g = rgb_array[i, j, 1]  # keep the green color
 *                 rgb_array[i, j, 0] = rgb_array[i, j, 2] # r-->b
 *                 rgb_array[i, j, 1] = tmp_r  # g --> r             # <<<<<<<<<<<<<<
 *                 rgb_array[i, j, 2] = tmp_g
 * 
 */
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_tmp_r;

                              /* "PygameShader/shader.pyx":2681
 *                 rgb_array[i, j, 0] = rgb_array[i, j, 2] # r-->b
 *                 rgb_array[i, j, 1] = tmp_r  # g --> r
 *                 rgb_array[i, j, 2] = tmp_g             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_tmp_g;
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":2673
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":2643
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_rgb_to_brg_inplace_c(unsigned char [:, :, :] rgb_array):             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":2689
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_greyscale_luminosity24_inplace_c(unsigned char [:, :, :] rgb_array):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER GRAYSCALE (CONSERVE LUMINOSITY)
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_greyscale_luminosity24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned char __pyx_v_luminosity;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  __Pyx_RefNannySetupContext("shader_greyscale_luminosity24_inplace_c", 0);

  /* "PygameShader/shader.pyx":2710
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":2719
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":2720
 * 
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(w):
 *                 r = &rgb_array[i, j, 0]
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_luminosity) lastprivate(__pyx_v_r) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_luminosity = ((unsigned char)'?');
                            __pyx_v_r = ((unsigned char *)1);

                            /* "PygameShader/shader.pyx":2721
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):             # <<<<<<<<<<<<<<
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]
 */
                            __pyx_t_5 = __pyx_v_w;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_i = __pyx_t_7;

                              /* "PygameShader/shader.pyx":2722
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 *                 r = &rgb_array[i, j, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":2723
 *             for i in range(w):
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array[i, j, 2]
 *                 luminosity = <unsigned char>(r[0] * 0.2126 + g[0] * 0.7152 + b[0] * 0.072)
 */
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":2724
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]             # <<<<<<<<<<<<<<
 *                 luminosity = <unsigned char>(r[0] * 0.2126 + g[0] * 0.7152 + b[0] * 0.072)
 *                 r[0] = luminosity
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":2725
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]
 *                 luminosity = <unsigned char>(r[0] * 0.2126 + g[0] * 0.7152 + b[0] * 0.072)             # <<<<<<<<<<<<<<
 *                 r[0] = luminosity
 *                 g[0] = luminosity
 */
                              __pyx_v_luminosity = ((unsigned char)((((__pyx_v_r[0]) * 0.2126) + ((__pyx_v_g[0]) * 0.7152)) + ((__pyx_v_b[0]) * 0.072)));

                              /* "PygameShader/shader.pyx":2726
 *                 b = &rgb_array[i, j, 2]
 *                 luminosity = <unsigned char>(r[0] * 0.2126 + g[0] * 0.7152 + b[0] * 0.072)
 *                 r[0] = luminosity             # <<<<<<<<<<<<<<
 *                 g[0] = luminosity
 *                 b[0] = luminosity
 */
                              (__pyx_v_r[0]) = __pyx_v_luminosity;

                              /* "PygameShader/shader.pyx":2727
 *                 luminosity = <unsigned char>(r[0] * 0.2126 + g[0] * 0.7152 + b[0] * 0.072)
 *                 r[0] = luminosity
 *                 g[0] = luminosity             # <<<<<<<<<<<<<<
 *                 b[0] = luminosity
 * 
 */
                              (__pyx_v_g[0]) = __pyx_v_luminosity;

                              /* "PygameShader/shader.pyx":2728
 *                 r[0] = luminosity
 *                 g[0] = luminosity
 *                 b[0] = luminosity             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              (__pyx_v_b[0]) = __pyx_v_luminosity;
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":2719
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":2689
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_greyscale_luminosity24_inplace_c(unsigned char [:, :, :] rgb_array):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER GRAYSCALE (CONSERVE LUMINOSITY)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":2735
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_sepia24_inplace_c(unsigned char [:, :, :] rgb_array):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sepia24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  float __pyx_v_rr;
  float __pyx_v_gg;
  float __pyx_v_bb;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("shader_sepia24_inplace_c", 0);

  /* "PygameShader/shader.pyx":2753
 *     """
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":2756
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         float rr, gg, bb
 *         unsigned char *r
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":2762
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":2763
 * 
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(w):
 * 
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_bb = ((float)__PYX_NAN());
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_gg = ((float)__PYX_NAN());
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_rr = ((float)__PYX_NAN());

                            /* "PygameShader/shader.pyx":2764
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):             # <<<<<<<<<<<<<<
 * 
 *                 r = &rgb_array[i, j, 0]
 */
                            __pyx_t_5 = __pyx_v_w;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_i = __pyx_t_7;

                              /* "PygameShader/shader.pyx":2766
 *             for i in range(w):
 * 
 *                 r = &rgb_array[i, j, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":2767
 * 
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array[i, j, 2]
 * 
 */
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":2768
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 *                 rr = r[0] * <float>0.393 + g[0] * <float>0.769 + b[0] * <float>0.189
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":2770
 *                 b = &rgb_array[i, j, 2]
 * 
 *                 rr = r[0] * <float>0.393 + g[0] * <float>0.769 + b[0] * <float>0.189             # <<<<<<<<<<<<<<
 *                 gg = r[0] * <float>0.349 + g[0] * <float>0.686 + b[0] * <float>0.168
 *                 bb = r[0] * <float>0.272 + g[0] * <float>0.534 + b[0] * <float>0.131
 */
                              __pyx_v_rr = ((((__pyx_v_r[0]) * ((float)0.393)) + ((__pyx_v_g[0]) * ((float)0.769))) + ((__pyx_v_b[0]) * ((float)0.189)));

                              /* "PygameShader/shader.pyx":2771
 * 
 *                 rr = r[0] * <float>0.393 + g[0] * <float>0.769 + b[0] * <float>0.189
 *                 gg = r[0] * <float>0.349 + g[0] * <float>0.686 + b[0] * <float>0.168             # <<<<<<<<<<<<<<
 *                 bb = r[0] * <float>0.272 + g[0] * <float>0.534 + b[0] * <float>0.131
 *                 if rr > 255:
 */
                              __pyx_v_gg = ((((__pyx_v_r[0]) * ((float)0.349)) + ((__pyx_v_g[0]) * ((float)0.686))) + ((__pyx_v_b[0]) * ((float)0.168)));

                              /* "PygameShader/shader.pyx":2772
 *                 rr = r[0] * <float>0.393 + g[0] * <float>0.769 + b[0] * <float>0.189
 *                 gg = r[0] * <float>0.349 + g[0] * <float>0.686 + b[0] * <float>0.168
 *                 bb = r[0] * <float>0.272 + g[0] * <float>0.534 + b[0] * <float>0.131             # <<<<<<<<<<<<<<
 *                 if rr > 255:
 *                     rr = 255
 */
                              __pyx_v_bb = ((((__pyx_v_r[0]) * ((float)0.272)) + ((__pyx_v_g[0]) * ((float)0.534))) + ((__pyx_v_b[0]) * ((float)0.131)));

                              /* "PygameShader/shader.pyx":2773
 *                 gg = r[0] * <float>0.349 + g[0] * <float>0.686 + b[0] * <float>0.168
 *                 bb = r[0] * <float>0.272 + g[0] * <float>0.534 + b[0] * <float>0.131
 *                 if rr > 255:             # <<<<<<<<<<<<<<
 *                     rr = 255
 *                 if gg > 255:
 */
                              __pyx_t_11 = ((__pyx_v_rr > 255.0) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":2774
 *                 bb = r[0] * <float>0.272 + g[0] * <float>0.534 + b[0] * <float>0.131
 *                 if rr > 255:
 *                     rr = 255             # <<<<<<<<<<<<<<
 *                 if gg > 255:
 *                     gg = 255
 */
                                __pyx_v_rr = 255.0;

                                /* "PygameShader/shader.pyx":2773
 *                 gg = r[0] * <float>0.349 + g[0] * <float>0.686 + b[0] * <float>0.168
 *                 bb = r[0] * <float>0.272 + g[0] * <float>0.534 + b[0] * <float>0.131
 *                 if rr > 255:             # <<<<<<<<<<<<<<
 *                     rr = 255
 *                 if gg > 255:
 */
                              }

                              /* "PygameShader/shader.pyx":2775
 *                 if rr > 255:
 *                     rr = 255
 *                 if gg > 255:             # <<<<<<<<<<<<<<
 *                     gg = 255
 *                 if bb > 255:
 */
                              __pyx_t_11 = ((__pyx_v_gg > 255.0) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":2776
 *                     rr = 255
 *                 if gg > 255:
 *                     gg = 255             # <<<<<<<<<<<<<<
 *                 if bb > 255:
 *                     bb = 255
 */
                                __pyx_v_gg = 255.0;

                                /* "PygameShader/shader.pyx":2775
 *                 if rr > 255:
 *                     rr = 255
 *                 if gg > 255:             # <<<<<<<<<<<<<<
 *                     gg = 255
 *                 if bb > 255:
 */
                              }

                              /* "PygameShader/shader.pyx":2777
 *                 if gg > 255:
 *                     gg = 255
 *                 if bb > 255:             # <<<<<<<<<<<<<<
 *                     bb = 255
 *                 r[0] = <unsigned char> rr
 */
                              __pyx_t_11 = ((__pyx_v_bb > 255.0) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":2778
 *                     gg = 255
 *                 if bb > 255:
 *                     bb = 255             # <<<<<<<<<<<<<<
 *                 r[0] = <unsigned char> rr
 *                 g[0] = <unsigned char> gg
 */
                                __pyx_v_bb = 255.0;

                                /* "PygameShader/shader.pyx":2777
 *                 if gg > 255:
 *                     gg = 255
 *                 if bb > 255:             # <<<<<<<<<<<<<<
 *                     bb = 255
 *                 r[0] = <unsigned char> rr
 */
                              }

                              /* "PygameShader/shader.pyx":2779
 *                 if bb > 255:
 *                     bb = 255
 *                 r[0] = <unsigned char> rr             # <<<<<<<<<<<<<<
 *                 g[0] = <unsigned char> gg
 *                 b[0] = <unsigned char> bb
 */
                              (__pyx_v_r[0]) = ((unsigned char)__pyx_v_rr);

                              /* "PygameShader/shader.pyx":2780
 *                     bb = 255
 *                 r[0] = <unsigned char> rr
 *                 g[0] = <unsigned char> gg             # <<<<<<<<<<<<<<
 *                 b[0] = <unsigned char> bb
 * 
 */
                              (__pyx_v_g[0]) = ((unsigned char)__pyx_v_gg);

                              /* "PygameShader/shader.pyx":2781
 *                 r[0] = <unsigned char> rr
 *                 g[0] = <unsigned char> gg
 *                 b[0] = <unsigned char> bb             # <<<<<<<<<<<<<<
 * 
 * # ************* SORTING ALGORITHM FOR MEDIAN FILTER
 */
                              (__pyx_v_b[0]) = ((unsigned char)__pyx_v_bb);
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":2762
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":2735
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_sepia24_inplace_c(unsigned char [:, :, :] rgb_array):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":2788
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void bubble_sort(unsigned char [::1] nums, int size)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bubble_sort(__Pyx_memviewslice __pyx_v_nums, int __pyx_v_size) {
  int __pyx_v_i;
  unsigned char *__pyx_v_p;
  unsigned char *__pyx_v_p1;
  int __pyx_v_swapped;
  int __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  unsigned char __pyx_t_6;
  unsigned char __pyx_t_7;

  /* "PygameShader/shader.pyx":2802
 *         bint swapped
 * 
 *     swapped = True             # <<<<<<<<<<<<<<
 *     while swapped:
 *         swapped = False
 */
  __pyx_v_swapped = 1;

  /* "PygameShader/shader.pyx":2803
 * 
 *     swapped = True
 *     while swapped:             # <<<<<<<<<<<<<<
 *         swapped = False
 *         for i in range(size - 1):
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_swapped != 0);
    if (!__pyx_t_1) break;

    /* "PygameShader/shader.pyx":2804
 *     swapped = True
 *     while swapped:
 *         swapped = False             # <<<<<<<<<<<<<<
 *         for i in range(size - 1):
 *             p  = &nums[i]
 */
    __pyx_v_swapped = 0;

    /* "PygameShader/shader.pyx":2805
 *     while swapped:
 *         swapped = False
 *         for i in range(size - 1):             # <<<<<<<<<<<<<<
 *             p  = &nums[i]
 *             p1 = &nums[i+1]
 */
    __pyx_t_2 = (__pyx_v_size - 1);
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "PygameShader/shader.pyx":2806
 *         swapped = False
 *         for i in range(size - 1):
 *             p  = &nums[i]             # <<<<<<<<<<<<<<
 *             p1 = &nums[i+1]
 *             if p[0] > p1[0]:
 */
      __pyx_t_5 = __pyx_v_i;
      __pyx_v_p = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_5)) ))));

      /* "PygameShader/shader.pyx":2807
 *         for i in range(size - 1):
 *             p  = &nums[i]
 *             p1 = &nums[i+1]             # <<<<<<<<<<<<<<
 *             if p[0] > p1[0]:
 *                 p[0], p1[0] = p1[0], p[0]
 */
      __pyx_t_5 = (__pyx_v_i + 1);
      __pyx_v_p1 = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_5)) ))));

      /* "PygameShader/shader.pyx":2808
 *             p  = &nums[i]
 *             p1 = &nums[i+1]
 *             if p[0] > p1[0]:             # <<<<<<<<<<<<<<
 *                 p[0], p1[0] = p1[0], p[0]
 *                 swapped = True
 */
      __pyx_t_1 = (((__pyx_v_p[0]) > (__pyx_v_p1[0])) != 0);
      if (__pyx_t_1) {

        /* "PygameShader/shader.pyx":2809
 *             p1 = &nums[i+1]
 *             if p[0] > p1[0]:
 *                 p[0], p1[0] = p1[0], p[0]             # <<<<<<<<<<<<<<
 *                 swapped = True
 * 
 */
        __pyx_t_6 = (__pyx_v_p1[0]);
        __pyx_t_7 = (__pyx_v_p[0]);
        (__pyx_v_p[0]) = __pyx_t_6;
        (__pyx_v_p1[0]) = __pyx_t_7;

        /* "PygameShader/shader.pyx":2810
 *             if p[0] > p1[0]:
 *                 p[0], p1[0] = p1[0], p[0]
 *                 swapped = True             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_v_swapped = 1;

        /* "PygameShader/shader.pyx":2808
 *             p  = &nums[i]
 *             p1 = &nums[i+1]
 *             if p[0] > p1[0]:             # <<<<<<<<<<<<<<
 *                 p[0], p1[0] = p1[0], p[0]
 *                 swapped = True
 */
      }
    }
  }

  /* "PygameShader/shader.pyx":2788
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void bubble_sort(unsigned char [::1] nums, int size)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
}

/* "PygameShader/shader.pyx":2817
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void insertion_sort(unsigned char [::1] nums, int size)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_insertion_sort(__Pyx_memviewslice __pyx_v_nums, CYTHON_UNUSED int __pyx_v_size) {
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned char __pyx_v_item_to_insert;
  int __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;

  /* "PygameShader/shader.pyx":2829
 *         unsigned char item_to_insert
 * 
 *     for i in prange(1, size, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *         item_to_insert = nums[i]
 * 
 */
  __pyx_t_1 = __pyx_v_size;
  if ((1 == 0)) abort();
  {
      #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
          #undef likely
          #undef unlikely
          #define likely(x)   (x)
          #define unlikely(x) (x)
      #endif
      __pyx_t_3 = (__pyx_t_1 - 1 + 1 - 1/abs(1)) / 1;
      if (__pyx_t_3 > 0)
      {
          #ifdef _OPENMP
          #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7)
          #endif /* _OPENMP */
          {
              #ifdef _OPENMP
              #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_item_to_insert) lastprivate(__pyx_v_j) schedule(static)
              #endif /* _OPENMP */
              for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                  {
                      __pyx_v_i = (int)(1 + 1 * __pyx_t_2);
                      /* Initialize private variables to invalid values */
                      __pyx_v_item_to_insert = ((unsigned char)'?');
                      __pyx_v_j = ((int)0xbad0bad0);

                      /* "PygameShader/shader.pyx":2830
 * 
 *     for i in prange(1, size, schedule='static', num_threads=THREADS):
 *         item_to_insert = nums[i]             # <<<<<<<<<<<<<<
 * 
 *         j = i - 1
 */
                      __pyx_t_4 = __pyx_v_i;
                      __pyx_v_item_to_insert = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) )));

                      /* "PygameShader/shader.pyx":2832
 *         item_to_insert = nums[i]
 * 
 *         j = i - 1             # <<<<<<<<<<<<<<
 *         while j >= 0 and nums[j] > item_to_insert:
 *             nums[j + 1] = nums[j]
 */
                      __pyx_v_j = (__pyx_v_i - 1);

                      /* "PygameShader/shader.pyx":2833
 * 
 *         j = i - 1
 *         while j >= 0 and nums[j] > item_to_insert:             # <<<<<<<<<<<<<<
 *             nums[j + 1] = nums[j]
 *             j = j - 1
 */
                      while (1) {
                        __pyx_t_6 = ((__pyx_v_j >= 0) != 0);
                        if (__pyx_t_6) {
                        } else {
                          __pyx_t_5 = __pyx_t_6;
                          goto __pyx_L9_bool_binop_done;
                        }
                        __pyx_t_4 = __pyx_v_j;
                        __pyx_t_6 = (((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) ))) > __pyx_v_item_to_insert) != 0);
                        __pyx_t_5 = __pyx_t_6;
                        __pyx_L9_bool_binop_done:;
                        if (!__pyx_t_5) break;

                        /* "PygameShader/shader.pyx":2834
 *         j = i - 1
 *         while j >= 0 and nums[j] > item_to_insert:
 *             nums[j + 1] = nums[j]             # <<<<<<<<<<<<<<
 *             j = j - 1
 *         # Insert the item
 */
                        __pyx_t_4 = __pyx_v_j;
                        __pyx_t_7 = (__pyx_v_j + 1);
                        *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_7)) )) = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) )));

                        /* "PygameShader/shader.pyx":2835
 *         while j >= 0 and nums[j] > item_to_insert:
 *             nums[j + 1] = nums[j]
 *             j = j - 1             # <<<<<<<<<<<<<<
 *         # Insert the item
 *         nums[j + 1] = item_to_insert
 */
                        __pyx_v_j = (__pyx_v_j - 1);
                      }

                      /* "PygameShader/shader.pyx":2837
 *             j = j - 1
 *         # Insert the item
 *         nums[j + 1] = item_to_insert             # <<<<<<<<<<<<<<
 * 
 * 
 */
                      __pyx_t_4 = (__pyx_v_j + 1);
                      *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) )) = __pyx_v_item_to_insert;
                  }
              }
          }
      }
  }
  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
      #undef likely
      #undef unlikely
      #define likely(x)   __builtin_expect(!!(x), 1)
      #define unlikely(x) __builtin_expect(!!(x), 0)
  #endif

  /* "PygameShader/shader.pyx":2817
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void insertion_sort(unsigned char [::1] nums, int size)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
}

/* "PygameShader/shader.pyx":2847
 * # There are different ways to do a Quick Sort partition, this implements the
 * # Hoare partition scheme. Tony Hoare also created the Quick Sort algorithm.
 * cdef inline int partition(unsigned char [::1] nums, int low, int high)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static CYTHON_INLINE int __pyx_f_12PygameShader_6shader_partition(__Pyx_memviewslice __pyx_v_nums, int __pyx_v_low, int __pyx_v_high) {
  int __pyx_v_pivot;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  unsigned char __pyx_t_3;
  unsigned char __pyx_t_4;

  /* "PygameShader/shader.pyx":2858
 *         int pivot
 *         int i, j
 *     pivot = nums[(low + high) >> 1]             # <<<<<<<<<<<<<<
 *     i = low - 1
 *     j = high + 1
 */
  __pyx_t_1 = ((__pyx_v_low + __pyx_v_high) >> 1);
  __pyx_v_pivot = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) )));

  /* "PygameShader/shader.pyx":2859
 *         int i, j
 *     pivot = nums[(low + high) >> 1]
 *     i = low - 1             # <<<<<<<<<<<<<<
 *     j = high + 1
 *     while True:
 */
  __pyx_v_i = (__pyx_v_low - 1);

  /* "PygameShader/shader.pyx":2860
 *     pivot = nums[(low + high) >> 1]
 *     i = low - 1
 *     j = high + 1             # <<<<<<<<<<<<<<
 *     while True:
 *         i += 1
 */
  __pyx_v_j = (__pyx_v_high + 1);

  /* "PygameShader/shader.pyx":2861
 *     i = low - 1
 *     j = high + 1
 *     while True:             # <<<<<<<<<<<<<<
 *         i += 1
 *         while nums[i] < pivot:
 */
  while (1) {

    /* "PygameShader/shader.pyx":2862
 *     j = high + 1
 *     while True:
 *         i += 1             # <<<<<<<<<<<<<<
 *         while nums[i] < pivot:
 *             i += 1
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "PygameShader/shader.pyx":2863
 *     while True:
 *         i += 1
 *         while nums[i] < pivot:             # <<<<<<<<<<<<<<
 *             i += 1
 * 
 */
    while (1) {
      __pyx_t_1 = __pyx_v_i;
      __pyx_t_2 = (((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) ))) < __pyx_v_pivot) != 0);
      if (!__pyx_t_2) break;

      /* "PygameShader/shader.pyx":2864
 *         i += 1
 *         while nums[i] < pivot:
 *             i += 1             # <<<<<<<<<<<<<<
 * 
 *         j -= 1
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }

    /* "PygameShader/shader.pyx":2866
 *             i += 1
 * 
 *         j -= 1             # <<<<<<<<<<<<<<
 *         while nums[j] > pivot:
 *             j -= 1
 */
    __pyx_v_j = (__pyx_v_j - 1);

    /* "PygameShader/shader.pyx":2867
 * 
 *         j -= 1
 *         while nums[j] > pivot:             # <<<<<<<<<<<<<<
 *             j -= 1
 * 
 */
    while (1) {
      __pyx_t_1 = __pyx_v_j;
      __pyx_t_2 = (((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) ))) > __pyx_v_pivot) != 0);
      if (!__pyx_t_2) break;

      /* "PygameShader/shader.pyx":2868
 *         j -= 1
 *         while nums[j] > pivot:
 *             j -= 1             # <<<<<<<<<<<<<<
 * 
 *         if i >= j:
 */
      __pyx_v_j = (__pyx_v_j - 1);
    }

    /* "PygameShader/shader.pyx":2870
 *             j -= 1
 * 
 *         if i >= j:             # <<<<<<<<<<<<<<
 *             return j
 * 
 */
    __pyx_t_2 = ((__pyx_v_i >= __pyx_v_j) != 0);
    if (__pyx_t_2) {

      /* "PygameShader/shader.pyx":2871
 * 
 *         if i >= j:
 *             return j             # <<<<<<<<<<<<<<
 * 
 *         nums[i], nums[j] = nums[j], nums[i]
 */
      __pyx_r = __pyx_v_j;
      goto __pyx_L0;

      /* "PygameShader/shader.pyx":2870
 *             j -= 1
 * 
 *         if i >= j:             # <<<<<<<<<<<<<<
 *             return j
 * 
 */
    }

    /* "PygameShader/shader.pyx":2873
 *             return j
 * 
 *         nums[i], nums[j] = nums[j], nums[i]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __pyx_v_j;
    __pyx_t_3 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) )));
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_4 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) )));
    __pyx_t_1 = __pyx_v_i;
    *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) )) = __pyx_t_3;
    __pyx_t_1 = __pyx_v_j;
    *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) )) = __pyx_t_4;
  }

  /* "PygameShader/shader.pyx":2847
 * # There are different ways to do a Quick Sort partition, this implements the
 * # Hoare partition scheme. Tony Hoare also created the Quick Sort algorithm.
 * cdef inline int partition(unsigned char [::1] nums, int low, int high)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "PygameShader/shader.pyx":2880
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void _quick_sort(unsigned char [::1] items, int low, int high)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader__quick_sort(__Pyx_memviewslice __pyx_v_items, int __pyx_v_low, int __pyx_v_high) {
  int __pyx_v_split_index;
  int __pyx_t_1;

  /* "PygameShader/shader.pyx":2889
 *     """
 *     cdef int split_index
 *     if low < high:             # <<<<<<<<<<<<<<
 *         split_index = partition(items, low, high)
 *         _quick_sort(items, low, split_index)
 */
  __pyx_t_1 = ((__pyx_v_low < __pyx_v_high) != 0);
  if (__pyx_t_1) {

    /* "PygameShader/shader.pyx":2890
 *     cdef int split_index
 *     if low < high:
 *         split_index = partition(items, low, high)             # <<<<<<<<<<<<<<
 *         _quick_sort(items, low, split_index)
 *         _quick_sort(items, split_index + 1, high)
 */
    __pyx_v_split_index = __pyx_f_12PygameShader_6shader_partition(__pyx_v_items, __pyx_v_low, __pyx_v_high);

    /* "PygameShader/shader.pyx":2891
 *     if low < high:
 *         split_index = partition(items, low, high)
 *         _quick_sort(items, low, split_index)             # <<<<<<<<<<<<<<
 *         _quick_sort(items, split_index + 1, high)
 * 
 */
    __pyx_f_12PygameShader_6shader__quick_sort(__pyx_v_items, __pyx_v_low, __pyx_v_split_index);

    /* "PygameShader/shader.pyx":2892
 *         split_index = partition(items, low, high)
 *         _quick_sort(items, low, split_index)
 *         _quick_sort(items, split_index + 1, high)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_f_12PygameShader_6shader__quick_sort(__pyx_v_items, (__pyx_v_split_index + 1), __pyx_v_high);

    /* "PygameShader/shader.pyx":2889
 *     """
 *     cdef int split_index
 *     if low < high:             # <<<<<<<<<<<<<<
 *         split_index = partition(items, low, high)
 *         _quick_sort(items, low, split_index)
 */
  }

  /* "PygameShader/shader.pyx":2880
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void _quick_sort(unsigned char [::1] items, int low, int high)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
}

/* "PygameShader/shader.pyx":2899
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void heapify(unsigned char [::1] nums, int heap_size, int root_index)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heapify(__Pyx_memviewslice __pyx_v_nums, int __pyx_v_heap_size, int __pyx_v_root_index) {
  int __pyx_v_largest;
  int __pyx_v_left_child;
  int __pyx_v_right_child;
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  unsigned char __pyx_t_5;
  unsigned char __pyx_t_6;

  /* "PygameShader/shader.pyx":2908
 *     """
 *     # Assume the index of the largest element is the root index
 *     cdef int largest = root_index             # <<<<<<<<<<<<<<
 *     cdef int left_child = (2 * root_index) + 1
 *     cdef int right_child = (2 * root_index) + 2
 */
  __pyx_v_largest = __pyx_v_root_index;

  /* "PygameShader/shader.pyx":2909
 *     # Assume the index of the largest element is the root index
 *     cdef int largest = root_index
 *     cdef int left_child = (2 * root_index) + 1             # <<<<<<<<<<<<<<
 *     cdef int right_child = (2 * root_index) + 2
 * 
 */
  __pyx_v_left_child = ((2 * __pyx_v_root_index) + 1);

  /* "PygameShader/shader.pyx":2910
 *     cdef int largest = root_index
 *     cdef int left_child = (2 * root_index) + 1
 *     cdef int right_child = (2 * root_index) + 2             # <<<<<<<<<<<<<<
 * 
 *     if left_child < heap_size and nums[left_child] > nums[largest]:
 */
  __pyx_v_right_child = ((2 * __pyx_v_root_index) + 2);

  /* "PygameShader/shader.pyx":2912
 *     cdef int right_child = (2 * root_index) + 2
 * 
 *     if left_child < heap_size and nums[left_child] > nums[largest]:             # <<<<<<<<<<<<<<
 *         largest = left_child
 * 
 */
  __pyx_t_2 = ((__pyx_v_left_child < __pyx_v_heap_size) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __pyx_v_left_child;
  __pyx_t_4 = __pyx_v_largest;
  __pyx_t_2 = (((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) ))) > (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) )))) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PygameShader/shader.pyx":2913
 * 
 *     if left_child < heap_size and nums[left_child] > nums[largest]:
 *         largest = left_child             # <<<<<<<<<<<<<<
 * 
 *     if right_child < heap_size and nums[right_child] > nums[largest]:
 */
    __pyx_v_largest = __pyx_v_left_child;

    /* "PygameShader/shader.pyx":2912
 *     cdef int right_child = (2 * root_index) + 2
 * 
 *     if left_child < heap_size and nums[left_child] > nums[largest]:             # <<<<<<<<<<<<<<
 *         largest = left_child
 * 
 */
  }

  /* "PygameShader/shader.pyx":2915
 *         largest = left_child
 * 
 *     if right_child < heap_size and nums[right_child] > nums[largest]:             # <<<<<<<<<<<<<<
 *         largest = right_child
 * 
 */
  __pyx_t_2 = ((__pyx_v_right_child < __pyx_v_heap_size) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_4 = __pyx_v_right_child;
  __pyx_t_3 = __pyx_v_largest;
  __pyx_t_2 = (((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) ))) > (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) )))) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PygameShader/shader.pyx":2916
 * 
 *     if right_child < heap_size and nums[right_child] > nums[largest]:
 *         largest = right_child             # <<<<<<<<<<<<<<
 * 
 *     if largest != root_index:
 */
    __pyx_v_largest = __pyx_v_right_child;

    /* "PygameShader/shader.pyx":2915
 *         largest = left_child
 * 
 *     if right_child < heap_size and nums[right_child] > nums[largest]:             # <<<<<<<<<<<<<<
 *         largest = right_child
 * 
 */
  }

  /* "PygameShader/shader.pyx":2918
 *         largest = right_child
 * 
 *     if largest != root_index:             # <<<<<<<<<<<<<<
 *         nums[root_index], nums[largest] = nums[largest], nums[root_index]
 *         heapify(nums, heap_size, largest)
 */
  __pyx_t_1 = ((__pyx_v_largest != __pyx_v_root_index) != 0);
  if (__pyx_t_1) {

    /* "PygameShader/shader.pyx":2919
 * 
 *     if largest != root_index:
 *         nums[root_index], nums[largest] = nums[largest], nums[root_index]             # <<<<<<<<<<<<<<
 *         heapify(nums, heap_size, largest)
 * 
 */
    __pyx_t_3 = __pyx_v_largest;
    __pyx_t_5 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) )));
    __pyx_t_3 = __pyx_v_root_index;
    __pyx_t_6 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) )));
    __pyx_t_3 = __pyx_v_root_index;
    *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) )) = __pyx_t_5;
    __pyx_t_3 = __pyx_v_largest;
    *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) )) = __pyx_t_6;

    /* "PygameShader/shader.pyx":2920
 *     if largest != root_index:
 *         nums[root_index], nums[largest] = nums[largest], nums[root_index]
 *         heapify(nums, heap_size, largest)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_f_12PygameShader_6shader_heapify(__pyx_v_nums, __pyx_v_heap_size, __pyx_v_largest);

    /* "PygameShader/shader.pyx":2918
 *         largest = right_child
 * 
 *     if largest != root_index:             # <<<<<<<<<<<<<<
 *         nums[root_index], nums[largest] = nums[largest], nums[root_index]
 *         heapify(nums, heap_size, largest)
 */
  }

  /* "PygameShader/shader.pyx":2899
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void heapify(unsigned char [::1] nums, int heap_size, int root_index)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
}

/* "PygameShader/shader.pyx":2928
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void heap_sort(unsigned char [::1] nums, int n)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heap_sort(__Pyx_memviewslice __pyx_v_nums, int __pyx_v_n) {
  long __pyx_v_i;
  long __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  unsigned char __pyx_t_3;
  unsigned char __pyx_t_4;

  /* "PygameShader/shader.pyx":2936
 *     """
 * 
 *     for i in range(n, -1, -1):             # <<<<<<<<<<<<<<
 *         heapify(nums, n, i)
 * 
 */
  for (__pyx_t_1 = __pyx_v_n; __pyx_t_1 > -1L; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "PygameShader/shader.pyx":2937
 * 
 *     for i in range(n, -1, -1):
 *         heapify(nums, n, i)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n - 1, 0, -1):
 */
    __pyx_f_12PygameShader_6shader_heapify(__pyx_v_nums, __pyx_v_n, __pyx_v_i);
  }

  /* "PygameShader/shader.pyx":2939
 *         heapify(nums, n, i)
 * 
 *     for i in range(n - 1, 0, -1):             # <<<<<<<<<<<<<<
 *         nums[i], nums[0] = nums[0], nums[i]
 *         heapify(nums, i, 0)
 */
  for (__pyx_t_1 = (__pyx_v_n - 1); __pyx_t_1 > 0; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "PygameShader/shader.pyx":2940
 * 
 *     for i in range(n - 1, 0, -1):
 *         nums[i], nums[0] = nums[0], nums[i]             # <<<<<<<<<<<<<<
 *         heapify(nums, i, 0)
 * 
 */
    __pyx_t_2 = 0;
    __pyx_t_3 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_2)) )));
    __pyx_t_2 = __pyx_v_i;
    __pyx_t_4 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_2)) )));
    __pyx_t_2 = __pyx_v_i;
    *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_2)) )) = __pyx_t_3;
    __pyx_t_2 = 0;
    *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_2)) )) = __pyx_t_4;

    /* "PygameShader/shader.pyx":2941
 *     for i in range(n - 1, 0, -1):
 *         nums[i], nums[0] = nums[0], nums[i]
 *         heapify(nums, i, 0)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_f_12PygameShader_6shader_heapify(__pyx_v_nums, __pyx_v_i, 0);
  }

  /* "PygameShader/shader.pyx":2928
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void heap_sort(unsigned char [::1] nums, int n)nogil:             # <<<<<<<<<<<<<<
 *     """
 * 
 */

  /* function exit code */
}

/* "PygameShader/shader.pyx":2952
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_filter24_inplace_heapsort_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_heapsort_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_heapsort_c *__pyx_optional_args) {
  int __pyx_v_kernel_size_ = ((int)2);
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_k;
  int __pyx_v_k_size;
  __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_ky;
  int __pyx_v_kx;
  Py_ssize_t __pyx_v_ii;
  Py_ssize_t __pyx_v_jj;
  __Pyx_memviewslice __pyx_v_tmp_red = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tmp_green = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tmp_blue = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_index;
  CYTHON_UNUSED Py_ssize_t __pyx_v_w_1;
  Py_ssize_t __pyx_v_h_1;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_t_20;
  int __pyx_t_21;
  int __pyx_t_22;
  int __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_median_filter24_inplace_heapsort_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
    }
  }

  /* "PygameShader/shader.pyx":2976
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":2979
 * 
 *     cdef:
 *         int k = kernel_size_ >> 1             # <<<<<<<<<<<<<<
 *         int k_size = kernel_size_ * kernel_size_
 * 
 */
  __pyx_v_k = (__pyx_v_kernel_size_ >> 1);

  /* "PygameShader/shader.pyx":2980
 *     cdef:
 *         int k = kernel_size_ >> 1
 *         int k_size = kernel_size_ * kernel_size_             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_v_k_size = (__pyx_v_kernel_size_ * __pyx_v_kernel_size_);

  /* "PygameShader/shader.pyx":2984
 *     cdef:
 *         unsigned char [:, :, ::1] rgb_array_copy = \
 *             ascontiguousarray(numpy.array(rgb_array_, copy=True))             # <<<<<<<<<<<<<<
 * 
 *         int i=0, j=0, ky, kx
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 2984, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(1, 2984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rgb_array_copy = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "PygameShader/shader.pyx":2986
 *             ascontiguousarray(numpy.array(rgb_array_, copy=True))
 * 
 *         int i=0, j=0, ky, kx             # <<<<<<<<<<<<<<
 *         Py_ssize_t ii=0, jj=0
 * 
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":2987
 * 
 *         int i=0, j=0, ky, kx
 *         Py_ssize_t ii=0, jj=0             # <<<<<<<<<<<<<<
 * 
 *         unsigned char [::1] tmp_red   = empty(k_size, numpy.uint8, order='C')
 */
  __pyx_v_ii = 0;
  __pyx_v_jj = 0;

  /* "PygameShader/shader.pyx":2989
 *         Py_ssize_t ii=0, jj=0
 * 
 *         unsigned char [::1] tmp_red   = empty(k_size, numpy.uint8, order='C')             # <<<<<<<<<<<<<<
 *         unsigned char [::1] tmp_green = empty(k_size, numpy.uint8, order='C')
 *         unsigned char [::1] tmp_blue  = empty(k_size, numpy.uint8, order='C')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_k_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_uint8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 2989, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2989, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_tmp_red = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "PygameShader/shader.pyx":2990
 * 
 *         unsigned char [::1] tmp_red   = empty(k_size, numpy.uint8, order='C')
 *         unsigned char [::1] tmp_green = empty(k_size, numpy.uint8, order='C')             # <<<<<<<<<<<<<<
 *         unsigned char [::1] tmp_blue  = empty(k_size, numpy.uint8, order='C')
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_k_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
  __pyx_t_6 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 2990, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2990, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_tmp_green = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "PygameShader/shader.pyx":2991
 *         unsigned char [::1] tmp_red   = empty(k_size, numpy.uint8, order='C')
 *         unsigned char [::1] tmp_green = empty(k_size, numpy.uint8, order='C')
 *         unsigned char [::1] tmp_blue  = empty(k_size, numpy.uint8, order='C')             # <<<<<<<<<<<<<<
 * 
 *         int index = 0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_k_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 2991, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2991, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_tmp_blue = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "PygameShader/shader.pyx":2993
 *         unsigned char [::1] tmp_blue  = empty(k_size, numpy.uint8, order='C')
 * 
 *         int index = 0             # <<<<<<<<<<<<<<
 *         Py_ssize_t w_1 = w, h_1 = h
 * 
 */
  __pyx_v_index = 0;

  /* "PygameShader/shader.pyx":2994
 * 
 *         int index = 0
 *         Py_ssize_t w_1 = w, h_1 = h             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_w_1 = __pyx_v_w;
  __pyx_v_h_1 = __pyx_v_h;

  /* "PygameShader/shader.pyx":2996
 *         Py_ssize_t w_1 = w, h_1 = h
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w_1, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in range(h_1):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":2997
 * 
 *     with nogil:
 *         for i in prange(w_1, schedule='static', num_threads=THREADS, chunksize=2048):             # <<<<<<<<<<<<<<
 *             for j in range(h_1):
 * 
 */
        __pyx_t_3 = __pyx_v_w_1;
        if ((1 == 0)) abort();
        {
            __pyx_t_13 = 0x800;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_12 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) schedule(static, __pyx_t_13)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_12; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_ii = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_index = ((int)0xbad0bad0);
                            __pyx_v_j = ((int)0xbad0bad0);
                            __pyx_v_jj = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_kx = ((int)0xbad0bad0);
                            __pyx_v_ky = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":2998
 *     with nogil:
 *         for i in prange(w_1, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in range(h_1):             # <<<<<<<<<<<<<<
 * 
 *                 index = 0
 */
                            __pyx_t_14 = __pyx_v_h_1;
                            __pyx_t_15 = __pyx_t_14;
                            for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
                              __pyx_v_j = __pyx_t_16;

                              /* "PygameShader/shader.pyx":3000
 *             for j in range(h_1):
 * 
 *                 index = 0             # <<<<<<<<<<<<<<
 * 
 *                 for kx in range(-k, k):
 */
                              __pyx_v_index = 0;

                              /* "PygameShader/shader.pyx":3002
 *                 index = 0
 * 
 *                 for kx in range(-k, k):             # <<<<<<<<<<<<<<
 *                     for ky in range(-k, k):
 * 
 */
                              __pyx_t_17 = __pyx_v_k;
                              __pyx_t_18 = __pyx_t_17;
                              for (__pyx_t_19 = (-__pyx_v_k); __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
                                __pyx_v_kx = __pyx_t_19;

                                /* "PygameShader/shader.pyx":3003
 * 
 *                 for kx in range(-k, k):
 *                     for ky in range(-k, k):             # <<<<<<<<<<<<<<
 * 
 *                         ii = i + kx
 */
                                __pyx_t_20 = __pyx_v_k;
                                __pyx_t_21 = __pyx_t_20;
                                for (__pyx_t_22 = (-__pyx_v_k); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
                                  __pyx_v_ky = __pyx_t_22;

                                  /* "PygameShader/shader.pyx":3005
 *                     for ky in range(-k, k):
 * 
 *                         ii = i + kx             # <<<<<<<<<<<<<<
 *                         jj = j + ky
 * 
 */
                                  __pyx_v_ii = (__pyx_v_i + __pyx_v_kx);

                                  /* "PygameShader/shader.pyx":3006
 * 
 *                         ii = i + kx
 *                         jj = j + ky             # <<<<<<<<<<<<<<
 * 
 *                         if ii < 0:
 */
                                  __pyx_v_jj = (__pyx_v_j + __pyx_v_ky);

                                  /* "PygameShader/shader.pyx":3008
 *                         jj = j + ky
 * 
 *                         if ii < 0:             # <<<<<<<<<<<<<<
 *                             ii = 0
 *                         elif ii > w:
 */
                                  __pyx_t_23 = ((__pyx_v_ii < 0) != 0);
                                  if (__pyx_t_23) {

                                    /* "PygameShader/shader.pyx":3009
 * 
 *                         if ii < 0:
 *                             ii = 0             # <<<<<<<<<<<<<<
 *                         elif ii > w:
 *                             ii = w
 */
                                    __pyx_v_ii = 0;

                                    /* "PygameShader/shader.pyx":3008
 *                         jj = j + ky
 * 
 *                         if ii < 0:             # <<<<<<<<<<<<<<
 *                             ii = 0
 *                         elif ii > w:
 */
                                    goto __pyx_L16;
                                  }

                                  /* "PygameShader/shader.pyx":3010
 *                         if ii < 0:
 *                             ii = 0
 *                         elif ii > w:             # <<<<<<<<<<<<<<
 *                             ii = w
 * 
 */
                                  __pyx_t_23 = ((__pyx_v_ii > __pyx_v_w) != 0);
                                  if (__pyx_t_23) {

                                    /* "PygameShader/shader.pyx":3011
 *                             ii = 0
 *                         elif ii > w:
 *                             ii = w             # <<<<<<<<<<<<<<
 * 
 *                         if jj < 0:
 */
                                    __pyx_v_ii = __pyx_v_w;

                                    /* "PygameShader/shader.pyx":3010
 *                         if ii < 0:
 *                             ii = 0
 *                         elif ii > w:             # <<<<<<<<<<<<<<
 *                             ii = w
 * 
 */
                                  }
                                  __pyx_L16:;

                                  /* "PygameShader/shader.pyx":3013
 *                             ii = w
 * 
 *                         if jj < 0:             # <<<<<<<<<<<<<<
 *                             jj = 0
 *                         elif jj > h:
 */
                                  __pyx_t_23 = ((__pyx_v_jj < 0) != 0);
                                  if (__pyx_t_23) {

                                    /* "PygameShader/shader.pyx":3014
 * 
 *                         if jj < 0:
 *                             jj = 0             # <<<<<<<<<<<<<<
 *                         elif jj > h:
 *                             jj = h
 */
                                    __pyx_v_jj = 0;

                                    /* "PygameShader/shader.pyx":3013
 *                             ii = w
 * 
 *                         if jj < 0:             # <<<<<<<<<<<<<<
 *                             jj = 0
 *                         elif jj > h:
 */
                                    goto __pyx_L17;
                                  }

                                  /* "PygameShader/shader.pyx":3015
 *                         if jj < 0:
 *                             jj = 0
 *                         elif jj > h:             # <<<<<<<<<<<<<<
 *                             jj = h
 * 
 */
                                  __pyx_t_23 = ((__pyx_v_jj > __pyx_v_h) != 0);
                                  if (__pyx_t_23) {

                                    /* "PygameShader/shader.pyx":3016
 *                             jj = 0
 *                         elif jj > h:
 *                             jj = h             # <<<<<<<<<<<<<<
 * 
 *                         tmp_red[index]   = rgb_array_copy[ii, jj, 0]
 */
                                    __pyx_v_jj = __pyx_v_h;

                                    /* "PygameShader/shader.pyx":3015
 *                         if jj < 0:
 *                             jj = 0
 *                         elif jj > h:             # <<<<<<<<<<<<<<
 *                             jj = h
 * 
 */
                                  }
                                  __pyx_L17:;

                                  /* "PygameShader/shader.pyx":3018
 *                             jj = h
 * 
 *                         tmp_red[index]   = rgb_array_copy[ii, jj, 0]             # <<<<<<<<<<<<<<
 *                         tmp_green[index] = rgb_array_copy[ii, jj, 1]
 *                         tmp_blue[index]  = rgb_array_copy[ii, jj, 2]
 */
                                  __pyx_t_24 = __pyx_v_ii;
                                  __pyx_t_25 = __pyx_v_jj;
                                  __pyx_t_26 = 0;
                                  __pyx_t_27 = __pyx_v_index;
                                  *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_red.data) + __pyx_t_27)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_24 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_26)) )));

                                  /* "PygameShader/shader.pyx":3019
 * 
 *                         tmp_red[index]   = rgb_array_copy[ii, jj, 0]
 *                         tmp_green[index] = rgb_array_copy[ii, jj, 1]             # <<<<<<<<<<<<<<
 *                         tmp_blue[index]  = rgb_array_copy[ii, jj, 2]
 *                         index = index + 1
 */
                                  __pyx_t_26 = __pyx_v_ii;
                                  __pyx_t_25 = __pyx_v_jj;
                                  __pyx_t_24 = 1;
                                  __pyx_t_27 = __pyx_v_index;
                                  *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_green.data) + __pyx_t_27)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_26 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_24)) )));

                                  /* "PygameShader/shader.pyx":3020
 *                         tmp_red[index]   = rgb_array_copy[ii, jj, 0]
 *                         tmp_green[index] = rgb_array_copy[ii, jj, 1]
 *                         tmp_blue[index]  = rgb_array_copy[ii, jj, 2]             # <<<<<<<<<<<<<<
 *                         index = index + 1
 * 
 */
                                  __pyx_t_24 = __pyx_v_ii;
                                  __pyx_t_25 = __pyx_v_jj;
                                  __pyx_t_26 = 2;
                                  __pyx_t_27 = __pyx_v_index;
                                  *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_blue.data) + __pyx_t_27)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_24 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_26)) )));

                                  /* "PygameShader/shader.pyx":3021
 *                         tmp_green[index] = rgb_array_copy[ii, jj, 1]
 *                         tmp_blue[index]  = rgb_array_copy[ii, jj, 2]
 *                         index = index + 1             # <<<<<<<<<<<<<<
 * 
 *                 heap_sort(tmp_red, k_size)
 */
                                  __pyx_v_index = (__pyx_v_index + 1);
                                }
                              }

                              /* "PygameShader/shader.pyx":3023
 *                         index = index + 1
 * 
 *                 heap_sort(tmp_red, k_size)             # <<<<<<<<<<<<<<
 *                 heap_sort(tmp_green, k_size)
 *                 heap_sort(tmp_blue, k_size)
 */
                              __pyx_f_12PygameShader_6shader_heap_sort(__pyx_v_tmp_red, __pyx_v_k_size);

                              /* "PygameShader/shader.pyx":3024
 * 
 *                 heap_sort(tmp_red, k_size)
 *                 heap_sort(tmp_green, k_size)             # <<<<<<<<<<<<<<
 *                 heap_sort(tmp_blue, k_size)
 * 
 */
                              __pyx_f_12PygameShader_6shader_heap_sort(__pyx_v_tmp_green, __pyx_v_k_size);

                              /* "PygameShader/shader.pyx":3025
 *                 heap_sort(tmp_red, k_size)
 *                 heap_sort(tmp_green, k_size)
 *                 heap_sort(tmp_blue, k_size)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[i, j, 0] = tmp_red[k + 1]
 */
                              __pyx_f_12PygameShader_6shader_heap_sort(__pyx_v_tmp_blue, __pyx_v_k_size);

                              /* "PygameShader/shader.pyx":3027
 *                 heap_sort(tmp_blue, k_size)
 * 
 *                 rgb_array_[i, j, 0] = tmp_red[k + 1]             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 1] = tmp_green[k + 1]
 *                 rgb_array_[i, j, 2]= tmp_blue[k + 1]
 */
                              __pyx_t_26 = (__pyx_v_k + 1);
                              __pyx_t_25 = __pyx_v_i;
                              __pyx_t_24 = __pyx_v_j;
                              __pyx_t_27 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_27 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_red.data) + __pyx_t_26)) )));

                              /* "PygameShader/shader.pyx":3028
 * 
 *                 rgb_array_[i, j, 0] = tmp_red[k + 1]
 *                 rgb_array_[i, j, 1] = tmp_green[k + 1]             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 2]= tmp_blue[k + 1]
 * 
 */
                              __pyx_t_26 = (__pyx_v_k + 1);
                              __pyx_t_27 = __pyx_v_i;
                              __pyx_t_24 = __pyx_v_j;
                              __pyx_t_25 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_27 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_green.data) + __pyx_t_26)) )));

                              /* "PygameShader/shader.pyx":3029
 *                 rgb_array_[i, j, 0] = tmp_red[k + 1]
 *                 rgb_array_[i, j, 1] = tmp_green[k + 1]
 *                 rgb_array_[i, j, 2]= tmp_blue[k + 1]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_26 = (__pyx_v_k + 1);
                              __pyx_t_25 = __pyx_v_i;
                              __pyx_t_24 = __pyx_v_j;
                              __pyx_t_27 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_27 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_blue.data) + __pyx_t_26)) )));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":2996
 *         Py_ssize_t w_1 = w, h_1 = h
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w_1, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in range(h_1):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":2952
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_filter24_inplace_heapsort_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_median_filter24_inplace_heapsort_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_red, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_green, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_blue, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3037
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_filter24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_c *__pyx_optional_args) {
  int __pyx_v_kernel_size_ = ((int)2);
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_ky;
  int __pyx_v_kx;
  Py_ssize_t __pyx_v_ii;
  Py_ssize_t __pyx_v_jj;
  int __pyx_v_k;
  int __pyx_v_k_size;
  int *__pyx_v_tmp_red;
  int *__pyx_v_tmp_green;
  int *__pyx_v_tmp_blue;
  __Pyx_memviewslice __pyx_v_tmp_red_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tmp_green_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tmp_blue_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  int *__pyx_v_tmpr;
  int *__pyx_v_tmpg;
  int *__pyx_v_tmpb;
  int __pyx_v_index;
  CYTHON_UNUSED Py_ssize_t __pyx_v_w_1;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h_1;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_array_obj *__pyx_t_11 = NULL;
  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_t_20;
  int __pyx_t_21;
  int __pyx_t_22;
  int __pyx_t_23;
  int __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_median_filter24_inplace_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
    }
  }

  /* "PygameShader/shader.pyx":3061
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":3065
 *     cdef:
 *         unsigned char [:, :, ::1] rgb_array_copy = \
 *             ascontiguousarray(numpy.array(rgb_array_, copy=True))             # <<<<<<<<<<<<<<
 * 
 *         int i=0, j=0, ky, kx
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3065, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(1, 3065, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rgb_array_copy = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "PygameShader/shader.pyx":3067
 *             ascontiguousarray(numpy.array(rgb_array_, copy=True))
 * 
 *         int i=0, j=0, ky, kx             # <<<<<<<<<<<<<<
 *         Py_ssize_t ii=0, jj=0
 *         int k = kernel_size_ >> 1
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":3068
 * 
 *         int i=0, j=0, ky, kx
 *         Py_ssize_t ii=0, jj=0             # <<<<<<<<<<<<<<
 *         int k = kernel_size_ >> 1
 *         int k_size = kernel_size_ * kernel_size_
 */
  __pyx_v_ii = 0;
  __pyx_v_jj = 0;

  /* "PygameShader/shader.pyx":3069
 *         int i=0, j=0, ky, kx
 *         Py_ssize_t ii=0, jj=0
 *         int k = kernel_size_ >> 1             # <<<<<<<<<<<<<<
 *         int k_size = kernel_size_ * kernel_size_
 * 
 */
  __pyx_v_k = (__pyx_v_kernel_size_ >> 1);

  /* "PygameShader/shader.pyx":3070
 *         Py_ssize_t ii=0, jj=0
 *         int k = kernel_size_ >> 1
 *         int k_size = kernel_size_ * kernel_size_             # <<<<<<<<<<<<<<
 * 
 *         # int [64] tmp_red   = empty(64, numpy.int16, order='C')
 */
  __pyx_v_k_size = (__pyx_v_kernel_size_ * __pyx_v_kernel_size_);

  /* "PygameShader/shader.pyx":3076
 *         # int [64] tmp_blue  = empty(64, numpy.int16, order='C')
 * 
 *         int *tmp_red   = <int *> malloc(k_size * sizeof(int))             # <<<<<<<<<<<<<<
 *         int *tmp_green = <int *> malloc(k_size * sizeof(int))
 *         int *tmp_blue  = <int *> malloc(k_size * sizeof(int))
 */
  __pyx_v_tmp_red = ((int *)malloc((__pyx_v_k_size * (sizeof(int)))));

  /* "PygameShader/shader.pyx":3077
 * 
 *         int *tmp_red   = <int *> malloc(k_size * sizeof(int))
 *         int *tmp_green = <int *> malloc(k_size * sizeof(int))             # <<<<<<<<<<<<<<
 *         int *tmp_blue  = <int *> malloc(k_size * sizeof(int))
 * 
 */
  __pyx_v_tmp_green = ((int *)malloc((__pyx_v_k_size * (sizeof(int)))));

  /* "PygameShader/shader.pyx":3078
 *         int *tmp_red   = <int *> malloc(k_size * sizeof(int))
 *         int *tmp_green = <int *> malloc(k_size * sizeof(int))
 *         int *tmp_blue  = <int *> malloc(k_size * sizeof(int))             # <<<<<<<<<<<<<<
 * 
 *         int [::1] tmp_red_ = <int[:k_size]>tmp_red
 */
  __pyx_v_tmp_blue = ((int *)malloc((__pyx_v_k_size * (sizeof(int)))));

  /* "PygameShader/shader.pyx":3080
 *         int *tmp_blue  = <int *> malloc(k_size * sizeof(int))
 * 
 *         int [::1] tmp_red_ = <int[:k_size]>tmp_red             # <<<<<<<<<<<<<<
 *         int [::1] tmp_green_ = <int[:k_size]>tmp_green
 *         int [::1] tmp_blue_ = <int[:k_size]>tmp_blue
 */
  if (!__pyx_v_tmp_red) {
    PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
    __PYX_ERR(1, 3080, __pyx_L1_error)
  }
  __pyx_t_5 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)__pyx_v_k_size)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __pyx_array_new(__pyx_t_4, sizeof(int), PyBytes_AS_STRING(__pyx_t_5), (char *) "c", (char *) __pyx_v_tmp_red);
  if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dc_int(((PyObject *)__pyx_t_11), PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(1, 3080, __pyx_L1_error)
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __pyx_v_tmp_red_ = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "PygameShader/shader.pyx":3081
 * 
 *         int [::1] tmp_red_ = <int[:k_size]>tmp_red
 *         int [::1] tmp_green_ = <int[:k_size]>tmp_green             # <<<<<<<<<<<<<<
 *         int [::1] tmp_blue_ = <int[:k_size]>tmp_blue
 * 
 */
  if (!__pyx_v_tmp_green) {
    PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
    __PYX_ERR(1, 3081, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)__pyx_v_k_size)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __pyx_array_new(__pyx_t_5, sizeof(int), PyBytes_AS_STRING(__pyx_t_4), (char *) "c", (char *) __pyx_v_tmp_green);
  if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dc_int(((PyObject *)__pyx_t_11), PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(1, 3081, __pyx_L1_error)
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __pyx_v_tmp_green_ = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "PygameShader/shader.pyx":3082
 *         int [::1] tmp_red_ = <int[:k_size]>tmp_red
 *         int [::1] tmp_green_ = <int[:k_size]>tmp_green
 *         int [::1] tmp_blue_ = <int[:k_size]>tmp_blue             # <<<<<<<<<<<<<<
 * 
 *         int *tmpr
 */
  if (!__pyx_v_tmp_blue) {
    PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
    __PYX_ERR(1, 3082, __pyx_L1_error)
  }
  __pyx_t_5 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)__pyx_v_k_size)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __pyx_array_new(__pyx_t_4, sizeof(int), PyBytes_AS_STRING(__pyx_t_5), (char *) "c", (char *) __pyx_v_tmp_blue);
  if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dc_int(((PyObject *)__pyx_t_11), PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(1, 3082, __pyx_L1_error)
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __pyx_v_tmp_blue_ = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "PygameShader/shader.pyx":3088
 *         int *tmpb
 * 
 *         int index = 0             # <<<<<<<<<<<<<<
 *         Py_ssize_t w_1 = w, h_1 = h
 * 
 */
  __pyx_v_index = 0;

  /* "PygameShader/shader.pyx":3089
 * 
 *         int index = 0
 *         Py_ssize_t w_1 = w, h_1 = h             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_w_1 = __pyx_v_w;
  __pyx_v_h_1 = __pyx_v_h;

  /* "PygameShader/shader.pyx":3092
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w_1, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in prange(h_1):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3093
 * 
 *     with nogil:
 *         for i in prange(w_1, schedule='static', num_threads=THREADS, chunksize=2048):             # <<<<<<<<<<<<<<
 *             for j in prange(h_1):
 * 
 */
        __pyx_t_3 = __pyx_v_w_1;
        if ((1 == 0)) abort();
        {
            __pyx_t_14 = 0x800;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_13 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_13 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_tmpb) lastprivate(__pyx_v_tmpg) lastprivate(__pyx_v_tmpr) schedule(static, __pyx_t_14)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_13; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_ii = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_index = ((int)0xbad0bad0);
                            __pyx_v_j = ((int)0xbad0bad0);
                            __pyx_v_jj = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_kx = ((int)0xbad0bad0);
                            __pyx_v_ky = ((int)0xbad0bad0);
                            __pyx_v_tmpb = ((int *)1);
                            __pyx_v_tmpg = ((int *)1);
                            __pyx_v_tmpr = ((int *)1);

                            /* "PygameShader/shader.pyx":3094
 *     with nogil:
 *         for i in prange(w_1, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in prange(h_1):             # <<<<<<<<<<<<<<
 * 
 *                 index = 0
 */
                            __pyx_t_15 = __pyx_v_h_1;
                            if ((1 == 0)) abort();
                            {
                                __pyx_t_17 = (__pyx_t_15 - 0 + 1 - 1/abs(1)) / 1;
                                if (__pyx_t_17 > 0)
                                {
                                    #if 0
                                    #pragma omp parallel
                                    #endif /* _OPENMP */
                                    {
                                        #if 0
                                        #pragma omp for lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_tmpb) lastprivate(__pyx_v_tmpg) lastprivate(__pyx_v_tmpr)
                                        #endif /* _OPENMP */
                                        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_17; __pyx_t_16++){
                                            {
                                                __pyx_v_j = (int)(0 + 1 * __pyx_t_16);
                                                /* Initialize private variables to invalid values */
                                                __pyx_v_ii = ((Py_ssize_t)0xbad0bad0);
                                                __pyx_v_index = ((int)0xbad0bad0);
                                                __pyx_v_jj = ((Py_ssize_t)0xbad0bad0);
                                                __pyx_v_kx = ((int)0xbad0bad0);
                                                __pyx_v_ky = ((int)0xbad0bad0);
                                                __pyx_v_tmpb = ((int *)1);
                                                __pyx_v_tmpg = ((int *)1);
                                                __pyx_v_tmpr = ((int *)1);

                                                /* "PygameShader/shader.pyx":3096
 *             for j in prange(h_1):
 * 
 *                 index = 0             # <<<<<<<<<<<<<<
 * 
 *                 for kx in range(-k, k):
 */
                                                __pyx_v_index = 0;

                                                /* "PygameShader/shader.pyx":3098
 *                 index = 0
 * 
 *                 for kx in range(-k, k):             # <<<<<<<<<<<<<<
 *                     for ky in range(-k, k):
 * 
 */
                                                __pyx_t_18 = __pyx_v_k;
                                                __pyx_t_19 = __pyx_t_18;
                                                for (__pyx_t_20 = (-__pyx_v_k); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
                                                  __pyx_v_kx = __pyx_t_20;

                                                  /* "PygameShader/shader.pyx":3099
 * 
 *                 for kx in range(-k, k):
 *                     for ky in range(-k, k):             # <<<<<<<<<<<<<<
 * 
 *                         ii = i + kx
 */
                                                  __pyx_t_21 = __pyx_v_k;
                                                  __pyx_t_22 = __pyx_t_21;
                                                  for (__pyx_t_23 = (-__pyx_v_k); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
                                                    __pyx_v_ky = __pyx_t_23;

                                                    /* "PygameShader/shader.pyx":3101
 *                     for ky in range(-k, k):
 * 
 *                         ii = i + kx             # <<<<<<<<<<<<<<
 *                         jj = j + ky
 * 
 */
                                                    __pyx_v_ii = (__pyx_v_i + __pyx_v_kx);

                                                    /* "PygameShader/shader.pyx":3102
 * 
 *                         ii = i + kx
 *                         jj = j + ky             # <<<<<<<<<<<<<<
 * 
 *                         if ii < 0:
 */
                                                    __pyx_v_jj = (__pyx_v_j + __pyx_v_ky);

                                                    /* "PygameShader/shader.pyx":3104
 *                         jj = j + ky
 * 
 *                         if ii < 0:             # <<<<<<<<<<<<<<
 *                             ii = 0
 *                         elif ii > w:
 */
                                                    __pyx_t_24 = ((__pyx_v_ii < 0) != 0);
                                                    if (__pyx_t_24) {

                                                      /* "PygameShader/shader.pyx":3105
 * 
 *                         if ii < 0:
 *                             ii = 0             # <<<<<<<<<<<<<<
 *                         elif ii > w:
 *                             ii = w
 */
                                                      __pyx_v_ii = 0;

                                                      /* "PygameShader/shader.pyx":3104
 *                         jj = j + ky
 * 
 *                         if ii < 0:             # <<<<<<<<<<<<<<
 *                             ii = 0
 *                         elif ii > w:
 */
                                                      goto __pyx_L18;
                                                    }

                                                    /* "PygameShader/shader.pyx":3106
 *                         if ii < 0:
 *                             ii = 0
 *                         elif ii > w:             # <<<<<<<<<<<<<<
 *                             ii = w
 * 
 */
                                                    __pyx_t_24 = ((__pyx_v_ii > __pyx_v_w) != 0);
                                                    if (__pyx_t_24) {

                                                      /* "PygameShader/shader.pyx":3107
 *                             ii = 0
 *                         elif ii > w:
 *                             ii = w             # <<<<<<<<<<<<<<
 * 
 *                         if jj < 0:
 */
                                                      __pyx_v_ii = __pyx_v_w;

                                                      /* "PygameShader/shader.pyx":3106
 *                         if ii < 0:
 *                             ii = 0
 *                         elif ii > w:             # <<<<<<<<<<<<<<
 *                             ii = w
 * 
 */
                                                    }
                                                    __pyx_L18:;

                                                    /* "PygameShader/shader.pyx":3109
 *                             ii = w
 * 
 *                         if jj < 0:             # <<<<<<<<<<<<<<
 *                             jj = 0
 *                         elif jj > h:
 */
                                                    __pyx_t_24 = ((__pyx_v_jj < 0) != 0);
                                                    if (__pyx_t_24) {

                                                      /* "PygameShader/shader.pyx":3110
 * 
 *                         if jj < 0:
 *                             jj = 0             # <<<<<<<<<<<<<<
 *                         elif jj > h:
 *                             jj = h
 */
                                                      __pyx_v_jj = 0;

                                                      /* "PygameShader/shader.pyx":3109
 *                             ii = w
 * 
 *                         if jj < 0:             # <<<<<<<<<<<<<<
 *                             jj = 0
 *                         elif jj > h:
 */
                                                      goto __pyx_L19;
                                                    }

                                                    /* "PygameShader/shader.pyx":3111
 *                         if jj < 0:
 *                             jj = 0
 *                         elif jj > h:             # <<<<<<<<<<<<<<
 *                             jj = h
 * 
 */
                                                    __pyx_t_24 = ((__pyx_v_jj > __pyx_v_h) != 0);
                                                    if (__pyx_t_24) {

                                                      /* "PygameShader/shader.pyx":3112
 *                             jj = 0
 *                         elif jj > h:
 *                             jj = h             # <<<<<<<<<<<<<<
 * 
 *                         tmp_red_[index]   = rgb_array_copy[ii, jj, 0]
 */
                                                      __pyx_v_jj = __pyx_v_h;

                                                      /* "PygameShader/shader.pyx":3111
 *                         if jj < 0:
 *                             jj = 0
 *                         elif jj > h:             # <<<<<<<<<<<<<<
 *                             jj = h
 * 
 */
                                                    }
                                                    __pyx_L19:;

                                                    /* "PygameShader/shader.pyx":3114
 *                             jj = h
 * 
 *                         tmp_red_[index]   = rgb_array_copy[ii, jj, 0]             # <<<<<<<<<<<<<<
 *                         tmp_green_[index] = rgb_array_copy[ii, jj, 1]
 *                         tmp_blue_[index]  = rgb_array_copy[ii, jj, 2]
 */
                                                    __pyx_t_25 = __pyx_v_ii;
                                                    __pyx_t_26 = __pyx_v_jj;
                                                    __pyx_t_27 = 0;
                                                    __pyx_t_28 = __pyx_v_index;
                                                    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_tmp_red_.data) + __pyx_t_28)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_25 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_27)) )));

                                                    /* "PygameShader/shader.pyx":3115
 * 
 *                         tmp_red_[index]   = rgb_array_copy[ii, jj, 0]
 *                         tmp_green_[index] = rgb_array_copy[ii, jj, 1]             # <<<<<<<<<<<<<<
 *                         tmp_blue_[index]  = rgb_array_copy[ii, jj, 2]
 *                         index = index + 1
 */
                                                    __pyx_t_27 = __pyx_v_ii;
                                                    __pyx_t_26 = __pyx_v_jj;
                                                    __pyx_t_25 = 1;
                                                    __pyx_t_28 = __pyx_v_index;
                                                    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_tmp_green_.data) + __pyx_t_28)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_27 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_25)) )));

                                                    /* "PygameShader/shader.pyx":3116
 *                         tmp_red_[index]   = rgb_array_copy[ii, jj, 0]
 *                         tmp_green_[index] = rgb_array_copy[ii, jj, 1]
 *                         tmp_blue_[index]  = rgb_array_copy[ii, jj, 2]             # <<<<<<<<<<<<<<
 *                         index = index + 1
 * 
 */
                                                    __pyx_t_25 = __pyx_v_ii;
                                                    __pyx_t_26 = __pyx_v_jj;
                                                    __pyx_t_27 = 2;
                                                    __pyx_t_28 = __pyx_v_index;
                                                    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_tmp_blue_.data) + __pyx_t_28)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_25 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_27)) )));

                                                    /* "PygameShader/shader.pyx":3117
 *                         tmp_green_[index] = rgb_array_copy[ii, jj, 1]
 *                         tmp_blue_[index]  = rgb_array_copy[ii, jj, 2]
 *                         index = index + 1             # <<<<<<<<<<<<<<
 * 
 *                 # External C quicksort
 */
                                                    __pyx_v_index = (__pyx_v_index + 1);
                                                  }
                                                }

                                                /* "PygameShader/shader.pyx":3120
 * 
 *                 # External C quicksort
 *                 tmpr = quickSort(&tmp_red_[0], 0, k_size)             # <<<<<<<<<<<<<<
 *                 tmpg = quickSort(&tmp_green[0], 0, k_size)
 *                 tmpb = quickSort(&tmp_blue[0], 0, k_size)
 */
                                                __pyx_t_27 = 0;
                                                __pyx_v_tmpr = quickSort((&(*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_tmp_red_.data) + __pyx_t_27)) )))), 0, __pyx_v_k_size);

                                                /* "PygameShader/shader.pyx":3121
 *                 # External C quicksort
 *                 tmpr = quickSort(&tmp_red_[0], 0, k_size)
 *                 tmpg = quickSort(&tmp_green[0], 0, k_size)             # <<<<<<<<<<<<<<
 *                 tmpb = quickSort(&tmp_blue[0], 0, k_size)
 * 
 */
                                                __pyx_v_tmpg = quickSort((&(__pyx_v_tmp_green[0])), 0, __pyx_v_k_size);

                                                /* "PygameShader/shader.pyx":3122
 *                 tmpr = quickSort(&tmp_red_[0], 0, k_size)
 *                 tmpg = quickSort(&tmp_green[0], 0, k_size)
 *                 tmpb = quickSort(&tmp_blue[0], 0, k_size)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[i, j, 0] = tmpr[k + 1]
 */
                                                __pyx_v_tmpb = quickSort((&(__pyx_v_tmp_blue[0])), 0, __pyx_v_k_size);

                                                /* "PygameShader/shader.pyx":3124
 *                 tmpb = quickSort(&tmp_blue[0], 0, k_size)
 * 
 *                 rgb_array_[i, j, 0] = tmpr[k + 1]             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 1] = tmpg[k + 1]
 *                 rgb_array_[i, j, 2] = tmpb[k + 1]
 */
                                                __pyx_t_27 = __pyx_v_i;
                                                __pyx_t_26 = __pyx_v_j;
                                                __pyx_t_25 = 0;
                                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_27 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmpr[(__pyx_v_k + 1)]);

                                                /* "PygameShader/shader.pyx":3125
 * 
 *                 rgb_array_[i, j, 0] = tmpr[k + 1]
 *                 rgb_array_[i, j, 1] = tmpg[k + 1]             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 2] = tmpb[k + 1]
 * 
 */
                                                __pyx_t_25 = __pyx_v_i;
                                                __pyx_t_26 = __pyx_v_j;
                                                __pyx_t_27 = 1;
                                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_27 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmpg[(__pyx_v_k + 1)]);

                                                /* "PygameShader/shader.pyx":3126
 *                 rgb_array_[i, j, 0] = tmpr[k + 1]
 *                 rgb_array_[i, j, 1] = tmpg[k + 1]
 *                 rgb_array_[i, j, 2] = tmpb[k + 1]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                                                __pyx_t_27 = __pyx_v_i;
                                                __pyx_t_26 = __pyx_v_j;
                                                __pyx_t_25 = 2;
                                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_27 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmpb[(__pyx_v_k + 1)]);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3092
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w_1, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in prange(h_1):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":3037
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_filter24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __Pyx_XDECREF(((PyObject *)__pyx_t_11));
  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_median_filter24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_red_, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_green_, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_blue_, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3134
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_filter24_avg_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_filter24_avg_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_avg_inplace_c *__pyx_optional_args) {
  int __pyx_v_kernel_size_ = ((int)2);
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_ky;
  int __pyx_v_kx;
  Py_ssize_t __pyx_v_ii;
  Py_ssize_t __pyx_v_jj;
  int __pyx_v_k;
  CYTHON_UNUSED int __pyx_v_k_size;
  Py_ssize_t __pyx_v_w_1;
  Py_ssize_t __pyx_v_h_1;
  unsigned char __pyx_v_max_r;
  unsigned char __pyx_v_min_r;
  unsigned char __pyx_v_max_g;
  unsigned char __pyx_v_min_g;
  unsigned char __pyx_v_max_b;
  unsigned char __pyx_v_min_b;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_t_20;
  int __pyx_t_21;
  int __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_median_filter24_avg_inplace_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
    }
  }

  /* "PygameShader/shader.pyx":3158
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":3162
 *     cdef:
 *         unsigned char [:, :, ::1] rgb_array_copy = \
 *             ascontiguousarray(numpy.array(rgb_array_, copy=True))             # <<<<<<<<<<<<<<
 * 
 *         int i=0, j=0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3162, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(1, 3162, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rgb_array_copy = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "PygameShader/shader.pyx":3164
 *             ascontiguousarray(numpy.array(rgb_array_, copy=True))
 * 
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         int ky, kx
 *         Py_ssize_t ii=0, jj=0
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":3166
 *         int i=0, j=0
 *         int ky, kx
 *         Py_ssize_t ii=0, jj=0             # <<<<<<<<<<<<<<
 *         int k = kernel_size_ >> 1
 *         int k_size = kernel_size_ * kernel_size_
 */
  __pyx_v_ii = 0;
  __pyx_v_jj = 0;

  /* "PygameShader/shader.pyx":3167
 *         int ky, kx
 *         Py_ssize_t ii=0, jj=0
 *         int k = kernel_size_ >> 1             # <<<<<<<<<<<<<<
 *         int k_size = kernel_size_ * kernel_size_
 * 
 */
  __pyx_v_k = (__pyx_v_kernel_size_ >> 1);

  /* "PygameShader/shader.pyx":3168
 *         Py_ssize_t ii=0, jj=0
 *         int k = kernel_size_ >> 1
 *         int k_size = kernel_size_ * kernel_size_             # <<<<<<<<<<<<<<
 * 
 *         Py_ssize_t w_1 = w - 1, h_1 = h - 1
 */
  __pyx_v_k_size = (__pyx_v_kernel_size_ * __pyx_v_kernel_size_);

  /* "PygameShader/shader.pyx":3170
 *         int k_size = kernel_size_ * kernel_size_
 * 
 *         Py_ssize_t w_1 = w - 1, h_1 = h - 1             # <<<<<<<<<<<<<<
 *         int red, green, blue
 *         unsigned char max_r, min_r, max_g, min_g, max_b, min_b
 */
  __pyx_v_w_1 = (__pyx_v_w - 1);
  __pyx_v_h_1 = (__pyx_v_h - 1);

  /* "PygameShader/shader.pyx":3177
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in range(h):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3178
 * 
 *     with nogil:
 *         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=2048):             # <<<<<<<<<<<<<<
 *             for j in range(h):
 * 
 */
        __pyx_t_3 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            __pyx_t_12 = 0x800;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_11 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_11 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_max_b) lastprivate(__pyx_v_max_g) lastprivate(__pyx_v_max_r) lastprivate(__pyx_v_min_b) lastprivate(__pyx_v_min_g) lastprivate(__pyx_v_min_r) lastprivate(__pyx_v_r) schedule(static, __pyx_t_12)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_11; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_ii = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_j = ((int)0xbad0bad0);
                            __pyx_v_jj = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_kx = ((int)0xbad0bad0);
                            __pyx_v_ky = ((int)0xbad0bad0);
                            __pyx_v_max_b = ((unsigned char)'?');
                            __pyx_v_max_g = ((unsigned char)'?');
                            __pyx_v_max_r = ((unsigned char)'?');
                            __pyx_v_min_b = ((unsigned char)'?');
                            __pyx_v_min_g = ((unsigned char)'?');
                            __pyx_v_min_r = ((unsigned char)'?');
                            __pyx_v_r = ((unsigned char *)1);

                            /* "PygameShader/shader.pyx":3179
 *     with nogil:
 *         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in range(h):             # <<<<<<<<<<<<<<
 * 
 *                 max_r = 0
 */
                            __pyx_t_13 = __pyx_v_h;
                            __pyx_t_14 = __pyx_t_13;
                            for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
                              __pyx_v_j = __pyx_t_15;

                              /* "PygameShader/shader.pyx":3181
 *             for j in range(h):
 * 
 *                 max_r = 0             # <<<<<<<<<<<<<<
 *                 min_r = 0
 *                 max_g = 0
 */
                              __pyx_v_max_r = 0;

                              /* "PygameShader/shader.pyx":3182
 * 
 *                 max_r = 0
 *                 min_r = 0             # <<<<<<<<<<<<<<
 *                 max_g = 0
 *                 min_g = 0
 */
                              __pyx_v_min_r = 0;

                              /* "PygameShader/shader.pyx":3183
 *                 max_r = 0
 *                 min_r = 0
 *                 max_g = 0             # <<<<<<<<<<<<<<
 *                 min_g = 0
 *                 max_b = 0
 */
                              __pyx_v_max_g = 0;

                              /* "PygameShader/shader.pyx":3184
 *                 min_r = 0
 *                 max_g = 0
 *                 min_g = 0             # <<<<<<<<<<<<<<
 *                 max_b = 0
 *                 min_b = 0
 */
                              __pyx_v_min_g = 0;

                              /* "PygameShader/shader.pyx":3185
 *                 max_g = 0
 *                 min_g = 0
 *                 max_b = 0             # <<<<<<<<<<<<<<
 *                 min_b = 0
 * 
 */
                              __pyx_v_max_b = 0;

                              /* "PygameShader/shader.pyx":3186
 *                 min_g = 0
 *                 max_b = 0
 *                 min_b = 0             # <<<<<<<<<<<<<<
 * 
 *                 for kx in range(-k, k):
 */
                              __pyx_v_min_b = 0;

                              /* "PygameShader/shader.pyx":3188
 *                 min_b = 0
 * 
 *                 for kx in range(-k, k):             # <<<<<<<<<<<<<<
 *                     for ky in range(-k, k):
 *                         ii = (i + kx)
 */
                              __pyx_t_16 = __pyx_v_k;
                              __pyx_t_17 = __pyx_t_16;
                              for (__pyx_t_18 = (-__pyx_v_k); __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                                __pyx_v_kx = __pyx_t_18;

                                /* "PygameShader/shader.pyx":3189
 * 
 *                 for kx in range(-k, k):
 *                     for ky in range(-k, k):             # <<<<<<<<<<<<<<
 *                         ii = (i + kx)
 *                         jj = (j + ky)
 */
                                __pyx_t_19 = __pyx_v_k;
                                __pyx_t_20 = __pyx_t_19;
                                for (__pyx_t_21 = (-__pyx_v_k); __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
                                  __pyx_v_ky = __pyx_t_21;

                                  /* "PygameShader/shader.pyx":3190
 *                 for kx in range(-k, k):
 *                     for ky in range(-k, k):
 *                         ii = (i + kx)             # <<<<<<<<<<<<<<
 *                         jj = (j + ky)
 * 
 */
                                  __pyx_v_ii = (__pyx_v_i + __pyx_v_kx);

                                  /* "PygameShader/shader.pyx":3191
 *                     for ky in range(-k, k):
 *                         ii = (i + kx)
 *                         jj = (j + ky)             # <<<<<<<<<<<<<<
 * 
 *                         if ii < 0:
 */
                                  __pyx_v_jj = (__pyx_v_j + __pyx_v_ky);

                                  /* "PygameShader/shader.pyx":3193
 *                         jj = (j + ky)
 * 
 *                         if ii < 0:             # <<<<<<<<<<<<<<
 *                             ii = 0
 *                         elif ii > w_1:
 */
                                  __pyx_t_22 = ((__pyx_v_ii < 0) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3194
 * 
 *                         if ii < 0:
 *                             ii = 0             # <<<<<<<<<<<<<<
 *                         elif ii > w_1:
 *                             ii = w_1
 */
                                    __pyx_v_ii = 0;

                                    /* "PygameShader/shader.pyx":3193
 *                         jj = (j + ky)
 * 
 *                         if ii < 0:             # <<<<<<<<<<<<<<
 *                             ii = 0
 *                         elif ii > w_1:
 */
                                    goto __pyx_L16;
                                  }

                                  /* "PygameShader/shader.pyx":3195
 *                         if ii < 0:
 *                             ii = 0
 *                         elif ii > w_1:             # <<<<<<<<<<<<<<
 *                             ii = w_1
 * 
 */
                                  __pyx_t_22 = ((__pyx_v_ii > __pyx_v_w_1) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3196
 *                             ii = 0
 *                         elif ii > w_1:
 *                             ii = w_1             # <<<<<<<<<<<<<<
 * 
 *                         if jj < 0:
 */
                                    __pyx_v_ii = __pyx_v_w_1;

                                    /* "PygameShader/shader.pyx":3195
 *                         if ii < 0:
 *                             ii = 0
 *                         elif ii > w_1:             # <<<<<<<<<<<<<<
 *                             ii = w_1
 * 
 */
                                  }
                                  __pyx_L16:;

                                  /* "PygameShader/shader.pyx":3198
 *                             ii = w_1
 * 
 *                         if jj < 0:             # <<<<<<<<<<<<<<
 *                             jj = 0
 *                         elif jj > h_1:
 */
                                  __pyx_t_22 = ((__pyx_v_jj < 0) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3199
 * 
 *                         if jj < 0:
 *                             jj = 0             # <<<<<<<<<<<<<<
 *                         elif jj > h_1:
 *                             jj = h_1
 */
                                    __pyx_v_jj = 0;

                                    /* "PygameShader/shader.pyx":3198
 *                             ii = w_1
 * 
 *                         if jj < 0:             # <<<<<<<<<<<<<<
 *                             jj = 0
 *                         elif jj > h_1:
 */
                                    goto __pyx_L17;
                                  }

                                  /* "PygameShader/shader.pyx":3200
 *                         if jj < 0:
 *                             jj = 0
 *                         elif jj > h_1:             # <<<<<<<<<<<<<<
 *                             jj = h_1
 * 
 */
                                  __pyx_t_22 = ((__pyx_v_jj > __pyx_v_h_1) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3201
 *                             jj = 0
 *                         elif jj > h_1:
 *                             jj = h_1             # <<<<<<<<<<<<<<
 * 
 *                         r = &rgb_array_[ii, jj, 0]
 */
                                    __pyx_v_jj = __pyx_v_h_1;

                                    /* "PygameShader/shader.pyx":3200
 *                         if jj < 0:
 *                             jj = 0
 *                         elif jj > h_1:             # <<<<<<<<<<<<<<
 *                             jj = h_1
 * 
 */
                                  }
                                  __pyx_L17:;

                                  /* "PygameShader/shader.pyx":3203
 *                             jj = h_1
 * 
 *                         r = &rgb_array_[ii, jj, 0]             # <<<<<<<<<<<<<<
 *                         g = &rgb_array_[ii, jj, 1]
 *                         b = &rgb_array_[ii, jj, 2]
 */
                                  __pyx_t_23 = __pyx_v_ii;
                                  __pyx_t_24 = __pyx_v_jj;
                                  __pyx_t_25 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":3204
 * 
 *                         r = &rgb_array_[ii, jj, 0]
 *                         g = &rgb_array_[ii, jj, 1]             # <<<<<<<<<<<<<<
 *                         b = &rgb_array_[ii, jj, 2]
 * 
 */
                                  __pyx_t_25 = __pyx_v_ii;
                                  __pyx_t_24 = __pyx_v_jj;
                                  __pyx_t_23 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":3205
 *                         r = &rgb_array_[ii, jj, 0]
 *                         g = &rgb_array_[ii, jj, 1]
 *                         b = &rgb_array_[ii, jj, 2]             # <<<<<<<<<<<<<<
 * 
 *                         if r[0] > max_r:
 */
                                  __pyx_t_23 = __pyx_v_ii;
                                  __pyx_t_24 = __pyx_v_jj;
                                  __pyx_t_25 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":3207
 *                         b = &rgb_array_[ii, jj, 2]
 * 
 *                         if r[0] > max_r:             # <<<<<<<<<<<<<<
 *                             max_r = r[0]
 *                         if g[0] > max_g:
 */
                                  __pyx_t_22 = (((__pyx_v_r[0]) > __pyx_v_max_r) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3208
 * 
 *                         if r[0] > max_r:
 *                             max_r = r[0]             # <<<<<<<<<<<<<<
 *                         if g[0] > max_g:
 *                             max_g = g[0]
 */
                                    __pyx_v_max_r = (__pyx_v_r[0]);

                                    /* "PygameShader/shader.pyx":3207
 *                         b = &rgb_array_[ii, jj, 2]
 * 
 *                         if r[0] > max_r:             # <<<<<<<<<<<<<<
 *                             max_r = r[0]
 *                         if g[0] > max_g:
 */
                                  }

                                  /* "PygameShader/shader.pyx":3209
 *                         if r[0] > max_r:
 *                             max_r = r[0]
 *                         if g[0] > max_g:             # <<<<<<<<<<<<<<
 *                             max_g = g[0]
 *                         if b[0] > max_b:
 */
                                  __pyx_t_22 = (((__pyx_v_g[0]) > __pyx_v_max_g) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3210
 *                             max_r = r[0]
 *                         if g[0] > max_g:
 *                             max_g = g[0]             # <<<<<<<<<<<<<<
 *                         if b[0] > max_b:
 *                             max_b = b[0]
 */
                                    __pyx_v_max_g = (__pyx_v_g[0]);

                                    /* "PygameShader/shader.pyx":3209
 *                         if r[0] > max_r:
 *                             max_r = r[0]
 *                         if g[0] > max_g:             # <<<<<<<<<<<<<<
 *                             max_g = g[0]
 *                         if b[0] > max_b:
 */
                                  }

                                  /* "PygameShader/shader.pyx":3211
 *                         if g[0] > max_g:
 *                             max_g = g[0]
 *                         if b[0] > max_b:             # <<<<<<<<<<<<<<
 *                             max_b = b[0]
 * 
 */
                                  __pyx_t_22 = (((__pyx_v_b[0]) > __pyx_v_max_b) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3212
 *                             max_g = g[0]
 *                         if b[0] > max_b:
 *                             max_b = b[0]             # <<<<<<<<<<<<<<
 * 
 *                         if r[0] < min_r:
 */
                                    __pyx_v_max_b = (__pyx_v_b[0]);

                                    /* "PygameShader/shader.pyx":3211
 *                         if g[0] > max_g:
 *                             max_g = g[0]
 *                         if b[0] > max_b:             # <<<<<<<<<<<<<<
 *                             max_b = b[0]
 * 
 */
                                  }

                                  /* "PygameShader/shader.pyx":3214
 *                             max_b = b[0]
 * 
 *                         if r[0] < min_r:             # <<<<<<<<<<<<<<
 *                             min_r = r[0]
 *                         if g[0] < min_g:
 */
                                  __pyx_t_22 = (((__pyx_v_r[0]) < __pyx_v_min_r) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3215
 * 
 *                         if r[0] < min_r:
 *                             min_r = r[0]             # <<<<<<<<<<<<<<
 *                         if g[0] < min_g:
 *                             min_g = g[0]
 */
                                    __pyx_v_min_r = (__pyx_v_r[0]);

                                    /* "PygameShader/shader.pyx":3214
 *                             max_b = b[0]
 * 
 *                         if r[0] < min_r:             # <<<<<<<<<<<<<<
 *                             min_r = r[0]
 *                         if g[0] < min_g:
 */
                                  }

                                  /* "PygameShader/shader.pyx":3216
 *                         if r[0] < min_r:
 *                             min_r = r[0]
 *                         if g[0] < min_g:             # <<<<<<<<<<<<<<
 *                             min_g = g[0]
 *                         if b[0] < min_b:
 */
                                  __pyx_t_22 = (((__pyx_v_g[0]) < __pyx_v_min_g) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3217
 *                             min_r = r[0]
 *                         if g[0] < min_g:
 *                             min_g = g[0]             # <<<<<<<<<<<<<<
 *                         if b[0] < min_b:
 *                             min_b = b[0]
 */
                                    __pyx_v_min_g = (__pyx_v_g[0]);

                                    /* "PygameShader/shader.pyx":3216
 *                         if r[0] < min_r:
 *                             min_r = r[0]
 *                         if g[0] < min_g:             # <<<<<<<<<<<<<<
 *                             min_g = g[0]
 *                         if b[0] < min_b:
 */
                                  }

                                  /* "PygameShader/shader.pyx":3218
 *                         if g[0] < min_g:
 *                             min_g = g[0]
 *                         if b[0] < min_b:             # <<<<<<<<<<<<<<
 *                             min_b = b[0]
 * 
 */
                                  __pyx_t_22 = (((__pyx_v_b[0]) < __pyx_v_min_b) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3219
 *                             min_g = g[0]
 *                         if b[0] < min_b:
 *                             min_b = b[0]             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[i, j, 0] = <unsigned char>((max_r - min_r) *0.5)
 */
                                    __pyx_v_min_b = (__pyx_v_b[0]);

                                    /* "PygameShader/shader.pyx":3218
 *                         if g[0] < min_g:
 *                             min_g = g[0]
 *                         if b[0] < min_b:             # <<<<<<<<<<<<<<
 *                             min_b = b[0]
 * 
 */
                                  }
                                }
                              }

                              /* "PygameShader/shader.pyx":3221
 *                             min_b = b[0]
 * 
 *                 rgb_array_[i, j, 0] = <unsigned char>((max_r - min_r) *0.5)             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 1] = <unsigned char>((max_g - min_g) *0.5)
 *                 rgb_array_[i, j, 2] = <unsigned char>((max_b - min_b) *0.5)
 */
                              __pyx_t_25 = __pyx_v_i;
                              __pyx_t_24 = __pyx_v_j;
                              __pyx_t_23 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((__pyx_v_max_r - __pyx_v_min_r) * 0.5));

                              /* "PygameShader/shader.pyx":3222
 * 
 *                 rgb_array_[i, j, 0] = <unsigned char>((max_r - min_r) *0.5)
 *                 rgb_array_[i, j, 1] = <unsigned char>((max_g - min_g) *0.5)             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 2] = <unsigned char>((max_b - min_b) *0.5)
 * 
 */
                              __pyx_t_23 = __pyx_v_i;
                              __pyx_t_24 = __pyx_v_j;
                              __pyx_t_25 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((__pyx_v_max_g - __pyx_v_min_g) * 0.5));

                              /* "PygameShader/shader.pyx":3223
 *                 rgb_array_[i, j, 0] = <unsigned char>((max_r - min_r) *0.5)
 *                 rgb_array_[i, j, 1] = <unsigned char>((max_g - min_g) *0.5)
 *                 rgb_array_[i, j, 2] = <unsigned char>((max_b - min_b) *0.5)             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_25 = __pyx_v_i;
                              __pyx_t_24 = __pyx_v_j;
                              __pyx_t_23 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((__pyx_v_max_b - __pyx_v_min_b) * 0.5));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3177
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in range(h):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":3134
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_filter24_avg_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_median_filter24_avg_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3231
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_grayscale_filter24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c *__pyx_optional_args) {
  int __pyx_v_kernel_size_ = ((int)2);
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_ky;
  int __pyx_v_kx;
  Py_ssize_t __pyx_v_ii;
  Py_ssize_t __pyx_v_jj;
  int __pyx_v_k;
  int __pyx_v_k_size;
  int *__pyx_v_tmp_;
  int *__pyx_v_tmp;
  int __pyx_v_index;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_t_20;
  int __pyx_t_21;
  int __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_median_grayscale_filter24_inplace_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
    }
  }

  /* "PygameShader/shader.pyx":3255
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":3259
 *     cdef:
 *         unsigned char [:, :, ::1] rgb_array_copy = \
 *             ascontiguousarray(numpy.array(rgb_array_, copy=True))             # <<<<<<<<<<<<<<
 * 
 *         int i=0, j=0, ky, kx
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3259, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(1, 3259, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rgb_array_copy = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "PygameShader/shader.pyx":3261
 *             ascontiguousarray(numpy.array(rgb_array_, copy=True))
 * 
 *         int i=0, j=0, ky, kx             # <<<<<<<<<<<<<<
 *         Py_ssize_t ii=0, jj=0
 * 
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":3262
 * 
 *         int i=0, j=0, ky, kx
 *         Py_ssize_t ii=0, jj=0             # <<<<<<<<<<<<<<
 * 
 *         int k = kernel_size_ >> 1
 */
  __pyx_v_ii = 0;
  __pyx_v_jj = 0;

  /* "PygameShader/shader.pyx":3264
 *         Py_ssize_t ii=0, jj=0
 * 
 *         int k = kernel_size_ >> 1             # <<<<<<<<<<<<<<
 *         int k_size = kernel_size_ * kernel_size_
 *         # int [64] tmp_  = empty(64, numpy.int16, order='C')
 */
  __pyx_v_k = (__pyx_v_kernel_size_ >> 1);

  /* "PygameShader/shader.pyx":3265
 * 
 *         int k = kernel_size_ >> 1
 *         int k_size = kernel_size_ * kernel_size_             # <<<<<<<<<<<<<<
 *         # int [64] tmp_  = empty(64, numpy.int16, order='C')
 *         int *tmp_   = <int *> malloc(k_size * sizeof(int))
 */
  __pyx_v_k_size = (__pyx_v_kernel_size_ * __pyx_v_kernel_size_);

  /* "PygameShader/shader.pyx":3267
 *         int k_size = kernel_size_ * kernel_size_
 *         # int [64] tmp_  = empty(64, numpy.int16, order='C')
 *         int *tmp_   = <int *> malloc(k_size * sizeof(int))             # <<<<<<<<<<<<<<
 *         int *tmp
 *         int index = 0
 */
  __pyx_v_tmp_ = ((int *)malloc((__pyx_v_k_size * (sizeof(int)))));

  /* "PygameShader/shader.pyx":3269
 *         int *tmp_   = <int *> malloc(k_size * sizeof(int))
 *         int *tmp
 *         int index = 0             # <<<<<<<<<<<<<<
 *         unsigned char *v
 * 
 */
  __pyx_v_index = 0;

  /* "PygameShader/shader.pyx":3273
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(0, w, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in range(0, h):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3274
 * 
 *     with nogil:
 *         for i in prange(0, w, schedule='static', num_threads=THREADS, chunksize=2048):             # <<<<<<<<<<<<<<
 *             for j in range(0, h):
 * 
 */
        __pyx_t_3 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            __pyx_t_12 = 0x800;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_11 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_11 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_tmp) schedule(static, __pyx_t_12)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_11; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_ii = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_index = ((int)0xbad0bad0);
                            __pyx_v_j = ((int)0xbad0bad0);
                            __pyx_v_jj = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_kx = ((int)0xbad0bad0);
                            __pyx_v_ky = ((int)0xbad0bad0);
                            __pyx_v_tmp = ((int *)1);

                            /* "PygameShader/shader.pyx":3275
 *     with nogil:
 *         for i in prange(0, w, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in range(0, h):             # <<<<<<<<<<<<<<
 * 
 *                 index = 0
 */
                            __pyx_t_13 = __pyx_v_h;
                            __pyx_t_14 = __pyx_t_13;
                            for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
                              __pyx_v_j = __pyx_t_15;

                              /* "PygameShader/shader.pyx":3277
 *             for j in range(0, h):
 * 
 *                 index = 0             # <<<<<<<<<<<<<<
 * 
 *                 for kx in range(-k, k):
 */
                              __pyx_v_index = 0;

                              /* "PygameShader/shader.pyx":3279
 *                 index = 0
 * 
 *                 for kx in range(-k, k):             # <<<<<<<<<<<<<<
 *                     for ky in range(-k, k):
 * 
 */
                              __pyx_t_16 = __pyx_v_k;
                              __pyx_t_17 = __pyx_t_16;
                              for (__pyx_t_18 = (-__pyx_v_k); __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                                __pyx_v_kx = __pyx_t_18;

                                /* "PygameShader/shader.pyx":3280
 * 
 *                 for kx in range(-k, k):
 *                     for ky in range(-k, k):             # <<<<<<<<<<<<<<
 * 
 *                         ii = i + kx
 */
                                __pyx_t_19 = __pyx_v_k;
                                __pyx_t_20 = __pyx_t_19;
                                for (__pyx_t_21 = (-__pyx_v_k); __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
                                  __pyx_v_ky = __pyx_t_21;

                                  /* "PygameShader/shader.pyx":3282
 *                     for ky in range(-k, k):
 * 
 *                         ii = i + kx             # <<<<<<<<<<<<<<
 *                         jj = j + ky
 * 
 */
                                  __pyx_v_ii = (__pyx_v_i + __pyx_v_kx);

                                  /* "PygameShader/shader.pyx":3283
 * 
 *                         ii = i + kx
 *                         jj = j + ky             # <<<<<<<<<<<<<<
 * 
 *                         if ii < 0:
 */
                                  __pyx_v_jj = (__pyx_v_j + __pyx_v_ky);

                                  /* "PygameShader/shader.pyx":3285
 *                         jj = j + ky
 * 
 *                         if ii < 0:             # <<<<<<<<<<<<<<
 *                             ii = 0
 *                         elif ii > w:
 */
                                  __pyx_t_22 = ((__pyx_v_ii < 0) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3286
 * 
 *                         if ii < 0:
 *                             ii = 0             # <<<<<<<<<<<<<<
 *                         elif ii > w:
 *                             ii = w
 */
                                    __pyx_v_ii = 0;

                                    /* "PygameShader/shader.pyx":3285
 *                         jj = j + ky
 * 
 *                         if ii < 0:             # <<<<<<<<<<<<<<
 *                             ii = 0
 *                         elif ii > w:
 */
                                    goto __pyx_L16;
                                  }

                                  /* "PygameShader/shader.pyx":3287
 *                         if ii < 0:
 *                             ii = 0
 *                         elif ii > w:             # <<<<<<<<<<<<<<
 *                             ii = w
 * 
 */
                                  __pyx_t_22 = ((__pyx_v_ii > __pyx_v_w) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3288
 *                             ii = 0
 *                         elif ii > w:
 *                             ii = w             # <<<<<<<<<<<<<<
 * 
 *                         if jj < 0:
 */
                                    __pyx_v_ii = __pyx_v_w;

                                    /* "PygameShader/shader.pyx":3287
 *                         if ii < 0:
 *                             ii = 0
 *                         elif ii > w:             # <<<<<<<<<<<<<<
 *                             ii = w
 * 
 */
                                  }
                                  __pyx_L16:;

                                  /* "PygameShader/shader.pyx":3290
 *                             ii = w
 * 
 *                         if jj < 0:             # <<<<<<<<<<<<<<
 *                             jj = 0
 *                         elif jj > h:
 */
                                  __pyx_t_22 = ((__pyx_v_jj < 0) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3291
 * 
 *                         if jj < 0:
 *                             jj = 0             # <<<<<<<<<<<<<<
 *                         elif jj > h:
 *                             jj = h
 */
                                    __pyx_v_jj = 0;

                                    /* "PygameShader/shader.pyx":3290
 *                             ii = w
 * 
 *                         if jj < 0:             # <<<<<<<<<<<<<<
 *                             jj = 0
 *                         elif jj > h:
 */
                                    goto __pyx_L17;
                                  }

                                  /* "PygameShader/shader.pyx":3292
 *                         if jj < 0:
 *                             jj = 0
 *                         elif jj > h:             # <<<<<<<<<<<<<<
 *                             jj = h
 * 
 */
                                  __pyx_t_22 = ((__pyx_v_jj > __pyx_v_h) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":3293
 *                             jj = 0
 *                         elif jj > h:
 *                             jj = h             # <<<<<<<<<<<<<<
 * 
 *                         tmp_[index]   = rgb_array_copy[ii, jj, 0]
 */
                                    __pyx_v_jj = __pyx_v_h;

                                    /* "PygameShader/shader.pyx":3292
 *                         if jj < 0:
 *                             jj = 0
 *                         elif jj > h:             # <<<<<<<<<<<<<<
 *                             jj = h
 * 
 */
                                  }
                                  __pyx_L17:;

                                  /* "PygameShader/shader.pyx":3295
 *                             jj = h
 * 
 *                         tmp_[index]   = rgb_array_copy[ii, jj, 0]             # <<<<<<<<<<<<<<
 * 
 *                         index = index + 1
 */
                                  __pyx_t_23 = __pyx_v_ii;
                                  __pyx_t_24 = __pyx_v_jj;
                                  __pyx_t_25 = 0;
                                  (__pyx_v_tmp_[__pyx_v_index]) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_23 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_25)) )));

                                  /* "PygameShader/shader.pyx":3297
 *                         tmp_[index]   = rgb_array_copy[ii, jj, 0]
 * 
 *                         index = index + 1             # <<<<<<<<<<<<<<
 * 
 *                 tmp = quickSort(tmp_, 0, k_size)
 */
                                  __pyx_v_index = (__pyx_v_index + 1);
                                }
                              }

                              /* "PygameShader/shader.pyx":3299
 *                         index = index + 1
 * 
 *                 tmp = quickSort(tmp_, 0, k_size)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[i, j, 0] = tmp[k + 1]
 */
                              __pyx_v_tmp = quickSort(__pyx_v_tmp_, 0, __pyx_v_k_size);

                              /* "PygameShader/shader.pyx":3301
 *                 tmp = quickSort(tmp_, 0, k_size)
 * 
 *                 rgb_array_[i, j, 0] = tmp[k + 1]             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 1] = tmp[k + 1]
 *                 rgb_array_[i, j, 2] = tmp[k + 1]
 */
                              __pyx_t_25 = __pyx_v_i;
                              __pyx_t_24 = __pyx_v_j;
                              __pyx_t_23 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmp[(__pyx_v_k + 1)]);

                              /* "PygameShader/shader.pyx":3302
 * 
 *                 rgb_array_[i, j, 0] = tmp[k + 1]
 *                 rgb_array_[i, j, 1] = tmp[k + 1]             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 2] = tmp[k + 1]
 * 
 */
                              __pyx_t_23 = __pyx_v_i;
                              __pyx_t_24 = __pyx_v_j;
                              __pyx_t_25 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmp[(__pyx_v_k + 1)]);

                              /* "PygameShader/shader.pyx":3303
 *                 rgb_array_[i, j, 0] = tmp[k + 1]
 *                 rgb_array_[i, j, 1] = tmp[k + 1]
 *                 rgb_array_[i, j, 2] = tmp[k + 1]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_25 = __pyx_v_i;
                              __pyx_t_24 = __pyx_v_j;
                              __pyx_t_23 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmp[(__pyx_v_k + 1)]);
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3273
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(0, w, schedule='static', num_threads=THREADS, chunksize=2048):
 *             for j in range(0, h):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":3231
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_median_grayscale_filter24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_median_grayscale_filter24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3313
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_color_reduction24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array, int color_number):
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_color_reduction24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array, int __pyx_v_color_number) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_x;
  int __pyx_v_y;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  float __pyx_v_f;
  float __pyx_v_c1;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  __Pyx_RefNannySetupContext("shader_color_reduction24_inplace_c", 0);

  /* "PygameShader/shader.pyx":3337
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     # cdef float color_number = <float>pow(2, factor)
 */
  __pyx_t_1 = __pyx_v_rgb_array.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":3342
 * 
 *     cdef:
 *         int x=0, y=0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_x = 0;
  __pyx_v_y = 0;

  /* "PygameShader/shader.pyx":3346
 *         unsigned char *g
 *         unsigned char *b
 *         float f = <float> 255.0 / <float> color_number             # <<<<<<<<<<<<<<
 *         float c1 = <float>color_number / <float>255.0
 * 
 */
  __pyx_v_f = (((float)255.0) / ((float)__pyx_v_color_number));

  /* "PygameShader/shader.pyx":3347
 *         unsigned char *b
 *         float f = <float> 255.0 / <float> color_number
 *         float c1 = <float>color_number / <float>255.0             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_c1 = (((float)__pyx_v_color_number) / ((float)255.0));

  /* "PygameShader/shader.pyx":3349
 *         float c1 = <float>color_number / <float>255.0
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 *             for x in range(0, w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3350
 * 
 *     with nogil:
 *         for y in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for x in range(0, w):
 * 
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_r) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":3351
 *     with nogil:
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 *             for x in range(0, w):             # <<<<<<<<<<<<<<
 * 
 *                 r = &rgb_array[x, y, 0]
 */
                            __pyx_t_5 = __pyx_v_w;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_x = __pyx_t_7;

                              /* "PygameShader/shader.pyx":3353
 *             for x in range(0, w):
 * 
 *                 r = &rgb_array[x, y, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array[x, y, 1]
 *                 b = &rgb_array[x, y, 2]
 */
                              __pyx_t_8 = __pyx_v_x;
                              __pyx_t_9 = __pyx_v_y;
                              __pyx_t_10 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3354
 * 
 *                 r = &rgb_array[x, y, 0]
 *                 g = &rgb_array[x, y, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array[x, y, 2]
 * 
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_9 = __pyx_v_y;
                              __pyx_t_8 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3355
 *                 r = &rgb_array[x, y, 0]
 *                 g = &rgb_array[x, y, 1]
 *                 b = &rgb_array[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 *                 r[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>r[0]) * f))
 */
                              __pyx_t_8 = __pyx_v_x;
                              __pyx_t_9 = __pyx_v_y;
                              __pyx_t_10 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3357
 *                 b = &rgb_array[x, y, 2]
 * 
 *                 r[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>r[0]) * f))             # <<<<<<<<<<<<<<
 *                 g[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>g[0]) * f))
 *                 b[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>b[0]) * f))
 */
                              (__pyx_v_r[0]) = ((unsigned char)((int)(((float)round((__pyx_v_c1 * ((float)(__pyx_v_r[0]))))) * __pyx_v_f)));

                              /* "PygameShader/shader.pyx":3358
 * 
 *                 r[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>r[0]) * f))
 *                 g[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>g[0]) * f))             # <<<<<<<<<<<<<<
 *                 b[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>b[0]) * f))
 * 
 */
                              (__pyx_v_g[0]) = ((unsigned char)((int)(((float)round((__pyx_v_c1 * ((float)(__pyx_v_g[0]))))) * __pyx_v_f)));

                              /* "PygameShader/shader.pyx":3359
 *                 r[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>r[0]) * f))
 *                 g[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>g[0]) * f))
 *                 b[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>b[0]) * f))             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              (__pyx_v_b[0]) = ((unsigned char)((int)(((float)round((__pyx_v_c1 * ((float)(__pyx_v_b[0]))))) * __pyx_v_f)));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3349
 *         float c1 = <float>color_number / <float>255.0
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 *             for x in range(0, w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":3313
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_color_reduction24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array, int color_number):
 *     """
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3381
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_sobel24_inplace_c(unsigned char [:, :, :] rgb_array, float threshold=20.0):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER SOBEL (EDGE DETECTION)
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sobel24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array, struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_inplace_c *__pyx_optional_args) {
  float __pyx_v_threshold = ((float)20.0);
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  Py_ssize_t __pyx_v_w_1;
  Py_ssize_t __pyx_v_h_1;
  int __pyx_v_kernel_offset_x;
  int __pyx_v_kernel_offset_y;
  __Pyx_memviewslice __pyx_v_source_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_x;
  int __pyx_v_y;
  Py_ssize_t __pyx_v_xx;
  Py_ssize_t __pyx_v_yy;
  float __pyx_v_r_gx;
  float __pyx_v_r_gy;
  unsigned char *__pyx_v_gray;
  unsigned char __pyx_v_m;
  float __pyx_v_magnitude;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  float __pyx_t_13;
  float __pyx_t_14;
  long __pyx_t_15;
  long __pyx_t_16;
  int __pyx_t_17;
  long __pyx_t_18;
  long __pyx_t_19;
  int __pyx_t_20;
  int __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  float __pyx_t_25;
  unsigned char __pyx_t_26;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_sobel24_inplace_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_threshold = __pyx_optional_args->threshold;
    }
  }

  /* "PygameShader/shader.pyx":3401
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":3404
 * 
 *     cdef:
 *         Py_ssize_t w_1 = w - 1             # <<<<<<<<<<<<<<
 *         Py_ssize_t h_1 = h - 1
 *         int kernel_offset_x, kernel_offset_y
 */
  __pyx_v_w_1 = (__pyx_v_w - 1);

  /* "PygameShader/shader.pyx":3405
 *     cdef:
 *         Py_ssize_t w_1 = w - 1
 *         Py_ssize_t h_1 = h - 1             # <<<<<<<<<<<<<<
 *         int kernel_offset_x, kernel_offset_y
 *         unsigned char [:, :, :] source_array = numpy.array(rgb_array, copy=True)
 */
  __pyx_v_h_1 = (__pyx_v_h - 1);

  /* "PygameShader/shader.pyx":3407
 *         Py_ssize_t h_1 = h - 1
 *         int kernel_offset_x, kernel_offset_y
 *         unsigned char [:, :, :] source_array = numpy.array(rgb_array, copy=True)             # <<<<<<<<<<<<<<
 *         int x, y
 *         Py_ssize_t xx, yy
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3407, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3407, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_source_array = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":3415
 *         float magnitude
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3417
 *     with nogil:
 * 
 *         for y in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *             for x in range(w):
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            unsigned char * __pyx_parallel_temp0 = ((unsigned char *)1);
            int __pyx_parallel_temp1 = ((int)0xbad0bad0);
            int __pyx_parallel_temp2 = ((int)0xbad0bad0);
            unsigned char __pyx_parallel_temp3 = ((unsigned char)'?');
            float __pyx_parallel_temp4 = ((float)__PYX_NAN());
            float __pyx_parallel_temp5 = ((float)__PYX_NAN());
            float __pyx_parallel_temp6 = ((float)__PYX_NAN());
            int __pyx_parallel_temp7 = ((int)0xbad0bad0);
            Py_ssize_t __pyx_parallel_temp8 = ((Py_ssize_t)0xbad0bad0);
            int __pyx_parallel_temp9 = ((int)0xbad0bad0);
            Py_ssize_t __pyx_parallel_temp10 = ((Py_ssize_t)0xbad0bad0);
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_9 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_gray) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_m) lastprivate(__pyx_v_magnitude) lastprivate(__pyx_v_r_gx) lastprivate(__pyx_v_r_gy) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_gray = ((unsigned char *)1);
                            __pyx_v_kernel_offset_x = ((int)0xbad0bad0);
                            __pyx_v_kernel_offset_y = ((int)0xbad0bad0);
                            __pyx_v_m = ((unsigned char)'?');
                            __pyx_v_magnitude = ((float)__PYX_NAN());
                            __pyx_v_r_gx = ((float)__PYX_NAN());
                            __pyx_v_r_gy = ((float)__PYX_NAN());
                            __pyx_v_x = ((int)0xbad0bad0);
                            __pyx_v_xx = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_yy = ((Py_ssize_t)0xbad0bad0);

                            /* "PygameShader/shader.pyx":3419
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 * 
 *             for x in range(w):             # <<<<<<<<<<<<<<
 * 
 *                 r_gx, r_gy = <float>0.0, <float>0.0
 */
                            __pyx_t_10 = __pyx_v_w;
                            __pyx_t_11 = __pyx_t_10;
                            for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                              __pyx_v_x = __pyx_t_12;

                              /* "PygameShader/shader.pyx":3421
 *             for x in range(w):
 * 
 *                 r_gx, r_gy = <float>0.0, <float>0.0             # <<<<<<<<<<<<<<
 * 
 *                 for kernel_offset_x in range(-KERNEL_HALF, KERNEL_HALF + 1):
 */
                              __pyx_t_13 = ((float)0.0);
                              __pyx_t_14 = ((float)0.0);
                              __pyx_v_r_gx = __pyx_t_13;
                              __pyx_v_r_gy = __pyx_t_14;

                              /* "PygameShader/shader.pyx":3423
 *                 r_gx, r_gy = <float>0.0, <float>0.0
 * 
 *                 for kernel_offset_x in range(-KERNEL_HALF, KERNEL_HALF + 1):             # <<<<<<<<<<<<<<
 * 
 *                     for kernel_offset_y in range(-KERNEL_HALF, KERNEL_HALF + 1):
 */
                              __pyx_t_15 = (__pyx_v_12PygameShader_6shader_KERNEL_HALF + 1);
                              __pyx_t_16 = __pyx_t_15;
                              for (__pyx_t_17 = (-__pyx_v_12PygameShader_6shader_KERNEL_HALF); __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
                                __pyx_v_kernel_offset_x = __pyx_t_17;

                                /* "PygameShader/shader.pyx":3425
 *                 for kernel_offset_x in range(-KERNEL_HALF, KERNEL_HALF + 1):
 * 
 *                     for kernel_offset_y in range(-KERNEL_HALF, KERNEL_HALF + 1):             # <<<<<<<<<<<<<<
 * 
 *                         xx = x + kernel_offset_x
 */
                                __pyx_t_18 = (__pyx_v_12PygameShader_6shader_KERNEL_HALF + 1);
                                __pyx_t_19 = __pyx_t_18;
                                for (__pyx_t_20 = (-__pyx_v_12PygameShader_6shader_KERNEL_HALF); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
                                  __pyx_v_kernel_offset_y = __pyx_t_20;

                                  /* "PygameShader/shader.pyx":3427
 *                     for kernel_offset_y in range(-KERNEL_HALF, KERNEL_HALF + 1):
 * 
 *                         xx = x + kernel_offset_x             # <<<<<<<<<<<<<<
 *                         yy = y + kernel_offset_y
 * 
 */
                                  __pyx_v_xx = (__pyx_v_x + __pyx_v_kernel_offset_x);

                                  /* "PygameShader/shader.pyx":3428
 * 
 *                         xx = x + kernel_offset_x
 *                         yy = y + kernel_offset_y             # <<<<<<<<<<<<<<
 * 
 *                         if xx > w_1:
 */
                                  __pyx_v_yy = (__pyx_v_y + __pyx_v_kernel_offset_y);

                                  /* "PygameShader/shader.pyx":3430
 *                         yy = y + kernel_offset_y
 * 
 *                         if xx > w_1:             # <<<<<<<<<<<<<<
 *                             xx = w_1
 *                         if xx < 0:
 */
                                  __pyx_t_21 = ((__pyx_v_xx > __pyx_v_w_1) != 0);
                                  if (__pyx_t_21) {

                                    /* "PygameShader/shader.pyx":3431
 * 
 *                         if xx > w_1:
 *                             xx = w_1             # <<<<<<<<<<<<<<
 *                         if xx < 0:
 *                             xx = 0
 */
                                    __pyx_v_xx = __pyx_v_w_1;

                                    /* "PygameShader/shader.pyx":3430
 *                         yy = y + kernel_offset_y
 * 
 *                         if xx > w_1:             # <<<<<<<<<<<<<<
 *                             xx = w_1
 *                         if xx < 0:
 */
                                  }

                                  /* "PygameShader/shader.pyx":3432
 *                         if xx > w_1:
 *                             xx = w_1
 *                         if xx < 0:             # <<<<<<<<<<<<<<
 *                             xx = 0
 * 
 */
                                  __pyx_t_21 = ((__pyx_v_xx < 0) != 0);
                                  if (__pyx_t_21) {

                                    /* "PygameShader/shader.pyx":3433
 *                             xx = w_1
 *                         if xx < 0:
 *                             xx = 0             # <<<<<<<<<<<<<<
 * 
 *                         if yy > h_1:
 */
                                    __pyx_v_xx = 0;

                                    /* "PygameShader/shader.pyx":3432
 *                         if xx > w_1:
 *                             xx = w_1
 *                         if xx < 0:             # <<<<<<<<<<<<<<
 *                             xx = 0
 * 
 */
                                  }

                                  /* "PygameShader/shader.pyx":3435
 *                             xx = 0
 * 
 *                         if yy > h_1:             # <<<<<<<<<<<<<<
 *                             yy = h_1
 *                         if yy < 0:
 */
                                  __pyx_t_21 = ((__pyx_v_yy > __pyx_v_h_1) != 0);
                                  if (__pyx_t_21) {

                                    /* "PygameShader/shader.pyx":3436
 * 
 *                         if yy > h_1:
 *                             yy = h_1             # <<<<<<<<<<<<<<
 *                         if yy < 0:
 *                             yy = 0
 */
                                    __pyx_v_yy = __pyx_v_h_1;

                                    /* "PygameShader/shader.pyx":3435
 *                             xx = 0
 * 
 *                         if yy > h_1:             # <<<<<<<<<<<<<<
 *                             yy = h_1
 *                         if yy < 0:
 */
                                  }

                                  /* "PygameShader/shader.pyx":3437
 *                         if yy > h_1:
 *                             yy = h_1
 *                         if yy < 0:             # <<<<<<<<<<<<<<
 *                             yy = 0
 * 
 */
                                  __pyx_t_21 = ((__pyx_v_yy < 0) != 0);
                                  if (__pyx_t_21) {

                                    /* "PygameShader/shader.pyx":3438
 *                             yy = h_1
 *                         if yy < 0:
 *                             yy = 0             # <<<<<<<<<<<<<<
 * 
 *                         # grayscale image red = green = blue
 */
                                    __pyx_v_yy = 0;

                                    /* "PygameShader/shader.pyx":3437
 *                         if yy > h_1:
 *                             yy = h_1
 *                         if yy < 0:             # <<<<<<<<<<<<<<
 *                             yy = 0
 * 
 */
                                  }

                                  /* "PygameShader/shader.pyx":3441
 * 
 *                         # grayscale image red = green = blue
 *                         gray = &source_array[xx, yy, 0]             # <<<<<<<<<<<<<<
 * 
 *                         if kernel_offset_x != 0:
 */
                                  __pyx_t_22 = __pyx_v_xx;
                                  __pyx_t_23 = __pyx_v_yy;
                                  __pyx_t_24 = 0;
                                  __pyx_v_gray = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_22 * __pyx_v_source_array.strides[0]) ) + __pyx_t_23 * __pyx_v_source_array.strides[1]) ) + __pyx_t_24 * __pyx_v_source_array.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":3443
 *                         gray = &source_array[xx, yy, 0]
 * 
 *                         if kernel_offset_x != 0:             # <<<<<<<<<<<<<<
 * 
 *                             r_gx = r_gx + <float> gray[0] * \
 */
                                  __pyx_t_21 = ((__pyx_v_kernel_offset_x != 0) != 0);
                                  if (__pyx_t_21) {

                                    /* "PygameShader/shader.pyx":3446
 * 
 *                             r_gx = r_gx + <float> gray[0] * \
 *                                    <float> GX[kernel_offset_x + KERNEL_HALF,             # <<<<<<<<<<<<<<
 *                                               kernel_offset_y + KERNEL_HALF]
 * 
 */
                                    if (unlikely(!__pyx_v_12PygameShader_6shader_GX.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("GX"); __PYX_ERR(1, 3446, __pyx_L8_error) }

                                    /* "PygameShader/shader.pyx":3447
 *                             r_gx = r_gx + <float> gray[0] * \
 *                                    <float> GX[kernel_offset_x + KERNEL_HALF,
 *                                               kernel_offset_y + KERNEL_HALF]             # <<<<<<<<<<<<<<
 * 
 *                         if kernel_offset_y != 0:
 */
                                    __pyx_t_24 = (__pyx_v_kernel_offset_x + __pyx_v_12PygameShader_6shader_KERNEL_HALF);
                                    __pyx_t_23 = (__pyx_v_kernel_offset_y + __pyx_v_12PygameShader_6shader_KERNEL_HALF);

                                    /* "PygameShader/shader.pyx":3445
 *                         if kernel_offset_x != 0:
 * 
 *                             r_gx = r_gx + <float> gray[0] * \             # <<<<<<<<<<<<<<
 *                                    <float> GX[kernel_offset_x + KERNEL_HALF,
 *                                               kernel_offset_y + KERNEL_HALF]
 */
                                    __pyx_v_r_gx = (__pyx_v_r_gx + (((float)(__pyx_v_gray[0])) * ((float)(*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_GX.data + __pyx_t_24 * __pyx_v_12PygameShader_6shader_GX.strides[0]) )) + __pyx_t_23)) ))))));

                                    /* "PygameShader/shader.pyx":3443
 *                         gray = &source_array[xx, yy, 0]
 * 
 *                         if kernel_offset_x != 0:             # <<<<<<<<<<<<<<
 * 
 *                             r_gx = r_gx + <float> gray[0] * \
 */
                                  }

                                  /* "PygameShader/shader.pyx":3449
 *                                               kernel_offset_y + KERNEL_HALF]
 * 
 *                         if kernel_offset_y != 0:             # <<<<<<<<<<<<<<
 * 
 *                             r_gy = r_gy + <float> gray[0] * \
 */
                                  __pyx_t_21 = ((__pyx_v_kernel_offset_y != 0) != 0);
                                  if (__pyx_t_21) {

                                    /* "PygameShader/shader.pyx":3452
 * 
 *                             r_gy = r_gy + <float> gray[0] * \
 *                                    <float> GY[kernel_offset_x + KERNEL_HALF,             # <<<<<<<<<<<<<<
 *                                               kernel_offset_y + KERNEL_HALF]
 * 
 */
                                    if (unlikely(!__pyx_v_12PygameShader_6shader_GY.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("GY"); __PYX_ERR(1, 3452, __pyx_L8_error) }

                                    /* "PygameShader/shader.pyx":3453
 *                             r_gy = r_gy + <float> gray[0] * \
 *                                    <float> GY[kernel_offset_x + KERNEL_HALF,
 *                                               kernel_offset_y + KERNEL_HALF]             # <<<<<<<<<<<<<<
 * 
 *                 magnitude = min(<float> sqrt(r_gx * r_gx + r_gy * r_gy), <float>255.0)
 */
                                    __pyx_t_23 = (__pyx_v_kernel_offset_x + __pyx_v_12PygameShader_6shader_KERNEL_HALF);
                                    __pyx_t_24 = (__pyx_v_kernel_offset_y + __pyx_v_12PygameShader_6shader_KERNEL_HALF);

                                    /* "PygameShader/shader.pyx":3451
 *                         if kernel_offset_y != 0:
 * 
 *                             r_gy = r_gy + <float> gray[0] * \             # <<<<<<<<<<<<<<
 *                                    <float> GY[kernel_offset_x + KERNEL_HALF,
 *                                               kernel_offset_y + KERNEL_HALF]
 */
                                    __pyx_v_r_gy = (__pyx_v_r_gy + (((float)(__pyx_v_gray[0])) * ((float)(*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_GY.data + __pyx_t_23 * __pyx_v_12PygameShader_6shader_GY.strides[0]) )) + __pyx_t_24)) ))))));

                                    /* "PygameShader/shader.pyx":3449
 *                                               kernel_offset_y + KERNEL_HALF]
 * 
 *                         if kernel_offset_y != 0:             # <<<<<<<<<<<<<<
 * 
 *                             r_gy = r_gy + <float> gray[0] * \
 */
                                  }
                                }
                              }

                              /* "PygameShader/shader.pyx":3455
 *                                               kernel_offset_y + KERNEL_HALF]
 * 
 *                 magnitude = min(<float> sqrt(r_gx * r_gx + r_gy * r_gy), <float>255.0)             # <<<<<<<<<<<<<<
 * 
 *                 # if magnitude > 255:
 */
                              __pyx_t_14 = ((float)255.0);
                              __pyx_t_13 = ((float)sqrt(((__pyx_v_r_gx * __pyx_v_r_gx) + (__pyx_v_r_gy * __pyx_v_r_gy))));
                              if (((__pyx_t_14 < __pyx_t_13) != 0)) {
                                __pyx_t_25 = __pyx_t_14;
                              } else {
                                __pyx_t_25 = __pyx_t_13;
                              }
                              __pyx_v_magnitude = __pyx_t_25;

                              /* "PygameShader/shader.pyx":3460
 *                 #     magnitude = 255.0
 * 
 *                 m = <unsigned char> magnitude if magnitude > threshold else 0             # <<<<<<<<<<<<<<
 * 
 *                 # update the pixel if the magnitude is above threshold else black pixel
 */
                              if (((__pyx_v_magnitude > __pyx_v_threshold) != 0)) {
                                __pyx_t_26 = ((unsigned char)__pyx_v_magnitude);
                              } else {
                                __pyx_t_26 = 0;
                              }
                              __pyx_v_m = __pyx_t_26;

                              /* "PygameShader/shader.pyx":3463
 * 
 *                 # update the pixel if the magnitude is above threshold else black pixel
 *                 rgb_array[x, y, 0] = m             # <<<<<<<<<<<<<<
 *                 rgb_array[x, y, 1] = m
 *                 rgb_array[x, y, 2] = m
 */
                              __pyx_t_24 = __pyx_v_x;
                              __pyx_t_23 = __pyx_v_y;
                              __pyx_t_22 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_24 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_m;

                              /* "PygameShader/shader.pyx":3464
 *                 # update the pixel if the magnitude is above threshold else black pixel
 *                 rgb_array[x, y, 0] = m
 *                 rgb_array[x, y, 1] = m             # <<<<<<<<<<<<<<
 *                 rgb_array[x, y, 2] = m
 * 
 */
                              __pyx_t_22 = __pyx_v_x;
                              __pyx_t_23 = __pyx_v_y;
                              __pyx_t_24 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_22 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_24 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_m;

                              /* "PygameShader/shader.pyx":3465
 *                 rgb_array[x, y, 0] = m
 *                 rgb_array[x, y, 1] = m
 *                 rgb_array[x, y, 2] = m             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_24 = __pyx_v_x;
                              __pyx_t_23 = __pyx_v_y;
                              __pyx_t_22 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_24 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_m;
                            }
                            goto __pyx_L23;
                            __pyx_L8_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L22;
                            __pyx_L22:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates0)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_gray;
                                __pyx_parallel_temp1 = __pyx_v_kernel_offset_x;
                                __pyx_parallel_temp2 = __pyx_v_kernel_offset_y;
                                __pyx_parallel_temp3 = __pyx_v_m;
                                __pyx_parallel_temp4 = __pyx_v_magnitude;
                                __pyx_parallel_temp5 = __pyx_v_r_gx;
                                __pyx_parallel_temp6 = __pyx_v_r_gy;
                                __pyx_parallel_temp7 = __pyx_v_x;
                                __pyx_parallel_temp8 = __pyx_v_xx;
                                __pyx_parallel_temp9 = __pyx_v_y;
                                __pyx_parallel_temp10 = __pyx_v_yy;
                            }
                            __pyx_L23:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_gray = __pyx_parallel_temp0;
              __pyx_v_kernel_offset_x = __pyx_parallel_temp1;
              __pyx_v_kernel_offset_y = __pyx_parallel_temp2;
              __pyx_v_m = __pyx_parallel_temp3;
              __pyx_v_magnitude = __pyx_parallel_temp4;
              __pyx_v_r_gx = __pyx_parallel_temp5;
              __pyx_v_r_gy = __pyx_parallel_temp6;
              __pyx_v_x = __pyx_parallel_temp7;
              __pyx_v_xx = __pyx_parallel_temp8;
              __pyx_v_y = __pyx_parallel_temp9;
              __pyx_v_yy = __pyx_parallel_temp10;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L4_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3415
 *         float magnitude
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":3381
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_sobel24_inplace_c(unsigned char [:, :, :] rgb_array, float threshold=20.0):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER SOBEL (EDGE DETECTION)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_sobel24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_source_array, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3473
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef unsigned char [:, :, ::1] scale_array24_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :]
 *         rgb_array,
 */

static __Pyx_memviewslice __pyx_f_12PygameShader_6shader_scale_array24_c(__Pyx_memviewslice __pyx_v_rgb_array, int __pyx_v_w2, int __pyx_v_h2) {
  Py_ssize_t __pyx_v_w1;
  Py_ssize_t __pyx_v_h1;
  CYTHON_UNUSED Py_ssize_t __pyx_v_s;
  CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
  __Pyx_memviewslice __pyx_v_new_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  float __pyx_v_fx;
  float __pyx_v_fy;
  int __pyx_v_x;
  int __pyx_v_y;
  Py_ssize_t __pyx_v_xx;
  Py_ssize_t __pyx_v_yy;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("scale_array24_c", 0);

  /* "PygameShader/shader.pyx":3498
 *     :return             : Return a MemoryViewSlice 3d numpy.ndarray format (w, h, 3) uint8
 *     """
 *     assert w2 > 0, "Argument w2 cannot be <=0"             # <<<<<<<<<<<<<<
 *     assert h2 > 0, "Argument h2 cannot be <=0"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_w2 > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_w2_cannot_be_0);
      __PYX_ERR(1, 3498, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":3499
 *     """
 *     assert w2 > 0, "Argument w2 cannot be <=0"
 *     assert h2 > 0, "Argument h2 cannot be <=0"             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t w1, h1, s
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_h2 > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_h2_cannot_be_0);
      __PYX_ERR(1, 3499, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":3503
 *     cdef Py_ssize_t w1, h1, s
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         w1, h1, s = rgb_array.shape[:3]
 * 
 */
  {
    (void)__pyx_t_1; (void)__pyx_t_2; (void)__pyx_t_3; /* mark used */
    /*try:*/ {

      /* "PygameShader/shader.pyx":3504
 * 
 *     try:
 *         w1, h1, s = rgb_array.shape[:3]             # <<<<<<<<<<<<<<
 * 
 *     except (ValueError, pygame.error) as e:
 */
      __pyx_t_4 = __pyx_v_rgb_array.shape;
      __pyx_t_5 = (__pyx_t_4[0]);
      __pyx_t_6 = (__pyx_t_4[1]);
      __pyx_t_7 = (__pyx_t_4[2]);
      __pyx_v_w1 = __pyx_t_5;
      __pyx_v_h1 = __pyx_t_6;
      __pyx_v_s = __pyx_t_7;

      /* "PygameShader/shader.pyx":3503
 *     cdef Py_ssize_t w1, h1, s
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         w1, h1, s = rgb_array.shape[:3]
 * 
 */
    }
  }

  /* "PygameShader/shader.pyx":3510
 * 
 *     cdef:
 *         unsigned char [:, :, ::1] new_array = numpy.zeros((w2, h2, 3), numpy.uint8)             # <<<<<<<<<<<<<<
 *         float fx = <float>w1 / <float>w2
 *         float fy = <float>h1 / <float>h2
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 3510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_w2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_h2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 3510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_int_3);
  __pyx_t_9 = 0;
  __pyx_t_11 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_numpy); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_uint8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = NULL;
  __pyx_t_13 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_13 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_12, __pyx_t_9};
    __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3510, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_12, __pyx_t_9};
    __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3510, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 3510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    if (__pyx_t_11) {
      __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11); __pyx_t_11 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_9);
    __pyx_t_12 = 0;
    __pyx_t_9 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(1, 3510, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_new_array = __pyx_t_15;
  __pyx_t_15.memview = NULL;
  __pyx_t_15.data = NULL;

  /* "PygameShader/shader.pyx":3511
 *     cdef:
 *         unsigned char [:, :, ::1] new_array = numpy.zeros((w2, h2, 3), numpy.uint8)
 *         float fx = <float>w1 / <float>w2             # <<<<<<<<<<<<<<
 *         float fy = <float>h1 / <float>h2
 *         int x, y
 */
  __pyx_v_fx = (((float)__pyx_v_w1) / ((float)__pyx_v_w2));

  /* "PygameShader/shader.pyx":3512
 *         unsigned char [:, :, ::1] new_array = numpy.zeros((w2, h2, 3), numpy.uint8)
 *         float fx = <float>w1 / <float>w2
 *         float fy = <float>h1 / <float>h2             # <<<<<<<<<<<<<<
 *         int x, y
 *         Py_ssize_t xx, yy
 */
  __pyx_v_fy = (((float)__pyx_v_h1) / ((float)__pyx_v_h2));

  /* "PygameShader/shader.pyx":3515
 *         int x, y
 *         Py_ssize_t xx, yy
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w2, schedule='static', num_threads=THREADS):
 *             xx = <int>(x * fx)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3516
 *         Py_ssize_t xx, yy
 *     with nogil:
 *         for x in prange(w2, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             xx = <int>(x * fx)
 *             for y in range(h2):
 */
        __pyx_t_13 = __pyx_v_w2;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_17 = (__pyx_t_13 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_17 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_17; __pyx_t_16++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_16);
                            /* Initialize private variables to invalid values */
                            __pyx_v_xx = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_y = ((int)0xbad0bad0);
                            __pyx_v_yy = ((Py_ssize_t)0xbad0bad0);

                            /* "PygameShader/shader.pyx":3517
 *     with nogil:
 *         for x in prange(w2, schedule='static', num_threads=THREADS):
 *             xx = <int>(x * fx)             # <<<<<<<<<<<<<<
 *             for y in range(h2):
 *                 yy = <int>(y * fy)
 */
                            __pyx_v_xx = ((int)(__pyx_v_x * __pyx_v_fx));

                            /* "PygameShader/shader.pyx":3518
 *         for x in prange(w2, schedule='static', num_threads=THREADS):
 *             xx = <int>(x * fx)
 *             for y in range(h2):             # <<<<<<<<<<<<<<
 *                 yy = <int>(y * fy)
 *                 new_array[x, y, 0] = rgb_array[xx, yy, 0]
 */
                            __pyx_t_18 = __pyx_v_h2;
                            __pyx_t_19 = __pyx_t_18;
                            for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
                              __pyx_v_y = __pyx_t_20;

                              /* "PygameShader/shader.pyx":3519
 *             xx = <int>(x * fx)
 *             for y in range(h2):
 *                 yy = <int>(y * fy)             # <<<<<<<<<<<<<<
 *                 new_array[x, y, 0] = rgb_array[xx, yy, 0]
 *                 new_array[x, y, 1] = rgb_array[xx, yy, 1]
 */
                              __pyx_v_yy = ((int)(__pyx_v_y * __pyx_v_fy));

                              /* "PygameShader/shader.pyx":3520
 *             for y in range(h2):
 *                 yy = <int>(y * fy)
 *                 new_array[x, y, 0] = rgb_array[xx, yy, 0]             # <<<<<<<<<<<<<<
 *                 new_array[x, y, 1] = rgb_array[xx, yy, 1]
 *                 new_array[x, y, 2] = rgb_array[xx, yy, 2]
 */
                              __pyx_t_21 = __pyx_v_xx;
                              __pyx_t_22 = __pyx_v_yy;
                              __pyx_t_23 = 0;
                              __pyx_t_24 = __pyx_v_x;
                              __pyx_t_25 = __pyx_v_y;
                              __pyx_t_26 = 0;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_24 * __pyx_v_new_array.strides[0]) ) + __pyx_t_25 * __pyx_v_new_array.strides[1]) )) + __pyx_t_26)) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_21 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_22 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array.strides[2]) )));

                              /* "PygameShader/shader.pyx":3521
 *                 yy = <int>(y * fy)
 *                 new_array[x, y, 0] = rgb_array[xx, yy, 0]
 *                 new_array[x, y, 1] = rgb_array[xx, yy, 1]             # <<<<<<<<<<<<<<
 *                 new_array[x, y, 2] = rgb_array[xx, yy, 2]
 * 
 */
                              __pyx_t_23 = __pyx_v_xx;
                              __pyx_t_22 = __pyx_v_yy;
                              __pyx_t_21 = 1;
                              __pyx_t_26 = __pyx_v_x;
                              __pyx_t_25 = __pyx_v_y;
                              __pyx_t_24 = 1;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_26 * __pyx_v_new_array.strides[0]) ) + __pyx_t_25 * __pyx_v_new_array.strides[1]) )) + __pyx_t_24)) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_23 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_22 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_21 * __pyx_v_rgb_array.strides[2]) )));

                              /* "PygameShader/shader.pyx":3522
 *                 new_array[x, y, 0] = rgb_array[xx, yy, 0]
 *                 new_array[x, y, 1] = rgb_array[xx, yy, 1]
 *                 new_array[x, y, 2] = rgb_array[xx, yy, 2]             # <<<<<<<<<<<<<<
 * 
 *     return new_array
 */
                              __pyx_t_21 = __pyx_v_xx;
                              __pyx_t_22 = __pyx_v_yy;
                              __pyx_t_23 = 2;
                              __pyx_t_24 = __pyx_v_x;
                              __pyx_t_25 = __pyx_v_y;
                              __pyx_t_26 = 2;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_24 * __pyx_v_new_array.strides[0]) ) + __pyx_t_25 * __pyx_v_new_array.strides[1]) )) + __pyx_t_26)) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_21 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_22 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array.strides[2]) )));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3515
 *         int x, y
 *         Py_ssize_t xx, yy
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w2, schedule='static', num_threads=THREADS):
 *             xx = <int>(x * fx)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L11;
        }
        __pyx_L11:;
      }
  }

  /* "PygameShader/shader.pyx":3524
 *                 new_array[x, y, 2] = rgb_array[xx, yy, 2]
 * 
 *     return new_array             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __PYX_INC_MEMVIEW(&__pyx_v_new_array, 0);
  __pyx_r = __pyx_v_new_array;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":3473
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef unsigned char [:, :, ::1] scale_array24_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :]
 *         rgb_array,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("PygameShader.shader.scale_array24_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_e);
  __PYX_XDEC_MEMVIEW(&__pyx_v_new_array, 1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":3531
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_sobel24_fast_inplace_c(             # <<<<<<<<<<<<<<
 *         surface_, int threshold_=20, unsigned short factor_=1):
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sobel24_fast_inplace_c(PyObject *__pyx_v_surface_, struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_fast_inplace_c *__pyx_optional_args) {
  int __pyx_v_threshold_ = ((int)20);
  unsigned short __pyx_v_factor_ = ((unsigned short)1);
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  Py_ssize_t __pyx_v_w_1;
  Py_ssize_t __pyx_v_h_1;
  int __pyx_v_kernel_offset_x;
  int __pyx_v_kernel_offset_y;
  int __pyx_v_x;
  int __pyx_v_y;
  Py_ssize_t __pyx_v_xx;
  Py_ssize_t __pyx_v_yy;
  float __pyx_v_r_gx;
  float __pyx_v_r_gy;
  unsigned char *__pyx_v_gray;
  unsigned char __pyx_v_m;
  float __pyx_v_magnitude;
  __Pyx_memviewslice __pyx_v_source_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_rescale_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_new_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_new_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  float __pyx_t_18;
  float __pyx_t_19;
  long __pyx_t_20;
  long __pyx_t_21;
  int __pyx_t_22;
  long __pyx_t_23;
  long __pyx_t_24;
  int __pyx_t_25;
  int __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  unsigned char __pyx_t_30;
  __Pyx_memviewslice __pyx_t_31 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_sobel24_fast_inplace_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_threshold_ = __pyx_optional_args->threshold_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_factor_ = __pyx_optional_args->factor_;
      }
    }
  }

  /* "PygameShader/shader.pyx":3556
 *     cdef:
 *         Py_ssize_t w, h, w_1, h_1
 *     w, h = surface_.get_size()             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 3556, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 3556, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 3556, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 3556, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 3556, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_w = __pyx_t_6;
  __pyx_v_h = __pyx_t_7;

  /* "PygameShader/shader.pyx":3567
 *         float magnitude
 * 
 *         unsigned char [:, :, :] source_array = pixels3d(surface_)             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rescale_array = \
 *             numpy.array(pixels3d(scale(surface_, (w >> factor_, h >> factor_))))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3567, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_source_array = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":3569
 *         unsigned char [:, :, :] source_array = pixels3d(surface_)
 *         unsigned char [:, :, :] rescale_array = \
 *             numpy.array(pixels3d(scale(surface_, (w >> factor_, h >> factor_))))             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] new_array = empty((w >> factor_, h >> factor_, 3), uint8)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_scale); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 3569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyInt_FromSsize_t((__pyx_v_w >> __pyx_v_factor_)); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyInt_FromSsize_t((__pyx_v_h >> __pyx_v_factor_)); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 3569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 3569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12);
  __pyx_t_11 = 0;
  __pyx_t_12 = 0;
  __pyx_t_12 = NULL;
  __pyx_t_14 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_14 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_surface_, __pyx_t_13};
    __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3569, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_surface_, __pyx_t_13};
    __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3569, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_12) {
      __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __pyx_t_12 = NULL;
    }
    __Pyx_INCREF(__pyx_v_surface_);
    __Pyx_GIVEREF(__pyx_v_surface_);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_14, __pyx_v_surface_);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_14, __pyx_t_13);
    __pyx_t_13 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3569, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rescale_array = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":3570
 *         unsigned char [:, :, :] rescale_array = \
 *             numpy.array(pixels3d(scale(surface_, (w >> factor_, h >> factor_))))
 *         unsigned char [:, :, :] new_array = empty((w >> factor_, h >> factor_, 3), uint8)             # <<<<<<<<<<<<<<
 * 
 *     h = h >> factor_
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_w >> __pyx_v_factor_)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_h >> __pyx_v_factor_)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_3);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_14 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_14 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_9, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3570, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_9, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3570, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 3570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_14, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_14, __pyx_t_4);
    __pyx_t_9 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3570, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_new_array = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":3572
 *         unsigned char [:, :, :] new_array = empty((w >> factor_, h >> factor_, 3), uint8)
 * 
 *     h = h >> factor_             # <<<<<<<<<<<<<<
 *     w = w >> factor_
 *     w_1 = w - 1
 */
  __pyx_v_h = (__pyx_v_h >> __pyx_v_factor_);

  /* "PygameShader/shader.pyx":3573
 * 
 *     h = h >> factor_
 *     w = w >> factor_             # <<<<<<<<<<<<<<
 *     w_1 = w - 1
 *     h_1 = h - 1
 */
  __pyx_v_w = (__pyx_v_w >> __pyx_v_factor_);

  /* "PygameShader/shader.pyx":3574
 *     h = h >> factor_
 *     w = w >> factor_
 *     w_1 = w - 1             # <<<<<<<<<<<<<<
 *     h_1 = h - 1
 * 
 */
  __pyx_v_w_1 = (__pyx_v_w - 1);

  /* "PygameShader/shader.pyx":3575
 *     w = w >> factor_
 *     w_1 = w - 1
 *     h_1 = h - 1             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_h_1 = (__pyx_v_h - 1);

  /* "PygameShader/shader.pyx":3577
 *     h_1 = h - 1
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3579
 *     with nogil:
 * 
 *         for y in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *             for x in range(w):
 */
        __pyx_t_7 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            unsigned char * __pyx_parallel_temp0 = ((unsigned char *)1);
            int __pyx_parallel_temp1 = ((int)0xbad0bad0);
            int __pyx_parallel_temp2 = ((int)0xbad0bad0);
            unsigned char __pyx_parallel_temp3 = ((unsigned char)'?');
            float __pyx_parallel_temp4 = ((float)__PYX_NAN());
            float __pyx_parallel_temp5 = ((float)__PYX_NAN());
            float __pyx_parallel_temp6 = ((float)__PYX_NAN());
            int __pyx_parallel_temp7 = ((int)0xbad0bad0);
            Py_ssize_t __pyx_parallel_temp8 = ((Py_ssize_t)0xbad0bad0);
            int __pyx_parallel_temp9 = ((int)0xbad0bad0);
            Py_ssize_t __pyx_parallel_temp10 = ((Py_ssize_t)0xbad0bad0);
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_15 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_15 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_14, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_gray) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_m) lastprivate(__pyx_v_magnitude) lastprivate(__pyx_v_r_gx) lastprivate(__pyx_v_r_gy) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_15; __pyx_t_6++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_y = (int)(0 + 1 * __pyx_t_6);
                            /* Initialize private variables to invalid values */
                            __pyx_v_gray = ((unsigned char *)1);
                            __pyx_v_kernel_offset_x = ((int)0xbad0bad0);
                            __pyx_v_kernel_offset_y = ((int)0xbad0bad0);
                            __pyx_v_m = ((unsigned char)'?');
                            __pyx_v_magnitude = ((float)__PYX_NAN());
                            __pyx_v_r_gx = ((float)__PYX_NAN());
                            __pyx_v_r_gy = ((float)__PYX_NAN());
                            __pyx_v_x = ((int)0xbad0bad0);
                            __pyx_v_xx = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_yy = ((Py_ssize_t)0xbad0bad0);

                            /* "PygameShader/shader.pyx":3581
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 * 
 *             for x in range(w):             # <<<<<<<<<<<<<<
 * 
 *                 r_gx, r_gy = <float>0.0, <float>0.0
 */
                            __pyx_t_16 = __pyx_v_w;
                            __pyx_t_17 = __pyx_t_16;
                            for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_17; __pyx_t_14+=1) {
                              __pyx_v_x = __pyx_t_14;

                              /* "PygameShader/shader.pyx":3583
 *             for x in range(w):
 * 
 *                 r_gx, r_gy = <float>0.0, <float>0.0             # <<<<<<<<<<<<<<
 * 
 *                 for kernel_offset_y in range(-KERNEL_HALF, KERNEL_HALF + 1):
 */
                              __pyx_t_18 = ((float)0.0);
                              __pyx_t_19 = ((float)0.0);
                              __pyx_v_r_gx = __pyx_t_18;
                              __pyx_v_r_gy = __pyx_t_19;

                              /* "PygameShader/shader.pyx":3585
 *                 r_gx, r_gy = <float>0.0, <float>0.0
 * 
 *                 for kernel_offset_y in range(-KERNEL_HALF, KERNEL_HALF + 1):             # <<<<<<<<<<<<<<
 * 
 *                     for kernel_offset_x in range(-KERNEL_HALF, KERNEL_HALF + 1):
 */
                              __pyx_t_20 = (__pyx_v_12PygameShader_6shader_KERNEL_HALF + 1);
                              __pyx_t_21 = __pyx_t_20;
                              for (__pyx_t_22 = (-__pyx_v_12PygameShader_6shader_KERNEL_HALF); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
                                __pyx_v_kernel_offset_y = __pyx_t_22;

                                /* "PygameShader/shader.pyx":3587
 *                 for kernel_offset_y in range(-KERNEL_HALF, KERNEL_HALF + 1):
 * 
 *                     for kernel_offset_x in range(-KERNEL_HALF, KERNEL_HALF + 1):             # <<<<<<<<<<<<<<
 * 
 *                         xx = x + kernel_offset_x
 */
                                __pyx_t_23 = (__pyx_v_12PygameShader_6shader_KERNEL_HALF + 1);
                                __pyx_t_24 = __pyx_t_23;
                                for (__pyx_t_25 = (-__pyx_v_12PygameShader_6shader_KERNEL_HALF); __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
                                  __pyx_v_kernel_offset_x = __pyx_t_25;

                                  /* "PygameShader/shader.pyx":3589
 *                     for kernel_offset_x in range(-KERNEL_HALF, KERNEL_HALF + 1):
 * 
 *                         xx = x + kernel_offset_x             # <<<<<<<<<<<<<<
 *                         yy = y + kernel_offset_y
 * 
 */
                                  __pyx_v_xx = (__pyx_v_x + __pyx_v_kernel_offset_x);

                                  /* "PygameShader/shader.pyx":3590
 * 
 *                         xx = x + kernel_offset_x
 *                         yy = y + kernel_offset_y             # <<<<<<<<<<<<<<
 * 
 *                         if xx > w_1:
 */
                                  __pyx_v_yy = (__pyx_v_y + __pyx_v_kernel_offset_y);

                                  /* "PygameShader/shader.pyx":3592
 *                         yy = y + kernel_offset_y
 * 
 *                         if xx > w_1:             # <<<<<<<<<<<<<<
 *                             xx = w_1
 *                         if xx < 0:
 */
                                  __pyx_t_26 = ((__pyx_v_xx > __pyx_v_w_1) != 0);
                                  if (__pyx_t_26) {

                                    /* "PygameShader/shader.pyx":3593
 * 
 *                         if xx > w_1:
 *                             xx = w_1             # <<<<<<<<<<<<<<
 *                         if xx < 0:
 *                             xx = 0
 */
                                    __pyx_v_xx = __pyx_v_w_1;

                                    /* "PygameShader/shader.pyx":3592
 *                         yy = y + kernel_offset_y
 * 
 *                         if xx > w_1:             # <<<<<<<<<<<<<<
 *                             xx = w_1
 *                         if xx < 0:
 */
                                  }

                                  /* "PygameShader/shader.pyx":3594
 *                         if xx > w_1:
 *                             xx = w_1
 *                         if xx < 0:             # <<<<<<<<<<<<<<
 *                             xx = 0
 * 
 */
                                  __pyx_t_26 = ((__pyx_v_xx < 0) != 0);
                                  if (__pyx_t_26) {

                                    /* "PygameShader/shader.pyx":3595
 *                             xx = w_1
 *                         if xx < 0:
 *                             xx = 0             # <<<<<<<<<<<<<<
 * 
 *                         if yy > h_1:
 */
                                    __pyx_v_xx = 0;

                                    /* "PygameShader/shader.pyx":3594
 *                         if xx > w_1:
 *                             xx = w_1
 *                         if xx < 0:             # <<<<<<<<<<<<<<
 *                             xx = 0
 * 
 */
                                  }

                                  /* "PygameShader/shader.pyx":3597
 *                             xx = 0
 * 
 *                         if yy > h_1:             # <<<<<<<<<<<<<<
 *                             yy = h_1
 *                         if yy < 0:
 */
                                  __pyx_t_26 = ((__pyx_v_yy > __pyx_v_h_1) != 0);
                                  if (__pyx_t_26) {

                                    /* "PygameShader/shader.pyx":3598
 * 
 *                         if yy > h_1:
 *                             yy = h_1             # <<<<<<<<<<<<<<
 *                         if yy < 0:
 *                             yy = 0
 */
                                    __pyx_v_yy = __pyx_v_h_1;

                                    /* "PygameShader/shader.pyx":3597
 *                             xx = 0
 * 
 *                         if yy > h_1:             # <<<<<<<<<<<<<<
 *                             yy = h_1
 *                         if yy < 0:
 */
                                  }

                                  /* "PygameShader/shader.pyx":3599
 *                         if yy > h_1:
 *                             yy = h_1
 *                         if yy < 0:             # <<<<<<<<<<<<<<
 *                             yy = 0
 * 
 */
                                  __pyx_t_26 = ((__pyx_v_yy < 0) != 0);
                                  if (__pyx_t_26) {

                                    /* "PygameShader/shader.pyx":3600
 *                             yy = h_1
 *                         if yy < 0:
 *                             yy = 0             # <<<<<<<<<<<<<<
 * 
 *                         # grayscale image red = green = blue
 */
                                    __pyx_v_yy = 0;

                                    /* "PygameShader/shader.pyx":3599
 *                         if yy > h_1:
 *                             yy = h_1
 *                         if yy < 0:             # <<<<<<<<<<<<<<
 *                             yy = 0
 * 
 */
                                  }

                                  /* "PygameShader/shader.pyx":3603
 * 
 *                         # grayscale image red = green = blue
 *                         gray = &rescale_array[xx, yy, 0]             # <<<<<<<<<<<<<<
 * 
 *                         if kernel_offset_x != 0:
 */
                                  __pyx_t_27 = __pyx_v_xx;
                                  __pyx_t_28 = __pyx_v_yy;
                                  __pyx_t_29 = 0;
                                  __pyx_v_gray = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rescale_array.data + __pyx_t_27 * __pyx_v_rescale_array.strides[0]) ) + __pyx_t_28 * __pyx_v_rescale_array.strides[1]) ) + __pyx_t_29 * __pyx_v_rescale_array.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":3605
 *                         gray = &rescale_array[xx, yy, 0]
 * 
 *                         if kernel_offset_x != 0:             # <<<<<<<<<<<<<<
 * 
 *                             r_gx = r_gx + <float> gray[0] * \
 */
                                  __pyx_t_26 = ((__pyx_v_kernel_offset_x != 0) != 0);
                                  if (__pyx_t_26) {

                                    /* "PygameShader/shader.pyx":3608
 * 
 *                             r_gx = r_gx + <float> gray[0] * \
 *                                    <float> GX[kernel_offset_x + KERNEL_HALF,             # <<<<<<<<<<<<<<
 *                                               kernel_offset_y + KERNEL_HALF]
 * 
 */
                                    if (unlikely(!__pyx_v_12PygameShader_6shader_GX.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("GX"); __PYX_ERR(1, 3608, __pyx_L10_error) }

                                    /* "PygameShader/shader.pyx":3609
 *                             r_gx = r_gx + <float> gray[0] * \
 *                                    <float> GX[kernel_offset_x + KERNEL_HALF,
 *                                               kernel_offset_y + KERNEL_HALF]             # <<<<<<<<<<<<<<
 * 
 *                         if kernel_offset_y != 0:
 */
                                    __pyx_t_29 = (__pyx_v_kernel_offset_x + __pyx_v_12PygameShader_6shader_KERNEL_HALF);
                                    __pyx_t_28 = (__pyx_v_kernel_offset_y + __pyx_v_12PygameShader_6shader_KERNEL_HALF);

                                    /* "PygameShader/shader.pyx":3607
 *                         if kernel_offset_x != 0:
 * 
 *                             r_gx = r_gx + <float> gray[0] * \             # <<<<<<<<<<<<<<
 *                                    <float> GX[kernel_offset_x + KERNEL_HALF,
 *                                               kernel_offset_y + KERNEL_HALF]
 */
                                    __pyx_v_r_gx = (__pyx_v_r_gx + (((float)(__pyx_v_gray[0])) * ((float)(*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_GX.data + __pyx_t_29 * __pyx_v_12PygameShader_6shader_GX.strides[0]) )) + __pyx_t_28)) ))))));

                                    /* "PygameShader/shader.pyx":3605
 *                         gray = &rescale_array[xx, yy, 0]
 * 
 *                         if kernel_offset_x != 0:             # <<<<<<<<<<<<<<
 * 
 *                             r_gx = r_gx + <float> gray[0] * \
 */
                                  }

                                  /* "PygameShader/shader.pyx":3611
 *                                               kernel_offset_y + KERNEL_HALF]
 * 
 *                         if kernel_offset_y != 0:             # <<<<<<<<<<<<<<
 * 
 *                             r_gy = r_gy + <float> gray[0] * \
 */
                                  __pyx_t_26 = ((__pyx_v_kernel_offset_y != 0) != 0);
                                  if (__pyx_t_26) {

                                    /* "PygameShader/shader.pyx":3614
 * 
 *                             r_gy = r_gy + <float> gray[0] * \
 *                                    <float> GY[kernel_offset_x + KERNEL_HALF,             # <<<<<<<<<<<<<<
 *                                               kernel_offset_y + KERNEL_HALF]
 * 
 */
                                    if (unlikely(!__pyx_v_12PygameShader_6shader_GY.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("GY"); __PYX_ERR(1, 3614, __pyx_L10_error) }

                                    /* "PygameShader/shader.pyx":3615
 *                             r_gy = r_gy + <float> gray[0] * \
 *                                    <float> GY[kernel_offset_x + KERNEL_HALF,
 *                                               kernel_offset_y + KERNEL_HALF]             # <<<<<<<<<<<<<<
 * 
 *                 magnitude = <float> sqrt(r_gx * r_gx + r_gy * r_gy)
 */
                                    __pyx_t_28 = (__pyx_v_kernel_offset_x + __pyx_v_12PygameShader_6shader_KERNEL_HALF);
                                    __pyx_t_29 = (__pyx_v_kernel_offset_y + __pyx_v_12PygameShader_6shader_KERNEL_HALF);

                                    /* "PygameShader/shader.pyx":3613
 *                         if kernel_offset_y != 0:
 * 
 *                             r_gy = r_gy + <float> gray[0] * \             # <<<<<<<<<<<<<<
 *                                    <float> GY[kernel_offset_x + KERNEL_HALF,
 *                                               kernel_offset_y + KERNEL_HALF]
 */
                                    __pyx_v_r_gy = (__pyx_v_r_gy + (((float)(__pyx_v_gray[0])) * ((float)(*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_GY.data + __pyx_t_28 * __pyx_v_12PygameShader_6shader_GY.strides[0]) )) + __pyx_t_29)) ))))));

                                    /* "PygameShader/shader.pyx":3611
 *                                               kernel_offset_y + KERNEL_HALF]
 * 
 *                         if kernel_offset_y != 0:             # <<<<<<<<<<<<<<
 * 
 *                             r_gy = r_gy + <float> gray[0] * \
 */
                                  }
                                }
                              }

                              /* "PygameShader/shader.pyx":3617
 *                                               kernel_offset_y + KERNEL_HALF]
 * 
 *                 magnitude = <float> sqrt(r_gx * r_gx + r_gy * r_gy)             # <<<<<<<<<<<<<<
 * 
 *                 if magnitude > 255:
 */
                              __pyx_v_magnitude = ((float)sqrt(((__pyx_v_r_gx * __pyx_v_r_gx) + (__pyx_v_r_gy * __pyx_v_r_gy))));

                              /* "PygameShader/shader.pyx":3619
 *                 magnitude = <float> sqrt(r_gx * r_gx + r_gy * r_gy)
 * 
 *                 if magnitude > 255:             # <<<<<<<<<<<<<<
 *                     magnitude = <float>255.0
 * 
 */
                              __pyx_t_26 = ((__pyx_v_magnitude > 255.0) != 0);
                              if (__pyx_t_26) {

                                /* "PygameShader/shader.pyx":3620
 * 
 *                 if magnitude > 255:
 *                     magnitude = <float>255.0             # <<<<<<<<<<<<<<
 * 
 *                 m = <unsigned char> magnitude if magnitude > threshold_ else 0
 */
                                __pyx_v_magnitude = ((float)255.0);

                                /* "PygameShader/shader.pyx":3619
 *                 magnitude = <float> sqrt(r_gx * r_gx + r_gy * r_gy)
 * 
 *                 if magnitude > 255:             # <<<<<<<<<<<<<<
 *                     magnitude = <float>255.0
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":3622
 *                     magnitude = <float>255.0
 * 
 *                 m = <unsigned char> magnitude if magnitude > threshold_ else 0             # <<<<<<<<<<<<<<
 * 
 *                 # update the pixel if the magnitude is above threshold else black pixel
 */
                              if (((__pyx_v_magnitude > __pyx_v_threshold_) != 0)) {
                                __pyx_t_30 = ((unsigned char)__pyx_v_magnitude);
                              } else {
                                __pyx_t_30 = 0;
                              }
                              __pyx_v_m = __pyx_t_30;

                              /* "PygameShader/shader.pyx":3625
 * 
 *                 # update the pixel if the magnitude is above threshold else black pixel
 *                 new_array[x, y, 0] = m             # <<<<<<<<<<<<<<
 *                 new_array[x, y, 1] = m
 *                 new_array[x, y, 2] = m
 */
                              __pyx_t_29 = __pyx_v_x;
                              __pyx_t_28 = __pyx_v_y;
                              __pyx_t_27 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_29 * __pyx_v_new_array.strides[0]) ) + __pyx_t_28 * __pyx_v_new_array.strides[1]) ) + __pyx_t_27 * __pyx_v_new_array.strides[2]) )) = __pyx_v_m;

                              /* "PygameShader/shader.pyx":3626
 *                 # update the pixel if the magnitude is above threshold else black pixel
 *                 new_array[x, y, 0] = m
 *                 new_array[x, y, 1] = m             # <<<<<<<<<<<<<<
 *                 new_array[x, y, 2] = m
 * 
 */
                              __pyx_t_27 = __pyx_v_x;
                              __pyx_t_28 = __pyx_v_y;
                              __pyx_t_29 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_27 * __pyx_v_new_array.strides[0]) ) + __pyx_t_28 * __pyx_v_new_array.strides[1]) ) + __pyx_t_29 * __pyx_v_new_array.strides[2]) )) = __pyx_v_m;

                              /* "PygameShader/shader.pyx":3627
 *                 new_array[x, y, 0] = m
 *                 new_array[x, y, 1] = m
 *                 new_array[x, y, 2] = m             # <<<<<<<<<<<<<<
 * 
 *     w = w << factor_
 */
                              __pyx_t_29 = __pyx_v_x;
                              __pyx_t_28 = __pyx_v_y;
                              __pyx_t_27 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_29 * __pyx_v_new_array.strides[0]) ) + __pyx_t_28 * __pyx_v_new_array.strides[1]) ) + __pyx_t_27 * __pyx_v_new_array.strides[2]) )) = __pyx_v_m;
                            }
                            goto __pyx_L26;
                            __pyx_L10_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L25;
                            __pyx_L25:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates1)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_gray;
                                __pyx_parallel_temp1 = __pyx_v_kernel_offset_x;
                                __pyx_parallel_temp2 = __pyx_v_kernel_offset_y;
                                __pyx_parallel_temp3 = __pyx_v_m;
                                __pyx_parallel_temp4 = __pyx_v_magnitude;
                                __pyx_parallel_temp5 = __pyx_v_r_gx;
                                __pyx_parallel_temp6 = __pyx_v_r_gy;
                                __pyx_parallel_temp7 = __pyx_v_x;
                                __pyx_parallel_temp8 = __pyx_v_xx;
                                __pyx_parallel_temp9 = __pyx_v_y;
                                __pyx_parallel_temp10 = __pyx_v_yy;
                            }
                            __pyx_L26:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_gray = __pyx_parallel_temp0;
              __pyx_v_kernel_offset_x = __pyx_parallel_temp1;
              __pyx_v_kernel_offset_y = __pyx_parallel_temp2;
              __pyx_v_m = __pyx_parallel_temp3;
              __pyx_v_magnitude = __pyx_parallel_temp4;
              __pyx_v_r_gx = __pyx_parallel_temp5;
              __pyx_v_r_gy = __pyx_parallel_temp6;
              __pyx_v_x = __pyx_parallel_temp7;
              __pyx_v_xx = __pyx_parallel_temp8;
              __pyx_v_y = __pyx_parallel_temp9;
              __pyx_v_yy = __pyx_parallel_temp10;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L6_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3577
 *     h_1 = h - 1
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L6_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L7:;
      }
  }

  /* "PygameShader/shader.pyx":3629
 *                 new_array[x, y, 2] = m
 * 
 *     w = w << factor_             # <<<<<<<<<<<<<<
 *     h = h << factor_
 * 
 */
  __pyx_v_w = (__pyx_v_w << __pyx_v_factor_);

  /* "PygameShader/shader.pyx":3630
 * 
 *     w = w << factor_
 *     h = h << factor_             # <<<<<<<<<<<<<<
 * 
 *     cdef unsigned char [:, :, :] new_ = scale_array24_c(new_array, w, h)
 */
  __pyx_v_h = (__pyx_v_h << __pyx_v_factor_);

  /* "PygameShader/shader.pyx":3632
 *     h = h << factor_
 * 
 *     cdef unsigned char [:, :, :] new_ = scale_array24_c(new_array, w, h)             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_t_31 = __pyx_f_12PygameShader_6shader_scale_array24_c(__pyx_v_new_array, __pyx_v_w, __pyx_v_h); if (unlikely(!__pyx_t_31.memview)) __PYX_ERR(1, 3632, __pyx_L1_error)
  __pyx_v_new_ = __pyx_t_31;
  __pyx_t_31.memview = NULL;
  __pyx_t_31.data = NULL;

  /* "PygameShader/shader.pyx":3634
 *     cdef unsigned char [:, :, :] new_ = scale_array24_c(new_array, w, h)
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3636
 *     with nogil:
 * 
 *         for y in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for x in range(w):
 * 
 */
        __pyx_t_15 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_7 = (__pyx_t_15 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_7 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_14, __pyx_t_16, __pyx_t_17, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_32, __pyx_t_33, __pyx_t_34)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6++){
                        {
                            __pyx_v_y = (int)(0 + 1 * __pyx_t_6);
                            /* Initialize private variables to invalid values */
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":3637
 * 
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 *             for x in range(w):             # <<<<<<<<<<<<<<
 * 
 *                 source_array[x, y, 0] = new_[x, y, 0]
 */
                            __pyx_t_16 = __pyx_v_w;
                            __pyx_t_17 = __pyx_t_16;
                            for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_17; __pyx_t_14+=1) {
                              __pyx_v_x = __pyx_t_14;

                              /* "PygameShader/shader.pyx":3639
 *             for x in range(w):
 * 
 *                 source_array[x, y, 0] = new_[x, y, 0]             # <<<<<<<<<<<<<<
 *                 source_array[x, y, 1] = new_[x, y, 1]
 *                 source_array[x, y, 2] = new_[x, y, 2]
 */
                              __pyx_t_27 = __pyx_v_x;
                              __pyx_t_28 = __pyx_v_y;
                              __pyx_t_29 = 0;
                              __pyx_t_32 = __pyx_v_x;
                              __pyx_t_33 = __pyx_v_y;
                              __pyx_t_34 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_32 * __pyx_v_source_array.strides[0]) ) + __pyx_t_33 * __pyx_v_source_array.strides[1]) ) + __pyx_t_34 * __pyx_v_source_array.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_.data + __pyx_t_27 * __pyx_v_new_.strides[0]) ) + __pyx_t_28 * __pyx_v_new_.strides[1]) ) + __pyx_t_29 * __pyx_v_new_.strides[2]) )));

                              /* "PygameShader/shader.pyx":3640
 * 
 *                 source_array[x, y, 0] = new_[x, y, 0]
 *                 source_array[x, y, 1] = new_[x, y, 1]             # <<<<<<<<<<<<<<
 *                 source_array[x, y, 2] = new_[x, y, 2]
 * 
 */
                              __pyx_t_29 = __pyx_v_x;
                              __pyx_t_28 = __pyx_v_y;
                              __pyx_t_27 = 1;
                              __pyx_t_34 = __pyx_v_x;
                              __pyx_t_33 = __pyx_v_y;
                              __pyx_t_32 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_34 * __pyx_v_source_array.strides[0]) ) + __pyx_t_33 * __pyx_v_source_array.strides[1]) ) + __pyx_t_32 * __pyx_v_source_array.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_.data + __pyx_t_29 * __pyx_v_new_.strides[0]) ) + __pyx_t_28 * __pyx_v_new_.strides[1]) ) + __pyx_t_27 * __pyx_v_new_.strides[2]) )));

                              /* "PygameShader/shader.pyx":3641
 *                 source_array[x, y, 0] = new_[x, y, 0]
 *                 source_array[x, y, 1] = new_[x, y, 1]
 *                 source_array[x, y, 2] = new_[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_27 = __pyx_v_x;
                              __pyx_t_28 = __pyx_v_y;
                              __pyx_t_29 = 2;
                              __pyx_t_32 = __pyx_v_x;
                              __pyx_t_33 = __pyx_v_y;
                              __pyx_t_34 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_32 * __pyx_v_source_array.strides[0]) ) + __pyx_t_33 * __pyx_v_source_array.strides[1]) ) + __pyx_t_34 * __pyx_v_source_array.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_.data + __pyx_t_27 * __pyx_v_new_.strides[0]) ) + __pyx_t_28 * __pyx_v_new_.strides[1]) ) + __pyx_t_29 * __pyx_v_new_.strides[2]) )));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3634
 *     cdef unsigned char [:, :, :] new_ = scale_array24_c(new_array, w, h)
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L29;
        }
        __pyx_L29:;
      }
  }

  /* "PygameShader/shader.pyx":3531
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_sobel24_fast_inplace_c(             # <<<<<<<<<<<<<<
 *         surface_, int threshold_=20, unsigned short factor_=1):
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __PYX_XDEC_MEMVIEW(&__pyx_t_31, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_sobel24_fast_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_source_array, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_rescale_array, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_new_array, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_new_, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3648
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_invert_surface_24bit_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array):
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_invert_surface_24bit_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  __Pyx_RefNannySetupContext("shader_invert_surface_24bit_inplace_c", 0);

  /* "PygameShader/shader.pyx":3667
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":3670
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":3675
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3676
 * 
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(w):
 *                 r = &rgb_array[i, j, 0]
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);

                            /* "PygameShader/shader.pyx":3677
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):             # <<<<<<<<<<<<<<
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]
 */
                            __pyx_t_5 = __pyx_v_w;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_i = __pyx_t_7;

                              /* "PygameShader/shader.pyx":3678
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 *                 r = &rgb_array[i, j, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3679
 *             for i in range(w):
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array[i, j, 2]
 *                 r[0] = 255 - r[0]
 */
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3680
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]             # <<<<<<<<<<<<<<
 *                 r[0] = 255 - r[0]
 *                 g[0] = 255 - g[0]
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3681
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]
 *                 r[0] = 255 - r[0]             # <<<<<<<<<<<<<<
 *                 g[0] = 255 - g[0]
 *                 b[0] = 255 - b[0]
 */
                              (__pyx_v_r[0]) = (0xFF - (__pyx_v_r[0]));

                              /* "PygameShader/shader.pyx":3682
 *                 b = &rgb_array[i, j, 2]
 *                 r[0] = 255 - r[0]
 *                 g[0] = 255 - g[0]             # <<<<<<<<<<<<<<
 *                 b[0] = 255 - b[0]
 * 
 */
                              (__pyx_v_g[0]) = (0xFF - (__pyx_v_g[0]));

                              /* "PygameShader/shader.pyx":3683
 *                 r[0] = 255 - r[0]
 *                 g[0] = 255 - g[0]
 *                 b[0] = 255 - b[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              (__pyx_v_b[0]) = (0xFF - (__pyx_v_b[0]));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3675
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":3648
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_invert_surface_24bit_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array):
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3692
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_blur5x5_array24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, mask=None, t=1):
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_blur5x5_array24_inplace_c *__pyx_optional_args) {
  PyObject *__pyx_v_t = ((PyObject *)__pyx_int_1);
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  short __pyx_v_kernel_half;
  __Pyx_memviewslice __pyx_v_convolve = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_convolved = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED Py_ssize_t __pyx_v_kernel_length;
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_xx;
  int __pyx_v_yy;
  float __pyx_v_r;
  float __pyx_v_g;
  float __pyx_v_b;
  char __pyx_v_kernel_offset;
  unsigned char __pyx_v_red;
  unsigned char __pyx_v_green;
  unsigned char __pyx_v_blue;
  float *__pyx_v_k;
  unsigned char *__pyx_v_c1;
  unsigned char *__pyx_v_c2;
  unsigned char *__pyx_v_c3;
  unsigned char *__pyx_v_c4;
  unsigned char *__pyx_v_c5;
  unsigned char *__pyx_v_c6;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *(*__pyx_t_9)(PyObject *);
  float __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_t_18;
  float __pyx_t_19;
  float __pyx_t_20;
  long __pyx_t_21;
  long __pyx_t_22;
  char __pyx_t_23;
  int __pyx_t_24;
  unsigned char __pyx_t_25;
  unsigned char __pyx_t_26;
  unsigned char __pyx_t_27;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_blur5x5_array24_inplace_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 1) {
      __pyx_v_t = __pyx_optional_args->t;
    }
  }

  /* "PygameShader/shader.pyx":3718
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     # kernel 5x5 separable
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":3723
 *     cdef:
 * 
 *         short int kernel_half = 2             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, ::1] convolve = numpy.empty((w, h, 3), dtype=uint8)
 *         unsigned char [:, :, ::1] convolved = numpy.empty((w, h, 3), dtype=uint8)
 */
  __pyx_v_kernel_half = 2;

  /* "PygameShader/shader.pyx":3724
 * 
 *         short int kernel_half = 2
 *         unsigned char [:, :, ::1] convolve = numpy.empty((w, h, 3), dtype=uint8)             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, ::1] convolved = numpy.empty((w, h, 3), dtype=uint8)
 *         Py_ssize_t kernel_length = len(GAUSS_KERNEL)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_3);
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3724, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_convolve = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":3725
 *         short int kernel_half = 2
 *         unsigned char [:, :, ::1] convolve = numpy.empty((w, h, 3), dtype=uint8)
 *         unsigned char [:, :, ::1] convolved = numpy.empty((w, h, 3), dtype=uint8)             # <<<<<<<<<<<<<<
 *         Py_ssize_t kernel_length = len(GAUSS_KERNEL)
 *         int x, y, xx, yy
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_3);
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3725, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_convolved = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":3726
 *         unsigned char [:, :, ::1] convolve = numpy.empty((w, h, 3), dtype=uint8)
 *         unsigned char [:, :, ::1] convolved = numpy.empty((w, h, 3), dtype=uint8)
 *         Py_ssize_t kernel_length = len(GAUSS_KERNEL)             # <<<<<<<<<<<<<<
 *         int x, y, xx, yy
 *         float r, g, b, s
 */
  __pyx_t_4 = __Pyx_carray_to_py_float(__pyx_v_12PygameShader_6shader_GAUSS_KERNEL, 5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 3726, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_kernel_length = __pyx_t_3;

  /* "PygameShader/shader.pyx":3739
 *         unsigned char *c6
 * 
 *     for r in range(t):             # <<<<<<<<<<<<<<
 *         with nogil:
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_3 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3739, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3739, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 3739, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3739, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 3739, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3739, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_9(__pyx_t_5);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 3739, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 3739, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_r = __pyx_t_10;

    /* "PygameShader/shader.pyx":3740
 * 
 *     for r in range(t):
 *         with nogil:             # <<<<<<<<<<<<<<
 * 
 *             # horizontal convolution
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "PygameShader/shader.pyx":3743
 * 
 *             # horizontal convolution
 *             for y in prange(0, h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *                 c1 = &rgb_array_[0, y, 0]
 */
          __pyx_t_2 = __pyx_v_h;
          if ((1 == 0)) abort();
          {
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   (x)
                  #define unlikely(x) (x)
              #endif
              __pyx_t_12 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1;
              if (__pyx_t_12 > 0)
              {
                  #ifdef _OPENMP
                  #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27)
                  #endif /* _OPENMP */
                  {
                      #ifdef _OPENMP
                      #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_blue) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_c3) lastprivate(__pyx_v_c4) lastprivate(__pyx_v_c5) lastprivate(__pyx_v_c6) lastprivate(__pyx_v_g) lastprivate(__pyx_v_green) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset) lastprivate(__pyx_v_r) lastprivate(__pyx_v_red) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                      #endif /* _OPENMP */
                      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                          {
                              __pyx_v_y = (int)(0 + 1 * __pyx_t_11);
                              /* Initialize private variables to invalid values */
                              __pyx_v_b = ((float)__PYX_NAN());
                              __pyx_v_blue = ((unsigned char)'?');
                              __pyx_v_c1 = ((unsigned char *)1);
                              __pyx_v_c2 = ((unsigned char *)1);
                              __pyx_v_c3 = ((unsigned char *)1);
                              __pyx_v_c4 = ((unsigned char *)1);
                              __pyx_v_c5 = ((unsigned char *)1);
                              __pyx_v_c6 = ((unsigned char *)1);
                              __pyx_v_g = ((float)__PYX_NAN());
                              __pyx_v_green = ((unsigned char)'?');
                              __pyx_v_k = ((float *)1);
                              __pyx_v_kernel_offset = ((char)'?');
                              __pyx_v_r = ((float)__PYX_NAN());
                              __pyx_v_red = ((unsigned char)'?');
                              __pyx_v_x = ((int)0xbad0bad0);
                              __pyx_v_xx = ((int)0xbad0bad0);

                              /* "PygameShader/shader.pyx":3745
 *             for y in prange(0, h, schedule='static', num_threads=THREADS):
 * 
 *                 c1 = &rgb_array_[0, y, 0]             # <<<<<<<<<<<<<<
 *                 c2 = &rgb_array_[0, y, 1]
 *                 c3 = &rgb_array_[0, y, 2]
 */
                              __pyx_t_13 = 0;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 0;
                              __pyx_v_c1 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3746
 * 
 *                 c1 = &rgb_array_[0, y, 0]
 *                 c2 = &rgb_array_[0, y, 1]             # <<<<<<<<<<<<<<
 *                 c3 = &rgb_array_[0, y, 2]
 *                 c4 = &rgb_array_[w-1, y, 0]
 */
                              __pyx_t_15 = 0;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 1;
                              __pyx_v_c2 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3747
 *                 c1 = &rgb_array_[0, y, 0]
 *                 c2 = &rgb_array_[0, y, 1]
 *                 c3 = &rgb_array_[0, y, 2]             # <<<<<<<<<<<<<<
 *                 c4 = &rgb_array_[w-1, y, 0]
 *                 c5 = &rgb_array_[w-1, y, 1]
 */
                              __pyx_t_13 = 0;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 2;
                              __pyx_v_c3 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3748
 *                 c2 = &rgb_array_[0, y, 1]
 *                 c3 = &rgb_array_[0, y, 2]
 *                 c4 = &rgb_array_[w-1, y, 0]             # <<<<<<<<<<<<<<
 *                 c5 = &rgb_array_[w-1, y, 1]
 *                 c6 = &rgb_array_[w-1, y, 2]
 */
                              __pyx_t_15 = (__pyx_v_w - 1);
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 0;
                              __pyx_v_c4 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3749
 *                 c3 = &rgb_array_[0, y, 2]
 *                 c4 = &rgb_array_[w-1, y, 0]
 *                 c5 = &rgb_array_[w-1, y, 1]             # <<<<<<<<<<<<<<
 *                 c6 = &rgb_array_[w-1, y, 2]
 * 
 */
                              __pyx_t_13 = (__pyx_v_w - 1);
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 1;
                              __pyx_v_c5 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3750
 *                 c4 = &rgb_array_[w-1, y, 0]
 *                 c5 = &rgb_array_[w-1, y, 1]
 *                 c6 = &rgb_array_[w-1, y, 2]             # <<<<<<<<<<<<<<
 * 
 *                 for x in range(0, w):  # range [0..w-1]
 */
                              __pyx_t_15 = (__pyx_v_w - 1);
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 2;
                              __pyx_v_c6 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":3752
 *                 c6 = &rgb_array_[w-1, y, 2]
 * 
 *                 for x in range(0, w):  # range [0..w-1]             # <<<<<<<<<<<<<<
 * 
 *                     r, g, b = 0, 0, 0
 */
                              __pyx_t_16 = __pyx_v_w;
                              __pyx_t_17 = __pyx_t_16;
                              for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                                __pyx_v_x = __pyx_t_18;

                                /* "PygameShader/shader.pyx":3754
 *                 for x in range(0, w):  # range [0..w-1]
 * 
 *                     r, g, b = 0, 0, 0             # <<<<<<<<<<<<<<
 * 
 *                     for kernel_offset in range(-kernel_half, kernel_half + 1):
 */
                                __pyx_t_10 = 0.0;
                                __pyx_t_19 = 0.0;
                                __pyx_t_20 = 0.0;
                                __pyx_v_r = __pyx_t_10;
                                __pyx_v_g = __pyx_t_19;
                                __pyx_v_b = __pyx_t_20;

                                /* "PygameShader/shader.pyx":3756
 *                     r, g, b = 0, 0, 0
 * 
 *                     for kernel_offset in range(-kernel_half, kernel_half + 1):             # <<<<<<<<<<<<<<
 * 
 *                         k = &GAUSS_KERNEL[kernel_offset + kernel_half]
 */
                                __pyx_t_21 = (__pyx_v_kernel_half + 1);
                                __pyx_t_22 = __pyx_t_21;
                                for (__pyx_t_23 = (-__pyx_v_kernel_half); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
                                  __pyx_v_kernel_offset = __pyx_t_23;

                                  /* "PygameShader/shader.pyx":3758
 *                     for kernel_offset in range(-kernel_half, kernel_half + 1):
 * 
 *                         k = &GAUSS_KERNEL[kernel_offset + kernel_half]             # <<<<<<<<<<<<<<
 * 
 *                         xx = x + kernel_offset
 */
                                  __pyx_v_k = (&(__pyx_v_12PygameShader_6shader_GAUSS_KERNEL[(__pyx_v_kernel_offset + __pyx_v_kernel_half)]));

                                  /* "PygameShader/shader.pyx":3760
 *                         k = &GAUSS_KERNEL[kernel_offset + kernel_half]
 * 
 *                         xx = x + kernel_offset             # <<<<<<<<<<<<<<
 * 
 *                         # check boundaries.
 */
                                  __pyx_v_xx = (__pyx_v_x + __pyx_v_kernel_offset);

                                  /* "PygameShader/shader.pyx":3764
 *                         # check boundaries.
 *                         # Fetch the edge pixel for the convolution
 *                         if xx < 0:             # <<<<<<<<<<<<<<
 *                             red, green, blue = c1[0], c2[0], c3[0]
 *                         elif xx > (w - 1):
 */
                                  __pyx_t_24 = ((__pyx_v_xx < 0) != 0);
                                  if (__pyx_t_24) {

                                    /* "PygameShader/shader.pyx":3765
 *                         # Fetch the edge pixel for the convolution
 *                         if xx < 0:
 *                             red, green, blue = c1[0], c2[0], c3[0]             # <<<<<<<<<<<<<<
 *                         elif xx > (w - 1):
 *                             red, green, blue = c4[0], c5[0], c6[0]
 */
                                    __pyx_t_25 = (__pyx_v_c1[0]);
                                    __pyx_t_26 = (__pyx_v_c2[0]);
                                    __pyx_t_27 = (__pyx_v_c3[0]);
                                    __pyx_v_red = __pyx_t_25;
                                    __pyx_v_green = __pyx_t_26;
                                    __pyx_v_blue = __pyx_t_27;

                                    /* "PygameShader/shader.pyx":3764
 *                         # check boundaries.
 *                         # Fetch the edge pixel for the convolution
 *                         if xx < 0:             # <<<<<<<<<<<<<<
 *                             red, green, blue = c1[0], c2[0], c3[0]
 *                         elif xx > (w - 1):
 */
                                    goto __pyx_L18;
                                  }

                                  /* "PygameShader/shader.pyx":3766
 *                         if xx < 0:
 *                             red, green, blue = c1[0], c2[0], c3[0]
 *                         elif xx > (w - 1):             # <<<<<<<<<<<<<<
 *                             red, green, blue = c4[0], c5[0], c6[0]
 *                         else:
 */
                                  __pyx_t_24 = ((__pyx_v_xx > (__pyx_v_w - 1)) != 0);
                                  if (__pyx_t_24) {

                                    /* "PygameShader/shader.pyx":3767
 *                             red, green, blue = c1[0], c2[0], c3[0]
 *                         elif xx > (w - 1):
 *                             red, green, blue = c4[0], c5[0], c6[0]             # <<<<<<<<<<<<<<
 *                         else:
 *                             red, green, blue = rgb_array_[xx, y, 0],\
 */
                                    __pyx_t_27 = (__pyx_v_c4[0]);
                                    __pyx_t_26 = (__pyx_v_c5[0]);
                                    __pyx_t_25 = (__pyx_v_c6[0]);
                                    __pyx_v_red = __pyx_t_27;
                                    __pyx_v_green = __pyx_t_26;
                                    __pyx_v_blue = __pyx_t_25;

                                    /* "PygameShader/shader.pyx":3766
 *                         if xx < 0:
 *                             red, green, blue = c1[0], c2[0], c3[0]
 *                         elif xx > (w - 1):             # <<<<<<<<<<<<<<
 *                             red, green, blue = c4[0], c5[0], c6[0]
 *                         else:
 */
                                    goto __pyx_L18;
                                  }

                                  /* "PygameShader/shader.pyx":3769
 *                             red, green, blue = c4[0], c5[0], c6[0]
 *                         else:
 *                             red, green, blue = rgb_array_[xx, y, 0],\             # <<<<<<<<<<<<<<
 *                                 rgb_array_[xx, y, 1], rgb_array_[xx, y, 2]
 *                             if red + green + blue == 0:
 */
                                  /*else*/ {
                                    __pyx_t_13 = __pyx_v_xx;
                                    __pyx_t_14 = __pyx_v_y;
                                    __pyx_t_15 = 0;
                                    __pyx_t_25 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )));

                                    /* "PygameShader/shader.pyx":3770
 *                         else:
 *                             red, green, blue = rgb_array_[xx, y, 0],\
 *                                 rgb_array_[xx, y, 1], rgb_array_[xx, y, 2]             # <<<<<<<<<<<<<<
 *                             if red + green + blue == 0:
 *                                 continue
 */
                                    __pyx_t_15 = __pyx_v_xx;
                                    __pyx_t_14 = __pyx_v_y;
                                    __pyx_t_13 = 1;
                                    __pyx_t_26 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )));
                                    __pyx_t_13 = __pyx_v_xx;
                                    __pyx_t_14 = __pyx_v_y;
                                    __pyx_t_15 = 2;
                                    __pyx_t_27 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )));
                                    __pyx_v_red = __pyx_t_25;
                                    __pyx_v_green = __pyx_t_26;
                                    __pyx_v_blue = __pyx_t_27;

                                    /* "PygameShader/shader.pyx":3771
 *                             red, green, blue = rgb_array_[xx, y, 0],\
 *                                 rgb_array_[xx, y, 1], rgb_array_[xx, y, 2]
 *                             if red + green + blue == 0:             # <<<<<<<<<<<<<<
 *                                 continue
 * 
 */
                                    __pyx_t_24 = ((((__pyx_v_red + __pyx_v_green) + __pyx_v_blue) == 0) != 0);
                                    if (__pyx_t_24) {

                                      /* "PygameShader/shader.pyx":3772
 *                                 rgb_array_[xx, y, 1], rgb_array_[xx, y, 2]
 *                             if red + green + blue == 0:
 *                                 continue             # <<<<<<<<<<<<<<
 * 
 *                         r = r + red * k[0]
 */
                                      goto __pyx_L16_continue;

                                      /* "PygameShader/shader.pyx":3771
 *                             red, green, blue = rgb_array_[xx, y, 0],\
 *                                 rgb_array_[xx, y, 1], rgb_array_[xx, y, 2]
 *                             if red + green + blue == 0:             # <<<<<<<<<<<<<<
 *                                 continue
 * 
 */
                                    }
                                  }
                                  __pyx_L18:;

                                  /* "PygameShader/shader.pyx":3774
 *                                 continue
 * 
 *                         r = r + red * k[0]             # <<<<<<<<<<<<<<
 *                         g = g + green * k[0]
 *                         b = b + blue * k[0]
 */
                                  __pyx_v_r = (__pyx_v_r + (__pyx_v_red * (__pyx_v_k[0])));

                                  /* "PygameShader/shader.pyx":3775
 * 
 *                         r = r + red * k[0]
 *                         g = g + green * k[0]             # <<<<<<<<<<<<<<
 *                         b = b + blue * k[0]
 * 
 */
                                  __pyx_v_g = (__pyx_v_g + (__pyx_v_green * (__pyx_v_k[0])));

                                  /* "PygameShader/shader.pyx":3776
 *                         r = r + red * k[0]
 *                         g = g + green * k[0]
 *                         b = b + blue * k[0]             # <<<<<<<<<<<<<<
 * 
 *                     convolve[x, y, 0] = <unsigned char>r
 */
                                  __pyx_v_b = (__pyx_v_b + (__pyx_v_blue * (__pyx_v_k[0])));
                                  __pyx_L16_continue:;
                                }

                                /* "PygameShader/shader.pyx":3778
 *                         b = b + blue * k[0]
 * 
 *                     convolve[x, y, 0] = <unsigned char>r             # <<<<<<<<<<<<<<
 *                     convolve[x, y, 1] = <unsigned char>g
 *                     convolve[x, y, 2] = <unsigned char>b
 */
                                __pyx_t_15 = __pyx_v_x;
                                __pyx_t_14 = __pyx_v_y;
                                __pyx_t_13 = 0;
                                *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) )) = ((unsigned char)__pyx_v_r);

                                /* "PygameShader/shader.pyx":3779
 * 
 *                     convolve[x, y, 0] = <unsigned char>r
 *                     convolve[x, y, 1] = <unsigned char>g             # <<<<<<<<<<<<<<
 *                     convolve[x, y, 2] = <unsigned char>b
 * 
 */
                                __pyx_t_13 = __pyx_v_x;
                                __pyx_t_14 = __pyx_v_y;
                                __pyx_t_15 = 1;
                                *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) )) = ((unsigned char)__pyx_v_g);

                                /* "PygameShader/shader.pyx":3780
 *                     convolve[x, y, 0] = <unsigned char>r
 *                     convolve[x, y, 1] = <unsigned char>g
 *                     convolve[x, y, 2] = <unsigned char>b             # <<<<<<<<<<<<<<
 * 
 *             # Vertical convolution
 */
                                __pyx_t_15 = __pyx_v_x;
                                __pyx_t_14 = __pyx_v_y;
                                __pyx_t_13 = 2;
                                *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) )) = ((unsigned char)__pyx_v_b);
                              }
                          }
                      }
                  }
              }
          }
          #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
              #undef likely
              #undef unlikely
              #define likely(x)   __builtin_expect(!!(x), 1)
              #define unlikely(x) __builtin_expect(!!(x), 0)
          #endif

          /* "PygameShader/shader.pyx":3783
 * 
 *             # Vertical convolution
 *             for x in prange(0,  w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *                 c1 = &convolve[x, 0, 0]
 */
          __pyx_t_12 = __pyx_v_w;
          if ((1 == 0)) abort();
          {
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   (x)
                  #define unlikely(x) (x)
              #endif
              __pyx_t_2 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
              if (__pyx_t_2 > 0)
              {
                  #ifdef _OPENMP
                  #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27)
                  #endif /* _OPENMP */
                  {
                      #ifdef _OPENMP
                      #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_blue) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_c3) lastprivate(__pyx_v_c4) lastprivate(__pyx_v_c5) lastprivate(__pyx_v_c6) lastprivate(__pyx_v_g) lastprivate(__pyx_v_green) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset) lastprivate(__pyx_v_r) lastprivate(__pyx_v_red) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
                      #endif /* _OPENMP */
                      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_2; __pyx_t_11++){
                          {
                              __pyx_v_x = (int)(0 + 1 * __pyx_t_11);
                              /* Initialize private variables to invalid values */
                              __pyx_v_b = ((float)__PYX_NAN());
                              __pyx_v_blue = ((unsigned char)'?');
                              __pyx_v_c1 = ((unsigned char *)1);
                              __pyx_v_c2 = ((unsigned char *)1);
                              __pyx_v_c3 = ((unsigned char *)1);
                              __pyx_v_c4 = ((unsigned char *)1);
                              __pyx_v_c5 = ((unsigned char *)1);
                              __pyx_v_c6 = ((unsigned char *)1);
                              __pyx_v_g = ((float)__PYX_NAN());
                              __pyx_v_green = ((unsigned char)'?');
                              __pyx_v_k = ((float *)1);
                              __pyx_v_kernel_offset = ((char)'?');
                              __pyx_v_r = ((float)__PYX_NAN());
                              __pyx_v_red = ((unsigned char)'?');
                              __pyx_v_y = ((int)0xbad0bad0);
                              __pyx_v_yy = ((int)0xbad0bad0);

                              /* "PygameShader/shader.pyx":3785
 *             for x in prange(0,  w, schedule='static', num_threads=THREADS):
 * 
 *                 c1 = &convolve[x, 0, 0]             # <<<<<<<<<<<<<<
 *                 c2 = &convolve[x, 0, 1]
 *                 c3 = &convolve[x, 0, 2]
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = 0;
                              __pyx_t_15 = 0;
                              __pyx_v_c1 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) ))));

                              /* "PygameShader/shader.pyx":3786
 * 
 *                 c1 = &convolve[x, 0, 0]
 *                 c2 = &convolve[x, 0, 1]             # <<<<<<<<<<<<<<
 *                 c3 = &convolve[x, 0, 2]
 *                 c4 = &convolve[x, h-1, 0]
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_14 = 0;
                              __pyx_t_13 = 1;
                              __pyx_v_c2 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) ))));

                              /* "PygameShader/shader.pyx":3787
 *                 c1 = &convolve[x, 0, 0]
 *                 c2 = &convolve[x, 0, 1]
 *                 c3 = &convolve[x, 0, 2]             # <<<<<<<<<<<<<<
 *                 c4 = &convolve[x, h-1, 0]
 *                 c5 = &convolve[x, h-1, 1]
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = 0;
                              __pyx_t_15 = 2;
                              __pyx_v_c3 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) ))));

                              /* "PygameShader/shader.pyx":3788
 *                 c2 = &convolve[x, 0, 1]
 *                 c3 = &convolve[x, 0, 2]
 *                 c4 = &convolve[x, h-1, 0]             # <<<<<<<<<<<<<<
 *                 c5 = &convolve[x, h-1, 1]
 *                 c6 = &convolve[x, h-1, 2]
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_14 = (__pyx_v_h - 1);
                              __pyx_t_13 = 0;
                              __pyx_v_c4 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) ))));

                              /* "PygameShader/shader.pyx":3789
 *                 c3 = &convolve[x, 0, 2]
 *                 c4 = &convolve[x, h-1, 0]
 *                 c5 = &convolve[x, h-1, 1]             # <<<<<<<<<<<<<<
 *                 c6 = &convolve[x, h-1, 2]
 * 
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = (__pyx_v_h - 1);
                              __pyx_t_15 = 1;
                              __pyx_v_c5 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) ))));

                              /* "PygameShader/shader.pyx":3790
 *                 c4 = &convolve[x, h-1, 0]
 *                 c5 = &convolve[x, h-1, 1]
 *                 c6 = &convolve[x, h-1, 2]             # <<<<<<<<<<<<<<
 * 
 *                 for y in range(0, h):
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_14 = (__pyx_v_h - 1);
                              __pyx_t_13 = 2;
                              __pyx_v_c6 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) ))));

                              /* "PygameShader/shader.pyx":3792
 *                 c6 = &convolve[x, h-1, 2]
 * 
 *                 for y in range(0, h):             # <<<<<<<<<<<<<<
 *                     r, g, b = 0, 0, 0
 * 
 */
                              __pyx_t_16 = __pyx_v_h;
                              __pyx_t_17 = __pyx_t_16;
                              for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                                __pyx_v_y = __pyx_t_18;

                                /* "PygameShader/shader.pyx":3793
 * 
 *                 for y in range(0, h):
 *                     r, g, b = 0, 0, 0             # <<<<<<<<<<<<<<
 * 
 *                     for kernel_offset in range(-kernel_half, kernel_half + 1):
 */
                                __pyx_t_20 = 0.0;
                                __pyx_t_19 = 0.0;
                                __pyx_t_10 = 0.0;
                                __pyx_v_r = __pyx_t_20;
                                __pyx_v_g = __pyx_t_19;
                                __pyx_v_b = __pyx_t_10;

                                /* "PygameShader/shader.pyx":3795
 *                     r, g, b = 0, 0, 0
 * 
 *                     for kernel_offset in range(-kernel_half, kernel_half + 1):             # <<<<<<<<<<<<<<
 * 
 *                         k = &GAUSS_KERNEL[kernel_offset + kernel_half]
 */
                                __pyx_t_21 = (__pyx_v_kernel_half + 1);
                                __pyx_t_22 = __pyx_t_21;
                                for (__pyx_t_23 = (-__pyx_v_kernel_half); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
                                  __pyx_v_kernel_offset = __pyx_t_23;

                                  /* "PygameShader/shader.pyx":3797
 *                     for kernel_offset in range(-kernel_half, kernel_half + 1):
 * 
 *                         k = &GAUSS_KERNEL[kernel_offset + kernel_half]             # <<<<<<<<<<<<<<
 *                         yy = y + kernel_offset
 * 
 */
                                  __pyx_v_k = (&(__pyx_v_12PygameShader_6shader_GAUSS_KERNEL[(__pyx_v_kernel_offset + __pyx_v_kernel_half)]));

                                  /* "PygameShader/shader.pyx":3798
 * 
 *                         k = &GAUSS_KERNEL[kernel_offset + kernel_half]
 *                         yy = y + kernel_offset             # <<<<<<<<<<<<<<
 * 
 *                         if yy < 0:
 */
                                  __pyx_v_yy = (__pyx_v_y + __pyx_v_kernel_offset);

                                  /* "PygameShader/shader.pyx":3800
 *                         yy = y + kernel_offset
 * 
 *                         if yy < 0:             # <<<<<<<<<<<<<<
 *                             red, green, blue = c1[0], c2[0], c3[0]
 *                         elif yy > (h -1):
 */
                                  __pyx_t_24 = ((__pyx_v_yy < 0) != 0);
                                  if (__pyx_t_24) {

                                    /* "PygameShader/shader.pyx":3801
 * 
 *                         if yy < 0:
 *                             red, green, blue = c1[0], c2[0], c3[0]             # <<<<<<<<<<<<<<
 *                         elif yy > (h -1):
 *                             red, green, blue = c4[0], c5[0], c6[0]
 */
                                    __pyx_t_27 = (__pyx_v_c1[0]);
                                    __pyx_t_26 = (__pyx_v_c2[0]);
                                    __pyx_t_25 = (__pyx_v_c3[0]);
                                    __pyx_v_red = __pyx_t_27;
                                    __pyx_v_green = __pyx_t_26;
                                    __pyx_v_blue = __pyx_t_25;

                                    /* "PygameShader/shader.pyx":3800
 *                         yy = y + kernel_offset
 * 
 *                         if yy < 0:             # <<<<<<<<<<<<<<
 *                             red, green, blue = c1[0], c2[0], c3[0]
 *                         elif yy > (h -1):
 */
                                    goto __pyx_L30;
                                  }

                                  /* "PygameShader/shader.pyx":3802
 *                         if yy < 0:
 *                             red, green, blue = c1[0], c2[0], c3[0]
 *                         elif yy > (h -1):             # <<<<<<<<<<<<<<
 *                             red, green, blue = c4[0], c5[0], c6[0]
 *                         else:
 */
                                  __pyx_t_24 = ((__pyx_v_yy > (__pyx_v_h - 1)) != 0);
                                  if (__pyx_t_24) {

                                    /* "PygameShader/shader.pyx":3803
 *                             red, green, blue = c1[0], c2[0], c3[0]
 *                         elif yy > (h -1):
 *                             red, green, blue = c4[0], c5[0], c6[0]             # <<<<<<<<<<<<<<
 *                         else:
 *                             red, green, blue = convolve[x, yy, 0],\
 */
                                    __pyx_t_25 = (__pyx_v_c4[0]);
                                    __pyx_t_26 = (__pyx_v_c5[0]);
                                    __pyx_t_27 = (__pyx_v_c6[0]);
                                    __pyx_v_red = __pyx_t_25;
                                    __pyx_v_green = __pyx_t_26;
                                    __pyx_v_blue = __pyx_t_27;

                                    /* "PygameShader/shader.pyx":3802
 *                         if yy < 0:
 *                             red, green, blue = c1[0], c2[0], c3[0]
 *                         elif yy > (h -1):             # <<<<<<<<<<<<<<
 *                             red, green, blue = c4[0], c5[0], c6[0]
 *                         else:
 */
                                    goto __pyx_L30;
                                  }

                                  /* "PygameShader/shader.pyx":3805
 *                             red, green, blue = c4[0], c5[0], c6[0]
 *                         else:
 *                             red, green, blue = convolve[x, yy, 0],\             # <<<<<<<<<<<<<<
 *                                 convolve[x, yy, 1], convolve[x, yy, 2]
 *                             if red + green + blue == 0:
 */
                                  /*else*/ {
                                    __pyx_t_13 = __pyx_v_x;
                                    __pyx_t_14 = __pyx_v_yy;
                                    __pyx_t_15 = 0;
                                    __pyx_t_27 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) )));

                                    /* "PygameShader/shader.pyx":3806
 *                         else:
 *                             red, green, blue = convolve[x, yy, 0],\
 *                                 convolve[x, yy, 1], convolve[x, yy, 2]             # <<<<<<<<<<<<<<
 *                             if red + green + blue == 0:
 *                                 continue
 */
                                    __pyx_t_15 = __pyx_v_x;
                                    __pyx_t_14 = __pyx_v_yy;
                                    __pyx_t_13 = 1;
                                    __pyx_t_26 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) )));
                                    __pyx_t_13 = __pyx_v_x;
                                    __pyx_t_14 = __pyx_v_yy;
                                    __pyx_t_15 = 2;
                                    __pyx_t_25 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) )));
                                    __pyx_v_red = __pyx_t_27;
                                    __pyx_v_green = __pyx_t_26;
                                    __pyx_v_blue = __pyx_t_25;

                                    /* "PygameShader/shader.pyx":3807
 *                             red, green, blue = convolve[x, yy, 0],\
 *                                 convolve[x, yy, 1], convolve[x, yy, 2]
 *                             if red + green + blue == 0:             # <<<<<<<<<<<<<<
 *                                 continue
 * 
 */
                                    __pyx_t_24 = ((((__pyx_v_red + __pyx_v_green) + __pyx_v_blue) == 0) != 0);
                                    if (__pyx_t_24) {

                                      /* "PygameShader/shader.pyx":3808
 *                                 convolve[x, yy, 1], convolve[x, yy, 2]
 *                             if red + green + blue == 0:
 *                                 continue             # <<<<<<<<<<<<<<
 * 
 *                         r = r + red * k[0]
 */
                                      goto __pyx_L28_continue;

                                      /* "PygameShader/shader.pyx":3807
 *                             red, green, blue = convolve[x, yy, 0],\
 *                                 convolve[x, yy, 1], convolve[x, yy, 2]
 *                             if red + green + blue == 0:             # <<<<<<<<<<<<<<
 *                                 continue
 * 
 */
                                    }
                                  }
                                  __pyx_L30:;

                                  /* "PygameShader/shader.pyx":3810
 *                                 continue
 * 
 *                         r = r + red * k[0]             # <<<<<<<<<<<<<<
 *                         g = g + green * k[0]
 *                         b = b + blue * k[0]
 */
                                  __pyx_v_r = (__pyx_v_r + (__pyx_v_red * (__pyx_v_k[0])));

                                  /* "PygameShader/shader.pyx":3811
 * 
 *                         r = r + red * k[0]
 *                         g = g + green * k[0]             # <<<<<<<<<<<<<<
 *                         b = b + blue * k[0]
 * 
 */
                                  __pyx_v_g = (__pyx_v_g + (__pyx_v_green * (__pyx_v_k[0])));

                                  /* "PygameShader/shader.pyx":3812
 *                         r = r + red * k[0]
 *                         g = g + green * k[0]
 *                         b = b + blue * k[0]             # <<<<<<<<<<<<<<
 * 
 *                     rgb_array_[x, y, 0], rgb_array_[x, y, 1], rgb_array_[x, y, 2] = \
 */
                                  __pyx_v_b = (__pyx_v_b + (__pyx_v_blue * (__pyx_v_k[0])));
                                  __pyx_L28_continue:;
                                }

                                /* "PygameShader/shader.pyx":3815
 * 
 *                     rgb_array_[x, y, 0], rgb_array_[x, y, 1], rgb_array_[x, y, 2] = \
 *                         <unsigned char>r, <unsigned char>g, <unsigned char>b             # <<<<<<<<<<<<<<
 * 
 * 
 */
                                __pyx_t_25 = ((unsigned char)__pyx_v_r);
                                __pyx_t_26 = ((unsigned char)__pyx_v_g);
                                __pyx_t_27 = ((unsigned char)__pyx_v_b);

                                /* "PygameShader/shader.pyx":3814
 *                         b = b + blue * k[0]
 * 
 *                     rgb_array_[x, y, 0], rgb_array_[x, y, 1], rgb_array_[x, y, 2] = \             # <<<<<<<<<<<<<<
 *                         <unsigned char>r, <unsigned char>g, <unsigned char>b
 * 
 */
                                __pyx_t_15 = __pyx_v_x;
                                __pyx_t_14 = __pyx_v_y;
                                __pyx_t_13 = 0;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_25;
                                __pyx_t_13 = __pyx_v_x;
                                __pyx_t_14 = __pyx_v_y;
                                __pyx_t_15 = 1;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_26;
                                __pyx_t_15 = __pyx_v_x;
                                __pyx_t_14 = __pyx_v_y;
                                __pyx_t_13 = 2;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_27;
                              }
                          }
                      }
                  }
              }
          }
          #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
              #undef likely
              #undef unlikely
              #define likely(x)   __builtin_expect(!!(x), 1)
              #define unlikely(x) __builtin_expect(!!(x), 0)
          #endif
        }

        /* "PygameShader/shader.pyx":3740
 * 
 *     for r in range(t):
 *         with nogil:             # <<<<<<<<<<<<<<
 * 
 *             # horizontal convolution
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "PygameShader/shader.pyx":3739
 *         unsigned char *c6
 * 
 *     for r in range(t):             # <<<<<<<<<<<<<<
 *         with nogil:
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PygameShader/shader.pyx":3692
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_blur5x5_array24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, mask=None, t=1):
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_blur5x5_array24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_convolve, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_convolved, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3822
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_wave24bit_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float rad,
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_wave24bit_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_rad, int __pyx_v_size) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  __Pyx_memviewslice __pyx_v_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_x_pos;
  int __pyx_v_y_pos;
  int __pyx_v_xx;
  int __pyx_v_yy;
  int __pyx_v_i;
  int __pyx_v_j;
  float __pyx_v_c1;
  int __pyx_v_w_1;
  int __pyx_v_h_1;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_9;
  int __pyx_t_10;
  long __pyx_t_11;
  long __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  long __pyx_t_15;
  long __pyx_t_16;
  long __pyx_t_17;
  long __pyx_t_18;
  int __pyx_t_19;
  long __pyx_t_20;
  long __pyx_t_21;
  int __pyx_t_22;
  int __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_wave24bit_inplace_c", 0);

  /* "PygameShader/shader.pyx":3845
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":3848
 * 
 *     cdef:
 *         unsigned char [:, :, :] rgb = numpy.array(rgb_array_, copy=True)             # <<<<<<<<<<<<<<
 *         int x, y, x_pos, y_pos, xx, yy
 *         int i=0, j=0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3848, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3848, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_rgb = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":3850
 *         unsigned char [:, :, :] rgb = numpy.array(rgb_array_, copy=True)
 *         int x, y, x_pos, y_pos, xx, yy
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         float c1 = <float>1.0 / <float>(size * size)
 *         int w_1 = <int>w - 1
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":3851
 *         int x, y, x_pos, y_pos, xx, yy
 *         int i=0, j=0
 *         float c1 = <float>1.0 / <float>(size * size)             # <<<<<<<<<<<<<<
 *         int w_1 = <int>w - 1
 *         int h_1 = <int>h - 1
 */
  __pyx_v_c1 = (((float)1.0) / ((float)(__pyx_v_size * __pyx_v_size)));

  /* "PygameShader/shader.pyx":3852
 *         int i=0, j=0
 *         float c1 = <float>1.0 / <float>(size * size)
 *         int w_1 = <int>w - 1             # <<<<<<<<<<<<<<
 *         int h_1 = <int>h - 1
 * 
 */
  __pyx_v_w_1 = (((int)__pyx_v_w) - 1);

  /* "PygameShader/shader.pyx":3853
 *         float c1 = <float>1.0 / <float>(size * size)
 *         int w_1 = <int>w - 1
 *         int h_1 = <int>h - 1             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_h_1 = (((int)__pyx_v_h) - 1);

  /* "PygameShader/shader.pyx":3855
 *         int h_1 = <int>h - 1
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(0, h_1 - size, size, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3857
 *     with nogil:
 * 
 *         for y in prange(0, h_1 - size, size, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *             y_pos = y + size + <int>(<float>sin(rad + <float>y * c1) * <float>size)
 */
        __pyx_t_9 = (__pyx_v_h_1 - __pyx_v_size);
        __pyx_t_10 = __pyx_v_size;
        if ((__pyx_t_10 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
            if (__pyx_t_12 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x_pos) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y_pos) lastprivate(__pyx_v_yy) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                        {
                            __pyx_v_y = (int)(0 + __pyx_t_10 * __pyx_t_11);
                            /* Initialize private variables to invalid values */
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_j = ((int)0xbad0bad0);
                            __pyx_v_x = ((int)0xbad0bad0);
                            __pyx_v_x_pos = ((int)0xbad0bad0);
                            __pyx_v_xx = ((int)0xbad0bad0);
                            __pyx_v_y_pos = ((int)0xbad0bad0);
                            __pyx_v_yy = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":3859
 *         for y in prange(0, h_1 - size, size, schedule='static', num_threads=THREADS):
 * 
 *             y_pos = y + size + <int>(<float>sin(rad + <float>y * c1) * <float>size)             # <<<<<<<<<<<<<<
 * 
 *             for x in prange(0, w_1 - size, size, schedule='static', num_threads=THREADS):
 */
                            __pyx_v_y_pos = ((__pyx_v_y + __pyx_v_size) + ((int)(((float)sin((__pyx_v_rad + (((float)__pyx_v_y) * __pyx_v_c1)))) * ((float)__pyx_v_size))));

                            /* "PygameShader/shader.pyx":3861
 *             y_pos = y + size + <int>(<float>sin(rad + <float>y * c1) * <float>size)
 * 
 *             for x in prange(0, w_1 - size, size, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *                 x_pos = x + size + <int> (<float>sin(rad + <float> x * c1) * <float> size)
 */
                            __pyx_t_13 = (__pyx_v_w_1 - __pyx_v_size);
                            __pyx_t_14 = __pyx_v_size;
                            if ((__pyx_t_14 == 0)) abort();
                            {
                                __pyx_t_16 = (__pyx_t_13 - 0 + __pyx_t_14 - __pyx_t_14/abs(__pyx_t_14)) / __pyx_t_14;
                                if (__pyx_t_16 > 0)
                                {
                                    #if 0
                                    #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                                    #endif /* _OPENMP */
                                    {
                                        #if 0
                                        #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x_pos) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_yy) schedule(static)
                                        #endif /* _OPENMP */
                                        for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
                                            {
                                                __pyx_v_x = (int)(0 + __pyx_t_14 * __pyx_t_15);
                                                /* Initialize private variables to invalid values */
                                                __pyx_v_i = ((int)0xbad0bad0);
                                                __pyx_v_j = ((int)0xbad0bad0);
                                                __pyx_v_x_pos = ((int)0xbad0bad0);
                                                __pyx_v_xx = ((int)0xbad0bad0);
                                                __pyx_v_yy = ((int)0xbad0bad0);

                                                /* "PygameShader/shader.pyx":3863
 *             for x in prange(0, w_1 - size, size, schedule='static', num_threads=THREADS):
 * 
 *                 x_pos = x + size + <int> (<float>sin(rad + <float> x * c1) * <float> size)             # <<<<<<<<<<<<<<
 * 
 *                 for i in range(0, size + 1):
 */
                                                __pyx_v_x_pos = ((__pyx_v_x + __pyx_v_size) + ((int)(((float)sin((__pyx_v_rad + (((float)__pyx_v_x) * __pyx_v_c1)))) * ((float)__pyx_v_size))));

                                                /* "PygameShader/shader.pyx":3865
 *                 x_pos = x + size + <int> (<float>sin(rad + <float> x * c1) * <float> size)
 * 
 *                 for i in range(0, size + 1):             # <<<<<<<<<<<<<<
 * 
 *                     for j in range(0, size + 1):
 */
                                                __pyx_t_17 = (__pyx_v_size + 1);
                                                __pyx_t_18 = __pyx_t_17;
                                                for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
                                                  __pyx_v_i = __pyx_t_19;

                                                  /* "PygameShader/shader.pyx":3867
 *                 for i in range(0, size + 1):
 * 
 *                     for j in range(0, size + 1):             # <<<<<<<<<<<<<<
 * 
 *                         xx = x_pos + i
 */
                                                  __pyx_t_20 = (__pyx_v_size + 1);
                                                  __pyx_t_21 = __pyx_t_20;
                                                  for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
                                                    __pyx_v_j = __pyx_t_22;

                                                    /* "PygameShader/shader.pyx":3869
 *                     for j in range(0, size + 1):
 * 
 *                         xx = x_pos + i             # <<<<<<<<<<<<<<
 *                         yy = y_pos + j
 * 
 */
                                                    __pyx_v_xx = (__pyx_v_x_pos + __pyx_v_i);

                                                    /* "PygameShader/shader.pyx":3870
 * 
 *                         xx = x_pos + i
 *                         yy = y_pos + j             # <<<<<<<<<<<<<<
 * 
 *                         if xx > w_1:
 */
                                                    __pyx_v_yy = (__pyx_v_y_pos + __pyx_v_j);

                                                    /* "PygameShader/shader.pyx":3872
 *                         yy = y_pos + j
 * 
 *                         if xx > w_1:             # <<<<<<<<<<<<<<
 *                             xx = w_1
 *                         elif xx < 0:
 */
                                                    __pyx_t_23 = ((__pyx_v_xx > __pyx_v_w_1) != 0);
                                                    if (__pyx_t_23) {

                                                      /* "PygameShader/shader.pyx":3873
 * 
 *                         if xx > w_1:
 *                             xx = w_1             # <<<<<<<<<<<<<<
 *                         elif xx < 0:
 *                             xx = 0
 */
                                                      __pyx_v_xx = __pyx_v_w_1;

                                                      /* "PygameShader/shader.pyx":3872
 *                         yy = y_pos + j
 * 
 *                         if xx > w_1:             # <<<<<<<<<<<<<<
 *                             xx = w_1
 *                         elif xx < 0:
 */
                                                      goto __pyx_L18;
                                                    }

                                                    /* "PygameShader/shader.pyx":3874
 *                         if xx > w_1:
 *                             xx = w_1
 *                         elif xx < 0:             # <<<<<<<<<<<<<<
 *                             xx = 0
 *                         if yy > h_1:
 */
                                                    __pyx_t_23 = ((__pyx_v_xx < 0) != 0);
                                                    if (__pyx_t_23) {

                                                      /* "PygameShader/shader.pyx":3875
 *                             xx = w_1
 *                         elif xx < 0:
 *                             xx = 0             # <<<<<<<<<<<<<<
 *                         if yy > h_1:
 *                             yy = h_1
 */
                                                      __pyx_v_xx = 0;

                                                      /* "PygameShader/shader.pyx":3874
 *                         if xx > w_1:
 *                             xx = w_1
 *                         elif xx < 0:             # <<<<<<<<<<<<<<
 *                             xx = 0
 *                         if yy > h_1:
 */
                                                    }
                                                    __pyx_L18:;

                                                    /* "PygameShader/shader.pyx":3876
 *                         elif xx < 0:
 *                             xx = 0
 *                         if yy > h_1:             # <<<<<<<<<<<<<<
 *                             yy = h_1
 *                         elif yy < 0:
 */
                                                    __pyx_t_23 = ((__pyx_v_yy > __pyx_v_h_1) != 0);
                                                    if (__pyx_t_23) {

                                                      /* "PygameShader/shader.pyx":3877
 *                             xx = 0
 *                         if yy > h_1:
 *                             yy = h_1             # <<<<<<<<<<<<<<
 *                         elif yy < 0:
 *                             yy = 0
 */
                                                      __pyx_v_yy = __pyx_v_h_1;

                                                      /* "PygameShader/shader.pyx":3876
 *                         elif xx < 0:
 *                             xx = 0
 *                         if yy > h_1:             # <<<<<<<<<<<<<<
 *                             yy = h_1
 *                         elif yy < 0:
 */
                                                      goto __pyx_L19;
                                                    }

                                                    /* "PygameShader/shader.pyx":3878
 *                         if yy > h_1:
 *                             yy = h_1
 *                         elif yy < 0:             # <<<<<<<<<<<<<<
 *                             yy = 0
 *                         rgb_array_[xx, yy, 0] = rgb[x + i, y + j, 0]
 */
                                                    __pyx_t_23 = ((__pyx_v_yy < 0) != 0);
                                                    if (__pyx_t_23) {

                                                      /* "PygameShader/shader.pyx":3879
 *                             yy = h_1
 *                         elif yy < 0:
 *                             yy = 0             # <<<<<<<<<<<<<<
 *                         rgb_array_[xx, yy, 0] = rgb[x + i, y + j, 0]
 *                         rgb_array_[xx, yy, 1] = rgb[x + i, y + j, 1]
 */
                                                      __pyx_v_yy = 0;

                                                      /* "PygameShader/shader.pyx":3878
 *                         if yy > h_1:
 *                             yy = h_1
 *                         elif yy < 0:             # <<<<<<<<<<<<<<
 *                             yy = 0
 *                         rgb_array_[xx, yy, 0] = rgb[x + i, y + j, 0]
 */
                                                    }
                                                    __pyx_L19:;

                                                    /* "PygameShader/shader.pyx":3880
 *                         elif yy < 0:
 *                             yy = 0
 *                         rgb_array_[xx, yy, 0] = rgb[x + i, y + j, 0]             # <<<<<<<<<<<<<<
 *                         rgb_array_[xx, yy, 1] = rgb[x + i, y + j, 1]
 *                         rgb_array_[xx, yy, 2] = rgb[x + i, y + j, 2]
 */
                                                    __pyx_t_24 = (__pyx_v_x + __pyx_v_i);
                                                    __pyx_t_25 = (__pyx_v_y + __pyx_v_j);
                                                    __pyx_t_26 = 0;
                                                    __pyx_t_27 = __pyx_v_xx;
                                                    __pyx_t_28 = __pyx_v_yy;
                                                    __pyx_t_29 = 0;
                                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_27 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_28 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_29 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_24 * __pyx_v_rgb.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb.strides[1]) ) + __pyx_t_26 * __pyx_v_rgb.strides[2]) )));

                                                    /* "PygameShader/shader.pyx":3881
 *                             yy = 0
 *                         rgb_array_[xx, yy, 0] = rgb[x + i, y + j, 0]
 *                         rgb_array_[xx, yy, 1] = rgb[x + i, y + j, 1]             # <<<<<<<<<<<<<<
 *                         rgb_array_[xx, yy, 2] = rgb[x + i, y + j, 2]
 * 
 */
                                                    __pyx_t_26 = (__pyx_v_x + __pyx_v_i);
                                                    __pyx_t_25 = (__pyx_v_y + __pyx_v_j);
                                                    __pyx_t_24 = 1;
                                                    __pyx_t_29 = __pyx_v_xx;
                                                    __pyx_t_28 = __pyx_v_yy;
                                                    __pyx_t_27 = 1;
                                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_29 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_28 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_27 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_26 * __pyx_v_rgb.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb.strides[1]) ) + __pyx_t_24 * __pyx_v_rgb.strides[2]) )));

                                                    /* "PygameShader/shader.pyx":3882
 *                         rgb_array_[xx, yy, 0] = rgb[x + i, y + j, 0]
 *                         rgb_array_[xx, yy, 1] = rgb[x + i, y + j, 1]
 *                         rgb_array_[xx, yy, 2] = rgb[x + i, y + j, 2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                                                    __pyx_t_24 = (__pyx_v_x + __pyx_v_i);
                                                    __pyx_t_25 = (__pyx_v_y + __pyx_v_j);
                                                    __pyx_t_26 = 2;
                                                    __pyx_t_27 = __pyx_v_xx;
                                                    __pyx_t_28 = __pyx_v_yy;
                                                    __pyx_t_29 = 2;
                                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_27 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_28 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_29 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_24 * __pyx_v_rgb.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb.strides[1]) ) + __pyx_t_26 * __pyx_v_rgb.strides[2]) )));
                                                  }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3855
 *         int h_1 = <int>h - 1
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(0, h_1 - size, size, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":3822
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_wave24bit_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float rad,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_wave24bit_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3891
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef inline void shader_swirl24bit_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float degrees
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_swirl24bit_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_degrees) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_diffx;
  int __pyx_v_diffy;
  int __pyx_v_angle;
  float __pyx_v_columns;
  float __pyx_v_rows;
  float __pyx_v_r;
  float __pyx_v_di;
  float __pyx_v_dj;
  float __pyx_v_c1;
  float __pyx_v_c2;
  __Pyx_memviewslice __pyx_v_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
  float __pyx_v_r_max;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  float __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  unsigned char __pyx_t_19;
  unsigned char __pyx_t_20;
  unsigned char __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_swirl24bit_inplace_c", 0);

  /* "PygameShader/shader.pyx":3913
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":3918
 *         int i, j, diffx, diffy, angle
 *         float columns, rows, r, di, dj, c1, c2
 *         unsigned char [:, :, ::1] rgb = numpy.array(rgb_array_, copy=True, order='C')             # <<<<<<<<<<<<<<
 *         float r_max
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3918, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 3918, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3918, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_rgb = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":3922
 * 
 * 
 *     columns = <float>0.5 * (<float>w - <float>1.0)             # <<<<<<<<<<<<<<
 *     rows    = <float>0.5 * (<float>h - <float>1.0)
 * 
 */
  __pyx_v_columns = (((float)0.5) * (((float)__pyx_v_w) - ((float)1.0)));

  /* "PygameShader/shader.pyx":3923
 * 
 *     columns = <float>0.5 * (<float>w - <float>1.0)
 *     rows    = <float>0.5 * (<float>h - <float>1.0)             # <<<<<<<<<<<<<<
 * 
 *     r_max = <float>sqrt(columns * columns + rows * rows)
 */
  __pyx_v_rows = (((float)0.5) * (((float)__pyx_v_h) - ((float)1.0)));

  /* "PygameShader/shader.pyx":3925
 *     rows    = <float>0.5 * (<float>h - <float>1.0)
 * 
 *     r_max = <float>sqrt(columns * columns + rows * rows)             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_r_max = ((float)sqrt(((__pyx_v_columns * __pyx_v_columns) + (__pyx_v_rows * __pyx_v_rows))));

  /* "PygameShader/shader.pyx":3927
 *     r_max = <float>sqrt(columns * columns + rows * rows)
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3928
 * 
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(w):
 * 
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            int __pyx_parallel_temp0 = ((int)0xbad0bad0);
            float __pyx_parallel_temp1 = ((float)__PYX_NAN());
            float __pyx_parallel_temp2 = ((float)__PYX_NAN());
            float __pyx_parallel_temp3 = ((float)__PYX_NAN());
            int __pyx_parallel_temp4 = ((int)0xbad0bad0);
            int __pyx_parallel_temp5 = ((int)0xbad0bad0);
            float __pyx_parallel_temp6 = ((float)__PYX_NAN());
            int __pyx_parallel_temp7 = ((int)0xbad0bad0);
            int __pyx_parallel_temp8 = ((int)0xbad0bad0);
            float __pyx_parallel_temp9 = ((float)__PYX_NAN());
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_9 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_angle) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_di) lastprivate(__pyx_v_diffx) lastprivate(__pyx_v_diffy) lastprivate(__pyx_v_dj) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_angle = ((int)0xbad0bad0);
                            __pyx_v_c1 = ((float)__PYX_NAN());
                            __pyx_v_c2 = ((float)__PYX_NAN());
                            __pyx_v_di = ((float)__PYX_NAN());
                            __pyx_v_diffx = ((int)0xbad0bad0);
                            __pyx_v_diffy = ((int)0xbad0bad0);
                            __pyx_v_dj = ((float)__PYX_NAN());
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_r = ((float)__PYX_NAN());

                            /* "PygameShader/shader.pyx":3929
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):             # <<<<<<<<<<<<<<
 * 
 *                 di = <float>i - columns
 */
                            __pyx_t_10 = __pyx_v_w;
                            __pyx_t_11 = __pyx_t_10;
                            for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                              __pyx_v_i = __pyx_t_12;

                              /* "PygameShader/shader.pyx":3931
 *             for i in range(w):
 * 
 *                 di = <float>i - columns             # <<<<<<<<<<<<<<
 *                 dj = <float>j - rows
 * 
 */
                              __pyx_v_di = (((float)__pyx_v_i) - __pyx_v_columns);

                              /* "PygameShader/shader.pyx":3932
 * 
 *                 di = <float>i - columns
 *                 dj = <float>j - rows             # <<<<<<<<<<<<<<
 * 
 *                 r = <float>sqrt(di * di + dj * dj) / <float>r_max
 */
                              __pyx_v_dj = (((float)__pyx_v_j) - __pyx_v_rows);

                              /* "PygameShader/shader.pyx":3934
 *                 dj = <float>j - rows
 * 
 *                 r = <float>sqrt(di * di + dj * dj) / <float>r_max             # <<<<<<<<<<<<<<
 *                 angle = <int>(degrees * r % 360)
 * 
 */
                              __pyx_t_13 = ((float)sqrt(((__pyx_v_di * __pyx_v_di) + (__pyx_v_dj * __pyx_v_dj))));
                              if (unlikely(((float)__pyx_v_r_max) == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "float division");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 3934, __pyx_L8_error)
                              }
                              __pyx_v_r = (__pyx_t_13 / ((float)__pyx_v_r_max));

                              /* "PygameShader/shader.pyx":3935
 * 
 *                 r = <float>sqrt(di * di + dj * dj) / <float>r_max
 *                 angle = <int>(degrees * r % 360)             # <<<<<<<<<<<<<<
 * 
 *                 c1 = COS_TABLE[angle]
 */
                              __pyx_v_angle = ((int)__Pyx_mod_float((__pyx_v_degrees * __pyx_v_r), 360.0));

                              /* "PygameShader/shader.pyx":3937
 *                 angle = <int>(degrees * r % 360)
 * 
 *                 c1 = COS_TABLE[angle]             # <<<<<<<<<<<<<<
 *                 c2 = SIN_TABLE[angle]
 *                 diffx = <int>(di * c1 - dj * c2 + columns)
 */
                              __pyx_v_c1 = (__pyx_v_12PygameShader_6shader_COS_TABLE[__pyx_v_angle]);

                              /* "PygameShader/shader.pyx":3938
 * 
 *                 c1 = COS_TABLE[angle]
 *                 c2 = SIN_TABLE[angle]             # <<<<<<<<<<<<<<
 *                 diffx = <int>(di * c1 - dj * c2 + columns)
 *                 diffy = <int>(di * c2 + dj * c1 + rows)
 */
                              __pyx_v_c2 = (__pyx_v_12PygameShader_6shader_SIN_TABLE[__pyx_v_angle]);

                              /* "PygameShader/shader.pyx":3939
 *                 c1 = COS_TABLE[angle]
 *                 c2 = SIN_TABLE[angle]
 *                 diffx = <int>(di * c1 - dj * c2 + columns)             # <<<<<<<<<<<<<<
 *                 diffy = <int>(di * c2 + dj * c1 + rows)
 * 
 */
                              __pyx_v_diffx = ((int)(((__pyx_v_di * __pyx_v_c1) - (__pyx_v_dj * __pyx_v_c2)) + __pyx_v_columns));

                              /* "PygameShader/shader.pyx":3940
 *                 c2 = SIN_TABLE[angle]
 *                 diffx = <int>(di * c1 - dj * c2 + columns)
 *                 diffy = <int>(di * c2 + dj * c1 + rows)             # <<<<<<<<<<<<<<
 * 
 *                 if (diffx >-1) and (diffx < w) and \
 */
                              __pyx_v_diffy = ((int)(((__pyx_v_di * __pyx_v_c2) + (__pyx_v_dj * __pyx_v_c1)) + __pyx_v_rows));

                              /* "PygameShader/shader.pyx":3942
 *                 diffy = <int>(di * c2 + dj * c1 + rows)
 * 
 *                 if (diffx >-1) and (diffx < w) and \             # <<<<<<<<<<<<<<
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 */
                              __pyx_t_15 = ((__pyx_v_diffx > -1L) != 0);
                              if (__pyx_t_15) {
                              } else {
                                __pyx_t_14 = __pyx_t_15;
                                goto __pyx_L13_bool_binop_done;
                              }
                              __pyx_t_15 = ((__pyx_v_diffx < __pyx_v_w) != 0);
                              if (__pyx_t_15) {
                              } else {
                                __pyx_t_14 = __pyx_t_15;
                                goto __pyx_L13_bool_binop_done;
                              }

                              /* "PygameShader/shader.pyx":3943
 * 
 *                 if (diffx >-1) and (diffx < w) and \
 *                    (diffy >-1) and (diffy < h):             # <<<<<<<<<<<<<<
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 *                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \
 */
                              __pyx_t_15 = ((__pyx_v_diffy > -1L) != 0);
                              if (__pyx_t_15) {
                              } else {
                                __pyx_t_14 = __pyx_t_15;
                                goto __pyx_L13_bool_binop_done;
                              }
                              __pyx_t_15 = ((__pyx_v_diffy < __pyx_v_h) != 0);
                              __pyx_t_14 = __pyx_t_15;
                              __pyx_L13_bool_binop_done:;

                              /* "PygameShader/shader.pyx":3942
 *                 diffy = <int>(di * c2 + dj * c1 + rows)
 * 
 *                 if (diffx >-1) and (diffx < w) and \             # <<<<<<<<<<<<<<
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 */
                              if (__pyx_t_14) {

                                /* "PygameShader/shader.pyx":3945
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 *                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \             # <<<<<<<<<<<<<<
 *                                               rgb[diffx, diffy, 1], rgb[diffx, diffy, 2]
 * 
 */
                                __pyx_t_16 = __pyx_v_diffx;
                                __pyx_t_17 = __pyx_v_diffy;
                                __pyx_t_18 = 0;
                                __pyx_t_19 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_16 * __pyx_v_rgb.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb.strides[1]) )) + __pyx_t_18)) )));

                                /* "PygameShader/shader.pyx":3946
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 *                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \
 *                                               rgb[diffx, diffy, 1], rgb[diffx, diffy, 2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                                __pyx_t_18 = __pyx_v_diffx;
                                __pyx_t_17 = __pyx_v_diffy;
                                __pyx_t_16 = 1;
                                __pyx_t_20 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_18 * __pyx_v_rgb.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb.strides[1]) )) + __pyx_t_16)) )));
                                __pyx_t_16 = __pyx_v_diffx;
                                __pyx_t_17 = __pyx_v_diffy;
                                __pyx_t_18 = 2;
                                __pyx_t_21 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_16 * __pyx_v_rgb.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb.strides[1]) )) + __pyx_t_18)) )));

                                /* "PygameShader/shader.pyx":3944
 *                 if (diffx >-1) and (diffx < w) and \
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\             # <<<<<<<<<<<<<<
 *                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \
 *                                               rgb[diffx, diffy, 1], rgb[diffx, diffy, 2]
 */
                                __pyx_t_18 = __pyx_v_i;
                                __pyx_t_17 = __pyx_v_j;
                                __pyx_t_16 = 0;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_18 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_19;
                                __pyx_t_16 = __pyx_v_i;
                                __pyx_t_17 = __pyx_v_j;
                                __pyx_t_18 = 1;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_20;

                                /* "PygameShader/shader.pyx":3945
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 *                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \             # <<<<<<<<<<<<<<
 *                                               rgb[diffx, diffy, 1], rgb[diffx, diffy, 2]
 * 
 */
                                __pyx_t_18 = __pyx_v_i;
                                __pyx_t_17 = __pyx_v_j;
                                __pyx_t_16 = 2;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_18 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_21;

                                /* "PygameShader/shader.pyx":3942
 *                 diffy = <int>(di * c2 + dj * c1 + rows)
 * 
 *                 if (diffx >-1) and (diffx < w) and \             # <<<<<<<<<<<<<<
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 */
                              }
                            }
                            goto __pyx_L18;
                            __pyx_L8_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L17;
                            __pyx_L17:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates2)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_angle;
                                __pyx_parallel_temp1 = __pyx_v_c1;
                                __pyx_parallel_temp2 = __pyx_v_c2;
                                __pyx_parallel_temp3 = __pyx_v_di;
                                __pyx_parallel_temp4 = __pyx_v_diffx;
                                __pyx_parallel_temp5 = __pyx_v_diffy;
                                __pyx_parallel_temp6 = __pyx_v_dj;
                                __pyx_parallel_temp7 = __pyx_v_i;
                                __pyx_parallel_temp8 = __pyx_v_j;
                                __pyx_parallel_temp9 = __pyx_v_r;
                            }
                            __pyx_L18:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_angle = __pyx_parallel_temp0;
              __pyx_v_c1 = __pyx_parallel_temp1;
              __pyx_v_c2 = __pyx_parallel_temp2;
              __pyx_v_di = __pyx_parallel_temp3;
              __pyx_v_diffx = __pyx_parallel_temp4;
              __pyx_v_diffy = __pyx_parallel_temp5;
              __pyx_v_dj = __pyx_parallel_temp6;
              __pyx_v_i = __pyx_parallel_temp7;
              __pyx_v_j = __pyx_parallel_temp8;
              __pyx_v_r = __pyx_parallel_temp9;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L4_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3927
 *     r_max = <float>sqrt(columns * columns + rows * rows)
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":3891
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef inline void shader_swirl24bit_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float degrees
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_swirl24bit_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":3953
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_swirl24bit_inplace_c1(unsigned char [:, :, :] rgb_array_, float degrees):             # <<<<<<<<<<<<<<
 *     """
 *     SWIRL AN IMAGE WITHOUT ANGLE APPROXIMATION
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_swirl24bit_inplace_c1(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_degrees) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_diffx;
  int __pyx_v_diffy;
  float __pyx_v_columns;
  float __pyx_v_rows;
  float __pyx_v_r;
  float __pyx_v_di;
  float __pyx_v_dj;
  float __pyx_v_c1;
  float __pyx_v_c2;
  float __pyx_v_angle;
  __Pyx_memviewslice __pyx_v_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
  float __pyx_v_rad;
  float __pyx_v_r_max;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  unsigned char __pyx_t_18;
  unsigned char __pyx_t_19;
  unsigned char __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_swirl24bit_inplace_c1", 0);

  /* "PygameShader/shader.pyx":3970
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":3975
 *         int i, j, diffx, diffy
 *         float columns, rows, r, di, dj, c1, c2, angle
 *         unsigned char [:, :, :] rgb = numpy.array(rgb_array_, copy=True)             # <<<<<<<<<<<<<<
 *         float rad = degrees * DEG_TO_RAD
 *         float r_max
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3975, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3975, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_rgb = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":3976
 *         float columns, rows, r, di, dj, c1, c2, angle
 *         unsigned char [:, :, :] rgb = numpy.array(rgb_array_, copy=True)
 *         float rad = degrees * DEG_TO_RAD             # <<<<<<<<<<<<<<
 *         float r_max
 * 
 */
  __pyx_v_rad = (__pyx_v_degrees * __pyx_v_12PygameShader_6shader_DEG_TO_RAD);

  /* "PygameShader/shader.pyx":3980
 * 
 * 
 *     columns = <float>0.5 * (w - <float>1.0)             # <<<<<<<<<<<<<<
 *     rows    = <float>0.5 * (h - <float>1.0)
 *     r_max   = <float>sqrt(columns * columns + rows * rows)
 */
  __pyx_v_columns = (((float)0.5) * (__pyx_v_w - ((float)1.0)));

  /* "PygameShader/shader.pyx":3981
 * 
 *     columns = <float>0.5 * (w - <float>1.0)
 *     rows    = <float>0.5 * (h - <float>1.0)             # <<<<<<<<<<<<<<
 *     r_max   = <float>sqrt(columns * columns + rows * rows)
 *     with nogil:
 */
  __pyx_v_rows = (((float)0.5) * (__pyx_v_h - ((float)1.0)));

  /* "PygameShader/shader.pyx":3982
 *     columns = <float>0.5 * (w - <float>1.0)
 *     rows    = <float>0.5 * (h - <float>1.0)
 *     r_max   = <float>sqrt(columns * columns + rows * rows)             # <<<<<<<<<<<<<<
 *     with nogil:
 *         for i in prange(w, schedule='static', num_threads=THREADS):
 */
  __pyx_v_r_max = ((float)sqrt(((__pyx_v_columns * __pyx_v_columns) + (__pyx_v_rows * __pyx_v_rows))));

  /* "PygameShader/shader.pyx":3983
 *     rows    = <float>0.5 * (h - <float>1.0)
 *     r_max   = <float>sqrt(columns * columns + rows * rows)
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w, schedule='static', num_threads=THREADS):
 *             for j in range(h):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":3984
 *     r_max   = <float>sqrt(columns * columns + rows * rows)
 *     with nogil:
 *         for i in prange(w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for j in range(h):
 * 
 */
        __pyx_t_3 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_9 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_angle) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_di) lastprivate(__pyx_v_diffx) lastprivate(__pyx_v_diffy) lastprivate(__pyx_v_dj) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_angle = ((float)__PYX_NAN());
                            __pyx_v_c1 = ((float)__PYX_NAN());
                            __pyx_v_c2 = ((float)__PYX_NAN());
                            __pyx_v_di = ((float)__PYX_NAN());
                            __pyx_v_diffx = ((int)0xbad0bad0);
                            __pyx_v_diffy = ((int)0xbad0bad0);
                            __pyx_v_dj = ((float)__PYX_NAN());
                            __pyx_v_j = ((int)0xbad0bad0);
                            __pyx_v_r = ((float)__PYX_NAN());

                            /* "PygameShader/shader.pyx":3985
 *     with nogil:
 *         for i in prange(w, schedule='static', num_threads=THREADS):
 *             for j in range(h):             # <<<<<<<<<<<<<<
 * 
 *                 di = <float>i - columns
 */
                            __pyx_t_10 = __pyx_v_h;
                            __pyx_t_11 = __pyx_t_10;
                            for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                              __pyx_v_j = __pyx_t_12;

                              /* "PygameShader/shader.pyx":3987
 *             for j in range(h):
 * 
 *                 di = <float>i - columns             # <<<<<<<<<<<<<<
 *                 dj = <float>j - rows
 * 
 */
                              __pyx_v_di = (((float)__pyx_v_i) - __pyx_v_columns);

                              /* "PygameShader/shader.pyx":3988
 * 
 *                 di = <float>i - columns
 *                 dj = <float>j - rows             # <<<<<<<<<<<<<<
 * 
 *                 r = <float>sqrt(di * di + dj * dj)
 */
                              __pyx_v_dj = (((float)__pyx_v_j) - __pyx_v_rows);

                              /* "PygameShader/shader.pyx":3990
 *                 dj = <float>j - rows
 * 
 *                 r = <float>sqrt(di * di + dj * dj)             # <<<<<<<<<<<<<<
 *                 angle = <float>(rad * r/r_max)
 * 
 */
                              __pyx_v_r = ((float)sqrt(((__pyx_v_di * __pyx_v_di) + (__pyx_v_dj * __pyx_v_dj))));

                              /* "PygameShader/shader.pyx":3991
 * 
 *                 r = <float>sqrt(di * di + dj * dj)
 *                 angle = <float>(rad * r/r_max)             # <<<<<<<<<<<<<<
 * 
 *                 c1 = <float>cos(angle)
 */
                              __pyx_v_angle = ((float)((__pyx_v_rad * __pyx_v_r) / __pyx_v_r_max));

                              /* "PygameShader/shader.pyx":3993
 *                 angle = <float>(rad * r/r_max)
 * 
 *                 c1 = <float>cos(angle)             # <<<<<<<<<<<<<<
 *                 c2 = <float>sin(angle)
 *                 diffx = <int>(di * c1 - dj * c2 + columns)
 */
                              __pyx_v_c1 = ((float)cos(__pyx_v_angle));

                              /* "PygameShader/shader.pyx":3994
 * 
 *                 c1 = <float>cos(angle)
 *                 c2 = <float>sin(angle)             # <<<<<<<<<<<<<<
 *                 diffx = <int>(di * c1 - dj * c2 + columns)
 *                 diffy = <int>(di * c2 + dj * c1 + rows)
 */
                              __pyx_v_c2 = ((float)sin(__pyx_v_angle));

                              /* "PygameShader/shader.pyx":3995
 *                 c1 = <float>cos(angle)
 *                 c2 = <float>sin(angle)
 *                 diffx = <int>(di * c1 - dj * c2 + columns)             # <<<<<<<<<<<<<<
 *                 diffy = <int>(di * c2 + dj * c1 + rows)
 * 
 */
                              __pyx_v_diffx = ((int)(((__pyx_v_di * __pyx_v_c1) - (__pyx_v_dj * __pyx_v_c2)) + __pyx_v_columns));

                              /* "PygameShader/shader.pyx":3996
 *                 c2 = <float>sin(angle)
 *                 diffx = <int>(di * c1 - dj * c2 + columns)
 *                 diffy = <int>(di * c2 + dj * c1 + rows)             # <<<<<<<<<<<<<<
 * 
 *                 if (diffx >-1) and (diffx < w) and \
 */
                              __pyx_v_diffy = ((int)(((__pyx_v_di * __pyx_v_c2) + (__pyx_v_dj * __pyx_v_c1)) + __pyx_v_rows));

                              /* "PygameShader/shader.pyx":3998
 *                 diffy = <int>(di * c2 + dj * c1 + rows)
 * 
 *                 if (diffx >-1) and (diffx < w) and \             # <<<<<<<<<<<<<<
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 */
                              __pyx_t_14 = ((__pyx_v_diffx > -1L) != 0);
                              if (__pyx_t_14) {
                              } else {
                                __pyx_t_13 = __pyx_t_14;
                                goto __pyx_L13_bool_binop_done;
                              }
                              __pyx_t_14 = ((__pyx_v_diffx < __pyx_v_w) != 0);
                              if (__pyx_t_14) {
                              } else {
                                __pyx_t_13 = __pyx_t_14;
                                goto __pyx_L13_bool_binop_done;
                              }

                              /* "PygameShader/shader.pyx":3999
 * 
 *                 if (diffx >-1) and (diffx < w) and \
 *                    (diffy >-1) and (diffy < h):             # <<<<<<<<<<<<<<
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 *                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \
 */
                              __pyx_t_14 = ((__pyx_v_diffy > -1L) != 0);
                              if (__pyx_t_14) {
                              } else {
                                __pyx_t_13 = __pyx_t_14;
                                goto __pyx_L13_bool_binop_done;
                              }
                              __pyx_t_14 = ((__pyx_v_diffy < __pyx_v_h) != 0);
                              __pyx_t_13 = __pyx_t_14;
                              __pyx_L13_bool_binop_done:;

                              /* "PygameShader/shader.pyx":3998
 *                 diffy = <int>(di * c2 + dj * c1 + rows)
 * 
 *                 if (diffx >-1) and (diffx < w) and \             # <<<<<<<<<<<<<<
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 */
                              if (__pyx_t_13) {

                                /* "PygameShader/shader.pyx":4001
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 *                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \             # <<<<<<<<<<<<<<
 *                                               rgb[diffx, diffy, 1], rgb[diffx, diffy, 2]
 * 
 */
                                __pyx_t_15 = __pyx_v_diffx;
                                __pyx_t_16 = __pyx_v_diffy;
                                __pyx_t_17 = 0;
                                __pyx_t_18 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_15 * __pyx_v_rgb.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb.strides[2]) )));

                                /* "PygameShader/shader.pyx":4002
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 *                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \
 *                                               rgb[diffx, diffy, 1], rgb[diffx, diffy, 2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                                __pyx_t_17 = __pyx_v_diffx;
                                __pyx_t_16 = __pyx_v_diffy;
                                __pyx_t_15 = 1;
                                __pyx_t_19 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_17 * __pyx_v_rgb.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb.strides[2]) )));
                                __pyx_t_15 = __pyx_v_diffx;
                                __pyx_t_16 = __pyx_v_diffy;
                                __pyx_t_17 = 2;
                                __pyx_t_20 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_15 * __pyx_v_rgb.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb.strides[2]) )));

                                /* "PygameShader/shader.pyx":4000
 *                 if (diffx >-1) and (diffx < w) and \
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\             # <<<<<<<<<<<<<<
 *                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \
 *                                               rgb[diffx, diffy, 1], rgb[diffx, diffy, 2]
 */
                                __pyx_t_17 = __pyx_v_i;
                                __pyx_t_16 = __pyx_v_j;
                                __pyx_t_15 = 0;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_17 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_18;
                                __pyx_t_15 = __pyx_v_i;
                                __pyx_t_16 = __pyx_v_j;
                                __pyx_t_17 = 1;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_19;

                                /* "PygameShader/shader.pyx":4001
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 *                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \             # <<<<<<<<<<<<<<
 *                                               rgb[diffx, diffy, 1], rgb[diffx, diffy, 2]
 * 
 */
                                __pyx_t_17 = __pyx_v_i;
                                __pyx_t_16 = __pyx_v_j;
                                __pyx_t_15 = 2;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_17 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_20;

                                /* "PygameShader/shader.pyx":3998
 *                 diffy = <int>(di * c2 + dj * c1 + rows)
 * 
 *                 if (diffx >-1) and (diffx < w) and \             # <<<<<<<<<<<<<<
 *                    (diffy >-1) and (diffy < h):
 *                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\
 */
                              }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":3983
 *     rows    = <float>0.5 * (h - <float>1.0)
 *     r_max   = <float>sqrt(columns * columns + rows * rows)
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w, schedule='static', num_threads=THREADS):
 *             for j in range(h):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":3953
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_swirl24bit_inplace_c1(unsigned char [:, :, :] rgb_array_, float degrees):             # <<<<<<<<<<<<<<
 *     """
 *     SWIRL AN IMAGE WITHOUT ANGLE APPROXIMATION
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_swirl24bit_inplace_c1", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4011
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef inline void shader_plasma24bit_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         int frame,
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_plasma24bit_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, int __pyx_v_frame, struct __pyx_opt_args_12PygameShader_6shader_shader_plasma24bit_inplace_c *__pyx_optional_args) {
  float __pyx_v_hue_ = __pyx_k__19;
  float __pyx_v_sat_ = __pyx_k__20;
  float __pyx_v_value_ = __pyx_k__21;
  float __pyx_v_a_ = ((float)0.00392156862745098);
  float __pyx_v_b_ = ((float)0.08333333333333333);
  float __pyx_v_c_ = ((float)0.08333333333333333);
  CYTHON_UNUSED Py_ssize_t __pyx_v_width;
  Py_ssize_t __pyx_v_height;
  float __pyx_v_xx;
  float __pyx_v_yy;
  float __pyx_v_t;
  float __pyx_v_h;
  float __pyx_v_s;
  float __pyx_v_v;
  int __pyx_v_i;
  int __pyx_v_x;
  int __pyx_v_y;
  float __pyx_v_f;
  float __pyx_v_p;
  float __pyx_v_q;
  float __pyx_v_t_;
  float __pyx_v_hue;
  float __pyx_v_r;
  float __pyx_v_g;
  float __pyx_v_b;
  unsigned char *__pyx_v_rr;
  unsigned char *__pyx_v_gg;
  unsigned char *__pyx_v_bb;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  float __pyx_t_8;
  float __pyx_t_9;
  float __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  __Pyx_RefNannySetupContext("shader_plasma24bit_inplace_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_hue_ = __pyx_optional_args->hue_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_sat_ = __pyx_optional_args->sat_;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_value_ = __pyx_optional_args->value_;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_a_ = __pyx_optional_args->a_;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_b_ = __pyx_optional_args->b_;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_c_ = __pyx_optional_args->c_;
              }
            }
          }
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":4042
 * 
 *     cdef Py_ssize_t width, height
 *     width, height = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_width = __pyx_t_2;
  __pyx_v_height = __pyx_t_3;

  /* "PygameShader/shader.pyx":4047
 *         float xx, yy, t
 *         float h, s, v
 *         int i = 0, x, y             # <<<<<<<<<<<<<<
 *         float f, p, q, t_
 *         float hue, r, g, b
 */
  __pyx_v_i = 0;

  /* "PygameShader/shader.pyx":4054
 *         unsigned char *bb
 * 
 *     t = <float>frame             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_t = ((float)__pyx_v_frame);

  /* "PygameShader/shader.pyx":4056
 *     t = <float>frame
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(width, schedule='static', num_threads=THREADS):
 *             for y in range(height):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4057
 * 
 *     with nogil:
 *         for x in prange(width, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for y in range(height):
 * 
 */
        __pyx_t_3 = __pyx_v_width;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_f) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_h) lastprivate(__pyx_v_hue) lastprivate(__pyx_v_i) lastprivate(__pyx_v_p) lastprivate(__pyx_v_q) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_s) lastprivate(__pyx_v_t_) lastprivate(__pyx_v_v) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((float)__PYX_NAN());
                            __pyx_v_bb = ((unsigned char *)1);
                            __pyx_v_f = ((float)__PYX_NAN());
                            __pyx_v_g = ((float)__PYX_NAN());
                            __pyx_v_gg = ((unsigned char *)1);
                            __pyx_v_h = ((float)__PYX_NAN());
                            __pyx_v_hue = ((float)__PYX_NAN());
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_p = ((float)__PYX_NAN());
                            __pyx_v_q = ((float)__PYX_NAN());
                            __pyx_v_r = ((float)__PYX_NAN());
                            __pyx_v_rr = ((unsigned char *)1);
                            __pyx_v_s = ((float)__PYX_NAN());
                            __pyx_v_t_ = ((float)__PYX_NAN());
                            __pyx_v_v = ((float)__PYX_NAN());
                            __pyx_v_xx = ((float)__PYX_NAN());
                            __pyx_v_y = ((int)0xbad0bad0);
                            __pyx_v_yy = ((float)__PYX_NAN());

                            /* "PygameShader/shader.pyx":4058
 *     with nogil:
 *         for x in prange(width, schedule='static', num_threads=THREADS):
 *             for y in range(height):             # <<<<<<<<<<<<<<
 * 
 *                 xx = <float>x * <float>0.5
 */
                            __pyx_t_5 = __pyx_v_height;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_y = __pyx_t_7;

                              /* "PygameShader/shader.pyx":4060
 *             for y in range(height):
 * 
 *                 xx = <float>x * <float>0.5             # <<<<<<<<<<<<<<
 *                 yy = <float>y * <float>0.5
 * 
 */
                              __pyx_v_xx = (((float)__pyx_v_x) * ((float)0.5));

                              /* "PygameShader/shader.pyx":4061
 * 
 *                 xx = <float>x * <float>0.5
 *                 yy = <float>y * <float>0.5             # <<<<<<<<<<<<<<
 * 
 *                 hue = <float>4.0 + <float>sin((xx * <float>0.5 + yy * <float>0.5) * a_) \
 */
                              __pyx_v_yy = (((float)__pyx_v_y) * ((float)0.5));

                              /* "PygameShader/shader.pyx":4064
 * 
 *                 hue = <float>4.0 + <float>sin((xx * <float>0.5 + yy * <float>0.5) * a_) \
 *                       + <float>sin((xx * b_ + t) * c_)             # <<<<<<<<<<<<<<
 * 
 *                 h, s, v = hue * hue_, hue * sat_, hue * value_
 */
                              __pyx_v_hue = ((((float)4.0) + ((float)sin((((__pyx_v_xx * ((float)0.5)) + (__pyx_v_yy * ((float)0.5))) * __pyx_v_a_)))) + ((float)sin((((__pyx_v_xx * __pyx_v_b_) + __pyx_v_t) * __pyx_v_c_))));

                              /* "PygameShader/shader.pyx":4066
 *                       + <float>sin((xx * b_ + t) * c_)
 * 
 *                 h, s, v = hue * hue_, hue * sat_, hue * value_             # <<<<<<<<<<<<<<
 * 
 *                 i = <int>(h * <float>6.0)
 */
                              __pyx_t_8 = (__pyx_v_hue * __pyx_v_hue_);
                              __pyx_t_9 = (__pyx_v_hue * __pyx_v_sat_);
                              __pyx_t_10 = (__pyx_v_hue * __pyx_v_value_);
                              __pyx_v_h = __pyx_t_8;
                              __pyx_v_s = __pyx_t_9;
                              __pyx_v_v = __pyx_t_10;

                              /* "PygameShader/shader.pyx":4068
 *                 h, s, v = hue * hue_, hue * sat_, hue * value_
 * 
 *                 i = <int>(h * <float>6.0)             # <<<<<<<<<<<<<<
 *                 f = (h * <float>6.0) - i
 *                 p = v*(<float>1.0 - s)
 */
                              __pyx_v_i = ((int)(__pyx_v_h * ((float)6.0)));

                              /* "PygameShader/shader.pyx":4069
 * 
 *                 i = <int>(h * <float>6.0)
 *                 f = (h * <float>6.0) - i             # <<<<<<<<<<<<<<
 *                 p = v*(<float>1.0 - s)
 *                 q = v*(<float>1.0 - s * f)
 */
                              __pyx_v_f = ((__pyx_v_h * ((float)6.0)) - __pyx_v_i);

                              /* "PygameShader/shader.pyx":4070
 *                 i = <int>(h * <float>6.0)
 *                 f = (h * <float>6.0) - i
 *                 p = v*(<float>1.0 - s)             # <<<<<<<<<<<<<<
 *                 q = v*(<float>1.0 - s * f)
 *                 t_ = v*(<float>1.0 - s * (<float>1.0 - f))
 */
                              __pyx_v_p = (__pyx_v_v * (((float)1.0) - __pyx_v_s));

                              /* "PygameShader/shader.pyx":4071
 *                 f = (h * <float>6.0) - i
 *                 p = v*(<float>1.0 - s)
 *                 q = v*(<float>1.0 - s * f)             # <<<<<<<<<<<<<<
 *                 t_ = v*(<float>1.0 - s * (<float>1.0 - f))
 *                 i = i % 6
 */
                              __pyx_v_q = (__pyx_v_v * (((float)1.0) - (__pyx_v_s * __pyx_v_f)));

                              /* "PygameShader/shader.pyx":4072
 *                 p = v*(<float>1.0 - s)
 *                 q = v*(<float>1.0 - s * f)
 *                 t_ = v*(<float>1.0 - s * (<float>1.0 - f))             # <<<<<<<<<<<<<<
 *                 i = i % 6
 * 
 */
                              __pyx_v_t_ = (__pyx_v_v * (((float)1.0) - (__pyx_v_s * (((float)1.0) - __pyx_v_f))));

                              /* "PygameShader/shader.pyx":4073
 *                 q = v*(<float>1.0 - s * f)
 *                 t_ = v*(<float>1.0 - s * (<float>1.0 - f))
 *                 i = i % 6             # <<<<<<<<<<<<<<
 * 
 *                 if i == 0:
 */
                              __pyx_v_i = __Pyx_mod_long(__pyx_v_i, 6);

                              /* "PygameShader/shader.pyx":4075
 *                 i = i % 6
 * 
 *                 if i == 0:             # <<<<<<<<<<<<<<
 *                     r, g, b =  v, t, p
 *                 if i == 1:
 */
                              __pyx_t_11 = ((__pyx_v_i == 0) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":4076
 * 
 *                 if i == 0:
 *                     r, g, b =  v, t, p             # <<<<<<<<<<<<<<
 *                 if i == 1:
 *                      r, g, b = q, v, p
 */
                                __pyx_t_10 = __pyx_v_v;
                                __pyx_t_9 = __pyx_v_t;
                                __pyx_t_8 = __pyx_v_p;
                                __pyx_v_r = __pyx_t_10;
                                __pyx_v_g = __pyx_t_9;
                                __pyx_v_b = __pyx_t_8;

                                /* "PygameShader/shader.pyx":4075
 *                 i = i % 6
 * 
 *                 if i == 0:             # <<<<<<<<<<<<<<
 *                     r, g, b =  v, t, p
 *                 if i == 1:
 */
                              }

                              /* "PygameShader/shader.pyx":4077
 *                 if i == 0:
 *                     r, g, b =  v, t, p
 *                 if i == 1:             # <<<<<<<<<<<<<<
 *                      r, g, b = q, v, p
 *                 if i == 2:
 */
                              __pyx_t_11 = ((__pyx_v_i == 1) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":4078
 *                     r, g, b =  v, t, p
 *                 if i == 1:
 *                      r, g, b = q, v, p             # <<<<<<<<<<<<<<
 *                 if i == 2:
 *                      r, g, b = p, v, t
 */
                                __pyx_t_8 = __pyx_v_q;
                                __pyx_t_9 = __pyx_v_v;
                                __pyx_t_10 = __pyx_v_p;
                                __pyx_v_r = __pyx_t_8;
                                __pyx_v_g = __pyx_t_9;
                                __pyx_v_b = __pyx_t_10;

                                /* "PygameShader/shader.pyx":4077
 *                 if i == 0:
 *                     r, g, b =  v, t, p
 *                 if i == 1:             # <<<<<<<<<<<<<<
 *                      r, g, b = q, v, p
 *                 if i == 2:
 */
                              }

                              /* "PygameShader/shader.pyx":4079
 *                 if i == 1:
 *                      r, g, b = q, v, p
 *                 if i == 2:             # <<<<<<<<<<<<<<
 *                      r, g, b = p, v, t
 *                 if i == 3:
 */
                              __pyx_t_11 = ((__pyx_v_i == 2) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":4080
 *                      r, g, b = q, v, p
 *                 if i == 2:
 *                      r, g, b = p, v, t             # <<<<<<<<<<<<<<
 *                 if i == 3:
 *                      r, g, b = p, q, v
 */
                                __pyx_t_10 = __pyx_v_p;
                                __pyx_t_9 = __pyx_v_v;
                                __pyx_t_8 = __pyx_v_t;
                                __pyx_v_r = __pyx_t_10;
                                __pyx_v_g = __pyx_t_9;
                                __pyx_v_b = __pyx_t_8;

                                /* "PygameShader/shader.pyx":4079
 *                 if i == 1:
 *                      r, g, b = q, v, p
 *                 if i == 2:             # <<<<<<<<<<<<<<
 *                      r, g, b = p, v, t
 *                 if i == 3:
 */
                              }

                              /* "PygameShader/shader.pyx":4081
 *                 if i == 2:
 *                      r, g, b = p, v, t
 *                 if i == 3:             # <<<<<<<<<<<<<<
 *                      r, g, b = p, q, v
 *                 if i == 4:
 */
                              __pyx_t_11 = ((__pyx_v_i == 3) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":4082
 *                      r, g, b = p, v, t
 *                 if i == 3:
 *                      r, g, b = p, q, v             # <<<<<<<<<<<<<<
 *                 if i == 4:
 *                      r, g, b = t_, p, v
 */
                                __pyx_t_8 = __pyx_v_p;
                                __pyx_t_9 = __pyx_v_q;
                                __pyx_t_10 = __pyx_v_v;
                                __pyx_v_r = __pyx_t_8;
                                __pyx_v_g = __pyx_t_9;
                                __pyx_v_b = __pyx_t_10;

                                /* "PygameShader/shader.pyx":4081
 *                 if i == 2:
 *                      r, g, b = p, v, t
 *                 if i == 3:             # <<<<<<<<<<<<<<
 *                      r, g, b = p, q, v
 *                 if i == 4:
 */
                              }

                              /* "PygameShader/shader.pyx":4083
 *                 if i == 3:
 *                      r, g, b = p, q, v
 *                 if i == 4:             # <<<<<<<<<<<<<<
 *                      r, g, b = t_, p, v
 *                 if i == 5:
 */
                              __pyx_t_11 = ((__pyx_v_i == 4) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":4084
 *                      r, g, b = p, q, v
 *                 if i == 4:
 *                      r, g, b = t_, p, v             # <<<<<<<<<<<<<<
 *                 if i == 5:
 *                      r, g, b = v, p, q
 */
                                __pyx_t_10 = __pyx_v_t_;
                                __pyx_t_9 = __pyx_v_p;
                                __pyx_t_8 = __pyx_v_v;
                                __pyx_v_r = __pyx_t_10;
                                __pyx_v_g = __pyx_t_9;
                                __pyx_v_b = __pyx_t_8;

                                /* "PygameShader/shader.pyx":4083
 *                 if i == 3:
 *                      r, g, b = p, q, v
 *                 if i == 4:             # <<<<<<<<<<<<<<
 *                      r, g, b = t_, p, v
 *                 if i == 5:
 */
                              }

                              /* "PygameShader/shader.pyx":4085
 *                 if i == 4:
 *                      r, g, b = t_, p, v
 *                 if i == 5:             # <<<<<<<<<<<<<<
 *                      r, g, b = v, p, q
 * 
 */
                              __pyx_t_11 = ((__pyx_v_i == 5) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":4086
 *                      r, g, b = t_, p, v
 *                 if i == 5:
 *                      r, g, b = v, p, q             # <<<<<<<<<<<<<<
 * 
 *                 if s == 0.0:
 */
                                __pyx_t_8 = __pyx_v_v;
                                __pyx_t_9 = __pyx_v_p;
                                __pyx_t_10 = __pyx_v_q;
                                __pyx_v_r = __pyx_t_8;
                                __pyx_v_g = __pyx_t_9;
                                __pyx_v_b = __pyx_t_10;

                                /* "PygameShader/shader.pyx":4085
 *                 if i == 4:
 *                      r, g, b = t_, p, v
 *                 if i == 5:             # <<<<<<<<<<<<<<
 *                      r, g, b = v, p, q
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":4088
 *                      r, g, b = v, p, q
 * 
 *                 if s == 0.0:             # <<<<<<<<<<<<<<
 *                      r, g, b = v, v, v
 * 
 */
                              __pyx_t_11 = ((__pyx_v_s == 0.0) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":4089
 * 
 *                 if s == 0.0:
 *                      r, g, b = v, v, v             # <<<<<<<<<<<<<<
 * 
 *                 rr = &rgb_array_[x, y, 0]
 */
                                __pyx_t_10 = __pyx_v_v;
                                __pyx_t_9 = __pyx_v_v;
                                __pyx_t_8 = __pyx_v_v;
                                __pyx_v_r = __pyx_t_10;
                                __pyx_v_g = __pyx_t_9;
                                __pyx_v_b = __pyx_t_8;

                                /* "PygameShader/shader.pyx":4088
 *                      r, g, b = v, p, q
 * 
 *                 if s == 0.0:             # <<<<<<<<<<<<<<
 *                      r, g, b = v, v, v
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":4091
 *                      r, g, b = v, v, v
 * 
 *                 rr = &rgb_array_[x, y, 0]             # <<<<<<<<<<<<<<
 *                 gg = &rgb_array_[x, y, 1]
 *                 bb = &rgb_array_[x, y, 2]
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_13 = __pyx_v_y;
                              __pyx_t_14 = 0;
                              __pyx_v_rr = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4092
 * 
 *                 rr = &rgb_array_[x, y, 0]
 *                 gg = &rgb_array_[x, y, 1]             # <<<<<<<<<<<<<<
 *                 bb = &rgb_array_[x, y, 2]
 * 
 */
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_13 = __pyx_v_y;
                              __pyx_t_12 = 1;
                              __pyx_v_gg = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4093
 *                 rr = &rgb_array_[x, y, 0]
 *                 gg = &rgb_array_[x, y, 1]
 *                 bb = &rgb_array_[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 *                 if rr[0] < 256:
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_13 = __pyx_v_y;
                              __pyx_t_14 = 2;
                              __pyx_v_bb = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4095
 *                 bb = &rgb_array_[x, y, 2]
 * 
 *                 if rr[0] < 256:             # <<<<<<<<<<<<<<
 *                     rr[0] = <unsigned char>(min(rr[0] + r * <float>128.0, <float>255.0))
 * 
 */
                              __pyx_t_11 = (((__pyx_v_rr[0]) < 0x100) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":4096
 * 
 *                 if rr[0] < 256:
 *                     rr[0] = <unsigned char>(min(rr[0] + r * <float>128.0, <float>255.0))             # <<<<<<<<<<<<<<
 * 
 *                 if gg[0] < 256:
 */
                                __pyx_t_8 = ((float)255.0);
                                __pyx_t_9 = ((__pyx_v_rr[0]) + (__pyx_v_r * ((float)128.0)));
                                if (((__pyx_t_8 < __pyx_t_9) != 0)) {
                                  __pyx_t_10 = __pyx_t_8;
                                } else {
                                  __pyx_t_10 = __pyx_t_9;
                                }
                                (__pyx_v_rr[0]) = ((unsigned char)__pyx_t_10);

                                /* "PygameShader/shader.pyx":4095
 *                 bb = &rgb_array_[x, y, 2]
 * 
 *                 if rr[0] < 256:             # <<<<<<<<<<<<<<
 *                     rr[0] = <unsigned char>(min(rr[0] + r * <float>128.0, <float>255.0))
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":4098
 *                     rr[0] = <unsigned char>(min(rr[0] + r * <float>128.0, <float>255.0))
 * 
 *                 if gg[0] < 256:             # <<<<<<<<<<<<<<
 *                     gg[0] = <unsigned char>(min(gg[0] + g * <float>128.0, <float>255.0))
 * 
 */
                              __pyx_t_11 = (((__pyx_v_gg[0]) < 0x100) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":4099
 * 
 *                 if gg[0] < 256:
 *                     gg[0] = <unsigned char>(min(gg[0] + g * <float>128.0, <float>255.0))             # <<<<<<<<<<<<<<
 * 
 *                 if bb[0] < 256:
 */
                                __pyx_t_10 = ((float)255.0);
                                __pyx_t_8 = ((__pyx_v_gg[0]) + (__pyx_v_g * ((float)128.0)));
                                if (((__pyx_t_10 < __pyx_t_8) != 0)) {
                                  __pyx_t_9 = __pyx_t_10;
                                } else {
                                  __pyx_t_9 = __pyx_t_8;
                                }
                                (__pyx_v_gg[0]) = ((unsigned char)__pyx_t_9);

                                /* "PygameShader/shader.pyx":4098
 *                     rr[0] = <unsigned char>(min(rr[0] + r * <float>128.0, <float>255.0))
 * 
 *                 if gg[0] < 256:             # <<<<<<<<<<<<<<
 *                     gg[0] = <unsigned char>(min(gg[0] + g * <float>128.0, <float>255.0))
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":4101
 *                     gg[0] = <unsigned char>(min(gg[0] + g * <float>128.0, <float>255.0))
 * 
 *                 if bb[0] < 256:             # <<<<<<<<<<<<<<
 *                     bb[0] = <unsigned char>(min(bb[0] + b * <float>128.0, <float>255.0))
 * 
 */
                              __pyx_t_11 = (((__pyx_v_bb[0]) < 0x100) != 0);
                              if (__pyx_t_11) {

                                /* "PygameShader/shader.pyx":4102
 * 
 *                 if bb[0] < 256:
 *                     bb[0] = <unsigned char>(min(bb[0] + b * <float>128.0, <float>255.0))             # <<<<<<<<<<<<<<
 * 
 * 
 */
                                __pyx_t_9 = ((float)255.0);
                                __pyx_t_10 = ((__pyx_v_bb[0]) + (__pyx_v_b * ((float)128.0)));
                                if (((__pyx_t_9 < __pyx_t_10) != 0)) {
                                  __pyx_t_8 = __pyx_t_9;
                                } else {
                                  __pyx_t_8 = __pyx_t_10;
                                }
                                (__pyx_v_bb[0]) = ((unsigned char)__pyx_t_8);

                                /* "PygameShader/shader.pyx":4101
 *                     gg[0] = <unsigned char>(min(gg[0] + g * <float>128.0, <float>255.0))
 * 
 *                 if bb[0] < 256:             # <<<<<<<<<<<<<<
 *                     bb[0] = <unsigned char>(min(bb[0] + b * <float>128.0, <float>255.0))
 * 
 */
                              }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4056
 *     t = <float>frame
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(width, schedule='static', num_threads=THREADS):
 *             for y in range(height):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4011
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef inline void shader_plasma24bit_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         int frame,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4109
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_plasma_c(surface_, float frame, unsigned int [::1] palette_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_plasma_c(PyObject *__pyx_v_surface_, float __pyx_v_frame, __Pyx_memviewslice __pyx_v_palette_) {
  Py_ssize_t __pyx_v_width;
  Py_ssize_t __pyx_v_height;
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_ii;
  int __pyx_v_c;
  __Pyx_memviewslice __pyx_v_rgb_array_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned char *__pyx_v_rr;
  unsigned char *__pyx_v_gg;
  unsigned char *__pyx_v_bb;
  float __pyx_v_color_;
  float __pyx_v_w2;
  float __pyx_v_h2;
  Py_ssize_t __pyx_v_length;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  size_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_plasma_c", 0);

  /* "PygameShader/shader.pyx":4123
 *     """
 *     cdef Py_ssize_t width, height
 *     width, height = surface_.get_size()             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 4123, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 4123, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 4123, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 4123, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 4123, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_width = __pyx_t_6;
  __pyx_v_height = __pyx_t_7;

  /* "PygameShader/shader.pyx":4128
 *         int x, y, ii,c
 * 
 *         unsigned char [:, :, :] rgb_array_ = pixels3d(surface_)             # <<<<<<<<<<<<<<
 * 
 *         unsigned char *rr
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 4128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rgb_array_ = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":4134
 *         unsigned char *bb
 *         float color_
 *         float w2 = <float>width * <float>HALF             # <<<<<<<<<<<<<<
 *         float h2 = <float>height * <float>HALF
 *         Py_ssize_t length = len(palette_)
 */
  __pyx_v_w2 = (((float)__pyx_v_width) * ((float)0.5));

  /* "PygameShader/shader.pyx":4135
 *         float color_
 *         float w2 = <float>width * <float>HALF
 *         float h2 = <float>height * <float>HALF             # <<<<<<<<<<<<<<
 *         Py_ssize_t length = len(palette_)
 * 
 */
  __pyx_v_h2 = (((float)__pyx_v_height) * ((float)0.5));

  /* "PygameShader/shader.pyx":4136
 *         float w2 = <float>width * <float>HALF
 *         float h2 = <float>height * <float>HALF
 *         Py_ssize_t length = len(palette_)             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_t_9 = __Pyx_MemoryView_Len(__pyx_v_palette_); 
  __pyx_v_length = __pyx_t_9;

  /* "PygameShader/shader.pyx":4138
 *         Py_ssize_t length = len(palette_)
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(height, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4140
 *     with nogil:
 * 
 *         for y in prange(height, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for x in range(width):
 * 
 */
        __pyx_t_7 = __pyx_v_height;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_10 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_10 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_bb) lastprivate(__pyx_v_c) lastprivate(__pyx_v_color_) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_10; __pyx_t_6++){
                        {
                            __pyx_v_y = (int)(0 + 1 * __pyx_t_6);
                            /* Initialize private variables to invalid values */
                            __pyx_v_bb = ((unsigned char *)1);
                            __pyx_v_c = ((int)0xbad0bad0);
                            __pyx_v_color_ = ((float)__PYX_NAN());
                            __pyx_v_gg = ((unsigned char *)1);
                            __pyx_v_ii = ((int)0xbad0bad0);
                            __pyx_v_rr = ((unsigned char *)1);
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":4141
 * 
 *         for y in prange(height, schedule='static', num_threads=THREADS):
 *             for x in range(width):             # <<<<<<<<<<<<<<
 * 
 *                 rr = &rgb_array_[x, y, 0]
 */
                            __pyx_t_11 = __pyx_v_width;
                            __pyx_t_12 = __pyx_t_11;
                            for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
                              __pyx_v_x = __pyx_t_13;

                              /* "PygameShader/shader.pyx":4143
 *             for x in range(width):
 * 
 *                 rr = &rgb_array_[x, y, 0]             # <<<<<<<<<<<<<<
 *                 gg = &rgb_array_[x, y, 1]
 *                 bb = &rgb_array_[x, y, 2]
 */
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_15 = __pyx_v_y;
                              __pyx_t_16 = 0;
                              __pyx_v_rr = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4144
 * 
 *                 rr = &rgb_array_[x, y, 0]
 *                 gg = &rgb_array_[x, y, 1]             # <<<<<<<<<<<<<<
 *                 bb = &rgb_array_[x, y, 2]
 * 
 */
                              __pyx_t_16 = __pyx_v_x;
                              __pyx_t_15 = __pyx_v_y;
                              __pyx_t_14 = 1;
                              __pyx_v_gg = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4145
 *                 rr = &rgb_array_[x, y, 0]
 *                 gg = &rgb_array_[x, y, 1]
 *                 bb = &rgb_array_[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 *                 color_ = <float>128.0 + (<float>128.0 * <float>sin(x * ONE_255 + frame)) \
 */
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_15 = __pyx_v_y;
                              __pyx_t_16 = 2;
                              __pyx_v_bb = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4151
 *                     + <float>128.0 + (<float>128.0 * <float>sin(
 *                     sqrt((x - w2) * (x - w2) + (y - h2) * (y - h2)) * ONE_255)) \
 *                     + <float>128.0 + (<float>128.0 * <float>sin(             # <<<<<<<<<<<<<<
 *                     <float>sqrt(x * x + y * y + frame) * <float>ONE_64))
 * 
 */
                              __pyx_v_color_ = (((((((((float)128.0) + (((float)128.0) * ((float)sin(((__pyx_v_x * 0.00392156862745098) + __pyx_v_frame))))) + ((float)128.0)) + (((float)128.0) * ((float)sin(((__pyx_v_frame * 0.03125) + (__pyx_v_y * 0.015625)))))) + ((float)128.0)) + (((float)128.0) * ((float)sin((sqrt((((__pyx_v_x - __pyx_v_w2) * (__pyx_v_x - __pyx_v_w2)) + ((__pyx_v_y - __pyx_v_h2) * (__pyx_v_y - __pyx_v_h2)))) * 0.00392156862745098))))) + ((float)128.0)) + (((float)128.0) * ((float)sin((((float)sqrt((((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + __pyx_v_frame))) * ((float)0.015625))))));

                              /* "PygameShader/shader.pyx":4154
 *                     <float>sqrt(x * x + y * y + frame) * <float>ONE_64))
 * 
 *                 c = min(<int>(color_ / <float>8.0), <int>length)             # <<<<<<<<<<<<<<
 * 
 *                 ii = palette_[c]
 */
                              __pyx_t_17 = ((int)__pyx_v_length);
                              __pyx_t_18 = ((int)(__pyx_v_color_ / ((float)8.0)));
                              if (((__pyx_t_17 < __pyx_t_18) != 0)) {
                                __pyx_t_19 = __pyx_t_17;
                              } else {
                                __pyx_t_19 = __pyx_t_18;
                              }
                              __pyx_v_c = __pyx_t_19;

                              /* "PygameShader/shader.pyx":4156
 *                 c = min(<int>(color_ / <float>8.0), <int>length)
 * 
 *                 ii = palette_[c]             # <<<<<<<<<<<<<<
 * 
 *                 rr[0] = (ii >> 16) & 255
 */
                              __pyx_t_16 = __pyx_v_c;
                              __pyx_v_ii = (*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_palette_.data) + __pyx_t_16)) )));

                              /* "PygameShader/shader.pyx":4158
 *                 ii = palette_[c]
 * 
 *                 rr[0] = (ii >> 16) & 255             # <<<<<<<<<<<<<<
 *                 gg[0] = (ii >> 8) & 255
 *                 bb[0] = ii & 255
 */
                              (__pyx_v_rr[0]) = ((__pyx_v_ii >> 16) & 0xFF);

                              /* "PygameShader/shader.pyx":4159
 * 
 *                 rr[0] = (ii >> 16) & 255
 *                 gg[0] = (ii >> 8) & 255             # <<<<<<<<<<<<<<
 *                 bb[0] = ii & 255
 * 
 */
                              (__pyx_v_gg[0]) = ((__pyx_v_ii >> 8) & 0xFF);

                              /* "PygameShader/shader.pyx":4160
 *                 rr[0] = (ii >> 16) & 255
 *                 gg[0] = (ii >> 8) & 255
 *                 bb[0] = ii & 255             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              (__pyx_v_bb[0]) = (__pyx_v_ii & 0xFF);
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4138
 *         Py_ssize_t length = len(palette_)
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(height, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "PygameShader/shader.pyx":4109
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_plasma_c(surface_, float frame, unsigned int [::1] palette_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_plasma_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4167
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline float [:, :, :, ::1] rgb_to_hsl_model_c():             # <<<<<<<<<<<<<<
 *     """
 *     CONVERT RGB INTO HSL MODEL
 */

static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_rgb_to_hsl_model_c(void) {
  __Pyx_memviewslice __pyx_v_rgb_to_hsl = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct hsl __pyx_v_hsl_;
  int __pyx_v_r;
  int __pyx_v_g;
  int __pyx_v_b;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  long __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  float __pyx_t_11;
  float __pyx_t_12;
  float __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_to_hsl_model_c", 0);

  /* "PygameShader/shader.pyx":4176
 *     :return: Numpy.ndarray shape (r, g, b, 3) type float
 *     """
 *     cdef float [:, :, :, ::1] rgb_to_hsl = numpy.empty((256, 256, 256, 3), float32)             # <<<<<<<<<<<<<<
 *     cdef hsl hsl_
 *     cdef int r, g, b
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_tuple__22, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4176, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_tuple__22, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4176, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4176, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_tuple__22);
    __Pyx_GIVEREF(__pyx_tuple__22);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_tuple__22);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4176, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 4176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rgb_to_hsl = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;

  /* "PygameShader/shader.pyx":4179
 *     cdef hsl hsl_
 *     cdef int r, g, b
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for r in prange(0, 256, schedule='static', num_threads=THREADS):
 *             for g in range(0, 256):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4180
 *     cdef int r, g, b
 *     with nogil:
 *         for r in prange(0, 256, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for g in range(0, 256):
 *                 for b in range(0, 256):
 */
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_9 = (0x100 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_9 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_5)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) firstprivate(__pyx_v_r) lastprivate(__pyx_v_r) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){
                        {
                            __pyx_v_r = (int)(0 + 1 * __pyx_t_8);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((int)0xbad0bad0);
                            __pyx_v_g = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":4181
 *     with nogil:
 *         for r in prange(0, 256, schedule='static', num_threads=THREADS):
 *             for g in range(0, 256):             # <<<<<<<<<<<<<<
 *                 for b in range(0, 256):
 *                     hsl_ = struct_rgb_to_hsl(
 */
                            for (__pyx_t_5 = 0; __pyx_t_5 < 0x100; __pyx_t_5+=1) {
                              __pyx_v_g = __pyx_t_5;

                              /* "PygameShader/shader.pyx":4182
 *         for r in prange(0, 256, schedule='static', num_threads=THREADS):
 *             for g in range(0, 256):
 *                 for b in range(0, 256):             # <<<<<<<<<<<<<<
 *                     hsl_ = struct_rgb_to_hsl(
 *                         r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)
 */
                              for (__pyx_t_10 = 0; __pyx_t_10 < 0x100; __pyx_t_10+=1) {
                                __pyx_v_b = __pyx_t_10;

                                /* "PygameShader/shader.pyx":4183
 *             for g in range(0, 256):
 *                 for b in range(0, 256):
 *                     hsl_ = struct_rgb_to_hsl(             # <<<<<<<<<<<<<<
 *                         r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)
 *                     rgb_to_hsl[r, g, b, 0] = min(<float>(hsl_.h * <float>255.0), <float>255.0)
 */
                                __pyx_v_hsl_ = struct_rgb_to_hsl((__pyx_v_r * ((float)0.00392156862745098)), (__pyx_v_g * ((float)0.00392156862745098)), (__pyx_v_b * ((float)0.00392156862745098)));

                                /* "PygameShader/shader.pyx":4185
 *                     hsl_ = struct_rgb_to_hsl(
 *                         r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)
 *                     rgb_to_hsl[r, g, b, 0] = min(<float>(hsl_.h * <float>255.0), <float>255.0)             # <<<<<<<<<<<<<<
 *                     rgb_to_hsl[r, g, b, 1] = min(<float>(hsl_.s * <float>255.0), <float>255.0)
 *                     rgb_to_hsl[r, g, b, 2] = min(<float>(hsl_.l * <float>255.0), <float>255.0)
 */
                                __pyx_t_11 = ((float)255.0);
                                __pyx_t_12 = ((float)(__pyx_v_hsl_.h * ((float)255.0)));
                                if (((__pyx_t_11 < __pyx_t_12) != 0)) {
                                  __pyx_t_13 = __pyx_t_11;
                                } else {
                                  __pyx_t_13 = __pyx_t_12;
                                }
                                __pyx_t_14 = __pyx_v_r;
                                __pyx_t_15 = __pyx_v_g;
                                __pyx_t_16 = __pyx_v_b;
                                __pyx_t_17 = 0;
                                *((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl.data + __pyx_t_14 * __pyx_v_rgb_to_hsl.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_to_hsl.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_to_hsl.strides[2]) )) + __pyx_t_17)) )) = __pyx_t_13;

                                /* "PygameShader/shader.pyx":4186
 *                         r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)
 *                     rgb_to_hsl[r, g, b, 0] = min(<float>(hsl_.h * <float>255.0), <float>255.0)
 *                     rgb_to_hsl[r, g, b, 1] = min(<float>(hsl_.s * <float>255.0), <float>255.0)             # <<<<<<<<<<<<<<
 *                     rgb_to_hsl[r, g, b, 2] = min(<float>(hsl_.l * <float>255.0), <float>255.0)
 * 
 */
                                __pyx_t_13 = ((float)255.0);
                                __pyx_t_11 = ((float)(__pyx_v_hsl_.s * ((float)255.0)));
                                if (((__pyx_t_13 < __pyx_t_11) != 0)) {
                                  __pyx_t_12 = __pyx_t_13;
                                } else {
                                  __pyx_t_12 = __pyx_t_11;
                                }
                                __pyx_t_17 = __pyx_v_r;
                                __pyx_t_16 = __pyx_v_g;
                                __pyx_t_15 = __pyx_v_b;
                                __pyx_t_14 = 1;
                                *((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl.data + __pyx_t_17 * __pyx_v_rgb_to_hsl.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_to_hsl.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_to_hsl.strides[2]) )) + __pyx_t_14)) )) = __pyx_t_12;

                                /* "PygameShader/shader.pyx":4187
 *                     rgb_to_hsl[r, g, b, 0] = min(<float>(hsl_.h * <float>255.0), <float>255.0)
 *                     rgb_to_hsl[r, g, b, 1] = min(<float>(hsl_.s * <float>255.0), <float>255.0)
 *                     rgb_to_hsl[r, g, b, 2] = min(<float>(hsl_.l * <float>255.0), <float>255.0)             # <<<<<<<<<<<<<<
 * 
 *     return asarray(rgb_to_hsl, dtype=float32)
 */
                                __pyx_t_12 = ((float)255.0);
                                __pyx_t_13 = ((float)(__pyx_v_hsl_.l * ((float)255.0)));
                                if (((__pyx_t_12 < __pyx_t_13) != 0)) {
                                  __pyx_t_11 = __pyx_t_12;
                                } else {
                                  __pyx_t_11 = __pyx_t_13;
                                }
                                __pyx_t_14 = __pyx_v_r;
                                __pyx_t_15 = __pyx_v_g;
                                __pyx_t_16 = __pyx_v_b;
                                __pyx_t_17 = 2;
                                *((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl.data + __pyx_t_14 * __pyx_v_rgb_to_hsl.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_to_hsl.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_to_hsl.strides[2]) )) + __pyx_t_17)) )) = __pyx_t_11;
                              }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4179
 *     cdef hsl hsl_
 *     cdef int r, g, b
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for r in prange(0, 256, schedule='static', num_threads=THREADS):
 *             for g in range(0, 256):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4189
 *                     rgb_to_hsl[r, g, b, 2] = min(<float>(hsl_.l * <float>255.0), <float>255.0)
 * 
 *     return asarray(rgb_to_hsl, dtype=float32)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_rgb_to_hsl, 4, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 4189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_float(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 4189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":4167
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline float [:, :, :, ::1] rgb_to_hsl_model_c():             # <<<<<<<<<<<<<<
 *     """
 *     CONVERT RGB INTO HSL MODEL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("PygameShader.shader.rgb_to_hsl_model_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_to_hsl, 1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":4197
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline unsigned char [:, :, :, ::1] hsl_to_rgb_model_c():             # <<<<<<<<<<<<<<
 *     """
 *     CONVERT HSL INTO RGB MODEL
 */

static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_hsl_to_rgb_model_c(void) {
  __Pyx_memviewslice __pyx_v_hsl_to_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct rgb __pyx_v_rgb_;
  int __pyx_v_h;
  int __pyx_v_s;
  int __pyx_v_l;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  long __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  unsigned char __pyx_t_11;
  unsigned char __pyx_t_12;
  unsigned char __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hsl_to_rgb_model_c", 0);

  /* "PygameShader/shader.pyx":4206
 *     :return: Numpy.ndarray shape (r, g, b, 3) type float
 *     """
 *     cdef unsigned char [:, :, :, ::1] hsl_to_rgb = numpy.empty((256, 256, 256, 3), uint8)             # <<<<<<<<<<<<<<
 *     cdef rgb rgb_
 *     cdef int r, g, b
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_tuple__22, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4206, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_tuple__22, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4206, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_tuple__22);
    __Pyx_GIVEREF(__pyx_tuple__22);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_tuple__22);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 4206, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_hsl_to_rgb = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;

  /* "PygameShader/shader.pyx":4211
 *     cdef int h, s, l
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for h in prange(0, 256, schedule='static', num_threads=THREADS):
 *             for s in range(0, 256):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4212
 * 
 *     with nogil:
 *         for h in prange(0, 256, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for s in range(0, 256):
 *                 for l in range(0, 256):
 */
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_9 = (0x100 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_9 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_5)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_h) lastprivate(__pyx_v_h) lastprivate(__pyx_v_l) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){
                        {
                            __pyx_v_h = (int)(0 + 1 * __pyx_t_8);
                            /* Initialize private variables to invalid values */
                            __pyx_v_l = ((int)0xbad0bad0);
                            __pyx_v_s = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":4213
 *     with nogil:
 *         for h in prange(0, 256, schedule='static', num_threads=THREADS):
 *             for s in range(0, 256):             # <<<<<<<<<<<<<<
 *                 for l in range(0, 256):
 *                     rgb_ = struct_hsl_to_rgb(h * <float>ONE_255, s *
 */
                            for (__pyx_t_5 = 0; __pyx_t_5 < 0x100; __pyx_t_5+=1) {
                              __pyx_v_s = __pyx_t_5;

                              /* "PygameShader/shader.pyx":4214
 *         for h in prange(0, 256, schedule='static', num_threads=THREADS):
 *             for s in range(0, 256):
 *                 for l in range(0, 256):             # <<<<<<<<<<<<<<
 *                     rgb_ = struct_hsl_to_rgb(h * <float>ONE_255, s *
 *                                              <float>ONE_255, l * <float>ONE_255)
 */
                              for (__pyx_t_10 = 0; __pyx_t_10 < 0x100; __pyx_t_10+=1) {
                                __pyx_v_l = __pyx_t_10;

                                /* "PygameShader/shader.pyx":4215
 *             for s in range(0, 256):
 *                 for l in range(0, 256):
 *                     rgb_ = struct_hsl_to_rgb(h * <float>ONE_255, s *             # <<<<<<<<<<<<<<
 *                                              <float>ONE_255, l * <float>ONE_255)
 *                     hsl_to_rgb[h, s, l, 0] =\
 */
                                __pyx_v_rgb_ = struct_hsl_to_rgb((__pyx_v_h * ((float)0.00392156862745098)), (__pyx_v_s * ((float)0.00392156862745098)), (__pyx_v_l * ((float)0.00392156862745098)));

                                /* "PygameShader/shader.pyx":4218
 *                                              <float>ONE_255, l * <float>ONE_255)
 *                     hsl_to_rgb[h, s, l, 0] =\
 *                         min(<unsigned char> (rgb_.r * <float>255.0), <unsigned char>255)             # <<<<<<<<<<<<<<
 *                     hsl_to_rgb[h, s, l, 1] = \
 *                         min(<unsigned char> (rgb_.g * <float>255.0), <unsigned char>255)
 */
                                __pyx_t_11 = ((unsigned char)0xFF);
                                __pyx_t_12 = ((unsigned char)(__pyx_v_rgb_.r * ((float)255.0)));
                                if (((__pyx_t_11 < __pyx_t_12) != 0)) {
                                  __pyx_t_13 = __pyx_t_11;
                                } else {
                                  __pyx_t_13 = __pyx_t_12;
                                }

                                /* "PygameShader/shader.pyx":4217
 *                     rgb_ = struct_hsl_to_rgb(h * <float>ONE_255, s *
 *                                              <float>ONE_255, l * <float>ONE_255)
 *                     hsl_to_rgb[h, s, l, 0] =\             # <<<<<<<<<<<<<<
 *                         min(<unsigned char> (rgb_.r * <float>255.0), <unsigned char>255)
 *                     hsl_to_rgb[h, s, l, 1] = \
 */
                                __pyx_t_14 = __pyx_v_h;
                                __pyx_t_15 = __pyx_v_s;
                                __pyx_t_16 = __pyx_v_l;
                                __pyx_t_17 = 0;
                                *((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_to_rgb.data + __pyx_t_14 * __pyx_v_hsl_to_rgb.strides[0]) ) + __pyx_t_15 * __pyx_v_hsl_to_rgb.strides[1]) ) + __pyx_t_16 * __pyx_v_hsl_to_rgb.strides[2]) )) + __pyx_t_17)) )) = __pyx_t_13;

                                /* "PygameShader/shader.pyx":4220
 *                         min(<unsigned char> (rgb_.r * <float>255.0), <unsigned char>255)
 *                     hsl_to_rgb[h, s, l, 1] = \
 *                         min(<unsigned char> (rgb_.g * <float>255.0), <unsigned char>255)             # <<<<<<<<<<<<<<
 *                     hsl_to_rgb[h, s, l, 2] = \
 *                         min(<unsigned char> (rgb_.b * <float>255.0), <unsigned char>255)
 */
                                __pyx_t_13 = ((unsigned char)0xFF);
                                __pyx_t_11 = ((unsigned char)(__pyx_v_rgb_.g * ((float)255.0)));
                                if (((__pyx_t_13 < __pyx_t_11) != 0)) {
                                  __pyx_t_12 = __pyx_t_13;
                                } else {
                                  __pyx_t_12 = __pyx_t_11;
                                }

                                /* "PygameShader/shader.pyx":4219
 *                     hsl_to_rgb[h, s, l, 0] =\
 *                         min(<unsigned char> (rgb_.r * <float>255.0), <unsigned char>255)
 *                     hsl_to_rgb[h, s, l, 1] = \             # <<<<<<<<<<<<<<
 *                         min(<unsigned char> (rgb_.g * <float>255.0), <unsigned char>255)
 *                     hsl_to_rgb[h, s, l, 2] = \
 */
                                __pyx_t_17 = __pyx_v_h;
                                __pyx_t_16 = __pyx_v_s;
                                __pyx_t_15 = __pyx_v_l;
                                __pyx_t_14 = 1;
                                *((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_to_rgb.data + __pyx_t_17 * __pyx_v_hsl_to_rgb.strides[0]) ) + __pyx_t_16 * __pyx_v_hsl_to_rgb.strides[1]) ) + __pyx_t_15 * __pyx_v_hsl_to_rgb.strides[2]) )) + __pyx_t_14)) )) = __pyx_t_12;

                                /* "PygameShader/shader.pyx":4222
 *                         min(<unsigned char> (rgb_.g * <float>255.0), <unsigned char>255)
 *                     hsl_to_rgb[h, s, l, 2] = \
 *                         min(<unsigned char> (rgb_.b * <float>255.0), <unsigned char>255)             # <<<<<<<<<<<<<<
 * 
 *     return asarray(hsl_to_rgb, dtype=uint8)
 */
                                __pyx_t_12 = ((unsigned char)0xFF);
                                __pyx_t_13 = ((unsigned char)(__pyx_v_rgb_.b * ((float)255.0)));
                                if (((__pyx_t_12 < __pyx_t_13) != 0)) {
                                  __pyx_t_11 = __pyx_t_12;
                                } else {
                                  __pyx_t_11 = __pyx_t_13;
                                }

                                /* "PygameShader/shader.pyx":4221
 *                     hsl_to_rgb[h, s, l, 1] = \
 *                         min(<unsigned char> (rgb_.g * <float>255.0), <unsigned char>255)
 *                     hsl_to_rgb[h, s, l, 2] = \             # <<<<<<<<<<<<<<
 *                         min(<unsigned char> (rgb_.b * <float>255.0), <unsigned char>255)
 * 
 */
                                __pyx_t_14 = __pyx_v_h;
                                __pyx_t_15 = __pyx_v_s;
                                __pyx_t_16 = __pyx_v_l;
                                __pyx_t_17 = 2;
                                *((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_to_rgb.data + __pyx_t_14 * __pyx_v_hsl_to_rgb.strides[0]) ) + __pyx_t_15 * __pyx_v_hsl_to_rgb.strides[1]) ) + __pyx_t_16 * __pyx_v_hsl_to_rgb.strides[2]) )) + __pyx_t_17)) )) = __pyx_t_11;
                              }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4211
 *     cdef int h, s, l
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for h in prange(0, 256, schedule='static', num_threads=THREADS):
 *             for s in range(0, 256):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4224
 *                         min(<unsigned char> (rgb_.b * <float>255.0), <unsigned char>255)
 * 
 *     return asarray(hsl_to_rgb, dtype=uint8)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_hsl_to_rgb, 4, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 4224, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 4224, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":4197
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline unsigned char [:, :, :, ::1] hsl_to_rgb_model_c():             # <<<<<<<<<<<<<<
 *     """
 *     CONVERT HSL INTO RGB MODEL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("PygameShader.shader.hsl_to_rgb_model_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_hsl_to_rgb, 1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":4230
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_hsl_surface24bit_inplace_c(unsigned char [:, :, :] rgb_array, float shift_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_hsl_surface24bit_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array, float __pyx_v_shift_) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  struct hsl __pyx_v_hsl_;
  struct rgb __pyx_v_rgb_;
  float __pyx_v_h_;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  __Pyx_RefNannySetupContext("shader_hsl_surface24bit_inplace_c", 0);

  /* "PygameShader/shader.pyx":4248
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":4251
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         hsl hsl_
 *         rgb rgb_
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":4260
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4261
 * 
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(w):
 *                 r = &rgb_array[i, j, 0]
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_h_) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_h_ = ((float)__PYX_NAN());
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);

                            /* "PygameShader/shader.pyx":4262
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):             # <<<<<<<<<<<<<<
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]
 */
                            __pyx_t_5 = __pyx_v_w;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_i = __pyx_t_7;

                              /* "PygameShader/shader.pyx":4263
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 *                 r = &rgb_array[i, j, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4264
 *             for i in range(w):
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array[i, j, 2]
 *                 hsl_ = struct_rgb_to_hsl(
 */
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4265
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]             # <<<<<<<<<<<<<<
 *                 hsl_ = struct_rgb_to_hsl(
 *                     r[0] * <float>ONE_255, g[0] *
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4266
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]
 *                 hsl_ = struct_rgb_to_hsl(             # <<<<<<<<<<<<<<
 *                     r[0] * <float>ONE_255, g[0] *
 *                     <float>ONE_255, b[0] * <float>ONE_255)
 */
                              __pyx_v_hsl_ = struct_rgb_to_hsl(((__pyx_v_r[0]) * ((float)0.00392156862745098)), ((__pyx_v_g[0]) * ((float)0.00392156862745098)), ((__pyx_v_b[0]) * ((float)0.00392156862745098)));

                              /* "PygameShader/shader.pyx":4272
 *                 #h_ = min((hsl_.h + shift_), 1.0)
 *                 #h_ = max(h_, 0.0)
 *                 h_ = hsl_.h + shift_             # <<<<<<<<<<<<<<
 *                 rgb_ = struct_hsl_to_rgb(h_, hsl_.s, hsl_.l)
 * 
 */
                              __pyx_v_h_ = (__pyx_v_hsl_.h + __pyx_v_shift_);

                              /* "PygameShader/shader.pyx":4273
 *                 #h_ = max(h_, 0.0)
 *                 h_ = hsl_.h + shift_
 *                 rgb_ = struct_hsl_to_rgb(h_, hsl_.s, hsl_.l)             # <<<<<<<<<<<<<<
 * 
 *                 r[0] = <unsigned char>(rgb_.r * <float>255.0)
 */
                              __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_h_, __pyx_v_hsl_.s, __pyx_v_hsl_.l);

                              /* "PygameShader/shader.pyx":4275
 *                 rgb_ = struct_hsl_to_rgb(h_, hsl_.s, hsl_.l)
 * 
 *                 r[0] = <unsigned char>(rgb_.r * <float>255.0)             # <<<<<<<<<<<<<<
 *                 g[0] = <unsigned char>(rgb_.g * <float>255.0)
 *                 b[0] = <unsigned char>(rgb_.b * <float>255.0)
 */
                              (__pyx_v_r[0]) = ((unsigned char)(__pyx_v_rgb_.r * ((float)255.0)));

                              /* "PygameShader/shader.pyx":4276
 * 
 *                 r[0] = <unsigned char>(rgb_.r * <float>255.0)
 *                 g[0] = <unsigned char>(rgb_.g * <float>255.0)             # <<<<<<<<<<<<<<
 *                 b[0] = <unsigned char>(rgb_.b * <float>255.0)
 * 
 */
                              (__pyx_v_g[0]) = ((unsigned char)(__pyx_v_rgb_.g * ((float)255.0)));

                              /* "PygameShader/shader.pyx":4277
 *                 r[0] = <unsigned char>(rgb_.r * <float>255.0)
 *                 g[0] = <unsigned char>(rgb_.g * <float>255.0)
 *                 b[0] = <unsigned char>(rgb_.b * <float>255.0)             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              (__pyx_v_b[0]) = ((unsigned char)(__pyx_v_rgb_.b * ((float)255.0)));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4260
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4230
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_hsl_surface24bit_inplace_c(unsigned char [:, :, :] rgb_array, float shift_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4285
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_hsl_surface24bit_fast_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array,
 *         float shift_,
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_hsl_surface24bit_fast_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_hsl_model_, __Pyx_memviewslice __pyx_v_rgb_model_) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  float __pyx_v_h_;
  unsigned char __pyx_v_h__;
  unsigned char __pyx_v_s__;
  unsigned char __pyx_v_l__;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  size_t __pyx_t_11;
  size_t __pyx_t_12;
  size_t __pyx_t_13;
  float __pyx_t_14;
  double __pyx_t_15;
  double __pyx_t_16;
  __Pyx_RefNannySetupContext("shader_hsl_surface24bit_fast_inplace_c", 0);

  /* "PygameShader/shader.pyx":4313
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":4316
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 * 
 *         float h_
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":4326
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='dynamic', num_threads=THREADS):
 *             for i in range(w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4327
 * 
 *     with nogil:
 *         for j in prange(h, schedule='dynamic', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(w):
 * 
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_h_) lastprivate(__pyx_v_h__) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l__) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s__) schedule(dynamic)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_h_ = ((float)__PYX_NAN());
                            __pyx_v_h__ = ((unsigned char)'?');
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_l__ = ((unsigned char)'?');
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_s__ = ((unsigned char)'?');

                            /* "PygameShader/shader.pyx":4328
 *     with nogil:
 *         for j in prange(h, schedule='dynamic', num_threads=THREADS):
 *             for i in range(w):             # <<<<<<<<<<<<<<
 * 
 *                 r = &rgb_array[i, j, 0]
 */
                            __pyx_t_5 = __pyx_v_w;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_i = __pyx_t_7;

                              /* "PygameShader/shader.pyx":4330
 *             for i in range(w):
 * 
 *                 r = &rgb_array[i, j, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4331
 * 
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array[i, j, 2]
 * 
 */
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4332
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 *                 h_ = hsl_model_[r[0], g[0], b[0], 0]
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4334
 *                 b = &rgb_array[i, j, 2]
 * 
 *                 h_ = hsl_model_[r[0], g[0], b[0], 0]             # <<<<<<<<<<<<<<
 * 
 *                 h__ = <unsigned char> (<float>min((h_ * ONE_255 + shift_), <float>1.0) * \
 */
                              __pyx_t_11 = (__pyx_v_r[0]);
                              __pyx_t_12 = (__pyx_v_g[0]);
                              __pyx_t_13 = (__pyx_v_b[0]);
                              __pyx_t_10 = 0;
                              __pyx_v_h_ = (*((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_model_.data + __pyx_t_11 * __pyx_v_hsl_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_hsl_model_.strides[1]) ) + __pyx_t_13 * __pyx_v_hsl_model_.strides[2]) )) + __pyx_t_10)) )));

                              /* "PygameShader/shader.pyx":4336
 *                 h_ = hsl_model_[r[0], g[0], b[0], 0]
 * 
 *                 h__ = <unsigned char> (<float>min((h_ * ONE_255 + shift_), <float>1.0) * \             # <<<<<<<<<<<<<<
 *                     <float>255.0)
 * 
 */
                              __pyx_t_14 = ((float)1.0);
                              __pyx_t_15 = ((__pyx_v_h_ * 0.00392156862745098) + __pyx_v_shift_);
                              if (((__pyx_t_14 < __pyx_t_15) != 0)) {
                                __pyx_t_16 = __pyx_t_14;
                              } else {
                                __pyx_t_16 = __pyx_t_15;
                              }

                              /* "PygameShader/shader.pyx":4337
 * 
 *                 h__ = <unsigned char> (<float>min((h_ * ONE_255 + shift_), <float>1.0) * \
 *                     <float>255.0)             # <<<<<<<<<<<<<<
 * 
 *                 s__ = <unsigned char> hsl_model_[r[0], g[0], b[0], 1]
 */
                              __pyx_v_h__ = ((unsigned char)(((float)__pyx_t_16) * ((float)255.0)));

                              /* "PygameShader/shader.pyx":4339
 *                     <float>255.0)
 * 
 *                 s__ = <unsigned char> hsl_model_[r[0], g[0], b[0], 1]             # <<<<<<<<<<<<<<
 *                 l__ = <unsigned char> hsl_model_[r[0], g[0], b[0], 2]
 * 
 */
                              __pyx_t_13 = (__pyx_v_r[0]);
                              __pyx_t_12 = (__pyx_v_g[0]);
                              __pyx_t_11 = (__pyx_v_b[0]);
                              __pyx_t_10 = 1;
                              __pyx_v_s__ = ((unsigned char)(*((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_model_.data + __pyx_t_13 * __pyx_v_hsl_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_hsl_model_.strides[1]) ) + __pyx_t_11 * __pyx_v_hsl_model_.strides[2]) )) + __pyx_t_10)) ))));

                              /* "PygameShader/shader.pyx":4340
 * 
 *                 s__ = <unsigned char> hsl_model_[r[0], g[0], b[0], 1]
 *                 l__ = <unsigned char> hsl_model_[r[0], g[0], b[0], 2]             # <<<<<<<<<<<<<<
 * 
 *                 r[0] = (&rgb_model_[h__, s__, l__, 0])[0]
 */
                              __pyx_t_11 = (__pyx_v_r[0]);
                              __pyx_t_12 = (__pyx_v_g[0]);
                              __pyx_t_13 = (__pyx_v_b[0]);
                              __pyx_t_10 = 2;
                              __pyx_v_l__ = ((unsigned char)(*((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_model_.data + __pyx_t_11 * __pyx_v_hsl_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_hsl_model_.strides[1]) ) + __pyx_t_13 * __pyx_v_hsl_model_.strides[2]) )) + __pyx_t_10)) ))));

                              /* "PygameShader/shader.pyx":4342
 *                 l__ = <unsigned char> hsl_model_[r[0], g[0], b[0], 2]
 * 
 *                 r[0] = (&rgb_model_[h__, s__, l__, 0])[0]             # <<<<<<<<<<<<<<
 *                 g[0] = (&rgb_model_[h__, s__, l__, 1])[0]
 *                 b[0] = (&rgb_model_[h__, s__, l__, 2])[0]
 */
                              __pyx_t_13 = __pyx_v_h__;
                              __pyx_t_12 = __pyx_v_s__;
                              __pyx_t_11 = __pyx_v_l__;
                              __pyx_t_10 = 0;
                              (__pyx_v_r[0]) = ((&(*((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_model_.data + __pyx_t_13 * __pyx_v_rgb_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_rgb_model_.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_model_.strides[2]) )) + __pyx_t_10)) ))))[0]);

                              /* "PygameShader/shader.pyx":4343
 * 
 *                 r[0] = (&rgb_model_[h__, s__, l__, 0])[0]
 *                 g[0] = (&rgb_model_[h__, s__, l__, 1])[0]             # <<<<<<<<<<<<<<
 *                 b[0] = (&rgb_model_[h__, s__, l__, 2])[0]
 * 
 */
                              __pyx_t_11 = __pyx_v_h__;
                              __pyx_t_12 = __pyx_v_s__;
                              __pyx_t_13 = __pyx_v_l__;
                              __pyx_t_10 = 1;
                              (__pyx_v_g[0]) = ((&(*((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_model_.data + __pyx_t_11 * __pyx_v_rgb_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_rgb_model_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_model_.strides[2]) )) + __pyx_t_10)) ))))[0]);

                              /* "PygameShader/shader.pyx":4344
 *                 r[0] = (&rgb_model_[h__, s__, l__, 0])[0]
 *                 g[0] = (&rgb_model_[h__, s__, l__, 1])[0]
 *                 b[0] = (&rgb_model_[h__, s__, l__, 2])[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_13 = __pyx_v_h__;
                              __pyx_t_12 = __pyx_v_s__;
                              __pyx_t_11 = __pyx_v_l__;
                              __pyx_t_10 = 2;
                              (__pyx_v_b[0]) = ((&(*((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_model_.data + __pyx_t_13 * __pyx_v_rgb_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_rgb_model_.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_model_.strides[2]) )) + __pyx_t_10)) ))))[0]);
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4326
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='dynamic', num_threads=THREADS):
 *             for i in range(w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4285
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_hsl_surface24bit_fast_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array,
 *         float shift_,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4352
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float shift_=0):
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_inplace_c *__pyx_optional_args) {
  float __pyx_v_shift_ = ((float)0.0);
  Py_ssize_t __pyx_v_width;
  CYTHON_UNUSED Py_ssize_t __pyx_v_height;
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  float __pyx_v_l;
  struct hsl __pyx_v_hsl_;
  struct rgb __pyx_v_rgb_;
  CYTHON_UNUSED int __pyx_v_exclude_color;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  unsigned char *__pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  unsigned char *__pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  unsigned char *__pyx_t_19;
  float __pyx_t_20;
  float __pyx_t_21;
  float __pyx_t_22;
  __Pyx_RefNannySetupContext("shader_brightness24_inplace_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_shift_ = __pyx_optional_args->shift_;
    }
  }

  /* "PygameShader/shader.pyx":4374
 * 
 *     cdef Py_ssize_t width, height
 *     width, height = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_width = __pyx_t_2;
  __pyx_v_height = __pyx_t_3;

  /* "PygameShader/shader.pyx":4377
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":4386
 *         float high, low, high_
 *         unsigned char exclude_r, exclude_g, exclude_b
 *         bint exclude_color = False             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_exclude_color = 0;

  /* "PygameShader/shader.pyx":4388
 *         bint exclude_color = False
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(height, schedule='static', num_threads=THREADS):
 *             for i in range(width):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4389
 * 
 *     with nogil:
 *         for j in prange(height, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(width):
 * 
 */
        __pyx_t_3 = __pyx_v_height;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_l = ((float)__PYX_NAN());
                            __pyx_v_r = ((unsigned char *)1);

                            /* "PygameShader/shader.pyx":4390
 *     with nogil:
 *         for j in prange(height, schedule='static', num_threads=THREADS):
 *             for i in range(width):             # <<<<<<<<<<<<<<
 * 
 *                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]
 */
                            __pyx_t_5 = __pyx_v_width;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_i = __pyx_t_7;

                              /* "PygameShader/shader.pyx":4392
 *             for i in range(width):
 * 
 *                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 *                 hsl_ = struct_rgb_to_hsl(
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 0;
                              __pyx_t_11 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_8 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))));
                              __pyx_t_12 = __pyx_v_i;
                              __pyx_t_13 = __pyx_v_j;
                              __pyx_t_14 = 1;
                              __pyx_t_15 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) ))));
                              __pyx_t_16 = __pyx_v_i;
                              __pyx_t_17 = __pyx_v_j;
                              __pyx_t_18 = 2;
                              __pyx_t_19 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) ))));
                              __pyx_v_r = __pyx_t_11;
                              __pyx_v_g = __pyx_t_15;
                              __pyx_v_b = __pyx_t_19;

                              /* "PygameShader/shader.pyx":4394
 *                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]
 * 
 *                 hsl_ = struct_rgb_to_hsl(             # <<<<<<<<<<<<<<
 *                     r[0] * <float>ONE_255, g[0] *
 *                     <float>ONE_255, b[0] * <float>ONE_255)
 */
                              __pyx_v_hsl_ = struct_rgb_to_hsl(((__pyx_v_r[0]) * ((float)0.00392156862745098)), ((__pyx_v_g[0]) * ((float)0.00392156862745098)), ((__pyx_v_b[0]) * ((float)0.00392156862745098)));

                              /* "PygameShader/shader.pyx":4398
 *                     <float>ONE_255, b[0] * <float>ONE_255)
 * 
 *                 l = min((hsl_.l + shift_), <float>1.0)             # <<<<<<<<<<<<<<
 *                 l = max(l, <float>0.0)
 * 
 */
                              __pyx_t_20 = ((float)1.0);
                              __pyx_t_21 = (__pyx_v_hsl_.l + __pyx_v_shift_);
                              if (((__pyx_t_20 < __pyx_t_21) != 0)) {
                                __pyx_t_22 = __pyx_t_20;
                              } else {
                                __pyx_t_22 = __pyx_t_21;
                              }
                              __pyx_v_l = __pyx_t_22;

                              /* "PygameShader/shader.pyx":4399
 * 
 *                 l = min((hsl_.l + shift_), <float>1.0)
 *                 l = max(l, <float>0.0)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)
 */
                              __pyx_t_22 = ((float)0.0);
                              __pyx_t_20 = __pyx_v_l;
                              if (((__pyx_t_22 > __pyx_t_20) != 0)) {
                                __pyx_t_21 = __pyx_t_22;
                              } else {
                                __pyx_t_21 = __pyx_t_20;
                              }
                              __pyx_v_l = __pyx_t_21;

                              /* "PygameShader/shader.pyx":4401
 *                 l = max(l, <float>0.0)
 * 
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)             # <<<<<<<<<<<<<<
 * 
 *                 r[0] = <unsigned char> (rgb_.r * 255.0)
 */
                              __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_hsl_.h, __pyx_v_hsl_.s, __pyx_v_l);

                              /* "PygameShader/shader.pyx":4403
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)
 * 
 *                 r[0] = <unsigned char> (rgb_.r * 255.0)             # <<<<<<<<<<<<<<
 *                 g[0] = <unsigned char> (rgb_.g * 255.0)
 *                 b[0] = <unsigned char> (rgb_.b * 255.0)
 */
                              (__pyx_v_r[0]) = ((unsigned char)(__pyx_v_rgb_.r * 255.0));

                              /* "PygameShader/shader.pyx":4404
 * 
 *                 r[0] = <unsigned char> (rgb_.r * 255.0)
 *                 g[0] = <unsigned char> (rgb_.g * 255.0)             # <<<<<<<<<<<<<<
 *                 b[0] = <unsigned char> (rgb_.b * 255.0)
 * 
 */
                              (__pyx_v_g[0]) = ((unsigned char)(__pyx_v_rgb_.g * 255.0));

                              /* "PygameShader/shader.pyx":4405
 *                 r[0] = <unsigned char> (rgb_.r * 255.0)
 *                 g[0] = <unsigned char> (rgb_.g * 255.0)
 *                 b[0] = <unsigned char> (rgb_.b * 255.0)             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              (__pyx_v_b[0]) = ((unsigned char)(__pyx_v_rgb_.b * 255.0));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4388
 *         bint exclude_color = False
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(height, schedule='static', num_threads=THREADS):
 *             for i in range(width):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4352
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float shift_=0):
 *     """
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4413
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness24_exclude_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float shift_=0.0, color_=(0, 0, 0)):
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness24_exclude_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_exclude_inplace_c *__pyx_optional_args) {
  float __pyx_v_shift_ = ((float)0.0);

  /* "PygameShader/shader.pyx":4414
 * @cython.cdivision(True)
 * cdef inline void shader_brightness24_exclude_inplace_c(
 *         unsigned char [:, :, :] rgb_array_, float shift_=0.0, color_=(0, 0, 0)):             # <<<<<<<<<<<<<<
 *     """
 *     SHADER BRIGHTNESS (EXCLUDE A SPECIFIC COLOR FROM THE PROCESS, DEFAULT BLACK COLOR)
 */
  PyObject *__pyx_v_color_ = ((PyObject *)__pyx_tuple__9);
  Py_ssize_t __pyx_v_width;
  Py_ssize_t __pyx_v_height;
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned char __pyx_v_r;
  unsigned char __pyx_v_g;
  unsigned char __pyx_v_b;
  float __pyx_v_l;
  struct hsl __pyx_v_hsl_;
  struct rgb __pyx_v_rgb_;
  unsigned char __pyx_v_rr;
  unsigned char __pyx_v_gg;
  unsigned char __pyx_v_bb;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  unsigned char __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  unsigned char __pyx_t_13;
  unsigned char __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  float __pyx_t_17;
  float __pyx_t_18;
  float __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_brightness24_exclude_inplace_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_shift_ = __pyx_optional_args->shift_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_color_ = __pyx_optional_args->color_;
      }
    }
  }

  /* "PygameShader/shader.pyx":4436
 * 
 *     cdef Py_ssize_t width, height
 *     width, height = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_width = __pyx_t_2;
  __pyx_v_height = __pyx_t_3;

  /* "PygameShader/shader.pyx":4439
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         unsigned char r
 *         unsigned char g
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":4447
 *         rgb rgb_
 *         float high, low, high_
 *         unsigned char rr=color_[0], gg=color_[1], bb=color_[2]             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_color_, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_As_unsigned_char(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 4447, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rr = __pyx_t_5;
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_color_, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_As_unsigned_char(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 4447, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_gg = __pyx_t_5;
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_color_, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_As_unsigned_char(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 4447, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_bb = __pyx_t_5;

  /* "PygameShader/shader.pyx":4449
 *         unsigned char rr=color_[0], gg=color_[1], bb=color_[2]
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in range(height): #, schedule='static', num_threads=THREADS):
 *             for i in range(width):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4450
 * 
 *     with nogil:
 *         for j in range(height): #, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(width):
 * 
 */
        __pyx_t_3 = __pyx_v_height;
        __pyx_t_2 = __pyx_t_3;
        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) {
          __pyx_v_j = __pyx_t_6;

          /* "PygameShader/shader.pyx":4451
 *     with nogil:
 *         for j in range(height): #, schedule='static', num_threads=THREADS):
 *             for i in range(width):             # <<<<<<<<<<<<<<
 * 
 *                 r, g, b = rgb_array_[i, j, 0], rgb_array_[i, j, 1], rgb_array_[i, j, 2]
 */
          __pyx_t_7 = __pyx_v_width;
          __pyx_t_8 = __pyx_t_7;
          for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
            __pyx_v_i = __pyx_t_9;

            /* "PygameShader/shader.pyx":4453
 *             for i in range(width):
 * 
 *                 r, g, b = rgb_array_[i, j, 0], rgb_array_[i, j, 1], rgb_array_[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 *                 if not ((r==rr) and (g==gg) and (b==bb)):
 */
            __pyx_t_10 = __pyx_v_i;
            __pyx_t_11 = __pyx_v_j;
            __pyx_t_12 = 0;
            __pyx_t_5 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));
            __pyx_t_12 = __pyx_v_i;
            __pyx_t_11 = __pyx_v_j;
            __pyx_t_10 = 1;
            __pyx_t_13 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )));
            __pyx_t_10 = __pyx_v_i;
            __pyx_t_11 = __pyx_v_j;
            __pyx_t_12 = 2;
            __pyx_t_14 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));
            __pyx_v_r = __pyx_t_5;
            __pyx_v_g = __pyx_t_13;
            __pyx_v_b = __pyx_t_14;

            /* "PygameShader/shader.pyx":4455
 *                 r, g, b = rgb_array_[i, j, 0], rgb_array_[i, j, 1], rgb_array_[i, j, 2]
 * 
 *                 if not ((r==rr) and (g==gg) and (b==bb)):             # <<<<<<<<<<<<<<
 * 
 *                     hsl_ = struct_rgb_to_hsl(
 */
            __pyx_t_16 = ((__pyx_v_r == __pyx_v_rr) != 0);
            if (__pyx_t_16) {
            } else {
              __pyx_t_15 = __pyx_t_16;
              goto __pyx_L11_bool_binop_done;
            }
            __pyx_t_16 = ((__pyx_v_g == __pyx_v_gg) != 0);
            if (__pyx_t_16) {
            } else {
              __pyx_t_15 = __pyx_t_16;
              goto __pyx_L11_bool_binop_done;
            }
            __pyx_t_16 = ((__pyx_v_b == __pyx_v_bb) != 0);
            __pyx_t_15 = __pyx_t_16;
            __pyx_L11_bool_binop_done:;
            __pyx_t_16 = ((!__pyx_t_15) != 0);
            if (__pyx_t_16) {

              /* "PygameShader/shader.pyx":4457
 *                 if not ((r==rr) and (g==gg) and (b==bb)):
 * 
 *                     hsl_ = struct_rgb_to_hsl(             # <<<<<<<<<<<<<<
 *                         r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)
 * 
 */
              __pyx_v_hsl_ = struct_rgb_to_hsl((__pyx_v_r * ((float)0.00392156862745098)), (__pyx_v_g * ((float)0.00392156862745098)), (__pyx_v_b * ((float)0.00392156862745098)));

              /* "PygameShader/shader.pyx":4460
 *                         r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)
 * 
 *                     l = min((hsl_.l + shift_), <float>1.0)             # <<<<<<<<<<<<<<
 *                     l = max(l, <float>0.0)
 * 
 */
              __pyx_t_17 = ((float)1.0);
              __pyx_t_18 = (__pyx_v_hsl_.l + __pyx_v_shift_);
              if (((__pyx_t_17 < __pyx_t_18) != 0)) {
                __pyx_t_19 = __pyx_t_17;
              } else {
                __pyx_t_19 = __pyx_t_18;
              }
              __pyx_v_l = __pyx_t_19;

              /* "PygameShader/shader.pyx":4461
 * 
 *                     l = min((hsl_.l + shift_), <float>1.0)
 *                     l = max(l, <float>0.0)             # <<<<<<<<<<<<<<
 * 
 *                     rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)
 */
              __pyx_t_19 = ((float)0.0);
              __pyx_t_17 = __pyx_v_l;
              if (((__pyx_t_19 > __pyx_t_17) != 0)) {
                __pyx_t_18 = __pyx_t_19;
              } else {
                __pyx_t_18 = __pyx_t_17;
              }
              __pyx_v_l = __pyx_t_18;

              /* "PygameShader/shader.pyx":4463
 *                     l = max(l, <float>0.0)
 * 
 *                     rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)             # <<<<<<<<<<<<<<
 * 
 *                     rgb_array_[i, j, 0] = <unsigned char> (rgb_.r * 255.0)
 */
              __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_hsl_.h, __pyx_v_hsl_.s, __pyx_v_l);

              /* "PygameShader/shader.pyx":4465
 *                     rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)
 * 
 *                     rgb_array_[i, j, 0] = <unsigned char> (rgb_.r * 255.0)             # <<<<<<<<<<<<<<
 *                     rgb_array_[i, j, 1] = <unsigned char> (rgb_.g * 255.0)
 *                     rgb_array_[i, j, 2] = <unsigned char> (rgb_.b * 255.0)
 */
              __pyx_t_12 = __pyx_v_i;
              __pyx_t_11 = __pyx_v_j;
              __pyx_t_10 = 0;
              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.r * 255.0));

              /* "PygameShader/shader.pyx":4466
 * 
 *                     rgb_array_[i, j, 0] = <unsigned char> (rgb_.r * 255.0)
 *                     rgb_array_[i, j, 1] = <unsigned char> (rgb_.g * 255.0)             # <<<<<<<<<<<<<<
 *                     rgb_array_[i, j, 2] = <unsigned char> (rgb_.b * 255.0)
 * 
 */
              __pyx_t_10 = __pyx_v_i;
              __pyx_t_11 = __pyx_v_j;
              __pyx_t_12 = 1;
              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.g * 255.0));

              /* "PygameShader/shader.pyx":4467
 *                     rgb_array_[i, j, 0] = <unsigned char> (rgb_.r * 255.0)
 *                     rgb_array_[i, j, 1] = <unsigned char> (rgb_.g * 255.0)
 *                     rgb_array_[i, j, 2] = <unsigned char> (rgb_.b * 255.0)             # <<<<<<<<<<<<<<
 * 
 * 
 */
              __pyx_t_12 = __pyx_v_i;
              __pyx_t_11 = __pyx_v_j;
              __pyx_t_10 = 2;
              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.b * 255.0));

              /* "PygameShader/shader.pyx":4455
 *                 r, g, b = rgb_array_[i, j, 0], rgb_array_[i, j, 1], rgb_array_[i, j, 2]
 * 
 *                 if not ((r==rr) and (g==gg) and (b==bb)):             # <<<<<<<<<<<<<<
 * 
 *                     hsl_ = struct_rgb_to_hsl(
 */
            }
          }
        }
      }

      /* "PygameShader/shader.pyx":4449
 *         unsigned char rr=color_[0], gg=color_[1], bb=color_[2]
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in range(height): #, schedule='static', num_threads=THREADS):
 *             for i in range(width):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4413
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness24_exclude_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float shift_=0.0, color_=(0, 0, 0)):
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_brightness24_exclude_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4475
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness24_bpf_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float shift_=0.0,
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness24_bpf_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_bpf_c *__pyx_optional_args) {
  float __pyx_v_shift_ = ((float)0.0);
  unsigned char __pyx_v_bpf_treshold_ = ((unsigned char)64);
  Py_ssize_t __pyx_v_width;
  CYTHON_UNUSED Py_ssize_t __pyx_v_height;
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned char __pyx_v_r;
  unsigned char __pyx_v_g;
  unsigned char __pyx_v_b;
  float __pyx_v_l;
  struct hsl __pyx_v_hsl_;
  struct rgb __pyx_v_rgb_;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  unsigned char __pyx_t_11;
  unsigned char __pyx_t_12;
  unsigned char __pyx_t_13;
  int __pyx_t_14;
  float __pyx_t_15;
  float __pyx_t_16;
  float __pyx_t_17;
  __Pyx_RefNannySetupContext("shader_brightness24_bpf_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_shift_ = __pyx_optional_args->shift_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_bpf_treshold_ = __pyx_optional_args->bpf_treshold_;
      }
    }
  }

  /* "PygameShader/shader.pyx":4490
 * 
 *     cdef Py_ssize_t width, height
 *     width, height = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_width = __pyx_t_2;
  __pyx_v_height = __pyx_t_3;

  /* "PygameShader/shader.pyx":4493
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         unsigned char r
 *         unsigned char g
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":4503
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(height, schedule='static', num_threads=THREADS):
 *             for i in range(width):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4504
 * 
 *     with nogil:
 *         for j in prange(height, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(width):
 * 
 */
        __pyx_t_3 = __pyx_v_height;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char)'?');
                            __pyx_v_g = ((unsigned char)'?');
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_l = ((float)__PYX_NAN());
                            __pyx_v_r = ((unsigned char)'?');

                            /* "PygameShader/shader.pyx":4505
 *     with nogil:
 *         for j in prange(height, schedule='static', num_threads=THREADS):
 *             for i in range(width):             # <<<<<<<<<<<<<<
 * 
 *                 r, g, b = rgb_array_[i, j, 0], rgb_array_[i, j, 1], rgb_array_[i, j, 2]
 */
                            __pyx_t_5 = __pyx_v_width;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_i = __pyx_t_7;

                              /* "PygameShader/shader.pyx":4507
 *             for i in range(width):
 * 
 *                 r, g, b = rgb_array_[i, j, 0], rgb_array_[i, j, 1], rgb_array_[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 *                 if r + g + b < bpf_treshold_:
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 0;
                              __pyx_t_11 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_8 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )));
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 1;
                              __pyx_t_12 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array_.strides[2]) )));
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 2;
                              __pyx_t_13 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_8 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )));
                              __pyx_v_r = __pyx_t_11;
                              __pyx_v_g = __pyx_t_12;
                              __pyx_v_b = __pyx_t_13;

                              /* "PygameShader/shader.pyx":4509
 *                 r, g, b = rgb_array_[i, j, 0], rgb_array_[i, j, 1], rgb_array_[i, j, 2]
 * 
 *                 if r + g + b < bpf_treshold_:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
                              __pyx_t_14 = ((((__pyx_v_r + __pyx_v_g) + __pyx_v_b) < __pyx_v_bpf_treshold_) != 0);
                              if (__pyx_t_14) {

                                /* "PygameShader/shader.pyx":4510
 * 
 *                 if r + g + b < bpf_treshold_:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 hsl_ = struct_rgb_to_hsl(
 */
                                goto __pyx_L10_continue;

                                /* "PygameShader/shader.pyx":4509
 *                 r, g, b = rgb_array_[i, j, 0], rgb_array_[i, j, 1], rgb_array_[i, j, 2]
 * 
 *                 if r + g + b < bpf_treshold_:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":4512
 *                     continue
 * 
 *                 hsl_ = struct_rgb_to_hsl(             # <<<<<<<<<<<<<<
 *                     r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)
 * 
 */
                              __pyx_v_hsl_ = struct_rgb_to_hsl((__pyx_v_r * ((float)0.00392156862745098)), (__pyx_v_g * ((float)0.00392156862745098)), (__pyx_v_b * ((float)0.00392156862745098)));

                              /* "PygameShader/shader.pyx":4515
 *                     r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)
 * 
 *                 l = min((hsl_.l + shift_), <float>1.0)             # <<<<<<<<<<<<<<
 *                 l = max(l, <float>0.0)
 * 
 */
                              __pyx_t_15 = ((float)1.0);
                              __pyx_t_16 = (__pyx_v_hsl_.l + __pyx_v_shift_);
                              if (((__pyx_t_15 < __pyx_t_16) != 0)) {
                                __pyx_t_17 = __pyx_t_15;
                              } else {
                                __pyx_t_17 = __pyx_t_16;
                              }
                              __pyx_v_l = __pyx_t_17;

                              /* "PygameShader/shader.pyx":4516
 * 
 *                 l = min((hsl_.l + shift_), <float>1.0)
 *                 l = max(l, <float>0.0)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)
 */
                              __pyx_t_17 = ((float)0.0);
                              __pyx_t_15 = __pyx_v_l;
                              if (((__pyx_t_17 > __pyx_t_15) != 0)) {
                                __pyx_t_16 = __pyx_t_17;
                              } else {
                                __pyx_t_16 = __pyx_t_15;
                              }
                              __pyx_v_l = __pyx_t_16;

                              /* "PygameShader/shader.pyx":4518
 *                 l = max(l, <float>0.0)
 * 
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[i, j, 0] = <unsigned char> (rgb_.r * 255.0 )
 */
                              __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_hsl_.h, __pyx_v_hsl_.s, __pyx_v_l);

                              /* "PygameShader/shader.pyx":4520
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)
 * 
 *                 rgb_array_[i, j, 0] = <unsigned char> (rgb_.r * 255.0 )             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 1] = <unsigned char> (rgb_.g * 255.0 )
 *                 rgb_array_[i, j, 2] = <unsigned char> (rgb_.b * 255.0 )
 */
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.r * 255.0));

                              /* "PygameShader/shader.pyx":4521
 * 
 *                 rgb_array_[i, j, 0] = <unsigned char> (rgb_.r * 255.0 )
 *                 rgb_array_[i, j, 1] = <unsigned char> (rgb_.g * 255.0 )             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 2] = <unsigned char> (rgb_.b * 255.0 )
 * 
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_8 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.g * 255.0));

                              /* "PygameShader/shader.pyx":4522
 *                 rgb_array_[i, j, 0] = <unsigned char> (rgb_.r * 255.0 )
 *                 rgb_array_[i, j, 1] = <unsigned char> (rgb_.g * 255.0 )
 *                 rgb_array_[i, j, 2] = <unsigned char> (rgb_.b * 255.0 )             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_10 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_8 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.b * 255.0));
                              __pyx_L10_continue:;
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4503
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(height, schedule='static', num_threads=THREADS):
 *             for i in range(width):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4475
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness24_bpf_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float shift_=0.0,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4530
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness_24_inplace1_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float shift_, float [:, :, :, :] rgb_to_hsl_model):
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness_24_inplace1_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_rgb_to_hsl_model) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_width;
  Py_ssize_t __pyx_v_height;
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  float __pyx_v_l;
  float __pyx_v_h;
  float __pyx_v_s;
  struct rgb __pyx_v_rgb_;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  unsigned char *__pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  unsigned char *__pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  unsigned char *__pyx_t_19;
  size_t __pyx_t_20;
  size_t __pyx_t_21;
  size_t __pyx_t_22;
  float __pyx_t_23;
  float __pyx_t_24;
  float __pyx_t_25;
  __Pyx_RefNannySetupContext("shader_brightness_24_inplace1_c", 0);

  /* "PygameShader/shader.pyx":4553
 * 
 *     cdef Py_ssize_t width, height
 *     width, height = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_width = __pyx_t_2;
  __pyx_v_height = __pyx_t_3;

  /* "PygameShader/shader.pyx":4556
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":4565
 *         float high, low, high_
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for i in prange(width, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4567
 *     with nogil:
 * 
 *         for i in prange(width, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for j in range(height):
 * 
 */
        __pyx_t_3 = __pyx_v_width;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_h) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_h = ((float)__PYX_NAN());
                            __pyx_v_j = ((int)0xbad0bad0);
                            __pyx_v_l = ((float)__PYX_NAN());
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_s = ((float)__PYX_NAN());

                            /* "PygameShader/shader.pyx":4568
 * 
 *         for i in prange(width, schedule='static', num_threads=THREADS):
 *             for j in range(height):             # <<<<<<<<<<<<<<
 * 
 *                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]
 */
                            __pyx_t_5 = __pyx_v_height;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_j = __pyx_t_7;

                              /* "PygameShader/shader.pyx":4570
 *             for j in range(height):
 * 
 *                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 *                 h = rgb_to_hsl_model[r[0], g[0], b[0], 0]
 */
                              __pyx_t_8 = __pyx_v_i;
                              __pyx_t_9 = __pyx_v_j;
                              __pyx_t_10 = 0;
                              __pyx_t_11 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_8 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))));
                              __pyx_t_12 = __pyx_v_i;
                              __pyx_t_13 = __pyx_v_j;
                              __pyx_t_14 = 1;
                              __pyx_t_15 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) ))));
                              __pyx_t_16 = __pyx_v_i;
                              __pyx_t_17 = __pyx_v_j;
                              __pyx_t_18 = 2;
                              __pyx_t_19 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) ))));
                              __pyx_v_r = __pyx_t_11;
                              __pyx_v_g = __pyx_t_15;
                              __pyx_v_b = __pyx_t_19;

                              /* "PygameShader/shader.pyx":4572
 *                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]
 * 
 *                 h = rgb_to_hsl_model[r[0], g[0], b[0], 0]             # <<<<<<<<<<<<<<
 *                 s = rgb_to_hsl_model[r[0], g[0], b[0], 1]
 *                 l = rgb_to_hsl_model[r[0], g[0], b[0], 2]
 */
                              __pyx_t_20 = (__pyx_v_r[0]);
                              __pyx_t_21 = (__pyx_v_g[0]);
                              __pyx_t_22 = (__pyx_v_b[0]);
                              __pyx_t_18 = 0;
                              __pyx_v_h = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl_model.data + __pyx_t_20 * __pyx_v_rgb_to_hsl_model.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_to_hsl_model.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_to_hsl_model.strides[2]) ) + __pyx_t_18 * __pyx_v_rgb_to_hsl_model.strides[3]) )));

                              /* "PygameShader/shader.pyx":4573
 * 
 *                 h = rgb_to_hsl_model[r[0], g[0], b[0], 0]
 *                 s = rgb_to_hsl_model[r[0], g[0], b[0], 1]             # <<<<<<<<<<<<<<
 *                 l = rgb_to_hsl_model[r[0], g[0], b[0], 2]
 * 
 */
                              __pyx_t_22 = (__pyx_v_r[0]);
                              __pyx_t_21 = (__pyx_v_g[0]);
                              __pyx_t_20 = (__pyx_v_b[0]);
                              __pyx_t_18 = 1;
                              __pyx_v_s = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl_model.data + __pyx_t_22 * __pyx_v_rgb_to_hsl_model.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_to_hsl_model.strides[1]) ) + __pyx_t_20 * __pyx_v_rgb_to_hsl_model.strides[2]) ) + __pyx_t_18 * __pyx_v_rgb_to_hsl_model.strides[3]) )));

                              /* "PygameShader/shader.pyx":4574
 *                 h = rgb_to_hsl_model[r[0], g[0], b[0], 0]
 *                 s = rgb_to_hsl_model[r[0], g[0], b[0], 1]
 *                 l = rgb_to_hsl_model[r[0], g[0], b[0], 2]             # <<<<<<<<<<<<<<
 * 
 *                 l = min((l + shift_), <float>1.0)
 */
                              __pyx_t_20 = (__pyx_v_r[0]);
                              __pyx_t_21 = (__pyx_v_g[0]);
                              __pyx_t_22 = (__pyx_v_b[0]);
                              __pyx_t_18 = 2;
                              __pyx_v_l = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl_model.data + __pyx_t_20 * __pyx_v_rgb_to_hsl_model.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_to_hsl_model.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_to_hsl_model.strides[2]) ) + __pyx_t_18 * __pyx_v_rgb_to_hsl_model.strides[3]) )));

                              /* "PygameShader/shader.pyx":4576
 *                 l = rgb_to_hsl_model[r[0], g[0], b[0], 2]
 * 
 *                 l = min((l + shift_), <float>1.0)             # <<<<<<<<<<<<<<
 *                 l = max(l, <float>0.0)
 * 
 */
                              __pyx_t_23 = ((float)1.0);
                              __pyx_t_24 = (__pyx_v_l + __pyx_v_shift_);
                              if (((__pyx_t_23 < __pyx_t_24) != 0)) {
                                __pyx_t_25 = __pyx_t_23;
                              } else {
                                __pyx_t_25 = __pyx_t_24;
                              }
                              __pyx_v_l = __pyx_t_25;

                              /* "PygameShader/shader.pyx":4577
 * 
 *                 l = min((l + shift_), <float>1.0)
 *                 l = max(l, <float>0.0)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_ = struct_hsl_to_rgb(h, s, l)
 */
                              __pyx_t_25 = ((float)0.0);
                              __pyx_t_23 = __pyx_v_l;
                              if (((__pyx_t_25 > __pyx_t_23) != 0)) {
                                __pyx_t_24 = __pyx_t_25;
                              } else {
                                __pyx_t_24 = __pyx_t_23;
                              }
                              __pyx_v_l = __pyx_t_24;

                              /* "PygameShader/shader.pyx":4579
 *                 l = max(l, <float>0.0)
 * 
 *                 rgb_ = struct_hsl_to_rgb(h, s, l)             # <<<<<<<<<<<<<<
 *                 r[0] = <unsigned char> (rgb_.r * <float>255.0)
 *                 g[0] = <unsigned char> (rgb_.g * <float>255.0)
 */
                              __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_h, __pyx_v_s, __pyx_v_l);

                              /* "PygameShader/shader.pyx":4580
 * 
 *                 rgb_ = struct_hsl_to_rgb(h, s, l)
 *                 r[0] = <unsigned char> (rgb_.r * <float>255.0)             # <<<<<<<<<<<<<<
 *                 g[0] = <unsigned char> (rgb_.g * <float>255.0)
 *                 b[0] = <unsigned char> (rgb_.b * <float>255.0)
 */
                              (__pyx_v_r[0]) = ((unsigned char)(__pyx_v_rgb_.r * ((float)255.0)));

                              /* "PygameShader/shader.pyx":4581
 *                 rgb_ = struct_hsl_to_rgb(h, s, l)
 *                 r[0] = <unsigned char> (rgb_.r * <float>255.0)
 *                 g[0] = <unsigned char> (rgb_.g * <float>255.0)             # <<<<<<<<<<<<<<
 *                 b[0] = <unsigned char> (rgb_.b * <float>255.0)
 * 
 */
                              (__pyx_v_g[0]) = ((unsigned char)(__pyx_v_rgb_.g * ((float)255.0)));

                              /* "PygameShader/shader.pyx":4582
 *                 r[0] = <unsigned char> (rgb_.r * <float>255.0)
 *                 g[0] = <unsigned char> (rgb_.g * <float>255.0)
 *                 b[0] = <unsigned char> (rgb_.b * <float>255.0)             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              (__pyx_v_b[0]) = ((unsigned char)(__pyx_v_rgb_.b * ((float)255.0)));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4565
 *         float high, low, high_
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for i in prange(width, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4530
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_brightness_24_inplace1_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float shift_, float [:, :, :, :] rgb_to_hsl_model):
 *     """
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4591
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_saturation_array24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float shift_):
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_saturation_array24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_shift_) {
  Py_ssize_t __pyx_v_width;
  CYTHON_UNUSED Py_ssize_t __pyx_v_height;
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  float __pyx_v_s;
  struct hsl __pyx_v_hsl_;
  struct rgb __pyx_v_rgb_;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  unsigned char *__pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  unsigned char *__pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  unsigned char *__pyx_t_20;
  float __pyx_t_21;
  float __pyx_t_22;
  float __pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_saturation_array24_inplace_c", 0);

  /* "PygameShader/shader.pyx":4610
 *     """
 * 
 *     assert -1.0 <= shift_ <= 1.0, \             # <<<<<<<<<<<<<<
 *         "Argument shift must be in range[-1.0 ... 1.0]"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (-1.0 <= __pyx_v_shift_);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_shift_ <= 1.0);
    }
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift_must_be_in_range);
      __PYX_ERR(1, 4610, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":4614
 * 
 *     cdef Py_ssize_t width, height
 *     width, height = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = __pyx_v_rgb_array_.shape;
  __pyx_t_3 = (__pyx_t_2[0]);
  __pyx_t_4 = (__pyx_t_2[1]);
  __pyx_v_width = __pyx_t_3;
  __pyx_v_height = __pyx_t_4;

  /* "PygameShader/shader.pyx":4617
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":4626
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(height, schedule='static', num_threads=THREADS):
 *             for i in range(width):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4627
 * 
 *     with nogil:
 *         for j in prange(height, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(width):
 *                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]
 */
        __pyx_t_4 = __pyx_v_height;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_5 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_5 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_3);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_s = ((float)__PYX_NAN());

                            /* "PygameShader/shader.pyx":4628
 *     with nogil:
 *         for j in prange(height, schedule='static', num_threads=THREADS):
 *             for i in range(width):             # <<<<<<<<<<<<<<
 *                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]
 *                 hsl_ = struct_rgb_to_hsl(<float>r[0] * <float>ONE_255,
 */
                            __pyx_t_6 = __pyx_v_width;
                            __pyx_t_7 = __pyx_t_6;
                            for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
                              __pyx_v_i = __pyx_t_8;

                              /* "PygameShader/shader.pyx":4629
 *         for j in prange(height, schedule='static', num_threads=THREADS):
 *             for i in range(width):
 *                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]             # <<<<<<<<<<<<<<
 *                 hsl_ = struct_rgb_to_hsl(<float>r[0] * <float>ONE_255,
 *                                          <float>g[0] * <float>ONE_255,
 */
                              __pyx_t_9 = __pyx_v_i;
                              __pyx_t_10 = __pyx_v_j;
                              __pyx_t_11 = 0;
                              __pyx_t_12 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_9 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[2]) ))));
                              __pyx_t_13 = __pyx_v_i;
                              __pyx_t_14 = __pyx_v_j;
                              __pyx_t_15 = 1;
                              __pyx_t_16 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));
                              __pyx_t_17 = __pyx_v_i;
                              __pyx_t_18 = __pyx_v_j;
                              __pyx_t_19 = 2;
                              __pyx_t_20 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_17 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_19 * __pyx_v_rgb_array_.strides[2]) ))));
                              __pyx_v_r = __pyx_t_12;
                              __pyx_v_g = __pyx_t_16;
                              __pyx_v_b = __pyx_t_20;

                              /* "PygameShader/shader.pyx":4630
 *             for i in range(width):
 *                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]
 *                 hsl_ = struct_rgb_to_hsl(<float>r[0] * <float>ONE_255,             # <<<<<<<<<<<<<<
 *                                          <float>g[0] * <float>ONE_255,
 *                                          <float>b[0] * <float>ONE_255)
 */
                              __pyx_v_hsl_ = struct_rgb_to_hsl((((float)(__pyx_v_r[0])) * ((float)0.00392156862745098)), (((float)(__pyx_v_g[0])) * ((float)0.00392156862745098)), (((float)(__pyx_v_b[0])) * ((float)0.00392156862745098)));

                              /* "PygameShader/shader.pyx":4634
 *                                          <float>b[0] * <float>ONE_255)
 * 
 *                 s = min((hsl_.s + shift_), <float>0.5)             # <<<<<<<<<<<<<<
 *                 s = max(s, <float>0.0)
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, s, hsl_.l)
 */
                              __pyx_t_21 = ((float)0.5);
                              __pyx_t_22 = (__pyx_v_hsl_.s + __pyx_v_shift_);
                              if (((__pyx_t_21 < __pyx_t_22) != 0)) {
                                __pyx_t_23 = __pyx_t_21;
                              } else {
                                __pyx_t_23 = __pyx_t_22;
                              }
                              __pyx_v_s = __pyx_t_23;

                              /* "PygameShader/shader.pyx":4635
 * 
 *                 s = min((hsl_.s + shift_), <float>0.5)
 *                 s = max(s, <float>0.0)             # <<<<<<<<<<<<<<
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, s, hsl_.l)
 *                 r[0] = <unsigned char>(rgb_.r * <float>255.0)
 */
                              __pyx_t_23 = ((float)0.0);
                              __pyx_t_21 = __pyx_v_s;
                              if (((__pyx_t_23 > __pyx_t_21) != 0)) {
                                __pyx_t_22 = __pyx_t_23;
                              } else {
                                __pyx_t_22 = __pyx_t_21;
                              }
                              __pyx_v_s = __pyx_t_22;

                              /* "PygameShader/shader.pyx":4636
 *                 s = min((hsl_.s + shift_), <float>0.5)
 *                 s = max(s, <float>0.0)
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, s, hsl_.l)             # <<<<<<<<<<<<<<
 *                 r[0] = <unsigned char>(rgb_.r * <float>255.0)
 *                 g[0] = <unsigned char>(rgb_.g * <float>255.0)
 */
                              __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_hsl_.h, __pyx_v_s, __pyx_v_hsl_.l);

                              /* "PygameShader/shader.pyx":4637
 *                 s = max(s, <float>0.0)
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, s, hsl_.l)
 *                 r[0] = <unsigned char>(rgb_.r * <float>255.0)             # <<<<<<<<<<<<<<
 *                 g[0] = <unsigned char>(rgb_.g * <float>255.0)
 *                 b[0] = <unsigned char>(rgb_.b * <float>255.0)
 */
                              (__pyx_v_r[0]) = ((unsigned char)(__pyx_v_rgb_.r * ((float)255.0)));

                              /* "PygameShader/shader.pyx":4638
 *                 rgb_ = struct_hsl_to_rgb(hsl_.h, s, hsl_.l)
 *                 r[0] = <unsigned char>(rgb_.r * <float>255.0)
 *                 g[0] = <unsigned char>(rgb_.g * <float>255.0)             # <<<<<<<<<<<<<<
 *                 b[0] = <unsigned char>(rgb_.b * <float>255.0)
 * 
 */
                              (__pyx_v_g[0]) = ((unsigned char)(__pyx_v_rgb_.g * ((float)255.0)));

                              /* "PygameShader/shader.pyx":4639
 *                 r[0] = <unsigned char>(rgb_.r * <float>255.0)
 *                 g[0] = <unsigned char>(rgb_.g * <float>255.0)
 *                 b[0] = <unsigned char>(rgb_.b * <float>255.0)             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              (__pyx_v_b[0]) = ((unsigned char)(__pyx_v_rgb_.b * ((float)255.0)));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4626
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(height, schedule='static', num_threads=THREADS):
 *             for i in range(width):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4591
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_saturation_array24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float shift_):
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PygameShader.shader.shader_saturation_array24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4653
 * #         surface_, numpy.full((w, h), 255, dtype=numpy.uint8),
 * #         b*random.uniform(55.0, 100), 0, sigma_=random.uniform(0.4, 1), mu_=b*2)
 * cdef inline void shader_heatwave24_vertical_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         unsigned char [:, :] mask,
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_heatwave24_vertical_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_mask, float __pyx_v_amplitude_, float __pyx_v_center_, float __pyx_v_sigma_, float __pyx_v_mu_) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_yy;
  int __pyx_v_h_1;
  __Pyx_memviewslice __pyx_v_f_gauss = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  float __pyx_t_15;
  struct __pyx_opt_args_12PygameShader_6shader_gauss __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_heatwave24_vertical_inplace_c", 0);

  /* "PygameShader/shader.pyx":4685
 * 
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":4688
 * 
 *     cdef:
 *         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=False)             # <<<<<<<<<<<<<<
 *         int x = 0, y = 0
 *         int yy
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_False) < 0) __PYX_ERR(1, 4688, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 4688, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_rgb_array_copy = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":4689
 *     cdef:
 *         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=False)
 *         int x = 0, y = 0             # <<<<<<<<<<<<<<
 *         int yy
 *         int h_1 = <int>h - 1
 */
  __pyx_v_x = 0;
  __pyx_v_y = 0;

  /* "PygameShader/shader.pyx":4691
 *         int x = 0, y = 0
 *         int yy
 *         int h_1 = <int>h - 1             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         float [::1] f_gauss = linspace(-4, 4, w, dtype=float32)
 */
  __pyx_v_h_1 = (((int)__pyx_v_h) - 1);

  /* "PygameShader/shader.pyx":4693
 *         int h_1 = <int>h - 1
 *         unsigned char *r
 *         float [::1] f_gauss = linspace(-4, 4, w, dtype=float32)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_int_neg_4);
  __Pyx_GIVEREF(__pyx_int_neg_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_neg_4);
  __Pyx_INCREF(__pyx_int_4);
  __Pyx_GIVEREF(__pyx_int_4);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 4693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 4693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_f_gauss = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":4696
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4698
 *     with nogil:
 * 
 *         for x in prange(w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *             for y in range(h):
 */
        __pyx_t_3 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_10 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_10 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_10; __pyx_t_2++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_y = ((int)0xbad0bad0);
                            __pyx_v_yy = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":4700
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 * 
 *             for y in range(h):             # <<<<<<<<<<<<<<
 * 
 *                 yy =<int>(gauss(f_gauss[x], center_, sigma_, mu_) * amplitude_ + y)
 */
                            __pyx_t_11 = __pyx_v_h;
                            __pyx_t_12 = __pyx_t_11;
                            for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
                              __pyx_v_y = __pyx_t_13;

                              /* "PygameShader/shader.pyx":4702
 *             for y in range(h):
 * 
 *                 yy =<int>(gauss(f_gauss[x], center_, sigma_, mu_) * amplitude_ + y)             # <<<<<<<<<<<<<<
 * 
 *                 # printf("\n %i ", yy)
 */
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_16.__pyx_n = 2;
                              __pyx_t_16.sigma = __pyx_v_sigma_;
                              __pyx_t_16.mu = __pyx_v_mu_;
                              __pyx_t_15 = __pyx_f_12PygameShader_6shader_gauss((*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_f_gauss.data) + __pyx_t_14)) ))), __pyx_v_center_, &__pyx_t_16); 
                              __pyx_v_yy = ((int)((__pyx_t_15 * __pyx_v_amplitude_) + __pyx_v_y));

                              /* "PygameShader/shader.pyx":4705
 * 
 *                 # printf("\n %i ", yy)
 *                 if yy > h_1:             # <<<<<<<<<<<<<<
 *                     yy = h_1
 * 
 */
                              __pyx_t_17 = ((__pyx_v_yy > __pyx_v_h_1) != 0);
                              if (__pyx_t_17) {

                                /* "PygameShader/shader.pyx":4706
 *                 # printf("\n %i ", yy)
 *                 if yy > h_1:
 *                     yy = h_1             # <<<<<<<<<<<<<<
 * 
 *                 if yy < 0:
 */
                                __pyx_v_yy = __pyx_v_h_1;

                                /* "PygameShader/shader.pyx":4705
 * 
 *                 # printf("\n %i ", yy)
 *                 if yy > h_1:             # <<<<<<<<<<<<<<
 *                     yy = h_1
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":4708
 *                     yy = h_1
 * 
 *                 if yy < 0:             # <<<<<<<<<<<<<<
 *                     yy = 0
 * 
 */
                              __pyx_t_17 = ((__pyx_v_yy < 0) != 0);
                              if (__pyx_t_17) {

                                /* "PygameShader/shader.pyx":4709
 * 
 *                 if yy < 0:
 *                     yy = 0             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x, yy, 0]
 */
                                __pyx_v_yy = 0;

                                /* "PygameShader/shader.pyx":4708
 *                     yy = h_1
 * 
 *                 if yy < 0:             # <<<<<<<<<<<<<<
 *                     yy = 0
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":4711
 *                     yy = 0
 * 
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x, yy, 0]             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y, 1] = rgb_array_copy[x, yy, 1]
 *                 rgb_array_[x, y, 2] = rgb_array_copy[x, yy, 2]
 */
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_18 = __pyx_v_yy;
                              __pyx_t_19 = 0;
                              __pyx_t_20 = __pyx_v_x;
                              __pyx_t_21 = __pyx_v_y;
                              __pyx_t_22 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_20 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_18 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_19 * __pyx_v_rgb_array_copy.strides[2]) )));

                              /* "PygameShader/shader.pyx":4712
 * 
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x, yy, 0]
 *                 rgb_array_[x, y, 1] = rgb_array_copy[x, yy, 1]             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y, 2] = rgb_array_copy[x, yy, 2]
 * 
 */
                              __pyx_t_19 = __pyx_v_x;
                              __pyx_t_18 = __pyx_v_yy;
                              __pyx_t_14 = 1;
                              __pyx_t_22 = __pyx_v_x;
                              __pyx_t_21 = __pyx_v_y;
                              __pyx_t_20 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_22 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_20 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_19 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_18 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[2]) )));

                              /* "PygameShader/shader.pyx":4713
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x, yy, 0]
 *                 rgb_array_[x, y, 1] = rgb_array_copy[x, yy, 1]
 *                 rgb_array_[x, y, 2] = rgb_array_copy[x, yy, 2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_18 = __pyx_v_yy;
                              __pyx_t_19 = 2;
                              __pyx_t_20 = __pyx_v_x;
                              __pyx_t_21 = __pyx_v_y;
                              __pyx_t_22 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_20 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_18 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_19 * __pyx_v_rgb_array_copy.strides[2]) )));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4696
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4653
 * #         surface_, numpy.full((w, h), 255, dtype=numpy.uint8),
 * #         b*random.uniform(55.0, 100), 0, sigma_=random.uniform(0.4, 1), mu_=b*2)
 * cdef inline void shader_heatwave24_vertical_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         unsigned char [:, :] mask,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_heatwave24_vertical_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_f_gauss, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4723
 * @cython.cdivision(False)
 * # e.g horizontal_glitch(surface, 0.5, 0.08, frame % 20)
 * cdef inline void shader_horizontal_glitch24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float rad1_,
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_horizontal_glitch24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_rad1_, float __pyx_v_frequency_, float __pyx_v_amplitude_) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  float __pyx_v_rad;
  float __pyx_v_angle;
  float __pyx_v_angle1;
  __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_ii;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  unsigned char __pyx_t_17;
  unsigned char __pyx_t_18;
  unsigned char __pyx_t_19;
  int __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_horizontal_glitch24_inplace_c", 0);

  /* "PygameShader/shader.pyx":4745
 *     """
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":4748
 * 
 *     cdef:
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         float rad = <float>(3.14/180.0)
 *         float angle = 0
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":4749
 *     cdef:
 *         int i=0, j=0
 *         float rad = <float>(3.14/180.0)             # <<<<<<<<<<<<<<
 *         float angle = 0
 *         float angle1 = 0
 */
  __pyx_v_rad = ((float)(3.14 / 180.0));

  /* "PygameShader/shader.pyx":4750
 *         int i=0, j=0
 *         float rad = <float>(3.14/180.0)
 *         float angle = 0             # <<<<<<<<<<<<<<
 *         float angle1 = 0
 *         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=True)
 */
  __pyx_v_angle = 0.0;

  /* "PygameShader/shader.pyx":4751
 *         float rad = <float>(3.14/180.0)
 *         float angle = 0
 *         float angle1 = 0             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=True)
 *         int ii=0
 */
  __pyx_v_angle1 = 0.0;

  /* "PygameShader/shader.pyx":4752
 *         float angle = 0
 *         float angle1 = 0
 *         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=True)             # <<<<<<<<<<<<<<
 *         int ii=0
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 4752, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 4752, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_rgb_array_copy = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":4753
 *         float angle1 = 0
 *         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=True)
 *         int ii=0             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_ii = 0;

  /* "PygameShader/shader.pyx":4755
 *         int ii=0
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for j in range(h):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4757
 *     with nogil:
 * 
 *         for j in range(h):             # <<<<<<<<<<<<<<
 * 
 *             for i in range(w):
 */
        __pyx_t_3 = __pyx_v_h;
        __pyx_t_2 = __pyx_t_3;
        for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_2; __pyx_t_9+=1) {
          __pyx_v_j = __pyx_t_9;

          /* "PygameShader/shader.pyx":4759
 *         for j in range(h):
 * 
 *             for i in range(w):             # <<<<<<<<<<<<<<
 * 
 *                 ii = (i + <int>(<float>cos(angle) * amplitude_))
 */
          __pyx_t_10 = __pyx_v_w;
          __pyx_t_11 = __pyx_t_10;
          for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
            __pyx_v_i = __pyx_t_12;

            /* "PygameShader/shader.pyx":4761
 *             for i in range(w):
 * 
 *                 ii = (i + <int>(<float>cos(angle) * amplitude_))             # <<<<<<<<<<<<<<
 *                 if ii > <int>w - 1:
 *                     ii = <int>w - 1
 */
            __pyx_v_ii = (__pyx_v_i + ((int)(((float)cos(__pyx_v_angle)) * __pyx_v_amplitude_)));

            /* "PygameShader/shader.pyx":4762
 * 
 *                 ii = (i + <int>(<float>cos(angle) * amplitude_))
 *                 if ii > <int>w - 1:             # <<<<<<<<<<<<<<
 *                     ii = <int>w - 1
 *                 if ii < 0:
 */
            __pyx_t_13 = ((__pyx_v_ii > (((int)__pyx_v_w) - 1)) != 0);
            if (__pyx_t_13) {

              /* "PygameShader/shader.pyx":4763
 *                 ii = (i + <int>(<float>cos(angle) * amplitude_))
 *                 if ii > <int>w - 1:
 *                     ii = <int>w - 1             # <<<<<<<<<<<<<<
 *                 if ii < 0:
 *                     ii = 0
 */
              __pyx_v_ii = (((int)__pyx_v_w) - 1);

              /* "PygameShader/shader.pyx":4762
 * 
 *                 ii = (i + <int>(<float>cos(angle) * amplitude_))
 *                 if ii > <int>w - 1:             # <<<<<<<<<<<<<<
 *                     ii = <int>w - 1
 *                 if ii < 0:
 */
            }

            /* "PygameShader/shader.pyx":4764
 *                 if ii > <int>w - 1:
 *                     ii = <int>w - 1
 *                 if ii < 0:             # <<<<<<<<<<<<<<
 *                     ii = 0
 * 
 */
            __pyx_t_13 = ((__pyx_v_ii < 0) != 0);
            if (__pyx_t_13) {

              /* "PygameShader/shader.pyx":4765
 *                     ii = <int>w - 1
 *                 if ii < 0:
 *                     ii = 0             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[i, j, 0],\
 */
              __pyx_v_ii = 0;

              /* "PygameShader/shader.pyx":4764
 *                 if ii > <int>w - 1:
 *                     ii = <int>w - 1
 *                 if ii < 0:             # <<<<<<<<<<<<<<
 *                     ii = 0
 * 
 */
            }

            /* "PygameShader/shader.pyx":4769
 *                 rgb_array_[i, j, 0],\
 *                 rgb_array_[i, j, 1],\
 *                 rgb_array_[i, j, 2] = rgb_array_copy[ii, j, 0],\             # <<<<<<<<<<<<<<
 *                     rgb_array_copy[ii, j, 1], rgb_array_copy[ii, j, 2]
 * 
 */
            __pyx_t_14 = __pyx_v_ii;
            __pyx_t_15 = __pyx_v_j;
            __pyx_t_16 = 0;
            __pyx_t_17 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[2]) )));

            /* "PygameShader/shader.pyx":4770
 *                 rgb_array_[i, j, 1],\
 *                 rgb_array_[i, j, 2] = rgb_array_copy[ii, j, 0],\
 *                     rgb_array_copy[ii, j, 1], rgb_array_copy[ii, j, 2]             # <<<<<<<<<<<<<<
 * 
 *             angle1 = angle1 + frequency_ * rad
 */
            __pyx_t_16 = __pyx_v_ii;
            __pyx_t_15 = __pyx_v_j;
            __pyx_t_14 = 1;
            __pyx_t_18 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[2]) )));
            __pyx_t_14 = __pyx_v_ii;
            __pyx_t_15 = __pyx_v_j;
            __pyx_t_16 = 2;
            __pyx_t_19 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[2]) )));

            /* "PygameShader/shader.pyx":4767
 *                     ii = 0
 * 
 *                 rgb_array_[i, j, 0],\             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 1],\
 *                 rgb_array_[i, j, 2] = rgb_array_copy[ii, j, 0],\
 */
            __pyx_t_16 = __pyx_v_i;
            __pyx_t_15 = __pyx_v_j;
            __pyx_t_14 = 0;
            *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_17;

            /* "PygameShader/shader.pyx":4768
 * 
 *                 rgb_array_[i, j, 0],\
 *                 rgb_array_[i, j, 1],\             # <<<<<<<<<<<<<<
 *                 rgb_array_[i, j, 2] = rgb_array_copy[ii, j, 0],\
 *                     rgb_array_copy[ii, j, 1], rgb_array_copy[ii, j, 2]
 */
            __pyx_t_14 = __pyx_v_i;
            __pyx_t_15 = __pyx_v_j;
            __pyx_t_16 = 1;
            *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_18;

            /* "PygameShader/shader.pyx":4769
 *                 rgb_array_[i, j, 0],\
 *                 rgb_array_[i, j, 1],\
 *                 rgb_array_[i, j, 2] = rgb_array_copy[ii, j, 0],\             # <<<<<<<<<<<<<<
 *                     rgb_array_copy[ii, j, 1], rgb_array_copy[ii, j, 2]
 * 
 */
            __pyx_t_16 = __pyx_v_i;
            __pyx_t_15 = __pyx_v_j;
            __pyx_t_14 = 2;
            *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_19;
          }

          /* "PygameShader/shader.pyx":4772
 *                     rgb_array_copy[ii, j, 1], rgb_array_copy[ii, j, 2]
 * 
 *             angle1 = angle1 + frequency_ * rad             # <<<<<<<<<<<<<<
 *             angle = angle + (rad1_ * rad + rand() % angle1 - rand() % angle1)
 * 
 */
          __pyx_v_angle1 = (__pyx_v_angle1 + (__pyx_v_frequency_ * __pyx_v_rad));

          /* "PygameShader/shader.pyx":4773
 * 
 *             angle1 = angle1 + frequency_ * rad
 *             angle = angle + (rad1_ * rad + rand() % angle1 - rand() % angle1)             # <<<<<<<<<<<<<<
 * 
 * 
 */
          __pyx_t_12 = rand();
          if (unlikely(__pyx_v_angle1 == 0)) {
            #ifdef WITH_THREAD
            PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
            #endif
            PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
            #ifdef WITH_THREAD
            __Pyx_PyGILState_Release(__pyx_gilstate_save);
            #endif
            __PYX_ERR(1, 4773, __pyx_L4_error)
          }
          __pyx_t_20 = rand();
          if (unlikely(__pyx_v_angle1 == 0)) {
            #ifdef WITH_THREAD
            PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
            #endif
            PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
            #ifdef WITH_THREAD
            __Pyx_PyGILState_Release(__pyx_gilstate_save);
            #endif
            __PYX_ERR(1, 4773, __pyx_L4_error)
          }
          __pyx_v_angle = (__pyx_v_angle + (((__pyx_v_rad1_ * __pyx_v_rad) + __Pyx_mod_float(__pyx_t_12, __pyx_v_angle1)) - __Pyx_mod_float(__pyx_t_20, __pyx_v_angle1)));
        }
      }

      /* "PygameShader/shader.pyx":4755
 *         int ii=0
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for j in range(h):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4723
 * @cython.cdivision(False)
 * # e.g horizontal_glitch(surface, 0.5, 0.08, frame % 20)
 * cdef inline void shader_horizontal_glitch24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float rad1_,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_horizontal_glitch24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4782
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_bpf24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int threshold = 128, bint transpose=False):
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_bpf24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_bpf24_inplace_c *__pyx_optional_args) {
  int __pyx_v_threshold = ((int)0x80);
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  float __pyx_v_lum;
  float __pyx_v_c;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  unsigned char __pyx_t_12;
  unsigned char __pyx_t_13;
  unsigned char __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_bpf24_inplace_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_threshold = __pyx_optional_args->threshold;
    }
  }

  /* "PygameShader/shader.pyx":4799
 *     """
 * 
 *     assert 0 <= threshold <= 255, "Argument threshold must be in range [0 ... 255]"             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (0 <= __pyx_v_threshold);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_threshold <= 0xFF);
    }
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_threshold_must_be_in_ra);
      __PYX_ERR(1, 4799, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":4803
 *     cdef:
 *         Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = __pyx_v_rgb_array_.shape;
  __pyx_t_3 = (__pyx_t_2[0]);
  __pyx_t_4 = (__pyx_t_2[1]);
  __pyx_v_w = __pyx_t_3;
  __pyx_v_h = __pyx_t_4;

  /* "PygameShader/shader.pyx":4806
 * 
 *     cdef:
 *         int i = 0, j = 0             # <<<<<<<<<<<<<<
 *         float lum, c
 *         unsigned char *r
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":4812
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):
 *             for i in range(0, w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4813
 * 
 *     with nogil:
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(0, w):
 * 
 */
        __pyx_t_4 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_5 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_5 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_1, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_c) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_lum) lastprivate(__pyx_v_r) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_3);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_c = ((float)__PYX_NAN());
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_lum = ((float)__PYX_NAN());
                            __pyx_v_r = ((unsigned char *)1);

                            /* "PygameShader/shader.pyx":4814
 *     with nogil:
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):
 *             for i in range(0, w):             # <<<<<<<<<<<<<<
 * 
 *                 # ITU-R BT.601 luma coefficients
 */
                            __pyx_t_6 = __pyx_v_w;
                            __pyx_t_7 = __pyx_t_6;
                            for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
                              __pyx_v_i = __pyx_t_8;

                              /* "PygameShader/shader.pyx":4817
 * 
 *                 # ITU-R BT.601 luma coefficients
 *                 r = &rgb_array_[i, j, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array_[i, j, 1]
 *                 b = &rgb_array_[i, j, 2]
 */
                              __pyx_t_9 = __pyx_v_i;
                              __pyx_t_10 = __pyx_v_j;
                              __pyx_t_11 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_9 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4818
 *                 # ITU-R BT.601 luma coefficients
 *                 r = &rgb_array_[i, j, 0]
 *                 g = &rgb_array_[i, j, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array_[i, j, 2]
 * 
 */
                              __pyx_t_11 = __pyx_v_i;
                              __pyx_t_10 = __pyx_v_j;
                              __pyx_t_9 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_11 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4819
 *                 r = &rgb_array_[i, j, 0]
 *                 g = &rgb_array_[i, j, 1]
 *                 b = &rgb_array_[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 *                 lum = r[0] * <float>0.299 + g[0] * <float>0.587 + b[0] * <float>0.114
 */
                              __pyx_t_9 = __pyx_v_i;
                              __pyx_t_10 = __pyx_v_j;
                              __pyx_t_11 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_9 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4821
 *                 b = &rgb_array_[i, j, 2]
 * 
 *                 lum = r[0] * <float>0.299 + g[0] * <float>0.587 + b[0] * <float>0.114             # <<<<<<<<<<<<<<
 * 
 *                 if lum > threshold:
 */
                              __pyx_v_lum = ((((__pyx_v_r[0]) * ((float)0.299)) + ((__pyx_v_g[0]) * ((float)0.587))) + ((__pyx_v_b[0]) * ((float)0.114)));

                              /* "PygameShader/shader.pyx":4823
 *                 lum = r[0] * <float>0.299 + g[0] * <float>0.587 + b[0] * <float>0.114
 * 
 *                 if lum > threshold:             # <<<<<<<<<<<<<<
 *                     c = (lum - threshold) / lum
 *                     r[0] = <unsigned char>(r[0] * c)
 */
                              __pyx_t_1 = ((__pyx_v_lum > __pyx_v_threshold) != 0);
                              if (__pyx_t_1) {

                                /* "PygameShader/shader.pyx":4824
 * 
 *                 if lum > threshold:
 *                     c = (lum - threshold) / lum             # <<<<<<<<<<<<<<
 *                     r[0] = <unsigned char>(r[0] * c)
 *                     g[0] = <unsigned char>(g[0] * c)
 */
                                __pyx_v_c = ((__pyx_v_lum - __pyx_v_threshold) / __pyx_v_lum);

                                /* "PygameShader/shader.pyx":4825
 *                 if lum > threshold:
 *                     c = (lum - threshold) / lum
 *                     r[0] = <unsigned char>(r[0] * c)             # <<<<<<<<<<<<<<
 *                     g[0] = <unsigned char>(g[0] * c)
 *                     b[0] = <unsigned char>(b[0] * c)
 */
                                (__pyx_v_r[0]) = ((unsigned char)((__pyx_v_r[0]) * __pyx_v_c));

                                /* "PygameShader/shader.pyx":4826
 *                     c = (lum - threshold) / lum
 *                     r[0] = <unsigned char>(r[0] * c)
 *                     g[0] = <unsigned char>(g[0] * c)             # <<<<<<<<<<<<<<
 *                     b[0] = <unsigned char>(b[0] * c)
 *                 else:
 */
                                (__pyx_v_g[0]) = ((unsigned char)((__pyx_v_g[0]) * __pyx_v_c));

                                /* "PygameShader/shader.pyx":4827
 *                     r[0] = <unsigned char>(r[0] * c)
 *                     g[0] = <unsigned char>(g[0] * c)
 *                     b[0] = <unsigned char>(b[0] * c)             # <<<<<<<<<<<<<<
 *                 else:
 *                     r[0], g[0], b[0] = 0, 0, 0
 */
                                (__pyx_v_b[0]) = ((unsigned char)((__pyx_v_b[0]) * __pyx_v_c));

                                /* "PygameShader/shader.pyx":4823
 *                 lum = r[0] * <float>0.299 + g[0] * <float>0.587 + b[0] * <float>0.114
 * 
 *                 if lum > threshold:             # <<<<<<<<<<<<<<
 *                     c = (lum - threshold) / lum
 *                     r[0] = <unsigned char>(r[0] * c)
 */
                                goto __pyx_L12;
                              }

                              /* "PygameShader/shader.pyx":4829
 *                     b[0] = <unsigned char>(b[0] * c)
 *                 else:
 *                     r[0], g[0], b[0] = 0, 0, 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              /*else*/ {
                                __pyx_t_12 = 0;
                                __pyx_t_13 = 0;
                                __pyx_t_14 = 0;
                                (__pyx_v_r[0]) = __pyx_t_12;
                                (__pyx_v_g[0]) = __pyx_t_13;
                                (__pyx_v_b[0]) = __pyx_t_14;
                              }
                              __pyx_L12:;
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4812
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):
 *             for i in range(0, w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4782
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_bpf24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, int threshold = 128, bint transpose=False):
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PygameShader.shader.shader_bpf24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":4837
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline bpf24_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] input_array_,
 *         int threshold = 128,
 */

static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_bpf24_c(__Pyx_memviewslice __pyx_v_input_array_, struct __pyx_opt_args_12PygameShader_6shader_bpf24_c *__pyx_optional_args) {
  int __pyx_v_threshold = ((int)0x80);
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  float __pyx_v_lum;
  float __pyx_v_c;
  __Pyx_memviewslice __pyx_v_output_array_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bpf24_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_threshold = __pyx_optional_args->threshold;
    }
  }

  /* "PygameShader/shader.pyx":4855
 *     :return            :  Return the modified array shape (w, h, 3) uint8
 *     """
 *     assert 0 <= threshold <= 255, "Argument threshold must be in range [0 ... 255]"             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (0 <= __pyx_v_threshold);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_threshold <= 0xFF);
    }
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_threshold_must_be_in_ra);
      __PYX_ERR(1, 4855, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":4859
 *     cdef:
 *         Py_ssize_t w, h
 *     w, h = input_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = __pyx_v_input_array_.shape;
  __pyx_t_3 = (__pyx_t_2[0]);
  __pyx_t_4 = (__pyx_t_2[1]);
  __pyx_v_w = __pyx_t_3;
  __pyx_v_h = __pyx_t_4;

  /* "PygameShader/shader.pyx":4862
 * 
 *     cdef:
 *         int i = 0, j = 0             # <<<<<<<<<<<<<<
 *         float lum, c
 *         unsigned char [:, :, :] output_array_ = numpy.zeros((h, w, 3), uint8)
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":4864
 *         int i = 0, j = 0
 *         float lum, c
 *         unsigned char [:, :, :] output_array_ = numpy.zeros((h, w, 3), uint8)             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 4864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_3);
  __pyx_t_6 = 0;
  __pyx_t_8 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_uint8); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_9, __pyx_t_8};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4864, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_9, __pyx_t_8};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4864, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 4864, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8);
    __pyx_t_9 = 0;
    __pyx_t_8 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4864, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(1, 4864, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_output_array_ = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "PygameShader/shader.pyx":4869
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):
 *             for i in range(0, w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4870
 * 
 *     with nogil:
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(0, w):
 * 
 */
        __pyx_t_4 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_13 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_13 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_1, __pyx_t_10, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_c) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_lum) lastprivate(__pyx_v_r) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_13; __pyx_t_3++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_3);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_c = ((float)__PYX_NAN());
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_lum = ((float)__PYX_NAN());
                            __pyx_v_r = ((unsigned char *)1);

                            /* "PygameShader/shader.pyx":4871
 *     with nogil:
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):
 *             for i in range(0, w):             # <<<<<<<<<<<<<<
 * 
 *                 # ITU-R BT.601 luma coefficients
 */
                            __pyx_t_14 = __pyx_v_w;
                            __pyx_t_15 = __pyx_t_14;
                            for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_15; __pyx_t_10+=1) {
                              __pyx_v_i = __pyx_t_10;

                              /* "PygameShader/shader.pyx":4874
 * 
 *                 # ITU-R BT.601 luma coefficients
 *                 r = &input_array_[i, j, 0]             # <<<<<<<<<<<<<<
 *                 g = &input_array_[i, j, 1]
 *                 b = &input_array_[i, j, 2]
 */
                              __pyx_t_16 = __pyx_v_i;
                              __pyx_t_17 = __pyx_v_j;
                              __pyx_t_18 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_input_array_.data + __pyx_t_16 * __pyx_v_input_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_input_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_input_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4875
 *                 # ITU-R BT.601 luma coefficients
 *                 r = &input_array_[i, j, 0]
 *                 g = &input_array_[i, j, 1]             # <<<<<<<<<<<<<<
 *                 b = &input_array_[i, j, 2]
 * 
 */
                              __pyx_t_18 = __pyx_v_i;
                              __pyx_t_17 = __pyx_v_j;
                              __pyx_t_16 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_input_array_.data + __pyx_t_18 * __pyx_v_input_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_input_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_input_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4876
 *                 r = &input_array_[i, j, 0]
 *                 g = &input_array_[i, j, 1]
 *                 b = &input_array_[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 *                 lum = r[0] * <float>0.299 + g[0] * <float>0.587 + b[0] * <float>0.114
 */
                              __pyx_t_16 = __pyx_v_i;
                              __pyx_t_17 = __pyx_v_j;
                              __pyx_t_18 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_input_array_.data + __pyx_t_16 * __pyx_v_input_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_input_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_input_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":4878
 *                 b = &input_array_[i, j, 2]
 * 
 *                 lum = r[0] * <float>0.299 + g[0] * <float>0.587 + b[0] * <float>0.114             # <<<<<<<<<<<<<<
 * 
 *                 if lum > threshold:
 */
                              __pyx_v_lum = ((((__pyx_v_r[0]) * ((float)0.299)) + ((__pyx_v_g[0]) * ((float)0.587))) + ((__pyx_v_b[0]) * ((float)0.114)));

                              /* "PygameShader/shader.pyx":4880
 *                 lum = r[0] * <float>0.299 + g[0] * <float>0.587 + b[0] * <float>0.114
 * 
 *                 if lum > threshold:             # <<<<<<<<<<<<<<
 *                     c = (lum - threshold) / lum
 *                     output_array_[j, i, 0] = <unsigned char>(r[0] * c)
 */
                              __pyx_t_1 = ((__pyx_v_lum > __pyx_v_threshold) != 0);
                              if (__pyx_t_1) {

                                /* "PygameShader/shader.pyx":4881
 * 
 *                 if lum > threshold:
 *                     c = (lum - threshold) / lum             # <<<<<<<<<<<<<<
 *                     output_array_[j, i, 0] = <unsigned char>(r[0] * c)
 *                     output_array_[j, i, 1] = <unsigned char>(g[0] * c)
 */
                                __pyx_v_c = ((__pyx_v_lum - __pyx_v_threshold) / __pyx_v_lum);

                                /* "PygameShader/shader.pyx":4882
 *                 if lum > threshold:
 *                     c = (lum - threshold) / lum
 *                     output_array_[j, i, 0] = <unsigned char>(r[0] * c)             # <<<<<<<<<<<<<<
 *                     output_array_[j, i, 1] = <unsigned char>(g[0] * c)
 *                     output_array_[j, i, 2] = <unsigned char>(b[0] * c)
 */
                                __pyx_t_18 = __pyx_v_j;
                                __pyx_t_17 = __pyx_v_i;
                                __pyx_t_16 = 0;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_output_array_.data + __pyx_t_18 * __pyx_v_output_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_output_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_output_array_.strides[2]) )) = ((unsigned char)((__pyx_v_r[0]) * __pyx_v_c));

                                /* "PygameShader/shader.pyx":4883
 *                     c = (lum - threshold) / lum
 *                     output_array_[j, i, 0] = <unsigned char>(r[0] * c)
 *                     output_array_[j, i, 1] = <unsigned char>(g[0] * c)             # <<<<<<<<<<<<<<
 *                     output_array_[j, i, 2] = <unsigned char>(b[0] * c)
 * 
 */
                                __pyx_t_16 = __pyx_v_j;
                                __pyx_t_17 = __pyx_v_i;
                                __pyx_t_18 = 1;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_output_array_.data + __pyx_t_16 * __pyx_v_output_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_output_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_output_array_.strides[2]) )) = ((unsigned char)((__pyx_v_g[0]) * __pyx_v_c));

                                /* "PygameShader/shader.pyx":4884
 *                     output_array_[j, i, 0] = <unsigned char>(r[0] * c)
 *                     output_array_[j, i, 1] = <unsigned char>(g[0] * c)
 *                     output_array_[j, i, 2] = <unsigned char>(b[0] * c)             # <<<<<<<<<<<<<<
 * 
 *     return pygame.image.frombuffer(output_array_, (w, h), 'RGB')
 */
                                __pyx_t_18 = __pyx_v_j;
                                __pyx_t_17 = __pyx_v_i;
                                __pyx_t_16 = 2;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_output_array_.data + __pyx_t_18 * __pyx_v_output_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_output_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_output_array_.strides[2]) )) = ((unsigned char)((__pyx_v_b[0]) * __pyx_v_c));

                                /* "PygameShader/shader.pyx":4880
 *                 lum = r[0] * <float>0.299 + g[0] * <float>0.587 + b[0] * <float>0.114
 * 
 *                 if lum > threshold:             # <<<<<<<<<<<<<<
 *                     c = (lum - threshold) / lum
 *                     output_array_[j, i, 0] = <unsigned char>(r[0] * c)
 */
                              }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":4869
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):
 *             for i in range(0, w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":4886
 *                     output_array_[j, i, 2] = <unsigned char>(b[0] * c)
 * 
 *     return pygame.image.frombuffer(output_array_, (w, h), 'RGB')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_image); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 4886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __pyx_memoryview_fromslice(__pyx_v_output_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 4886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 4886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_9);
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_11, __pyx_t_6, __pyx_n_s_RGB};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4886, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_11, __pyx_t_6, __pyx_n_s_RGB};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4886, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_t_6);
    __Pyx_INCREF(__pyx_n_s_RGB);
    __Pyx_GIVEREF(__pyx_n_s_RGB);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_10, __pyx_n_s_RGB);
    __pyx_t_11 = 0;
    __pyx_t_6 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":4837
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline bpf24_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] input_array_,
 *         int threshold = 128,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  __Pyx_AddTraceback("PygameShader.shader.bpf24_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_output_array_, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":4894
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_bloom_effect_array24_c(             # <<<<<<<<<<<<<<
 *         surface_,
 *         int threshold_,
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(PyObject *__pyx_v_surface_, int __pyx_v_threshold_, struct __pyx_opt_args_12PygameShader_6shader_shader_bloom_effect_array24_c *__pyx_optional_args) {

  /* "PygameShader/shader.pyx":4897
 *         surface_,
 *         int threshold_,
 *         bint fast_ = False):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A BLOOM EFFECT
 */
  int __pyx_v_fast_ = ((int)0);
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  CYTHON_UNUSED int __pyx_v_bit_size;
  int __pyx_v_w2;
  int __pyx_v_h2;
  int __pyx_v_w4;
  int __pyx_v_h4;
  int __pyx_v_w8;
  int __pyx_v_h8;
  int __pyx_v_w16;
  int __pyx_v_h16;
  int __pyx_v_x2;
  int __pyx_v_x4;
  int __pyx_v_x8;
  int __pyx_v_x16;
  PyObject *__pyx_v_surface_cp = NULL;
  PyObject *__pyx_v_s2 = NULL;
  PyObject *__pyx_v_s2_array = NULL;
  PyObject *__pyx_v_b2_blurred = NULL;
  PyObject *__pyx_v_s4 = NULL;
  PyObject *__pyx_v_s4_array = NULL;
  PyObject *__pyx_v_b4_blurred = NULL;
  PyObject *__pyx_v_s8 = NULL;
  PyObject *__pyx_v_s8_array = NULL;
  PyObject *__pyx_v_b8_blurred = NULL;
  PyObject *__pyx_v_s16 = NULL;
  PyObject *__pyx_v_s16_array = NULL;
  PyObject *__pyx_v_b16_blurred = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  long __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_memviewslice __pyx_t_14 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_bpf24_c __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_bloom_effect_array24_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_fast_ = __pyx_optional_args->fast_;
    }
  }

  /* "PygameShader/shader.pyx":4915
 *     """
 * 
 *     assert 0 <= threshold_ <= 255, "Argument threshold must be in range [0 ... 255]"             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (0 <= __pyx_v_threshold_);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_threshold_ <= 0xFF);
    }
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_threshold_must_be_in_ra);
      __PYX_ERR(1, 4915, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":4921
 *         int bit_size
 *         int w2, h2, w4, h4, w8, h8, w16, h16
 *         bint x2, x4, x8, x16 = False             # <<<<<<<<<<<<<<
 * 
 *     w, h = surface_.get_size()
 */
  __pyx_v_x16 = 0;

  /* "PygameShader/shader.pyx":4923
 *         bint x2, x4, x8, x16 = False
 * 
 *     w, h = surface_.get_size()             # <<<<<<<<<<<<<<
 *     bit_size = surface_.get_bitsize()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 4923, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(1, 4923, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 4923, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 4923, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 4923, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_w = __pyx_t_7;
  __pyx_v_h = __pyx_t_8;

  /* "PygameShader/shader.pyx":4924
 * 
 *     w, h = surface_.get_size()
 *     bit_size = surface_.get_bitsize()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bitsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4924, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_bit_size = __pyx_t_9;

  /* "PygameShader/shader.pyx":4926
 *     bit_size = surface_.get_bitsize()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         w2, h2   = <int>w >> 1, <int>h >> 1
 *         w4, h4   = w2 >> 1, h2 >> 1
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4927
 * 
 *     with nogil:
 *         w2, h2   = <int>w >> 1, <int>h >> 1             # <<<<<<<<<<<<<<
 *         w4, h4   = w2 >> 1, h2 >> 1
 *         w8, h8   = w4 >> 1, h4 >> 1
 */
        __pyx_t_10 = (((int)__pyx_v_w) >> 1);
        __pyx_t_11 = (((int)__pyx_v_h) >> 1);
        __pyx_v_w2 = __pyx_t_10;
        __pyx_v_h2 = __pyx_t_11;

        /* "PygameShader/shader.pyx":4928
 *     with nogil:
 *         w2, h2   = <int>w >> 1, <int>h >> 1
 *         w4, h4   = w2 >> 1, h2 >> 1             # <<<<<<<<<<<<<<
 *         w8, h8   = w4 >> 1, h4 >> 1
 *         w16, h16 = w8 >> 1, h8 >> 1
 */
        __pyx_t_11 = (__pyx_v_w2 >> 1);
        __pyx_t_10 = (__pyx_v_h2 >> 1);
        __pyx_v_w4 = __pyx_t_11;
        __pyx_v_h4 = __pyx_t_10;

        /* "PygameShader/shader.pyx":4929
 *         w2, h2   = <int>w >> 1, <int>h >> 1
 *         w4, h4   = w2 >> 1, h2 >> 1
 *         w8, h8   = w4 >> 1, h4 >> 1             # <<<<<<<<<<<<<<
 *         w16, h16 = w8 >> 1, h8 >> 1
 * 
 */
        __pyx_t_10 = (__pyx_v_w4 >> 1);
        __pyx_t_11 = (__pyx_v_h4 >> 1);
        __pyx_v_w8 = __pyx_t_10;
        __pyx_v_h8 = __pyx_t_11;

        /* "PygameShader/shader.pyx":4930
 *         w4, h4   = w2 >> 1, h2 >> 1
 *         w8, h8   = w4 >> 1, h4 >> 1
 *         w16, h16 = w8 >> 1, h8 >> 1             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
        __pyx_t_11 = (__pyx_v_w8 >> 1);
        __pyx_t_10 = (__pyx_v_h8 >> 1);
        __pyx_v_w16 = __pyx_t_11;
        __pyx_v_h16 = __pyx_t_10;
      }

      /* "PygameShader/shader.pyx":4926
 *     bit_size = surface_.get_bitsize()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         w2, h2   = <int>w >> 1, <int>h >> 1
 *         w4, h4   = w2 >> 1, h2 >> 1
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "PygameShader/shader.pyx":4932
 *         w16, h16 = w8 >> 1, h8 >> 1
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         if w2 > 0 and h2 > 0:
 *             x2 = True
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":4933
 * 
 *     with nogil:
 *         if w2 > 0 and h2 > 0:             # <<<<<<<<<<<<<<
 *             x2 = True
 *         else:
 */
        __pyx_t_12 = ((__pyx_v_w2 > 0) != 0);
        if (__pyx_t_12) {
        } else {
          __pyx_t_1 = __pyx_t_12;
          goto __pyx_L12_bool_binop_done;
        }
        __pyx_t_12 = ((__pyx_v_h2 > 0) != 0);
        __pyx_t_1 = __pyx_t_12;
        __pyx_L12_bool_binop_done:;
        if (__pyx_t_1) {

          /* "PygameShader/shader.pyx":4934
 *     with nogil:
 *         if w2 > 0 and h2 > 0:
 *             x2 = True             # <<<<<<<<<<<<<<
 *         else:
 *             x2 = False
 */
          __pyx_v_x2 = 1;

          /* "PygameShader/shader.pyx":4933
 * 
 *     with nogil:
 *         if w2 > 0 and h2 > 0:             # <<<<<<<<<<<<<<
 *             x2 = True
 *         else:
 */
          goto __pyx_L11;
        }

        /* "PygameShader/shader.pyx":4936
 *             x2 = True
 *         else:
 *             x2 = False             # <<<<<<<<<<<<<<
 * 
 *         if w4 > 0 and h4 > 0:
 */
        /*else*/ {
          __pyx_v_x2 = 0;
        }
        __pyx_L11:;

        /* "PygameShader/shader.pyx":4938
 *             x2 = False
 * 
 *         if w4 > 0 and h4 > 0:             # <<<<<<<<<<<<<<
 *             x4 = True
 *         else:
 */
        __pyx_t_12 = ((__pyx_v_w4 > 0) != 0);
        if (__pyx_t_12) {
        } else {
          __pyx_t_1 = __pyx_t_12;
          goto __pyx_L15_bool_binop_done;
        }
        __pyx_t_12 = ((__pyx_v_h4 > 0) != 0);
        __pyx_t_1 = __pyx_t_12;
        __pyx_L15_bool_binop_done:;
        if (__pyx_t_1) {

          /* "PygameShader/shader.pyx":4939
 * 
 *         if w4 > 0 and h4 > 0:
 *             x4 = True             # <<<<<<<<<<<<<<
 *         else:
 *             x4 = False
 */
          __pyx_v_x4 = 1;

          /* "PygameShader/shader.pyx":4938
 *             x2 = False
 * 
 *         if w4 > 0 and h4 > 0:             # <<<<<<<<<<<<<<
 *             x4 = True
 *         else:
 */
          goto __pyx_L14;
        }

        /* "PygameShader/shader.pyx":4941
 *             x4 = True
 *         else:
 *             x4 = False             # <<<<<<<<<<<<<<
 * 
 *         if w8 > 0 and h8 > 0:
 */
        /*else*/ {
          __pyx_v_x4 = 0;
        }
        __pyx_L14:;

        /* "PygameShader/shader.pyx":4943
 *             x4 = False
 * 
 *         if w8 > 0 and h8 > 0:             # <<<<<<<<<<<<<<
 *             x8 = True
 *         else:
 */
        __pyx_t_12 = ((__pyx_v_w8 > 0) != 0);
        if (__pyx_t_12) {
        } else {
          __pyx_t_1 = __pyx_t_12;
          goto __pyx_L18_bool_binop_done;
        }
        __pyx_t_12 = ((__pyx_v_h8 > 0) != 0);
        __pyx_t_1 = __pyx_t_12;
        __pyx_L18_bool_binop_done:;
        if (__pyx_t_1) {

          /* "PygameShader/shader.pyx":4944
 * 
 *         if w8 > 0 and h8 > 0:
 *             x8 = True             # <<<<<<<<<<<<<<
 *         else:
 *             x8 = False
 */
          __pyx_v_x8 = 1;

          /* "PygameShader/shader.pyx":4943
 *             x4 = False
 * 
 *         if w8 > 0 and h8 > 0:             # <<<<<<<<<<<<<<
 *             x8 = True
 *         else:
 */
          goto __pyx_L17;
        }

        /* "PygameShader/shader.pyx":4946
 *             x8 = True
 *         else:
 *             x8 = False             # <<<<<<<<<<<<<<
 * 
 *         if w16 > 0 and h16 > 0:
 */
        /*else*/ {
          __pyx_v_x8 = 0;
        }
        __pyx_L17:;

        /* "PygameShader/shader.pyx":4948
 *             x8 = False
 * 
 *         if w16 > 0 and h16 > 0:             # <<<<<<<<<<<<<<
 *             x16 = True
 *         else:
 */
        __pyx_t_12 = ((__pyx_v_w16 > 0) != 0);
        if (__pyx_t_12) {
        } else {
          __pyx_t_1 = __pyx_t_12;
          goto __pyx_L21_bool_binop_done;
        }
        __pyx_t_12 = ((__pyx_v_h16 > 0) != 0);
        __pyx_t_1 = __pyx_t_12;
        __pyx_L21_bool_binop_done:;
        if (__pyx_t_1) {

          /* "PygameShader/shader.pyx":4949
 * 
 *         if w16 > 0 and h16 > 0:
 *             x16 = True             # <<<<<<<<<<<<<<
 *         else:
 *             x16 = False
 */
          __pyx_v_x16 = 1;

          /* "PygameShader/shader.pyx":4948
 *             x8 = False
 * 
 *         if w16 > 0 and h16 > 0:             # <<<<<<<<<<<<<<
 *             x16 = True
 *         else:
 */
          goto __pyx_L20;
        }

        /* "PygameShader/shader.pyx":4951
 *             x16 = True
 *         else:
 *             x16 = False             # <<<<<<<<<<<<<<
 * 
 *     # SUBSURFACE DOWNSCALE CANNOT
 */
        /*else*/ {
          __pyx_v_x16 = 0;
        }
        __pyx_L20:;
      }

      /* "PygameShader/shader.pyx":4932
 *         w16, h16 = w8 >> 1, h8 >> 1
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         if w2 > 0 and h2 > 0:
 *             x2 = True
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L10;
        }
        __pyx_L10:;
      }
  }

  /* "PygameShader/shader.pyx":4955
 *     # SUBSURFACE DOWNSCALE CANNOT
 *     # BE PERFORMED AND WILL RAISE AN EXCEPTION
 *     if not x2:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_x2 != 0)) != 0);
  if (__pyx_t_1) {

    /* "PygameShader/shader.pyx":4956
 *     # BE PERFORMED AND WILL RAISE AN EXCEPTION
 *     if not x2:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if fast_:
 */
    goto __pyx_L0;

    /* "PygameShader/shader.pyx":4955
 *     # SUBSURFACE DOWNSCALE CANNOT
 *     # BE PERFORMED AND WILL RAISE AN EXCEPTION
 *     if not x2:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "PygameShader/shader.pyx":4958
 *         return
 * 
 *     if fast_:             # <<<<<<<<<<<<<<
 *         x2, x4, x8 = False, False, False
 * 
 */
  __pyx_t_1 = (__pyx_v_fast_ != 0);
  if (__pyx_t_1) {

    /* "PygameShader/shader.pyx":4959
 * 
 *     if fast_:
 *         x2, x4, x8 = False, False, False             # <<<<<<<<<<<<<<
 * 
 *     surface_cp = bpf24_c(pixels3d(surface_), threshold=threshold_)
 */
    __pyx_t_1 = 0;
    __pyx_t_12 = 0;
    __pyx_t_13 = 0;
    __pyx_v_x2 = __pyx_t_1;
    __pyx_v_x4 = __pyx_t_12;
    __pyx_v_x8 = __pyx_t_13;

    /* "PygameShader/shader.pyx":4958
 *         return
 * 
 *     if fast_:             # <<<<<<<<<<<<<<
 *         x2, x4, x8 = False, False, False
 * 
 */
  }

  /* "PygameShader/shader.pyx":4961
 *         x2, x4, x8 = False, False, False
 * 
 *     surface_cp = bpf24_c(pixels3d(surface_), threshold=threshold_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 4961, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_15.__pyx_n = 1;
  __pyx_t_15.threshold = __pyx_v_threshold_;
  __pyx_t_2 = __pyx_f_12PygameShader_6shader_bpf24_c(__pyx_t_14, &__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
  __pyx_t_14.memview = NULL;
  __pyx_t_14.data = NULL;
  __pyx_v_surface_cp = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":4966
 *     # FIRST SUBSURFACE DOWNSCALE x2
 *     # THIS IS THE MOST EXPENSIVE IN TERM OF PROCESSING TIME
 *     if x2:             # <<<<<<<<<<<<<<
 *         s2 = scale(surface_cp, (w2, h2))
 *         s2_array = numpy.array(s2.get_view('3'), dtype=numpy.uint8)
 */
  __pyx_t_13 = (__pyx_v_x2 != 0);
  if (__pyx_t_13) {

    /* "PygameShader/shader.pyx":4967
 *     # THIS IS THE MOST EXPENSIVE IN TERM OF PROCESSING TIME
 *     if x2:
 *         s2 = scale(surface_cp, (w2, h2))             # <<<<<<<<<<<<<<
 *         s2_array = numpy.array(s2.get_view('3'), dtype=numpy.uint8)
 *         shader_blur5x5_array24_inplace_c(s2_array)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_scale); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_w2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_16};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4967, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_16};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4967, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_surface_cp);
      __Pyx_GIVEREF(__pyx_v_surface_cp);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_v_surface_cp);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_t_16);
      __pyx_t_16 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_s2 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PygameShader/shader.pyx":4968
 *     if x2:
 *         s2 = scale(surface_cp, (w2, h2))
 *         s2_array = numpy.array(s2.get_view('3'), dtype=numpy.uint8)             # <<<<<<<<<<<<<<
 *         shader_blur5x5_array24_inplace_c(s2_array)
 *         # b2_blurred = frombuffer(numpy.array(s2_array.transpose(1, 0, 2),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_s2, __pyx_n_s_get_view); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_16, __pyx_kp_s_3) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_3);
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_numpy); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 4968, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_s2_array = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":4969
 *         s2 = scale(surface_cp, (w2, h2))
 *         s2_array = numpy.array(s2.get_view('3'), dtype=numpy.uint8)
 *         shader_blur5x5_array24_inplace_c(s2_array)             # <<<<<<<<<<<<<<
 *         # b2_blurred = frombuffer(numpy.array(s2_array.transpose(1, 0, 2),
 *         # order='C', copy=False), (w2, h2), 'RGB')
 */
    __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_s2_array, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 4969, __pyx_L1_error)
    __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_14, NULL);
    __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
    __pyx_t_14.memview = NULL;
    __pyx_t_14.data = NULL;

    /* "PygameShader/shader.pyx":4972
 *         # b2_blurred = frombuffer(numpy.array(s2_array.transpose(1, 0, 2),
 *         # order='C', copy=False), (w2, h2), 'RGB')
 *         b2_blurred = make_surface(s2_array)             # <<<<<<<<<<<<<<
 *         s2 = smoothscale(b2_blurred, (w, h))
 *         surface_.blit(s2, (0, 0), special_flags=BLEND_RGB_ADD)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_s2_array) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_s2_array);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_b2_blurred = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":4973
 *         # order='C', copy=False), (w2, h2), 'RGB')
 *         b2_blurred = make_surface(s2_array)
 *         s2 = smoothscale(b2_blurred, (w, h))             # <<<<<<<<<<<<<<
 *         surface_.blit(s2, (0, 0), special_flags=BLEND_RGB_ADD)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_b2_blurred, __pyx_t_16};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4973, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_b2_blurred, __pyx_t_16};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4973, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4973, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_b2_blurred);
      __Pyx_GIVEREF(__pyx_v_b2_blurred);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_v_b2_blurred);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_t_16);
      __pyx_t_16 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4973, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":4974
 *         b2_blurred = make_surface(s2_array)
 *         s2 = smoothscale(b2_blurred, (w, h))
 *         surface_.blit(s2, (0, 0), special_flags=BLEND_RGB_ADD)             # <<<<<<<<<<<<<<
 * 
 *     # SECOND SUBSURFACE DOWNSCALE x4
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_s2);
    __Pyx_GIVEREF(__pyx_v_s2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s2);
    __Pyx_INCREF(__pyx_tuple__12);
    __Pyx_GIVEREF(__pyx_tuple__12);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_tuple__12);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_special_flags, __pyx_t_16) < 0) __PYX_ERR(1, 4974, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

    /* "PygameShader/shader.pyx":4966
 *     # FIRST SUBSURFACE DOWNSCALE x2
 *     # THIS IS THE MOST EXPENSIVE IN TERM OF PROCESSING TIME
 *     if x2:             # <<<<<<<<<<<<<<
 *         s2 = scale(surface_cp, (w2, h2))
 *         s2_array = numpy.array(s2.get_view('3'), dtype=numpy.uint8)
 */
  }

  /* "PygameShader/shader.pyx":4978
 *     # SECOND SUBSURFACE DOWNSCALE x4
 *     # THIS IS THE SECOND MOST EXPENSIVE IN TERM OF PROCESSING TIME
 *     if x4:             # <<<<<<<<<<<<<<
 *         s4 = scale(surface_cp, (w4, h4))
 *         s4_array = numpy.array(s4.get_view('3'), dtype=numpy.uint8)
 */
  __pyx_t_13 = (__pyx_v_x4 != 0);
  if (__pyx_t_13) {

    /* "PygameShader/shader.pyx":4979
 *     # THIS IS THE SECOND MOST EXPENSIVE IN TERM OF PROCESSING TIME
 *     if x4:
 *         s4 = scale(surface_cp, (w4, h4))             # <<<<<<<<<<<<<<
 *         s4_array = numpy.array(s4.get_view('3'), dtype=numpy.uint8)
 *         shader_blur5x5_array24_inplace_c(s4_array)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_scale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_4};
      __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4979, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_4};
      __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4979, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_surface_cp);
      __Pyx_GIVEREF(__pyx_v_surface_cp);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_surface_cp);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_s4 = __pyx_t_16;
    __pyx_t_16 = 0;

    /* "PygameShader/shader.pyx":4980
 *     if x4:
 *         s4 = scale(surface_cp, (w4, h4))
 *         s4_array = numpy.array(s4.get_view('3'), dtype=numpy.uint8)             # <<<<<<<<<<<<<<
 *         shader_blur5x5_array24_inplace_c(s4_array)
 *         # b4_blurred = frombuffer(numpy.array(s4_array.transpose(1, 0, 2),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_numpy); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_array_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_s4, __pyx_n_s_get_view); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_16 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_kp_s_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_3);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_16);
    __pyx_t_16 = 0;
    __pyx_t_16 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 4980, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_v_s4_array = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":4981
 *         s4 = scale(surface_cp, (w4, h4))
 *         s4_array = numpy.array(s4.get_view('3'), dtype=numpy.uint8)
 *         shader_blur5x5_array24_inplace_c(s4_array)             # <<<<<<<<<<<<<<
 *         # b4_blurred = frombuffer(numpy.array(s4_array.transpose(1, 0, 2),
 *         # order='C', copy=False), (w4, h4), 'RGB')
 */
    __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_s4_array, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 4981, __pyx_L1_error)
    __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_14, NULL);
    __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
    __pyx_t_14.memview = NULL;
    __pyx_t_14.data = NULL;

    /* "PygameShader/shader.pyx":4984
 *         # b4_blurred = frombuffer(numpy.array(s4_array.transpose(1, 0, 2),
 *         # order='C', copy=False), (w4, h4), 'RGB')
 *         b4_blurred = make_surface(s4_array)             # <<<<<<<<<<<<<<
 *         s4 = smoothscale(b4_blurred, (w, h))
 *         surface_.blit(s4, (0, 0), special_flags=BLEND_RGB_ADD)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
      }
    }
    __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_2, __pyx_v_s4_array) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_v_s4_array);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_v_b4_blurred = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":4985
 *         # order='C', copy=False), (w4, h4), 'RGB')
 *         b4_blurred = make_surface(s4_array)
 *         s4 = smoothscale(b4_blurred, (w, h))             # <<<<<<<<<<<<<<
 *         surface_.blit(s4, (0, 0), special_flags=BLEND_RGB_ADD)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_b4_blurred, __pyx_t_4};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4985, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_b4_blurred, __pyx_t_4};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4985, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4985, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_b4_blurred);
      __Pyx_GIVEREF(__pyx_v_b4_blurred);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_b4_blurred);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4985, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF_SET(__pyx_v_s4, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":4986
 *         b4_blurred = make_surface(s4_array)
 *         s4 = smoothscale(b4_blurred, (w, h))
 *         surface_.blit(s4, (0, 0), special_flags=BLEND_RGB_ADD)             # <<<<<<<<<<<<<<
 * 
 *     # THIRD SUBSURFACE DOWNSCALE x8
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_INCREF(__pyx_v_s4);
    __Pyx_GIVEREF(__pyx_v_s4);
    PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_s4);
    __Pyx_INCREF(__pyx_tuple__12);
    __Pyx_GIVEREF(__pyx_tuple__12);
    PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_tuple__12);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_special_flags, __pyx_t_4) < 0) __PYX_ERR(1, 4986, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PygameShader/shader.pyx":4978
 *     # SECOND SUBSURFACE DOWNSCALE x4
 *     # THIS IS THE SECOND MOST EXPENSIVE IN TERM OF PROCESSING TIME
 *     if x4:             # <<<<<<<<<<<<<<
 *         s4 = scale(surface_cp, (w4, h4))
 *         s4_array = numpy.array(s4.get_view('3'), dtype=numpy.uint8)
 */
  }

  /* "PygameShader/shader.pyx":4989
 * 
 *     # THIRD SUBSURFACE DOWNSCALE x8
 *     if x8:             # <<<<<<<<<<<<<<
 *         s8 = scale(surface_cp, (w8, h8))
 *         s8_array = numpy.array(s8.get_view('3'), dtype=numpy.uint8)
 */
  __pyx_t_13 = (__pyx_v_x8 != 0);
  if (__pyx_t_13) {

    /* "PygameShader/shader.pyx":4990
 *     # THIRD SUBSURFACE DOWNSCALE x8
 *     if x8:
 *         s8 = scale(surface_cp, (w8, h8))             # <<<<<<<<<<<<<<
 *         s8_array = numpy.array(s8.get_view('3'), dtype=numpy.uint8)
 *         shader_blur5x5_array24_inplace_c(s8_array)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_scale); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_w8); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
    __pyx_t_16 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_3};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4990, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_3};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4990, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_surface_cp);
      __Pyx_GIVEREF(__pyx_v_surface_cp);
      PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_9, __pyx_v_surface_cp);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_9, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_s8 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PygameShader/shader.pyx":4991
 *     if x8:
 *         s8 = scale(surface_cp, (w8, h8))
 *         s8_array = numpy.array(s8.get_view('3'), dtype=numpy.uint8)             # <<<<<<<<<<<<<<
 *         shader_blur5x5_array24_inplace_c(s8_array)
 *         # b8_blurred = frombuffer(numpy.array(s8_array.transpose(1, 0, 2),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_s8, __pyx_n_s_get_view); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
      }
    }
    __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_3, __pyx_kp_s_3) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_kp_s_3);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 4991, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_16, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_s8_array = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":4992
 *         s8 = scale(surface_cp, (w8, h8))
 *         s8_array = numpy.array(s8.get_view('3'), dtype=numpy.uint8)
 *         shader_blur5x5_array24_inplace_c(s8_array)             # <<<<<<<<<<<<<<
 *         # b8_blurred = frombuffer(numpy.array(s8_array.transpose(1, 0, 2),
 *         # order='C', copy=False), (w8, h8), 'RGB')
 */
    __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_s8_array, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 4992, __pyx_L1_error)
    __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_14, NULL);
    __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
    __pyx_t_14.memview = NULL;
    __pyx_t_14.data = NULL;

    /* "PygameShader/shader.pyx":4995
 *         # b8_blurred = frombuffer(numpy.array(s8_array.transpose(1, 0, 2),
 *         # order='C', copy=False), (w8, h8), 'RGB')
 *         b8_blurred = make_surface(s8_array)             # <<<<<<<<<<<<<<
 *         s8 = smoothscale(b8_blurred, (w, h))
 *         surface_.blit(s8, (0, 0), special_flags=BLEND_RGB_ADD)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_5 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_16, __pyx_v_s8_array) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_s8_array);
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_b8_blurred = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":4996
 *         # order='C', copy=False), (w8, h8), 'RGB')
 *         b8_blurred = make_surface(s8_array)
 *         s8 = smoothscale(b8_blurred, (w, h))             # <<<<<<<<<<<<<<
 *         surface_.blit(s8, (0, 0), special_flags=BLEND_RGB_ADD)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_16 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_16 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_b8_blurred, __pyx_t_3};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4996, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_b8_blurred, __pyx_t_3};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4996, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4996, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_b8_blurred);
      __Pyx_GIVEREF(__pyx_v_b8_blurred);
      PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_9, __pyx_v_b8_blurred);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_9, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_16, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4996, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_s8, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":4997
 *         b8_blurred = make_surface(s8_array)
 *         s8 = smoothscale(b8_blurred, (w, h))
 *         surface_.blit(s8, (0, 0), special_flags=BLEND_RGB_ADD)             # <<<<<<<<<<<<<<
 * 
 *     # FOURTH SUBSURFACE DOWNSCALE x16
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_s8);
    __Pyx_GIVEREF(__pyx_v_s8);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_s8);
    __Pyx_INCREF(__pyx_tuple__12);
    __Pyx_GIVEREF(__pyx_tuple__12);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_tuple__12);
    __pyx_t_16 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_special_flags, __pyx_t_3) < 0) __PYX_ERR(1, 4997, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PygameShader/shader.pyx":4989
 * 
 *     # THIRD SUBSURFACE DOWNSCALE x8
 *     if x8:             # <<<<<<<<<<<<<<
 *         s8 = scale(surface_cp, (w8, h8))
 *         s8_array = numpy.array(s8.get_view('3'), dtype=numpy.uint8)
 */
  }

  /* "PygameShader/shader.pyx":5001
 *     # FOURTH SUBSURFACE DOWNSCALE x16
 *     # LESS SIGNIFICANT IN TERMS OF RENDERING AND PROCESSING TIME
 *     if x16:             # <<<<<<<<<<<<<<
 *         s16 = scale(surface_cp, (w16, h16))
 *         s16_array = numpy.array(s16.get_view('3'), dtype=numpy.uint8)
 */
  __pyx_t_13 = (__pyx_v_x16 != 0);
  if (__pyx_t_13) {

    /* "PygameShader/shader.pyx":5002
 *     # LESS SIGNIFICANT IN TERMS OF RENDERING AND PROCESSING TIME
 *     if x16:
 *         s16 = scale(surface_cp, (w16, h16))             # <<<<<<<<<<<<<<
 *         s16_array = numpy.array(s16.get_view('3'), dtype=numpy.uint8)
 *         shader_blur5x5_array24_inplace_c(s16_array)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_scale); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5002, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_w16); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5002, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h16); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5002, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5002, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5002, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5002, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5002, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_surface_cp);
      __Pyx_GIVEREF(__pyx_v_surface_cp);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_v_surface_cp);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5002, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_v_s16 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PygameShader/shader.pyx":5003
 *     if x16:
 *         s16 = scale(surface_cp, (w16, h16))
 *         s16_array = numpy.array(s16.get_view('3'), dtype=numpy.uint8)             # <<<<<<<<<<<<<<
 *         shader_blur5x5_array24_inplace_c(s16_array)
 *         # b16_blurred = frombuffer(numpy.array(s16_array.transpose(1, 0, 2),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s16, __pyx_n_s_get_view); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_kp_s_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 5003, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_s16_array = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":5004
 *         s16 = scale(surface_cp, (w16, h16))
 *         s16_array = numpy.array(s16.get_view('3'), dtype=numpy.uint8)
 *         shader_blur5x5_array24_inplace_c(s16_array)             # <<<<<<<<<<<<<<
 *         # b16_blurred = frombuffer(numpy.array(s16_array.transpose(1, 0, 2),
 *         # order='C', copy=False), (w16, h16), 'RGB')
 */
    __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_s16_array, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 5004, __pyx_L1_error)
    __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_14, NULL);
    __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
    __pyx_t_14.memview = NULL;
    __pyx_t_14.data = NULL;

    /* "PygameShader/shader.pyx":5007
 *         # b16_blurred = frombuffer(numpy.array(s16_array.transpose(1, 0, 2),
 *         # order='C', copy=False), (w16, h16), 'RGB')
 *         b16_blurred = make_surface(s16_array)             # <<<<<<<<<<<<<<
 *         s16 = smoothscale(b16_blurred, (w, h))
 *         surface_.blit(s16, (0, 0), special_flags=BLEND_RGB_ADD)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5007, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_s16_array) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_s16_array);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5007, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_b16_blurred = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":5008
 *         # order='C', copy=False), (w16, h16), 'RGB')
 *         b16_blurred = make_surface(s16_array)
 *         s16 = smoothscale(b16_blurred, (w, h))             # <<<<<<<<<<<<<<
 *         surface_.blit(s16, (0, 0), special_flags=BLEND_RGB_ADD)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_16 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_16);
    __pyx_t_4 = 0;
    __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_v_b16_blurred, __pyx_t_2};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5008, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_v_b16_blurred, __pyx_t_2};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5008, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5008, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_INCREF(__pyx_v_b16_blurred);
      __Pyx_GIVEREF(__pyx_v_b16_blurred);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_v_b16_blurred);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5008, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_s16, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":5009
 *         b16_blurred = make_surface(s16_array)
 *         s16 = smoothscale(b16_blurred, (w, h))
 *         surface_.blit(s16, (0, 0), special_flags=BLEND_RGB_ADD)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_s16);
    __Pyx_GIVEREF(__pyx_v_s16);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_s16);
    __Pyx_INCREF(__pyx_tuple__12);
    __Pyx_GIVEREF(__pyx_tuple__12);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_tuple__12);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_special_flags, __pyx_t_2) < 0) __PYX_ERR(1, 5009, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "PygameShader/shader.pyx":5001
 *     # FOURTH SUBSURFACE DOWNSCALE x16
 *     # LESS SIGNIFICANT IN TERMS OF RENDERING AND PROCESSING TIME
 *     if x16:             # <<<<<<<<<<<<<<
 *         s16 = scale(surface_cp, (w16, h16))
 *         s16_array = numpy.array(s16.get_view('3'), dtype=numpy.uint8)
 */
  }

  /* "PygameShader/shader.pyx":4894
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_bloom_effect_array24_c(             # <<<<<<<<<<<<<<
 *         surface_,
 *         int threshold_,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_bloom_effect_array24_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_surface_cp);
  __Pyx_XDECREF(__pyx_v_s2);
  __Pyx_XDECREF(__pyx_v_s2_array);
  __Pyx_XDECREF(__pyx_v_b2_blurred);
  __Pyx_XDECREF(__pyx_v_s4);
  __Pyx_XDECREF(__pyx_v_s4_array);
  __Pyx_XDECREF(__pyx_v_b4_blurred);
  __Pyx_XDECREF(__pyx_v_s8);
  __Pyx_XDECREF(__pyx_v_s8_array);
  __Pyx_XDECREF(__pyx_v_b8_blurred);
  __Pyx_XDECREF(__pyx_v_s16);
  __Pyx_XDECREF(__pyx_v_s16_array);
  __Pyx_XDECREF(__pyx_v_b16_blurred);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":5025
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline shader_fisheye24_footprint_c(Py_ssize_t w, Py_ssize_t h):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_fisheye24_footprint_c(Py_ssize_t __pyx_v_w, Py_ssize_t __pyx_v_h) {
  __Pyx_memviewslice __pyx_v_image_fisheye_model = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_y;
  int __pyx_v_x;
  CYTHON_UNUSED int __pyx_v_v;
  float __pyx_v_ny;
  float __pyx_v_ny2;
  float __pyx_v_nx;
  float __pyx_v_nx2;
  float __pyx_v_r;
  float __pyx_v_theta;
  float __pyx_v_nxn;
  float __pyx_v_nyn;
  float __pyx_v_nr;
  int __pyx_v_x2;
  int __pyx_v_y2;
  CYTHON_UNUSED float __pyx_v_s;
  float __pyx_v_c1;
  float __pyx_v_c2;
  float __pyx_v_w2;
  float __pyx_v_h2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_fisheye24_footprint_c", 0);

  /* "PygameShader/shader.pyx":5045
 *     """
 * 
 *     assert w > 0, "Argument w must be > 0"             # <<<<<<<<<<<<<<
 *     assert h > 0, "Argument h must be > 0"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_w > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_w_must_be_0);
      __PYX_ERR(1, 5045, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":5046
 * 
 *     assert w > 0, "Argument w must be > 0"
 *     assert h > 0, "Argument h must be > 0"             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_h > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_h_must_be_0);
      __PYX_ERR(1, 5046, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":5049
 * 
 *     cdef:
 *         unsigned int [:, :, :] image_fisheye_model = numpy.zeros((w, h, 2), numpy.uint)             # <<<<<<<<<<<<<<
 *         int y=0, x=0, v
 *         float ny, ny2, nx, nx2, r, theta, nxn, nyn, nr
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_2);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5049, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5049, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5049, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_image_fisheye_model = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":5050
 *     cdef:
 *         unsigned int [:, :, :] image_fisheye_model = numpy.zeros((w, h, 2), numpy.uint)
 *         int y=0, x=0, v             # <<<<<<<<<<<<<<
 *         float ny, ny2, nx, nx2, r, theta, nxn, nyn, nr
 *         int x2, y2
 */
  __pyx_v_y = 0;
  __pyx_v_x = 0;

  /* "PygameShader/shader.pyx":5053
 *         float ny, ny2, nx, nx2, r, theta, nxn, nyn, nr
 *         int x2, y2
 *         float s = <float>w * <float>h             # <<<<<<<<<<<<<<
 *         float c1 = <float>2.0 / <float>h
 *         float c2 = <float>2.0 / <float>w
 */
  __pyx_v_s = (((float)__pyx_v_w) * ((float)__pyx_v_h));

  /* "PygameShader/shader.pyx":5054
 *         int x2, y2
 *         float s = <float>w * <float>h
 *         float c1 = <float>2.0 / <float>h             # <<<<<<<<<<<<<<
 *         float c2 = <float>2.0 / <float>w
 *         float w2 = <float>w * <float>0.5
 */
  __pyx_v_c1 = (((float)2.0) / ((float)__pyx_v_h));

  /* "PygameShader/shader.pyx":5055
 *         float s = <float>w * <float>h
 *         float c1 = <float>2.0 / <float>h
 *         float c2 = <float>2.0 / <float>w             # <<<<<<<<<<<<<<
 *         float w2 = <float>w * <float>0.5
 *         float h2 = <float>h * <float>0.5
 */
  __pyx_v_c2 = (((float)2.0) / ((float)__pyx_v_w));

  /* "PygameShader/shader.pyx":5056
 *         float c1 = <float>2.0 / <float>h
 *         float c2 = <float>2.0 / <float>w
 *         float w2 = <float>w * <float>0.5             # <<<<<<<<<<<<<<
 *         float h2 = <float>h * <float>0.5
 * 
 */
  __pyx_v_w2 = (((float)__pyx_v_w) * ((float)0.5));

  /* "PygameShader/shader.pyx":5057
 *         float c2 = <float>2.0 / <float>w
 *         float w2 = <float>w * <float>0.5
 *         float h2 = <float>h * <float>0.5             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_h2 = (((float)__pyx_v_h) * ((float)0.5));

  /* "PygameShader/shader.pyx":5059
 *         float h2 = <float>h * <float>0.5
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             nx = x * c2 - <float>1.0
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":5060
 * 
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             nx = x * c2 - <float>1.0
 *             nx2 = nx * nx
 */
        __pyx_t_9 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_11 = (__pyx_t_9 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_11 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_6)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_nr) lastprivate(__pyx_v_nx) lastprivate(__pyx_v_nx2) lastprivate(__pyx_v_nxn) lastprivate(__pyx_v_ny) lastprivate(__pyx_v_ny2) lastprivate(__pyx_v_nyn) lastprivate(__pyx_v_r) lastprivate(__pyx_v_theta) lastprivate(__pyx_v_v) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_10);
                            /* Initialize private variables to invalid values */
                            __pyx_v_nr = ((float)__PYX_NAN());
                            __pyx_v_nx = ((float)__PYX_NAN());
                            __pyx_v_nx2 = ((float)__PYX_NAN());
                            __pyx_v_nxn = ((float)__PYX_NAN());
                            __pyx_v_ny = ((float)__PYX_NAN());
                            __pyx_v_ny2 = ((float)__PYX_NAN());
                            __pyx_v_nyn = ((float)__PYX_NAN());
                            __pyx_v_r = ((float)__PYX_NAN());
                            __pyx_v_theta = ((float)__PYX_NAN());
                            __pyx_v_v = ((int)0xbad0bad0);
                            __pyx_v_x2 = ((int)0xbad0bad0);
                            __pyx_v_y = ((int)0xbad0bad0);
                            __pyx_v_y2 = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":5061
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             nx = x * c2 - <float>1.0             # <<<<<<<<<<<<<<
 *             nx2 = nx * nx
 *             for y in range(h):
 */
                            __pyx_v_nx = ((__pyx_v_x * __pyx_v_c2) - ((float)1.0));

                            /* "PygameShader/shader.pyx":5062
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             nx = x * c2 - <float>1.0
 *             nx2 = nx * nx             # <<<<<<<<<<<<<<
 *             for y in range(h):
 *                 ny = <float>y * c1 - <float>1.0
 */
                            __pyx_v_nx2 = (__pyx_v_nx * __pyx_v_nx);

                            /* "PygameShader/shader.pyx":5063
 *             nx = x * c2 - <float>1.0
 *             nx2 = nx * nx
 *             for y in range(h):             # <<<<<<<<<<<<<<
 *                 ny = <float>y * c1 - <float>1.0
 *                 ny2 = ny * ny
 */
                            __pyx_t_12 = __pyx_v_h;
                            __pyx_t_13 = __pyx_t_12;
                            for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_13; __pyx_t_6+=1) {
                              __pyx_v_y = __pyx_t_6;

                              /* "PygameShader/shader.pyx":5064
 *             nx2 = nx * nx
 *             for y in range(h):
 *                 ny = <float>y * c1 - <float>1.0             # <<<<<<<<<<<<<<
 *                 ny2 = ny * ny
 *                 r = <float>sqrt(nx2 + ny2)
 */
                              __pyx_v_ny = ((((float)__pyx_v_y) * __pyx_v_c1) - ((float)1.0));

                              /* "PygameShader/shader.pyx":5065
 *             for y in range(h):
 *                 ny = <float>y * c1 - <float>1.0
 *                 ny2 = ny * ny             # <<<<<<<<<<<<<<
 *                 r = <float>sqrt(nx2 + ny2)
 *                 if 0.0 <= r <= 1.0:
 */
                              __pyx_v_ny2 = (__pyx_v_ny * __pyx_v_ny);

                              /* "PygameShader/shader.pyx":5066
 *                 ny = <float>y * c1 - <float>1.0
 *                 ny2 = ny * ny
 *                 r = <float>sqrt(nx2 + ny2)             # <<<<<<<<<<<<<<
 *                 if 0.0 <= r <= 1.0:
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.5
 */
                              __pyx_v_r = ((float)sqrt((__pyx_v_nx2 + __pyx_v_ny2)));

                              /* "PygameShader/shader.pyx":5067
 *                 ny2 = ny * ny
 *                 r = <float>sqrt(nx2 + ny2)
 *                 if 0.0 <= r <= 1.0:             # <<<<<<<<<<<<<<
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.5
 *                     if nr <= 1.0:
 */
                              __pyx_t_14 = (0.0 <= __pyx_v_r);
                              if (__pyx_t_14) {
                                __pyx_t_14 = (__pyx_v_r <= 1.0);
                              }
                              __pyx_t_15 = (__pyx_t_14 != 0);
                              if (__pyx_t_15) {

                                /* "PygameShader/shader.pyx":5068
 *                 r = <float>sqrt(nx2 + ny2)
 *                 if 0.0 <= r <= 1.0:
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.5             # <<<<<<<<<<<<<<
 *                     if nr <= 1.0:
 *                         theta = <float>atan2(ny, nx)
 */
                                __pyx_v_nr = (((__pyx_v_r + ((float)1.0)) - ((float)sqrt((1.0 - (__pyx_v_nx2 + __pyx_v_ny2))))) * ((float)0.5));

                                /* "PygameShader/shader.pyx":5069
 *                 if 0.0 <= r <= 1.0:
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.5
 *                     if nr <= 1.0:             # <<<<<<<<<<<<<<
 *                         theta = <float>atan2(ny, nx)
 *                         nxn = nr * <float>cos(theta)
 */
                                __pyx_t_15 = ((__pyx_v_nr <= 1.0) != 0);
                                if (__pyx_t_15) {

                                  /* "PygameShader/shader.pyx":5070
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.5
 *                     if nr <= 1.0:
 *                         theta = <float>atan2(ny, nx)             # <<<<<<<<<<<<<<
 *                         nxn = nr * <float>cos(theta)
 *                         nyn = nr * <float>sin(theta)
 */
                                  __pyx_v_theta = ((float)atan2(__pyx_v_ny, __pyx_v_nx));

                                  /* "PygameShader/shader.pyx":5071
 *                     if nr <= 1.0:
 *                         theta = <float>atan2(ny, nx)
 *                         nxn = nr * <float>cos(theta)             # <<<<<<<<<<<<<<
 *                         nyn = nr * <float>sin(theta)
 *                         x2 = <int>(nxn * w2 + w2)
 */
                                  __pyx_v_nxn = (__pyx_v_nr * ((float)cos(__pyx_v_theta)));

                                  /* "PygameShader/shader.pyx":5072
 *                         theta = <float>atan2(ny, nx)
 *                         nxn = nr * <float>cos(theta)
 *                         nyn = nr * <float>sin(theta)             # <<<<<<<<<<<<<<
 *                         x2 = <int>(nxn * w2 + w2)
 *                         y2 = <int>(nyn * h2 + h2)
 */
                                  __pyx_v_nyn = (__pyx_v_nr * ((float)sin(__pyx_v_theta)));

                                  /* "PygameShader/shader.pyx":5073
 *                         nxn = nr * <float>cos(theta)
 *                         nyn = nr * <float>sin(theta)
 *                         x2 = <int>(nxn * w2 + w2)             # <<<<<<<<<<<<<<
 *                         y2 = <int>(nyn * h2 + h2)
 *                         v = <int>(y2 * w + x2)
 */
                                  __pyx_v_x2 = ((int)((__pyx_v_nxn * __pyx_v_w2) + __pyx_v_w2));

                                  /* "PygameShader/shader.pyx":5074
 *                         nyn = nr * <float>sin(theta)
 *                         x2 = <int>(nxn * w2 + w2)
 *                         y2 = <int>(nyn * h2 + h2)             # <<<<<<<<<<<<<<
 *                         v = <int>(y2 * w + x2)
 *                         image_fisheye_model[x, y, 0] = x2
 */
                                  __pyx_v_y2 = ((int)((__pyx_v_nyn * __pyx_v_h2) + __pyx_v_h2));

                                  /* "PygameShader/shader.pyx":5075
 *                         x2 = <int>(nxn * w2 + w2)
 *                         y2 = <int>(nyn * h2 + h2)
 *                         v = <int>(y2 * w + x2)             # <<<<<<<<<<<<<<
 *                         image_fisheye_model[x, y, 0] = x2
 *                         image_fisheye_model[x, y, 1] = y2
 */
                                  __pyx_v_v = ((int)((__pyx_v_y2 * __pyx_v_w) + __pyx_v_x2));

                                  /* "PygameShader/shader.pyx":5076
 *                         y2 = <int>(nyn * h2 + h2)
 *                         v = <int>(y2 * w + x2)
 *                         image_fisheye_model[x, y, 0] = x2             # <<<<<<<<<<<<<<
 *                         image_fisheye_model[x, y, 1] = y2
 * 
 */
                                  __pyx_t_16 = __pyx_v_x;
                                  __pyx_t_17 = __pyx_v_y;
                                  __pyx_t_18 = 0;
                                  *((unsigned int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_image_fisheye_model.data + __pyx_t_16 * __pyx_v_image_fisheye_model.strides[0]) ) + __pyx_t_17 * __pyx_v_image_fisheye_model.strides[1]) ) + __pyx_t_18 * __pyx_v_image_fisheye_model.strides[2]) )) = __pyx_v_x2;

                                  /* "PygameShader/shader.pyx":5077
 *                         v = <int>(y2 * w + x2)
 *                         image_fisheye_model[x, y, 0] = x2
 *                         image_fisheye_model[x, y, 1] = y2             # <<<<<<<<<<<<<<
 * 
 *     return asarray(ascontiguousarray(image_fisheye_model))
 */
                                  __pyx_t_18 = __pyx_v_x;
                                  __pyx_t_17 = __pyx_v_y;
                                  __pyx_t_16 = 1;
                                  *((unsigned int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_image_fisheye_model.data + __pyx_t_18 * __pyx_v_image_fisheye_model.strides[0]) ) + __pyx_t_17 * __pyx_v_image_fisheye_model.strides[1]) ) + __pyx_t_16 * __pyx_v_image_fisheye_model.strides[2]) )) = __pyx_v_y2;

                                  /* "PygameShader/shader.pyx":5069
 *                 if 0.0 <= r <= 1.0:
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.5
 *                     if nr <= 1.0:             # <<<<<<<<<<<<<<
 *                         theta = <float>atan2(ny, nx)
 *                         nxn = nr * <float>cos(theta)
 */
                                }

                                /* "PygameShader/shader.pyx":5067
 *                 ny2 = ny * ny
 *                 r = <float>sqrt(nx2 + ny2)
 *                 if 0.0 <= r <= 1.0:             # <<<<<<<<<<<<<<
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.5
 *                     if nr <= 1.0:
 */
                              }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":5059
 *         float h2 = <float>h * <float>0.5
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             nx = x * c2 - <float>1.0
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":5079
 *                         image_fisheye_model[x, y, 1] = y2
 * 
 *     return asarray(ascontiguousarray(image_fisheye_model))             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_image_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_7 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":5025
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline shader_fisheye24_footprint_c(Py_ssize_t w, Py_ssize_t h):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_AddTraceback("PygameShader.shader.shader_fisheye24_footprint_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_image_fisheye_model, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":5085
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_fisheye24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, unsigned int [:, :, :] fisheye_model):
 *     """
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_fisheye24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, __Pyx_memviewslice __pyx_v_fisheye_model) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_x;
  int __pyx_v_y;
  __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned int *__pyx_v_x2;
  unsigned int *__pyx_v_y2;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  size_t __pyx_t_16;
  size_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_fisheye24_inplace_c", 0);

  /* "PygameShader/shader.pyx":5112
 *     cdef:
 *         Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":5116
 *     cdef:
 *         int x, y
 *         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=False, order='C')             # <<<<<<<<<<<<<<
 *         unsigned int *x2
 *         unsigned int *y2
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_False) < 0) __PYX_ERR(1, 5116, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5116, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_rgb_array_copy = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":5120
 *         unsigned int *y2
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":5121
 * 
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for y in range(h):
 *                 x2 = &fisheye_model[x, y, 0]
 */
        __pyx_t_3 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_9 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_x2 = ((unsigned int *)1);
                            __pyx_v_y = ((int)0xbad0bad0);
                            __pyx_v_y2 = ((unsigned int *)1);

                            /* "PygameShader/shader.pyx":5122
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):             # <<<<<<<<<<<<<<
 *                 x2 = &fisheye_model[x, y, 0]
 *                 y2 = &fisheye_model[x, y, 1]
 */
                            __pyx_t_10 = __pyx_v_h;
                            __pyx_t_11 = __pyx_t_10;
                            for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                              __pyx_v_y = __pyx_t_12;

                              /* "PygameShader/shader.pyx":5123
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):
 *                 x2 = &fisheye_model[x, y, 0]             # <<<<<<<<<<<<<<
 *                 y2 = &fisheye_model[x, y, 1]
 * 
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 0;
                              __pyx_v_x2 = (&(*((unsigned int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_fisheye_model.data + __pyx_t_13 * __pyx_v_fisheye_model.strides[0]) ) + __pyx_t_14 * __pyx_v_fisheye_model.strides[1]) ) + __pyx_t_15 * __pyx_v_fisheye_model.strides[2]) ))));

                              /* "PygameShader/shader.pyx":5124
 *             for y in range(h):
 *                 x2 = &fisheye_model[x, y, 0]
 *                 y2 = &fisheye_model[x, y, 1]             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x2[0], y2[0], 0]
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 1;
                              __pyx_v_y2 = (&(*((unsigned int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_fisheye_model.data + __pyx_t_15 * __pyx_v_fisheye_model.strides[0]) ) + __pyx_t_14 * __pyx_v_fisheye_model.strides[1]) ) + __pyx_t_13 * __pyx_v_fisheye_model.strides[2]) ))));

                              /* "PygameShader/shader.pyx":5126
 *                 y2 = &fisheye_model[x, y, 1]
 * 
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x2[0], y2[0], 0]             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y, 1] = rgb_array_copy[x2[0], y2[0], 1]
 *                 rgb_array_[x, y, 2] = rgb_array_copy[x2[0], y2[0], 2]
 */
                              __pyx_t_16 = (__pyx_v_x2[0]);
                              __pyx_t_17 = (__pyx_v_y2[0]);
                              __pyx_t_13 = 0;
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_15 = __pyx_v_y;
                              __pyx_t_18 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[2]) )));

                              /* "PygameShader/shader.pyx":5127
 * 
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x2[0], y2[0], 0]
 *                 rgb_array_[x, y, 1] = rgb_array_copy[x2[0], y2[0], 1]             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y, 2] = rgb_array_copy[x2[0], y2[0], 2]
 * 
 */
                              __pyx_t_17 = (__pyx_v_x2[0]);
                              __pyx_t_16 = (__pyx_v_y2[0]);
                              __pyx_t_13 = 1;
                              __pyx_t_18 = __pyx_v_x;
                              __pyx_t_15 = __pyx_v_y;
                              __pyx_t_14 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_18 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[2]) )));

                              /* "PygameShader/shader.pyx":5128
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x2[0], y2[0], 0]
 *                 rgb_array_[x, y, 1] = rgb_array_copy[x2[0], y2[0], 1]
 *                 rgb_array_[x, y, 2] = rgb_array_copy[x2[0], y2[0], 2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_16 = (__pyx_v_x2[0]);
                              __pyx_t_17 = (__pyx_v_y2[0]);
                              __pyx_t_13 = 2;
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_15 = __pyx_v_y;
                              __pyx_t_18 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[2]) )));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":5120
 *         unsigned int *y2
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":5085
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_fisheye24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, unsigned int [:, :, :] fisheye_model):
 *     """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_fisheye24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":5136
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline tuple shader_rain_footprint_inplace_c(Py_ssize_t w, Py_ssize_t h):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A FISH EYE LENS DEFORMATION MAP/TEXTURE
 */

static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_rain_footprint_inplace_c(Py_ssize_t __pyx_v_w, Py_ssize_t __pyx_v_h) {
  __Pyx_memviewslice __pyx_v_rain_fisheye_model = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_y;
  int __pyx_v_x;
  CYTHON_UNUSED int __pyx_v_v;
  float __pyx_v_ny;
  float __pyx_v_ny2;
  float __pyx_v_nx;
  float __pyx_v_nx2;
  float __pyx_v_r;
  float __pyx_v_theta;
  float __pyx_v_nxn;
  float __pyx_v_nyn;
  float __pyx_v_nr;
  int __pyx_v_x2;
  int __pyx_v_y2;
  CYTHON_UNUSED float __pyx_v_s;
  float __pyx_v_c1;
  float __pyx_v_c2;
  float __pyx_v_w2;
  float __pyx_v_h2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_rain_footprint_inplace_c", 0);

  /* "PygameShader/shader.pyx":5150
 *     :return     : Pygame Surface representing the fish-eye effect and the equivalent numpy.ndarray
 *     """
 *     assert w > 0, "Argument w must be > 0"             # <<<<<<<<<<<<<<
 *     assert h > 0, "Argument h must be > 0"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_w > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_w_must_be_0);
      __PYX_ERR(1, 5150, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":5151
 *     """
 *     assert w > 0, "Argument w must be > 0"
 *     assert h > 0, "Argument h must be > 0"             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_h > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_h_must_be_0);
      __PYX_ERR(1, 5151, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":5154
 * 
 *     cdef:
 *         unsigned int [:, :, ::1] rain_fisheye_model = numpy.zeros((w, h, 3), numpy.uint)             # <<<<<<<<<<<<<<
 *         int y=0, x=0, v
 *         float ny, ny2, nx, nx2, r, theta, nxn, nyn, nr
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_3);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5154, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5154, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rain_fisheye_model = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":5155
 *     cdef:
 *         unsigned int [:, :, ::1] rain_fisheye_model = numpy.zeros((w, h, 3), numpy.uint)
 *         int y=0, x=0, v             # <<<<<<<<<<<<<<
 *         float ny, ny2, nx, nx2, r, theta, nxn, nyn, nr
 *         int x2, y2
 */
  __pyx_v_y = 0;
  __pyx_v_x = 0;

  /* "PygameShader/shader.pyx":5158
 *         float ny, ny2, nx, nx2, r, theta, nxn, nyn, nr
 *         int x2, y2
 *         float s = <float>w * <float>h             # <<<<<<<<<<<<<<
 *         float c1 = <float>2.0 / <float>h
 *         float c2 = <float>2.0 / <float>w
 */
  __pyx_v_s = (((float)__pyx_v_w) * ((float)__pyx_v_h));

  /* "PygameShader/shader.pyx":5159
 *         int x2, y2
 *         float s = <float>w * <float>h
 *         float c1 = <float>2.0 / <float>h             # <<<<<<<<<<<<<<
 *         float c2 = <float>2.0 / <float>w
 *         float w2 = <float>w * <float>0.5
 */
  __pyx_v_c1 = (((float)2.0) / ((float)__pyx_v_h));

  /* "PygameShader/shader.pyx":5160
 *         float s = <float>w * <float>h
 *         float c1 = <float>2.0 / <float>h
 *         float c2 = <float>2.0 / <float>w             # <<<<<<<<<<<<<<
 *         float w2 = <float>w * <float>0.5
 *         float h2 = <float>h * <float>0.5
 */
  __pyx_v_c2 = (((float)2.0) / ((float)__pyx_v_w));

  /* "PygameShader/shader.pyx":5161
 *         float c1 = <float>2.0 / <float>h
 *         float c2 = <float>2.0 / <float>w
 *         float w2 = <float>w * <float>0.5             # <<<<<<<<<<<<<<
 *         float h2 = <float>h * <float>0.5
 * 
 */
  __pyx_v_w2 = (((float)__pyx_v_w) * ((float)0.5));

  /* "PygameShader/shader.pyx":5162
 *         float c2 = <float>2.0 / <float>w
 *         float w2 = <float>w * <float>0.5
 *         float h2 = <float>h * <float>0.5             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_h2 = (((float)__pyx_v_h) * ((float)0.5));

  /* "PygameShader/shader.pyx":5164
 *         float h2 = <float>h * <float>0.5
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             nx = x * c2 - <float>1.0
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":5165
 * 
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             nx = x * c2 - <float>1.0
 *             nx2 = nx * nx
 */
        __pyx_t_9 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_11 = (__pyx_t_9 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_11 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_6)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_nr) lastprivate(__pyx_v_nx) lastprivate(__pyx_v_nx2) lastprivate(__pyx_v_nxn) lastprivate(__pyx_v_ny) lastprivate(__pyx_v_ny2) lastprivate(__pyx_v_nyn) lastprivate(__pyx_v_r) lastprivate(__pyx_v_theta) lastprivate(__pyx_v_v) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_10);
                            /* Initialize private variables to invalid values */
                            __pyx_v_nr = ((float)__PYX_NAN());
                            __pyx_v_nx = ((float)__PYX_NAN());
                            __pyx_v_nx2 = ((float)__PYX_NAN());
                            __pyx_v_nxn = ((float)__PYX_NAN());
                            __pyx_v_ny = ((float)__PYX_NAN());
                            __pyx_v_ny2 = ((float)__PYX_NAN());
                            __pyx_v_nyn = ((float)__PYX_NAN());
                            __pyx_v_r = ((float)__PYX_NAN());
                            __pyx_v_theta = ((float)__PYX_NAN());
                            __pyx_v_v = ((int)0xbad0bad0);
                            __pyx_v_x2 = ((int)0xbad0bad0);
                            __pyx_v_y = ((int)0xbad0bad0);
                            __pyx_v_y2 = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":5166
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             nx = x * c2 - <float>1.0             # <<<<<<<<<<<<<<
 *             nx2 = nx * nx
 *             for y in range(h):
 */
                            __pyx_v_nx = ((__pyx_v_x * __pyx_v_c2) - ((float)1.0));

                            /* "PygameShader/shader.pyx":5167
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             nx = x * c2 - <float>1.0
 *             nx2 = nx * nx             # <<<<<<<<<<<<<<
 *             for y in range(h):
 *                 ny = y * c1 - <float>1.0
 */
                            __pyx_v_nx2 = (__pyx_v_nx * __pyx_v_nx);

                            /* "PygameShader/shader.pyx":5168
 *             nx = x * c2 - <float>1.0
 *             nx2 = nx * nx
 *             for y in range(h):             # <<<<<<<<<<<<<<
 *                 ny = y * c1 - <float>1.0
 *                 ny2 = ny * ny
 */
                            __pyx_t_12 = __pyx_v_h;
                            __pyx_t_13 = __pyx_t_12;
                            for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_13; __pyx_t_6+=1) {
                              __pyx_v_y = __pyx_t_6;

                              /* "PygameShader/shader.pyx":5169
 *             nx2 = nx * nx
 *             for y in range(h):
 *                 ny = y * c1 - <float>1.0             # <<<<<<<<<<<<<<
 *                 ny2 = ny * ny
 *                 r = <float>sqrt(nx2 + ny2)
 */
                              __pyx_v_ny = ((__pyx_v_y * __pyx_v_c1) - ((float)1.0));

                              /* "PygameShader/shader.pyx":5170
 *             for y in range(h):
 *                 ny = y * c1 - <float>1.0
 *                 ny2 = ny * ny             # <<<<<<<<<<<<<<
 *                 r = <float>sqrt(nx2 + ny2)
 *                 if 0.0 <= r <= 1.0:
 */
                              __pyx_v_ny2 = (__pyx_v_ny * __pyx_v_ny);

                              /* "PygameShader/shader.pyx":5171
 *                 ny = y * c1 - <float>1.0
 *                 ny2 = ny * ny
 *                 r = <float>sqrt(nx2 + ny2)             # <<<<<<<<<<<<<<
 *                 if 0.0 <= r <= 1.0:
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.45
 */
                              __pyx_v_r = ((float)sqrt((__pyx_v_nx2 + __pyx_v_ny2)));

                              /* "PygameShader/shader.pyx":5172
 *                 ny2 = ny * ny
 *                 r = <float>sqrt(nx2 + ny2)
 *                 if 0.0 <= r <= 1.0:             # <<<<<<<<<<<<<<
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.45
 *                     if nr <= 1.0:
 */
                              __pyx_t_14 = (0.0 <= __pyx_v_r);
                              if (__pyx_t_14) {
                                __pyx_t_14 = (__pyx_v_r <= 1.0);
                              }
                              __pyx_t_15 = (__pyx_t_14 != 0);
                              if (__pyx_t_15) {

                                /* "PygameShader/shader.pyx":5173
 *                 r = <float>sqrt(nx2 + ny2)
 *                 if 0.0 <= r <= 1.0:
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.45             # <<<<<<<<<<<<<<
 *                     if nr <= 1.0:
 *                         theta = <float>atan2(ny, nx)
 */
                                __pyx_v_nr = (((__pyx_v_r + ((float)1.0)) - ((float)sqrt((1.0 - (__pyx_v_nx2 + __pyx_v_ny2))))) * ((float)0.45));

                                /* "PygameShader/shader.pyx":5174
 *                 if 0.0 <= r <= 1.0:
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.45
 *                     if nr <= 1.0:             # <<<<<<<<<<<<<<
 *                         theta = <float>atan2(ny, nx)
 *                         nxn = nr * <float>cos(theta)
 */
                                __pyx_t_15 = ((__pyx_v_nr <= 1.0) != 0);
                                if (__pyx_t_15) {

                                  /* "PygameShader/shader.pyx":5175
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.45
 *                     if nr <= 1.0:
 *                         theta = <float>atan2(ny, nx)             # <<<<<<<<<<<<<<
 *                         nxn = nr * <float>cos(theta)
 *                         nyn = nr * <float>sin(theta)
 */
                                  __pyx_v_theta = ((float)atan2(__pyx_v_ny, __pyx_v_nx));

                                  /* "PygameShader/shader.pyx":5176
 *                     if nr <= 1.0:
 *                         theta = <float>atan2(ny, nx)
 *                         nxn = nr * <float>cos(theta)             # <<<<<<<<<<<<<<
 *                         nyn = nr * <float>sin(theta)
 *                         x2 = <int>(nxn * w2 + w2)
 */
                                  __pyx_v_nxn = (__pyx_v_nr * ((float)cos(__pyx_v_theta)));

                                  /* "PygameShader/shader.pyx":5177
 *                         theta = <float>atan2(ny, nx)
 *                         nxn = nr * <float>cos(theta)
 *                         nyn = nr * <float>sin(theta)             # <<<<<<<<<<<<<<
 *                         x2 = <int>(nxn * w2 + w2)
 *                         y2 = <int>(nyn * h2 + h2)
 */
                                  __pyx_v_nyn = (__pyx_v_nr * ((float)sin(__pyx_v_theta)));

                                  /* "PygameShader/shader.pyx":5178
 *                         nxn = nr * <float>cos(theta)
 *                         nyn = nr * <float>sin(theta)
 *                         x2 = <int>(nxn * w2 + w2)             # <<<<<<<<<<<<<<
 *                         y2 = <int>(nyn * h2 + h2)
 *                         v = <int>(y2 * w + x2)
 */
                                  __pyx_v_x2 = ((int)((__pyx_v_nxn * __pyx_v_w2) + __pyx_v_w2));

                                  /* "PygameShader/shader.pyx":5179
 *                         nyn = nr * <float>sin(theta)
 *                         x2 = <int>(nxn * w2 + w2)
 *                         y2 = <int>(nyn * h2 + h2)             # <<<<<<<<<<<<<<
 *                         v = <int>(y2 * w + x2)
 *                         rain_fisheye_model[x, y, 0] = x2
 */
                                  __pyx_v_y2 = ((int)((__pyx_v_nyn * __pyx_v_h2) + __pyx_v_h2));

                                  /* "PygameShader/shader.pyx":5180
 *                         x2 = <int>(nxn * w2 + w2)
 *                         y2 = <int>(nyn * h2 + h2)
 *                         v = <int>(y2 * w + x2)             # <<<<<<<<<<<<<<
 *                         rain_fisheye_model[x, y, 0] = x2
 *                         rain_fisheye_model[x, y, 1] = y2
 */
                                  __pyx_v_v = ((int)((__pyx_v_y2 * __pyx_v_w) + __pyx_v_x2));

                                  /* "PygameShader/shader.pyx":5181
 *                         y2 = <int>(nyn * h2 + h2)
 *                         v = <int>(y2 * w + x2)
 *                         rain_fisheye_model[x, y, 0] = x2             # <<<<<<<<<<<<<<
 *                         rain_fisheye_model[x, y, 1] = y2
 *                         rain_fisheye_model[x, y, 2] = 0
 */
                                  __pyx_t_16 = __pyx_v_x;
                                  __pyx_t_17 = __pyx_v_y;
                                  __pyx_t_18 = 0;
                                  *((unsigned int *) ( /* dim=2 */ ((char *) (((unsigned int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rain_fisheye_model.data + __pyx_t_16 * __pyx_v_rain_fisheye_model.strides[0]) ) + __pyx_t_17 * __pyx_v_rain_fisheye_model.strides[1]) )) + __pyx_t_18)) )) = __pyx_v_x2;

                                  /* "PygameShader/shader.pyx":5182
 *                         v = <int>(y2 * w + x2)
 *                         rain_fisheye_model[x, y, 0] = x2
 *                         rain_fisheye_model[x, y, 1] = y2             # <<<<<<<<<<<<<<
 *                         rain_fisheye_model[x, y, 2] = 0
 * 
 */
                                  __pyx_t_18 = __pyx_v_x;
                                  __pyx_t_17 = __pyx_v_y;
                                  __pyx_t_16 = 1;
                                  *((unsigned int *) ( /* dim=2 */ ((char *) (((unsigned int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rain_fisheye_model.data + __pyx_t_18 * __pyx_v_rain_fisheye_model.strides[0]) ) + __pyx_t_17 * __pyx_v_rain_fisheye_model.strides[1]) )) + __pyx_t_16)) )) = __pyx_v_y2;

                                  /* "PygameShader/shader.pyx":5183
 *                         rain_fisheye_model[x, y, 0] = x2
 *                         rain_fisheye_model[x, y, 1] = y2
 *                         rain_fisheye_model[x, y, 2] = 0             # <<<<<<<<<<<<<<
 * 
 *     return make_surface(asarray(rain_fisheye_model)), asarray(rain_fisheye_model)
 */
                                  __pyx_t_16 = __pyx_v_x;
                                  __pyx_t_17 = __pyx_v_y;
                                  __pyx_t_18 = 2;
                                  *((unsigned int *) ( /* dim=2 */ ((char *) (((unsigned int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rain_fisheye_model.data + __pyx_t_16 * __pyx_v_rain_fisheye_model.strides[0]) ) + __pyx_t_17 * __pyx_v_rain_fisheye_model.strides[1]) )) + __pyx_t_18)) )) = 0;

                                  /* "PygameShader/shader.pyx":5174
 *                 if 0.0 <= r <= 1.0:
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.45
 *                     if nr <= 1.0:             # <<<<<<<<<<<<<<
 *                         theta = <float>atan2(ny, nx)
 *                         nxn = nr * <float>cos(theta)
 */
                                }

                                /* "PygameShader/shader.pyx":5172
 *                 ny2 = ny * ny
 *                 r = <float>sqrt(nx2 + ny2)
 *                 if 0.0 <= r <= 1.0:             # <<<<<<<<<<<<<<
 *                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.45
 *                     if nr <= 1.0:
 */
                              }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":5164
 *         float h2 = <float>h * <float>0.5
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             nx = x * c2 - <float>1.0
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":5185
 *                         rain_fisheye_model[x, y, 2] = 0
 * 
 *     return make_surface(asarray(rain_fisheye_model)), asarray(rain_fisheye_model)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_rain_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_7 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_asarray); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_rain_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":5136
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline tuple shader_rain_footprint_inplace_c(Py_ssize_t w, Py_ssize_t h):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A FISH EYE LENS DEFORMATION MAP/TEXTURE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_AddTraceback("PygameShader.shader.shader_rain_footprint_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rain_fisheye_model, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":5192
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_rain_fisheye24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         unsigned int [:, :, ::1] rain_fisheye_model
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rain_fisheye24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, __Pyx_memviewslice __pyx_v_rain_fisheye_model) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_x;
  int __pyx_v_y;
  __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned int *__pyx_v_x2;
  unsigned int *__pyx_v_y2;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  size_t __pyx_t_16;
  size_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_rain_fisheye24_inplace_c", 0);

  /* "PygameShader/shader.pyx":5236
 *     cdef:
 *         Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":5240
 *     cdef:
 *         int x, y
 *         unsigned char [:, :, ::1] rgb_array_copy = numpy.array(rgb_array_, copy=True, order='C')             # <<<<<<<<<<<<<<
 *         unsigned int *x2
 *         unsigned int *y2
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 5240, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5240, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_rgb_array_copy = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":5244
 *         unsigned int *y2
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":5245
 * 
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for y in range(h):
 *                 x2 = &rain_fisheye_model[x, y, 0]
 */
        __pyx_t_3 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_9 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_x2 = ((unsigned int *)1);
                            __pyx_v_y = ((int)0xbad0bad0);
                            __pyx_v_y2 = ((unsigned int *)1);

                            /* "PygameShader/shader.pyx":5246
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):             # <<<<<<<<<<<<<<
 *                 x2 = &rain_fisheye_model[x, y, 0]
 *                 y2 = &rain_fisheye_model[x, y, 1]
 */
                            __pyx_t_10 = __pyx_v_h;
                            __pyx_t_11 = __pyx_t_10;
                            for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                              __pyx_v_y = __pyx_t_12;

                              /* "PygameShader/shader.pyx":5247
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):
 *                 x2 = &rain_fisheye_model[x, y, 0]             # <<<<<<<<<<<<<<
 *                 y2 = &rain_fisheye_model[x, y, 1]
 * 
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 0;
                              __pyx_v_x2 = (&(*((unsigned int *) ( /* dim=2 */ ((char *) (((unsigned int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rain_fisheye_model.data + __pyx_t_13 * __pyx_v_rain_fisheye_model.strides[0]) ) + __pyx_t_14 * __pyx_v_rain_fisheye_model.strides[1]) )) + __pyx_t_15)) ))));

                              /* "PygameShader/shader.pyx":5248
 *             for y in range(h):
 *                 x2 = &rain_fisheye_model[x, y, 0]
 *                 y2 = &rain_fisheye_model[x, y, 1]             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x2[0], y2[0], 0]
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 1;
                              __pyx_v_y2 = (&(*((unsigned int *) ( /* dim=2 */ ((char *) (((unsigned int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rain_fisheye_model.data + __pyx_t_15 * __pyx_v_rain_fisheye_model.strides[0]) ) + __pyx_t_14 * __pyx_v_rain_fisheye_model.strides[1]) )) + __pyx_t_13)) ))));

                              /* "PygameShader/shader.pyx":5250
 *                 y2 = &rain_fisheye_model[x, y, 1]
 * 
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x2[0], y2[0], 0]             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y, 1] = rgb_array_copy[x2[0], y2[0], 1]
 *                 rgb_array_[x, y, 2] = rgb_array_copy[x2[0], y2[0], 2]
 */
                              __pyx_t_16 = (__pyx_v_x2[0]);
                              __pyx_t_17 = (__pyx_v_y2[0]);
                              __pyx_t_13 = 0;
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_15 = __pyx_v_y;
                              __pyx_t_18 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_13)) )));

                              /* "PygameShader/shader.pyx":5251
 * 
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x2[0], y2[0], 0]
 *                 rgb_array_[x, y, 1] = rgb_array_copy[x2[0], y2[0], 1]             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y, 2] = rgb_array_copy[x2[0], y2[0], 2]
 * 
 */
                              __pyx_t_17 = (__pyx_v_x2[0]);
                              __pyx_t_16 = (__pyx_v_y2[0]);
                              __pyx_t_13 = 1;
                              __pyx_t_18 = __pyx_v_x;
                              __pyx_t_15 = __pyx_v_y;
                              __pyx_t_14 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_18 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_13)) )));

                              /* "PygameShader/shader.pyx":5252
 *                 rgb_array_[x, y, 0] = rgb_array_copy[x2[0], y2[0], 0]
 *                 rgb_array_[x, y, 1] = rgb_array_copy[x2[0], y2[0], 1]
 *                 rgb_array_[x, y, 2] = rgb_array_copy[x2[0], y2[0], 2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_16 = (__pyx_v_x2[0]);
                              __pyx_t_17 = (__pyx_v_y2[0]);
                              __pyx_t_13 = 2;
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_15 = __pyx_v_y;
                              __pyx_t_18 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_13)) )));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":5244
 *         unsigned int *y2
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":5192
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_rain_fisheye24_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         unsigned int [:, :, ::1] rain_fisheye_model
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_rain_fisheye24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":5262
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_tv_scanline_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         int frame_):
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_tv_scanline_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, int __pyx_v_frame_) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_j;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  int __pyx_v_frame_2;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  __Pyx_RefNannySetupContext("shader_tv_scanline_inplace_c", 0);

  /* "PygameShader/shader.pyx":5286
 *     cdef:
 *         Py_ssize_t w, h
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":5293
 *         unsigned char *g
 *         unsigned char *b
 *         int frame_2 = frame_ >> 1             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_frame_2 = (__pyx_v_frame_ >> 1);

  /* "PygameShader/shader.pyx":5295
 *         int frame_2 = frame_ >> 1
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for y in prange(0, h, frame_, schedule='static', num_threads=THREADS):
 *             for x in range(w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":5296
 * 
 *     with nogil:
 *         for y in prange(0, h, frame_, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for x in range(w):
 *                 for j in range(frame_2):
 */
        __pyx_t_3 = __pyx_v_h;
        __pyx_t_4 = __pyx_v_frame_;
        if ((__pyx_t_4 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_5 = (__pyx_t_3 - 0 + __pyx_t_4 - __pyx_t_4/abs(__pyx_t_4)) / __pyx_t_4;
            if (__pyx_t_5 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_5; __pyx_t_2++){
                        {
                            __pyx_v_y = (int)(0 + __pyx_t_4 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_j = ((int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":5297
 *     with nogil:
 *         for y in prange(0, h, frame_, schedule='static', num_threads=THREADS):
 *             for x in range(w):             # <<<<<<<<<<<<<<
 *                 for j in range(frame_2):
 *                     if y + j < h - 1:
 */
                            __pyx_t_6 = __pyx_v_w;
                            __pyx_t_7 = __pyx_t_6;
                            for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
                              __pyx_v_x = __pyx_t_8;

                              /* "PygameShader/shader.pyx":5298
 *         for y in prange(0, h, frame_, schedule='static', num_threads=THREADS):
 *             for x in range(w):
 *                 for j in range(frame_2):             # <<<<<<<<<<<<<<
 *                     if y + j < h - 1:
 *                         r = &rgb_array_[x, y + j, 0]
 */
                              __pyx_t_9 = __pyx_v_frame_2;
                              __pyx_t_10 = __pyx_t_9;
                              for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
                                __pyx_v_j = __pyx_t_11;

                                /* "PygameShader/shader.pyx":5299
 *             for x in range(w):
 *                 for j in range(frame_2):
 *                     if y + j < h - 1:             # <<<<<<<<<<<<<<
 *                         r = &rgb_array_[x, y + j, 0]
 *                         g = &rgb_array_[x, y + j, 1]
 */
                                __pyx_t_12 = (((__pyx_v_y + __pyx_v_j) < (__pyx_v_h - 1)) != 0);
                                if (__pyx_t_12) {

                                  /* "PygameShader/shader.pyx":5300
 *                 for j in range(frame_2):
 *                     if y + j < h - 1:
 *                         r = &rgb_array_[x, y + j, 0]             # <<<<<<<<<<<<<<
 *                         g = &rgb_array_[x, y + j, 1]
 *                         b = &rgb_array_[x, y + j, 2]
 */
                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_y + __pyx_v_j);
                                  __pyx_t_15 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":5301
 *                     if y + j < h - 1:
 *                         r = &rgb_array_[x, y + j, 0]
 *                         g = &rgb_array_[x, y + j, 1]             # <<<<<<<<<<<<<<
 *                         b = &rgb_array_[x, y + j, 2]
 *                     else:
 */
                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_y + __pyx_v_j);
                                  __pyx_t_13 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":5302
 *                         r = &rgb_array_[x, y + j, 0]
 *                         g = &rgb_array_[x, y + j, 1]
 *                         b = &rgb_array_[x, y + j, 2]             # <<<<<<<<<<<<<<
 *                     else:
 *                         r = &rgb_array_[x, y, 0]
 */
                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_y + __pyx_v_j);
                                  __pyx_t_15 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":5299
 *             for x in range(w):
 *                 for j in range(frame_2):
 *                     if y + j < h - 1:             # <<<<<<<<<<<<<<
 *                         r = &rgb_array_[x, y + j, 0]
 *                         g = &rgb_array_[x, y + j, 1]
 */
                                  goto __pyx_L14;
                                }

                                /* "PygameShader/shader.pyx":5304
 *                         b = &rgb_array_[x, y + j, 2]
 *                     else:
 *                         r = &rgb_array_[x, y, 0]             # <<<<<<<<<<<<<<
 *                         g = &rgb_array_[x, y, 1]
 *                         b = &rgb_array_[x, y, 2]
 */
                                /*else*/ {
                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":5305
 *                     else:
 *                         r = &rgb_array_[x, y, 0]
 *                         g = &rgb_array_[x, y, 1]             # <<<<<<<<<<<<<<
 *                         b = &rgb_array_[x, y, 2]
 *                     r[0] = <unsigned char> (r[0] * <float>0.65)
 */
                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":5306
 *                         r = &rgb_array_[x, y, 0]
 *                         g = &rgb_array_[x, y, 1]
 *                         b = &rgb_array_[x, y, 2]             # <<<<<<<<<<<<<<
 *                     r[0] = <unsigned char> (r[0] * <float>0.65)
 *                     g[0] = <unsigned char> (g[0] * <float>0.65)
 */
                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));
                                }
                                __pyx_L14:;

                                /* "PygameShader/shader.pyx":5307
 *                         g = &rgb_array_[x, y, 1]
 *                         b = &rgb_array_[x, y, 2]
 *                     r[0] = <unsigned char> (r[0] * <float>0.65)             # <<<<<<<<<<<<<<
 *                     g[0] = <unsigned char> (g[0] * <float>0.65)
 *                     b[0] = <unsigned char> (b[0] * <float>0.65)
 */
                                (__pyx_v_r[0]) = ((unsigned char)((__pyx_v_r[0]) * ((float)0.65)));

                                /* "PygameShader/shader.pyx":5308
 *                         b = &rgb_array_[x, y, 2]
 *                     r[0] = <unsigned char> (r[0] * <float>0.65)
 *                     g[0] = <unsigned char> (g[0] * <float>0.65)             # <<<<<<<<<<<<<<
 *                     b[0] = <unsigned char> (b[0] * <float>0.65)
 * 
 */
                                (__pyx_v_g[0]) = ((unsigned char)((__pyx_v_g[0]) * ((float)0.65)));

                                /* "PygameShader/shader.pyx":5309
 *                     r[0] = <unsigned char> (r[0] * <float>0.65)
 *                     g[0] = <unsigned char> (g[0] * <float>0.65)
 *                     b[0] = <unsigned char> (b[0] * <float>0.65)             # <<<<<<<<<<<<<<
 * 
 * 
 */
                                (__pyx_v_b[0]) = ((unsigned char)((__pyx_v_b[0]) * ((float)0.65)));
                              }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":5295
 *         int frame_2 = frame_ >> 1
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for y in prange(0, h, frame_, schedule='static', num_threads=THREADS):
 *             for x in range(w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":5262
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_tv_scanline_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         int frame_):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":5317
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_rgb_split_inplace_c(object surface_, int offset_):             # <<<<<<<<<<<<<<
 *     """
 *     THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rgb_split_inplace_c(PyObject *__pyx_v_surface_, int __pyx_v_offset_) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_z;
  __Pyx_memviewslice __pyx_v_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_red = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_green = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_blue = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_rgb_split_inplace_c", 0);

  /* "PygameShader/shader.pyx":5343
 *     cdef:
 *         Py_ssize_t w, h
 *     w, h = surface_.get_size()             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 5343, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 5343, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 5343, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5343, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5343, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_w = __pyx_t_6;
  __pyx_v_h = __pyx_t_7;

  /* "PygameShader/shader.pyx":5347
 *     cdef:
 *         int i, j
 *         int z = <int>h * <int>w * 3             # <<<<<<<<<<<<<<
 *         unsigned char [:] rgb   = numpy.frombuffer(surface_.get_buffer(), dtype=numpy.uint8)
 *         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')
 */
  __pyx_v_z = ((((int)__pyx_v_h) * ((int)__pyx_v_w)) * 3);

  /* "PygameShader/shader.pyx":5348
 *         int i, j
 *         int z = <int>h * <int>w * 3
 *         unsigned char [:] rgb   = numpy.frombuffer(surface_.get_buffer(), dtype=numpy.uint8)             # <<<<<<<<<<<<<<
 *         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')
 *         unsigned char [:] green = numpy.zeros(z, uint8, order='C')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_rgb = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":5349
 *         int z = <int>h * <int>w * 3
 *         unsigned char [:] rgb   = numpy.frombuffer(surface_.get_buffer(), dtype=numpy.uint8)
 *         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')             # <<<<<<<<<<<<<<
 *         unsigned char [:] green = numpy.zeros(z, uint8, order='C')
 *         unsigned char [:] blue  = numpy.zeros(z, uint8, order='C')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_8 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5349, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5349, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_red = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":5350
 *         unsigned char [:] rgb   = numpy.frombuffer(surface_.get_buffer(), dtype=numpy.uint8)
 *         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')
 *         unsigned char [:] green = numpy.zeros(z, uint8, order='C')             # <<<<<<<<<<<<<<
 *         unsigned char [:] blue  = numpy.zeros(z, uint8, order='C')
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __pyx_t_8 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5350, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5350, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_green = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":5351
 *         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')
 *         unsigned char [:] green = numpy.zeros(z, uint8, order='C')
 *         unsigned char [:] blue  = numpy.zeros(z, uint8, order='C')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_uint8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_8 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5351, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5351, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_blue = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":5354
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":5356
 *     with nogil:
 * 
 *         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):             # <<<<<<<<<<<<<<
 *             j = (i >> 2) * 3
 *             red[j]     = rgb[i + 2]
 */
        __pyx_t_7 = ((__pyx_v_w * __pyx_v_h) * 4);
        if ((4 == 0)) abort();
        {
            __pyx_t_11 = 8;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_10 = (__pyx_t_7 - 0 + 4 - 4/abs(4)) / 4;
            if (__pyx_t_10 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_12, __pyx_t_13)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) schedule(static, __pyx_t_11)
                    #endif /* _OPENMP */
                    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_10; __pyx_t_6++){
                        {
                            __pyx_v_i = (int)(0 + 4 * __pyx_t_6);
                            /* Initialize private variables to invalid values */
                            __pyx_v_j = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":5357
 * 
 *         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):
 *             j = (i >> 2) * 3             # <<<<<<<<<<<<<<
 *             red[j]     = rgb[i + 2]
 *             green[j+1] = rgb[i + 1]
 */
                            __pyx_v_j = ((__pyx_v_i >> 2) * 3);

                            /* "PygameShader/shader.pyx":5358
 *         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):
 *             j = (i >> 2) * 3
 *             red[j]     = rgb[i + 2]             # <<<<<<<<<<<<<<
 *             green[j+1] = rgb[i + 1]
 *             blue[j+2]  = rgb[i    ]
 */
                            __pyx_t_12 = (__pyx_v_i + 2);
                            __pyx_t_13 = __pyx_v_j;
                            *((unsigned char *) ( /* dim=0 */ (__pyx_v_red.data + __pyx_t_13 * __pyx_v_red.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));

                            /* "PygameShader/shader.pyx":5359
 *             j = (i >> 2) * 3
 *             red[j]     = rgb[i + 2]
 *             green[j+1] = rgb[i + 1]             # <<<<<<<<<<<<<<
 *             blue[j+2]  = rgb[i    ]
 * 
 */
                            __pyx_t_12 = (__pyx_v_i + 1);
                            __pyx_t_13 = (__pyx_v_j + 1);
                            *((unsigned char *) ( /* dim=0 */ (__pyx_v_green.data + __pyx_t_13 * __pyx_v_green.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));

                            /* "PygameShader/shader.pyx":5360
 *             red[j]     = rgb[i + 2]
 *             green[j+1] = rgb[i + 1]
 *             blue[j+2]  = rgb[i    ]             # <<<<<<<<<<<<<<
 * 
 *     del rgb
 */
                            __pyx_t_12 = __pyx_v_i;
                            __pyx_t_13 = (__pyx_v_j + 2);
                            *((unsigned char *) ( /* dim=0 */ (__pyx_v_blue.data + __pyx_t_13 * __pyx_v_blue.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":5354
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "PygameShader/shader.pyx":5362
 *             blue[j+2]  = rgb[i    ]
 * 
 *     del rgb             # <<<<<<<<<<<<<<
 *     surface_.blit(fromstring(bytes(red), (w, h), 'RGB'), (0, 0))
 *     surface_.blit(fromstring(bytes(green), (w, h), 'RGB'), (offset_, offset_),
 */
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);

  /* "PygameShader/shader.pyx":5363
 * 
 *     del rgb
 *     surface_.blit(fromstring(bytes(red), (w, h), 'RGB'), (0, 0))             # <<<<<<<<<<<<<<
 *     surface_.blit(fromstring(bytes(green), (w, h), 'RGB'), (offset_, offset_),
 *                   special_flags=BLEND_RGB_ADD)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_red, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_14 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_15 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 5363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15);
  __pyx_t_4 = 0;
  __pyx_t_15 = 0;
  __pyx_t_15 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_15)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_15, __pyx_t_14, __pyx_t_16, __pyx_n_s_RGB};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5363, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_15, __pyx_t_14, __pyx_t_16, __pyx_n_s_RGB};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5363, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_15) {
      __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_15); __pyx_t_15 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_t_16);
    __Pyx_INCREF(__pyx_n_s_RGB);
    __Pyx_GIVEREF(__pyx_n_s_RGB);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_11, __pyx_n_s_RGB);
    __pyx_t_14 = 0;
    __pyx_t_16 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_tuple__12};
    __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5363, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_tuple__12};
    __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5363, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_t_2);
    __Pyx_INCREF(__pyx_tuple__12);
    __Pyx_GIVEREF(__pyx_tuple__12);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_tuple__12);
    __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PygameShader/shader.pyx":5364
 *     del rgb
 *     surface_.blit(fromstring(bytes(red), (w, h), 'RGB'), (0, 0))
 *     surface_.blit(fromstring(bytes(green), (w, h), 'RGB'), (offset_, offset_),             # <<<<<<<<<<<<<<
 *                   special_flags=BLEND_RGB_ADD)
 *     surface_.blit(fromstring(bytes(blue), (w, h), 'RGB'), (offset_ << 1, offset_ << 1),
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_green, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_16 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_16);
  __pyx_t_2 = 0;
  __pyx_t_16 = 0;
  __pyx_t_16 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_t_3, __pyx_t_14, __pyx_n_s_RGB};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5364, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_t_3, __pyx_t_14, __pyx_n_s_RGB};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5364, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_16) {
      __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_16); __pyx_t_16 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_11, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_11, __pyx_t_14);
    __Pyx_INCREF(__pyx_n_s_RGB);
    __Pyx_GIVEREF(__pyx_n_s_RGB);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_11, __pyx_n_s_RGB);
    __pyx_t_3 = 0;
    __pyx_t_14 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2);
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_14);
  __pyx_t_1 = 0;
  __pyx_t_14 = 0;

  /* "PygameShader/shader.pyx":5365
 *     surface_.blit(fromstring(bytes(red), (w, h), 'RGB'), (0, 0))
 *     surface_.blit(fromstring(bytes(green), (w, h), 'RGB'), (offset_, offset_),
 *                   special_flags=BLEND_RGB_ADD)             # <<<<<<<<<<<<<<
 *     surface_.blit(fromstring(bytes(blue), (w, h), 'RGB'), (offset_ << 1, offset_ << 1),
 *                   special_flags=BLEND_RGB_ADD)
 */
  __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_special_flags, __pyx_t_1) < 0) __PYX_ERR(1, 5365, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":5364
 *     del rgb
 *     surface_.blit(fromstring(bytes(red), (w, h), 'RGB'), (0, 0))
 *     surface_.blit(fromstring(bytes(green), (w, h), 'RGB'), (offset_, offset_),             # <<<<<<<<<<<<<<
 *                   special_flags=BLEND_RGB_ADD)
 *     surface_.blit(fromstring(bytes(blue), (w, h), 'RGB'), (offset_ << 1, offset_ << 1),
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":5366
 *     surface_.blit(fromstring(bytes(green), (w, h), 'RGB'), (offset_, offset_),
 *                   special_flags=BLEND_RGB_ADD)
 *     surface_.blit(fromstring(bytes(blue), (w, h), 'RGB'), (offset_ << 1, offset_ << 1),             # <<<<<<<<<<<<<<
 *                   special_flags=BLEND_RGB_ADD)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_blue, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_3);
  __pyx_t_8 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_4, __pyx_t_16, __pyx_n_s_RGB};
    __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5366, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_4, __pyx_t_16, __pyx_n_s_RGB};
    __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5366, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_11, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_11, __pyx_t_16);
    __Pyx_INCREF(__pyx_n_s_RGB);
    __Pyx_GIVEREF(__pyx_n_s_RGB);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_11, __pyx_n_s_RGB);
    __pyx_t_4 = 0;
    __pyx_t_16 = 0;
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_offset_ << 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyInt_From_long((__pyx_v_offset_ << 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_8);
  __pyx_t_2 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_16);
  __pyx_t_14 = 0;
  __pyx_t_16 = 0;

  /* "PygameShader/shader.pyx":5367
 *                   special_flags=BLEND_RGB_ADD)
 *     surface_.blit(fromstring(bytes(blue), (w, h), 'RGB'), (offset_ << 1, offset_ << 1),
 *                   special_flags=BLEND_RGB_ADD)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_16 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_special_flags, __pyx_t_14) < 0) __PYX_ERR(1, 5367, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "PygameShader/shader.pyx":5366
 *     surface_.blit(fromstring(bytes(green), (w, h), 'RGB'), (offset_, offset_),
 *                   special_flags=BLEND_RGB_ADD)
 *     surface_.blit(fromstring(bytes(blue), (w, h), 'RGB'), (offset_ << 1, offset_ << 1),             # <<<<<<<<<<<<<<
 *                   special_flags=BLEND_RGB_ADD)
 * 
 */
  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_16); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "PygameShader/shader.pyx":5317
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_rgb_split_inplace_c(object surface_, int offset_):             # <<<<<<<<<<<<<<
 *     """
 *     THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_rgb_split_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_red, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_green, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_blue, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":5376
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef shader_rgb_split_c(object surface_, int offset_):             # <<<<<<<<<<<<<<
 *     """
 *     THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)
 */

static PyObject *__pyx_f_12PygameShader_6shader_shader_rgb_split_c(PyObject *__pyx_v_surface_, int __pyx_v_offset_) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_z;
  __Pyx_memviewslice __pyx_v_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_red = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_green = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_blue = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_new_surface = NULL;
  PyObject *__pyx_v_red_ = NULL;
  PyObject *__pyx_v_green_ = NULL;
  PyObject *__pyx_v_blue_ = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_rgb_split_c", 0);

  /* "PygameShader/shader.pyx":5391
 *     cdef:
 *         Py_ssize_t w, h
 *     w, h = surface_.get_size()             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 5391, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 5391, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 5391, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5391, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5391, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_w = __pyx_t_6;
  __pyx_v_h = __pyx_t_7;

  /* "PygameShader/shader.pyx":5395
 *     cdef:
 *         int i, j
 *         int z = <int>h * <int>w * 3             # <<<<<<<<<<<<<<
 *         unsigned char [:] rgb   = numpy.frombuffer(surface_.get_buffer(), dtype=numpy.uint8)
 *         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')
 */
  __pyx_v_z = ((((int)__pyx_v_h) * ((int)__pyx_v_w)) * 3);

  /* "PygameShader/shader.pyx":5396
 *         int i, j
 *         int z = <int>h * <int>w * 3
 *         unsigned char [:] rgb   = numpy.frombuffer(surface_.get_buffer(), dtype=numpy.uint8)             # <<<<<<<<<<<<<<
 *         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')
 *         unsigned char [:] green = numpy.zeros(z, uint8, order='C')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5396, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_rgb = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":5397
 *         int z = <int>h * <int>w * 3
 *         unsigned char [:] rgb   = numpy.frombuffer(surface_.get_buffer(), dtype=numpy.uint8)
 *         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')             # <<<<<<<<<<<<<<
 *         unsigned char [:] green = numpy.zeros(z, uint8, order='C')
 *         unsigned char [:] blue  = numpy.zeros(z, uint8, order='C')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_8 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5397, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5397, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_red = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":5398
 *         unsigned char [:] rgb   = numpy.frombuffer(surface_.get_buffer(), dtype=numpy.uint8)
 *         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')
 *         unsigned char [:] green = numpy.zeros(z, uint8, order='C')             # <<<<<<<<<<<<<<
 *         unsigned char [:] blue  = numpy.zeros(z, uint8, order='C')
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __pyx_t_8 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5398, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_green = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":5399
 *         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')
 *         unsigned char [:] green = numpy.zeros(z, uint8, order='C')
 *         unsigned char [:] blue  = numpy.zeros(z, uint8, order='C')             # <<<<<<<<<<<<<<
 * 
 *     # Create a new surface (sizes - offset)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_uint8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_8 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5399, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5399, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_blue = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":5402
 * 
 *     # Create a new surface (sizes - offset)
 *     new_surface = Surface((w-offset_, h-offset_))             # <<<<<<<<<<<<<<
 *     new_surface.convert()
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_w - __pyx_v_offset_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_h - __pyx_v_offset_)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_new_surface = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "PygameShader/shader.pyx":5403
 *     # Create a new surface (sizes - offset)
 *     new_surface = Surface((w-offset_, h-offset_))
 *     new_surface.convert()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_surface, __pyx_n_s_convert); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PygameShader/shader.pyx":5405
 *     new_surface.convert()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":5407
 *     with nogil:
 * 
 *         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):             # <<<<<<<<<<<<<<
 *             j = (i >> 2) * 3
 *             red[j]     = rgb[i + 2]
 */
        __pyx_t_7 = ((__pyx_v_w * __pyx_v_h) * 4);
        if ((4 == 0)) abort();
        {
            __pyx_t_11 = 8;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_10 = (__pyx_t_7 - 0 + 4 - 4/abs(4)) / 4;
            if (__pyx_t_10 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_12, __pyx_t_13)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) schedule(static, __pyx_t_11)
                    #endif /* _OPENMP */
                    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_10; __pyx_t_6++){
                        {
                            __pyx_v_i = (int)(0 + 4 * __pyx_t_6);
                            /* Initialize private variables to invalid values */
                            __pyx_v_j = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":5408
 * 
 *         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):
 *             j = (i >> 2) * 3             # <<<<<<<<<<<<<<
 *             red[j]     = rgb[i + 2]
 *             green[j+1] = rgb[i + 1]
 */
                            __pyx_v_j = ((__pyx_v_i >> 2) * 3);

                            /* "PygameShader/shader.pyx":5409
 *         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):
 *             j = (i >> 2) * 3
 *             red[j]     = rgb[i + 2]             # <<<<<<<<<<<<<<
 *             green[j+1] = rgb[i + 1]
 *             blue[j+2]  = rgb[i    ]
 */
                            __pyx_t_12 = (__pyx_v_i + 2);
                            __pyx_t_13 = __pyx_v_j;
                            *((unsigned char *) ( /* dim=0 */ (__pyx_v_red.data + __pyx_t_13 * __pyx_v_red.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));

                            /* "PygameShader/shader.pyx":5410
 *             j = (i >> 2) * 3
 *             red[j]     = rgb[i + 2]
 *             green[j+1] = rgb[i + 1]             # <<<<<<<<<<<<<<
 *             blue[j+2]  = rgb[i    ]
 * 
 */
                            __pyx_t_12 = (__pyx_v_i + 1);
                            __pyx_t_13 = (__pyx_v_j + 1);
                            *((unsigned char *) ( /* dim=0 */ (__pyx_v_green.data + __pyx_t_13 * __pyx_v_green.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));

                            /* "PygameShader/shader.pyx":5411
 *             red[j]     = rgb[i + 2]
 *             green[j+1] = rgb[i + 1]
 *             blue[j+2]  = rgb[i    ]             # <<<<<<<<<<<<<<
 * 
 *     del rgb
 */
                            __pyx_t_12 = __pyx_v_i;
                            __pyx_t_13 = (__pyx_v_j + 2);
                            *((unsigned char *) ( /* dim=0 */ (__pyx_v_blue.data + __pyx_t_13 * __pyx_v_blue.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":5405
 *     new_surface.convert()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "PygameShader/shader.pyx":5413
 *             blue[j+2]  = rgb[i    ]
 * 
 *     del rgb             # <<<<<<<<<<<<<<
 * 
 *     red_ = fromstring(bytes(red), (w, h), 'RGB')
 */
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);

  /* "PygameShader/shader.pyx":5415
 *     del rgb
 * 
 *     red_ = fromstring(bytes(red), (w, h), 'RGB')             # <<<<<<<<<<<<<<
 *     green_ = fromstring(bytes(green), (w, h), 'RGB')
 *     blue_ = fromstring(bytes(blue), (w, h), 'RGB')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_red, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2);
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_3, __pyx_t_14, __pyx_n_s_RGB};
    __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5415, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_3, __pyx_t_14, __pyx_n_s_RGB};
    __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5415, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_t_14);
    __Pyx_INCREF(__pyx_n_s_RGB);
    __Pyx_GIVEREF(__pyx_n_s_RGB);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_11, __pyx_n_s_RGB);
    __pyx_t_3 = 0;
    __pyx_t_14 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_red_ = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "PygameShader/shader.pyx":5416
 * 
 *     red_ = fromstring(bytes(red), (w, h), 'RGB')
 *     green_ = fromstring(bytes(green), (w, h), 'RGB')             # <<<<<<<<<<<<<<
 *     blue_ = fromstring(bytes(blue), (w, h), 'RGB')
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_green, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_14 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_14, __pyx_t_2, __pyx_n_s_RGB};
    __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5416, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_14, __pyx_t_2, __pyx_n_s_RGB};
    __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5416, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_RGB);
    __Pyx_GIVEREF(__pyx_n_s_RGB);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_11, __pyx_n_s_RGB);
    __pyx_t_14 = 0;
    __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_green_ = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "PygameShader/shader.pyx":5417
 *     red_ = fromstring(bytes(red), (w, h), 'RGB')
 *     green_ = fromstring(bytes(green), (w, h), 'RGB')
 *     blue_ = fromstring(bytes(blue), (w, h), 'RGB')             # <<<<<<<<<<<<<<
 * 
 *     new_surface.blit(red_, (-offset_, -offset_), special_flags=BLEND_RGB_ADD)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_blue, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_14 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_14);
  __pyx_t_4 = 0;
  __pyx_t_14 = 0;
  __pyx_t_14 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_14)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_14, __pyx_t_2, __pyx_t_3, __pyx_n_s_RGB};
    __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5417, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_14, __pyx_t_2, __pyx_t_3, __pyx_n_s_RGB};
    __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5417, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_14) {
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_14); __pyx_t_14 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_RGB);
    __Pyx_GIVEREF(__pyx_n_s_RGB);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_11, __pyx_n_s_RGB);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_blue_ = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "PygameShader/shader.pyx":5419
 *     blue_ = fromstring(bytes(blue), (w, h), 'RGB')
 * 
 *     new_surface.blit(red_, (-offset_, -offset_), special_flags=BLEND_RGB_ADD)             # <<<<<<<<<<<<<<
 *     new_surface.blit(green_, (0, 0), special_flags=BLEND_RGB_ADD)
 *     new_surface.blit(blue_, (offset_, offset_), special_flags=BLEND_RGB_ADD)
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_surface, __pyx_n_s_blit); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = __Pyx_PyInt_From_int((-__pyx_v_offset_)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_From_int((-__pyx_v_offset_)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_red_);
  __Pyx_GIVEREF(__pyx_v_red_);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_red_);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_special_flags, __pyx_t_1) < 0) __PYX_ERR(1, 5419, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":5420
 * 
 *     new_surface.blit(red_, (-offset_, -offset_), special_flags=BLEND_RGB_ADD)
 *     new_surface.blit(green_, (0, 0), special_flags=BLEND_RGB_ADD)             # <<<<<<<<<<<<<<
 *     new_surface.blit(blue_, (offset_, offset_), special_flags=BLEND_RGB_ADD)
 *     return new_surface
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_surface, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_green_);
  __Pyx_GIVEREF(__pyx_v_green_);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_green_);
  __Pyx_INCREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_tuple__12);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_special_flags, __pyx_t_8) < 0) __PYX_ERR(1, 5420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PygameShader/shader.pyx":5421
 *     new_surface.blit(red_, (-offset_, -offset_), special_flags=BLEND_RGB_ADD)
 *     new_surface.blit(green_, (0, 0), special_flags=BLEND_RGB_ADD)
 *     new_surface.blit(blue_, (offset_, offset_), special_flags=BLEND_RGB_ADD)             # <<<<<<<<<<<<<<
 *     return new_surface
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_surface, __pyx_n_s_blit); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_blue_);
  __Pyx_GIVEREF(__pyx_v_blue_);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_blue_);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_special_flags, __pyx_t_4) < 0) __PYX_ERR(1, 5421, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "PygameShader/shader.pyx":5422
 *     new_surface.blit(green_, (0, 0), special_flags=BLEND_RGB_ADD)
 *     new_surface.blit(blue_, (offset_, offset_), special_flags=BLEND_RGB_ADD)
 *     return new_surface             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_new_surface);
  __pyx_r = __pyx_v_new_surface;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":5376
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef shader_rgb_split_c(object surface_, int offset_):             # <<<<<<<<<<<<<<
 *     """
 *     THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("PygameShader.shader.shader_rgb_split_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_red, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_green, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_blue, 1);
  __Pyx_XDECREF(__pyx_v_new_surface);
  __Pyx_XDECREF(__pyx_v_red_);
  __Pyx_XDECREF(__pyx_v_green_);
  __Pyx_XDECREF(__pyx_v_blue_);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":5425
 * 
 * 
 * cpdef inline void putmask_c(             # <<<<<<<<<<<<<<
 *         int [:, :, :] array_, Py_ssize_t rows_, Py_ssize_t cols_, int v_=0)nogil:
 *     """
 */

static PyObject *__pyx_pw_12PygameShader_6shader_137putmask_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_putmask_c(__Pyx_memviewslice __pyx_v_array_, CYTHON_UNUSED Py_ssize_t __pyx_v_rows_, Py_ssize_t __pyx_v_cols_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_putmask_c *__pyx_optional_args) {
  int __pyx_v_i;
  int __pyx_v_j;
  int *__pyx_v_r;
  int *__pyx_v_g;
  int *__pyx_v_b;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  if (__pyx_optional_args) {
  }

  /* "PygameShader/shader.pyx":5447
 *         int *b
 * 
 *     for i in prange(0, rows_, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *         for j in range(0, cols_):
 *             r = &array_[i, j, 0]
 */
  __pyx_t_1 = __pyx_v_rows_;
  if ((1 == 0)) abort();
  {
      #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
          #undef likely
          #undef unlikely
          #define likely(x)   (x)
          #define unlikely(x) (x)
      #endif
      __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
      if (__pyx_t_3 > 0)
      {
          #ifdef _OPENMP
          #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
          #endif /* _OPENMP */
          {
              #ifdef _OPENMP
              #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static)
              #endif /* _OPENMP */
              for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                  {
                      __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                      /* Initialize private variables to invalid values */
                      __pyx_v_b = ((int *)1);
                      __pyx_v_g = ((int *)1);
                      __pyx_v_j = ((int)0xbad0bad0);
                      __pyx_v_r = ((int *)1);

                      /* "PygameShader/shader.pyx":5448
 * 
 *     for i in prange(0, rows_, schedule='static', num_threads=THREADS):
 *         for j in range(0, cols_):             # <<<<<<<<<<<<<<
 *             r = &array_[i, j, 0]
 *             g = &array_[i, j, 1]
 */
                      __pyx_t_4 = __pyx_v_cols_;
                      __pyx_t_5 = __pyx_t_4;
                      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
                        __pyx_v_j = __pyx_t_6;

                        /* "PygameShader/shader.pyx":5449
 *     for i in prange(0, rows_, schedule='static', num_threads=THREADS):
 *         for j in range(0, cols_):
 *             r = &array_[i, j, 0]             # <<<<<<<<<<<<<<
 *             g = &array_[i, j, 1]
 *             b = &array_[i, j, 2]
 */
                        __pyx_t_7 = __pyx_v_i;
                        __pyx_t_8 = __pyx_v_j;
                        __pyx_t_9 = 0;
                        __pyx_v_r = (&(*((int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array_.data + __pyx_t_7 * __pyx_v_array_.strides[0]) ) + __pyx_t_8 * __pyx_v_array_.strides[1]) ) + __pyx_t_9 * __pyx_v_array_.strides[2]) ))));

                        /* "PygameShader/shader.pyx":5450
 *         for j in range(0, cols_):
 *             r = &array_[i, j, 0]
 *             g = &array_[i, j, 1]             # <<<<<<<<<<<<<<
 *             b = &array_[i, j, 2]
 *             if r[0] < 0:
 */
                        __pyx_t_9 = __pyx_v_i;
                        __pyx_t_8 = __pyx_v_j;
                        __pyx_t_7 = 1;
                        __pyx_v_g = (&(*((int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array_.data + __pyx_t_9 * __pyx_v_array_.strides[0]) ) + __pyx_t_8 * __pyx_v_array_.strides[1]) ) + __pyx_t_7 * __pyx_v_array_.strides[2]) ))));

                        /* "PygameShader/shader.pyx":5451
 *             r = &array_[i, j, 0]
 *             g = &array_[i, j, 1]
 *             b = &array_[i, j, 2]             # <<<<<<<<<<<<<<
 *             if r[0] < 0:
 *                 r[0] = 0
 */
                        __pyx_t_7 = __pyx_v_i;
                        __pyx_t_8 = __pyx_v_j;
                        __pyx_t_9 = 2;
                        __pyx_v_b = (&(*((int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array_.data + __pyx_t_7 * __pyx_v_array_.strides[0]) ) + __pyx_t_8 * __pyx_v_array_.strides[1]) ) + __pyx_t_9 * __pyx_v_array_.strides[2]) ))));

                        /* "PygameShader/shader.pyx":5452
 *             g = &array_[i, j, 1]
 *             b = &array_[i, j, 2]
 *             if r[0] < 0:             # <<<<<<<<<<<<<<
 *                 r[0] = 0
 *                 g[0] = 0
 */
                        __pyx_t_10 = (((__pyx_v_r[0]) < 0) != 0);
                        if (__pyx_t_10) {

                          /* "PygameShader/shader.pyx":5453
 *             b = &array_[i, j, 2]
 *             if r[0] < 0:
 *                 r[0] = 0             # <<<<<<<<<<<<<<
 *                 g[0] = 0
 *                 b[0] = 0
 */
                          (__pyx_v_r[0]) = 0;

                          /* "PygameShader/shader.pyx":5454
 *             if r[0] < 0:
 *                 r[0] = 0
 *                 g[0] = 0             # <<<<<<<<<<<<<<
 *                 b[0] = 0
 * 
 */
                          (__pyx_v_g[0]) = 0;

                          /* "PygameShader/shader.pyx":5455
 *                 r[0] = 0
 *                 g[0] = 0
 *                 b[0] = 0             # <<<<<<<<<<<<<<
 * 
 *             # if r[0] > 255:
 */
                          (__pyx_v_b[0]) = 0;

                          /* "PygameShader/shader.pyx":5452
 *             g = &array_[i, j, 1]
 *             b = &array_[i, j, 2]
 *             if r[0] < 0:             # <<<<<<<<<<<<<<
 *                 r[0] = 0
 *                 g[0] = 0
 */
                        }
                      }
                  }
              }
          }
      }
  }
  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
      #undef likely
      #undef unlikely
      #define likely(x)   __builtin_expect(!!(x), 1)
      #define unlikely(x) __builtin_expect(!!(x), 0)
  #endif

  /* "PygameShader/shader.pyx":5425
 * 
 * 
 * cpdef inline void putmask_c(             # <<<<<<<<<<<<<<
 *         int [:, :, :] array_, Py_ssize_t rows_, Py_ssize_t cols_, int v_=0)nogil:
 *     """
 */

  /* function exit code */
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_137putmask_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_136putmask_c[] = "\n    EQUIVALENT METHOD TO numpy.putmask BUT MUCH FASTER FOR OPERATION WITH OPERAND < V_\n\n    * Cython cpdef function, this function can be called directly and do not require a\n      hook function.\n\n    numpy.putmask(array_, array_<0, 0) --> putmask_c(array_, w, h, 0)\n\n    :param array_   : numpy.ndarray shape (w, h, 3) of integer\n    :param rows_    : integer;\n    :param cols_    : integer;\n    :param v_       : Value for filter < v_\n    :return         : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_137putmask_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_array_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_rows_;
  Py_ssize_t __pyx_v_cols_;
  int __pyx_v_v_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("putmask_c (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_array,&__pyx_n_s_rows,&__pyx_n_s_cols,&__pyx_n_s_v,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_array)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rows)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("putmask_c", 0, 3, 4, 1); __PYX_ERR(1, 5425, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cols)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("putmask_c", 0, 3, 4, 2); __PYX_ERR(1, 5425, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "putmask_c") < 0)) __PYX_ERR(1, 5425, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_array_ = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_array_.memview)) __PYX_ERR(1, 5426, __pyx_L3_error)
    __pyx_v_rows_ = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_rows_ == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5426, __pyx_L3_error)
    __pyx_v_cols_ = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_cols_ == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5426, __pyx_L3_error)
    if (values[3]) {
      __pyx_v_v_ = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_v_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5426, __pyx_L3_error)
    } else {
      __pyx_v_v_ = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("putmask_c", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5425, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.putmask_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_136putmask_c(__pyx_self, __pyx_v_array_, __pyx_v_rows_, __pyx_v_cols_, __pyx_v_v_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_136putmask_c(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_array_, Py_ssize_t __pyx_v_rows_, Py_ssize_t __pyx_v_cols_, int __pyx_v_v_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_putmask_c __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("putmask_c", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_array_.memview)) { __Pyx_RaiseUnboundLocalError("array_"); __PYX_ERR(1, 5425, __pyx_L1_error) }
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.v_ = __pyx_v_v_;
  __pyx_f_12PygameShader_6shader_putmask_c(__pyx_v_array_, __pyx_v_rows_, __pyx_v_cols_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.putmask_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_array_, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":5471
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline tuple shader_ripple_c(             # <<<<<<<<<<<<<<
 *        Py_ssize_t rows_, Py_ssize_t cols_,
 *        float [:, ::1] previous,
 */

static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_ripple_c(CYTHON_UNUSED Py_ssize_t __pyx_v_rows_, CYTHON_UNUSED Py_ssize_t __pyx_v_cols_, __Pyx_memviewslice __pyx_v_previous, __Pyx_memviewslice __pyx_v_current, __Pyx_memviewslice __pyx_v_array) {
  int __pyx_v_i;
  int __pyx_v_j;
  float __pyx_v_data;
  float *__pyx_v_c;
  float *__pyx_v_d;
  unsigned char *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  unsigned char __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_ripple_c", 0);

  /* "PygameShader/shader.pyx":5547
 *         float r
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for i in prange(1, rows_ - 1, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":5549
 *     with nogil:
 * 
 *         for i in prange(1, rows_ - 1, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for j in prange(1, cols_ - 1, schedule='static', num_threads=THREADS):
 * 
 */
        __pyx_t_1 = (__pyx_v_rows_ - 1);
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_1 - 1 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_c) lastprivate(__pyx_v_d) lastprivate(__pyx_v_data) lastprivate(__pyx_v_e) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(1 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_c = ((float *)1);
                            __pyx_v_d = ((float *)1);
                            __pyx_v_data = ((float)__PYX_NAN());
                            __pyx_v_e = ((unsigned char *)1);
                            __pyx_v_j = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":5550
 * 
 *         for i in prange(1, rows_ - 1, schedule='static', num_threads=THREADS):
 *             for j in prange(1, cols_ - 1, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *                 # data = <int>(previous[i + 1, j] + previous[i - 1, j] +
 */
                            __pyx_t_4 = (__pyx_v_cols_ - 1);
                            if ((1 == 0)) abort();
                            {
                                __pyx_t_6 = (__pyx_t_4 - 1 + 1 - 1/abs(1)) / 1;
                                if (__pyx_t_6 > 0)
                                {
                                    #if 0
                                    #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                                    #endif /* _OPENMP */
                                    {
                                        #if 0
                                        #pragma omp for lastprivate(__pyx_v_c) lastprivate(__pyx_v_d) lastprivate(__pyx_v_data) lastprivate(__pyx_v_e) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) schedule(static)
                                        #endif /* _OPENMP */
                                        for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){
                                            {
                                                __pyx_v_j = (int)(1 + 1 * __pyx_t_5);
                                                /* Initialize private variables to invalid values */
                                                __pyx_v_c = ((float *)1);
                                                __pyx_v_d = ((float *)1);
                                                __pyx_v_data = ((float)__PYX_NAN());
                                                __pyx_v_e = ((unsigned char *)1);

                                                /* "PygameShader/shader.pyx":5555
 *                 #         previous[i, j - 1] + previous[i, j + 1])  >> 1
 * 
 *                 data = (previous[i + 1, j] + previous[i - 1, j] +             # <<<<<<<<<<<<<<
 *                               previous[i, j - 1] + previous[i, j + 1]) * <float>0.5
 *                 c = &current[i, j]
 */
                                                __pyx_t_7 = (__pyx_v_i + 1);
                                                __pyx_t_8 = __pyx_v_j;
                                                __pyx_t_9 = (__pyx_v_i - 1);
                                                __pyx_t_10 = __pyx_v_j;

                                                /* "PygameShader/shader.pyx":5556
 * 
 *                 data = (previous[i + 1, j] + previous[i - 1, j] +
 *                               previous[i, j - 1] + previous[i, j + 1]) * <float>0.5             # <<<<<<<<<<<<<<
 *                 c = &current[i, j]
 *                 data = data - <float>c[0]
 */
                                                __pyx_t_11 = __pyx_v_i;
                                                __pyx_t_12 = (__pyx_v_j - 1);

                                                /* "PygameShader/shader.pyx":5555
 *                 #         previous[i, j - 1] + previous[i, j + 1])  >> 1
 * 
 *                 data = (previous[i + 1, j] + previous[i - 1, j] +             # <<<<<<<<<<<<<<
 *                               previous[i, j - 1] + previous[i, j + 1]) * <float>0.5
 *                 c = &current[i, j]
 */
                                                __pyx_t_13 = __pyx_v_i;
                                                __pyx_t_14 = (__pyx_v_j + 1);

                                                /* "PygameShader/shader.pyx":5556
 * 
 *                 data = (previous[i + 1, j] + previous[i - 1, j] +
 *                               previous[i, j - 1] + previous[i, j + 1]) * <float>0.5             # <<<<<<<<<<<<<<
 *                 c = &current[i, j]
 *                 data = data - <float>c[0]
 */
                                                __pyx_v_data = (((((*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_previous.data + __pyx_t_7 * __pyx_v_previous.strides[0]) )) + __pyx_t_8)) ))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_previous.data + __pyx_t_9 * __pyx_v_previous.strides[0]) )) + __pyx_t_10)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_previous.data + __pyx_t_11 * __pyx_v_previous.strides[0]) )) + __pyx_t_12)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_previous.data + __pyx_t_13 * __pyx_v_previous.strides[0]) )) + __pyx_t_14)) )))) * ((float)0.5));

                                                /* "PygameShader/shader.pyx":5557
 *                 data = (previous[i + 1, j] + previous[i - 1, j] +
 *                               previous[i, j - 1] + previous[i, j + 1]) * <float>0.5
 *                 c = &current[i, j]             # <<<<<<<<<<<<<<
 *                 data = data - <float>c[0]
 *                 data = data - (data * <float>0.011)
 */
                                                __pyx_t_14 = __pyx_v_i;
                                                __pyx_t_13 = __pyx_v_j;
                                                __pyx_v_c = (&(*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_current.data + __pyx_t_14 * __pyx_v_current.strides[0]) )) + __pyx_t_13)) ))));

                                                /* "PygameShader/shader.pyx":5558
 *                               previous[i, j - 1] + previous[i, j + 1]) * <float>0.5
 *                 c = &current[i, j]
 *                 data = data - <float>c[0]             # <<<<<<<<<<<<<<
 *                 data = data - (data * <float>0.011)
 *                 c[0] = data
 */
                                                __pyx_v_data = (__pyx_v_data - ((float)(__pyx_v_c[0])));

                                                /* "PygameShader/shader.pyx":5559
 *                 c = &current[i, j]
 *                 data = data - <float>c[0]
 *                 data = data - (data * <float>0.011)             # <<<<<<<<<<<<<<
 *                 c[0] = data
 *                 d = &previous[i,j]
 */
                                                __pyx_v_data = (__pyx_v_data - (__pyx_v_data * ((float)0.011)));

                                                /* "PygameShader/shader.pyx":5560
 *                 data = data - <float>c[0]
 *                 data = data - (data * <float>0.011)
 *                 c[0] = data             # <<<<<<<<<<<<<<
 *                 d = &previous[i,j]
 *                 e = &array[i, j, 0]
 */
                                                (__pyx_v_c[0]) = __pyx_v_data;

                                                /* "PygameShader/shader.pyx":5561
 *                 data = data - (data * <float>0.011)
 *                 c[0] = data
 *                 d = &previous[i,j]             # <<<<<<<<<<<<<<
 *                 e = &array[i, j, 0]
 *                 e[0] = <unsigned char> d[0] if d[0] > 0 else 0
 */
                                                __pyx_t_13 = __pyx_v_i;
                                                __pyx_t_14 = __pyx_v_j;
                                                __pyx_v_d = (&(*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_previous.data + __pyx_t_13 * __pyx_v_previous.strides[0]) )) + __pyx_t_14)) ))));

                                                /* "PygameShader/shader.pyx":5562
 *                 c[0] = data
 *                 d = &previous[i,j]
 *                 e = &array[i, j, 0]             # <<<<<<<<<<<<<<
 *                 e[0] = <unsigned char> d[0] if d[0] > 0 else 0
 *                 array[i, j, 1] = e[0]
 */
                                                __pyx_t_14 = __pyx_v_i;
                                                __pyx_t_13 = __pyx_v_j;
                                                __pyx_t_12 = 0;
                                                __pyx_v_e = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array.data + __pyx_t_14 * __pyx_v_array.strides[0]) ) + __pyx_t_13 * __pyx_v_array.strides[1]) )) + __pyx_t_12)) ))));

                                                /* "PygameShader/shader.pyx":5563
 *                 d = &previous[i,j]
 *                 e = &array[i, j, 0]
 *                 e[0] = <unsigned char> d[0] if d[0] > 0 else 0             # <<<<<<<<<<<<<<
 *                 array[i, j, 1] = e[0]
 *                 array[i, j, 2] = e[0]
 */
                                                if ((((__pyx_v_d[0]) > 0.0) != 0)) {
                                                  __pyx_t_15 = ((unsigned char)(__pyx_v_d[0]));
                                                } else {
                                                  __pyx_t_15 = 0;
                                                }
                                                (__pyx_v_e[0]) = __pyx_t_15;

                                                /* "PygameShader/shader.pyx":5564
 *                 e = &array[i, j, 0]
 *                 e[0] = <unsigned char> d[0] if d[0] > 0 else 0
 *                 array[i, j, 1] = e[0]             # <<<<<<<<<<<<<<
 *                 array[i, j, 2] = e[0]
 * 
 */
                                                __pyx_t_12 = __pyx_v_i;
                                                __pyx_t_13 = __pyx_v_j;
                                                __pyx_t_14 = 1;
                                                *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array.data + __pyx_t_12 * __pyx_v_array.strides[0]) ) + __pyx_t_13 * __pyx_v_array.strides[1]) )) + __pyx_t_14)) )) = (__pyx_v_e[0]);

                                                /* "PygameShader/shader.pyx":5565
 *                 e[0] = <unsigned char> d[0] if d[0] > 0 else 0
 *                 array[i, j, 1] = e[0]
 *                 array[i, j, 2] = e[0]             # <<<<<<<<<<<<<<
 * 
 *     return current, previous, array
 */
                                                __pyx_t_14 = __pyx_v_i;
                                                __pyx_t_13 = __pyx_v_j;
                                                __pyx_t_12 = 2;
                                                *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array.data + __pyx_t_14 * __pyx_v_array.strides[0]) ) + __pyx_t_13 * __pyx_v_array.strides[1]) )) + __pyx_t_12)) )) = (__pyx_v_e[0]);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":5547
 *         float r
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for i in prange(1, rows_ - 1, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":5567
 *                 array[i, j, 2] = e[0]
 * 
 *     return current, previous, array             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v_current, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_17 = __pyx_memoryview_fromslice(__pyx_v_previous, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 5567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_array, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 5567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_19 = PyTuple_New(3); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 5567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_GIVEREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_17);
  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_18);
  PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_18);
  __pyx_t_16 = 0;
  __pyx_t_17 = 0;
  __pyx_t_18 = 0;
  __pyx_r = ((PyObject*)__pyx_t_19);
  __pyx_t_19 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":5471
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline tuple shader_ripple_c(             # <<<<<<<<<<<<<<
 *        Py_ssize_t rows_, Py_ssize_t cols_,
 *        float [:, ::1] previous,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_AddTraceback("PygameShader.shader.shader_ripple_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":5576
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cpdef tunnel_modeling32(Py_ssize_t screen_width, Py_ssize_t screen_height):             # <<<<<<<<<<<<<<
 *     """
 *     THIS METHOD CREATE A TUNNEL MODEL
 */

static PyObject *__pyx_pw_12PygameShader_6shader_139tunnel_modeling32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_tunnel_modeling32(Py_ssize_t __pyx_v_screen_width, Py_ssize_t __pyx_v_screen_height, CYTHON_UNUSED int __pyx_skip_dispatch) {
  __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_angles = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_shades = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_surface = NULL;
  int __pyx_v_s_width;
  int __pyx_v_s_height;
  __Pyx_memviewslice __pyx_v_scr_data = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_i;
  double __pyx_v_sqy;
  double __pyx_v_sqx;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  float __pyx_t_17;
  float __pyx_t_18;
  int __pyx_t_19;
  double __pyx_t_20;
  long __pyx_t_21;
  double __pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tunnel_modeling32", 0);

  /* "PygameShader/shader.pyx":5607
 *     """
 * 
 *     assert screen_width > 0, "Argument screen_width must be > 0"             # <<<<<<<<<<<<<<
 *     assert screen_height > 0, "Argument screen_height must be > 0"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_screen_width > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_width_must_be_0);
      __PYX_ERR(1, 5607, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":5608
 * 
 *     assert screen_width > 0, "Argument screen_width must be > 0"
 *     assert screen_height > 0, "Argument screen_height must be > 0"             # <<<<<<<<<<<<<<
 * 
 *     cdef int [:] distances = numpy.empty((screen_width * screen_height * 4), int32)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_screen_height > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_height_must_be_0);
      __PYX_ERR(1, 5608, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":5610
 *     assert screen_height > 0, "Argument screen_height must be > 0"
 * 
 *     cdef int [:] distances = numpy.empty((screen_width * screen_height * 4), int32)             # <<<<<<<<<<<<<<
 *     cdef int [:] angles    = numpy.empty((screen_width * screen_height * 4), int32)
 *     cdef int [:] shades    = numpy.empty((screen_width * screen_height * 4), int32)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(((__pyx_v_screen_width * __pyx_v_screen_height) * 4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5610, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5610, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5610, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_distances = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":5611
 * 
 *     cdef int [:] distances = numpy.empty((screen_width * screen_height * 4), int32)
 *     cdef int [:] angles    = numpy.empty((screen_width * screen_height * 4), int32)             # <<<<<<<<<<<<<<
 *     cdef int [:] shades    = numpy.empty((screen_width * screen_height * 4), int32)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(((__pyx_v_screen_width * __pyx_v_screen_height) * 4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5611, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5611, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_angles = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":5612
 *     cdef int [:] distances = numpy.empty((screen_width * screen_height * 4), int32)
 *     cdef int [:] angles    = numpy.empty((screen_width * screen_height * 4), int32)
 *     cdef int [:] shades    = numpy.empty((screen_width * screen_height * 4), int32)             # <<<<<<<<<<<<<<
 * 
 *     surface = pygame.image.load("../Assets/space1.jpg").convert()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyInt_FromSsize_t(((__pyx_v_screen_width * __pyx_v_screen_height) * 4)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5612, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5612, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_7 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5612, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_shades = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":5614
 *     cdef int [:] shades    = numpy.empty((screen_width * screen_height * 4), int32)
 * 
 *     surface = pygame.image.load("../Assets/space1.jpg").convert()             # <<<<<<<<<<<<<<
 * 
 *     cdef int s_width  = 512
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pygame); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_image); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_kp_s_Assets_space1_jpg) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_Assets_space1_jpg);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_convert); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_surface = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":5616
 *     surface = pygame.image.load("../Assets/space1.jpg").convert()
 * 
 *     cdef int s_width  = 512             # <<<<<<<<<<<<<<
 *     cdef int s_height = 512
 *     surface = smoothscale(surface, (s_width, s_height))
 */
  __pyx_v_s_width = 0x200;

  /* "PygameShader/shader.pyx":5617
 * 
 *     cdef int s_width  = 512
 *     cdef int s_height = 512             # <<<<<<<<<<<<<<
 *     surface = smoothscale(surface, (s_width, s_height))
 *     cdef unsigned char [::1] scr_data = surface.get_buffer()
 */
  __pyx_v_s_height = 0x200;

  /* "PygameShader/shader.pyx":5618
 *     cdef int s_width  = 512
 *     cdef int s_height = 512
 *     surface = smoothscale(surface, (s_width, s_height))             # <<<<<<<<<<<<<<
 *     cdef unsigned char [::1] scr_data = surface.get_buffer()
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_s_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_s_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __pyx_t_5 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5618, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5618, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_surface);
    __Pyx_GIVEREF(__pyx_v_surface);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_surface);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_surface, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":5619
 *     cdef int s_height = 512
 *     surface = smoothscale(surface, (s_width, s_height))
 *     cdef unsigned char [::1] scr_data = surface.get_buffer()             # <<<<<<<<<<<<<<
 * 
 *     cdef  int x, y, i = 0
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5619, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_scr_data = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "PygameShader/shader.pyx":5621
 *     cdef unsigned char [::1] scr_data = surface.get_buffer()
 * 
 *     cdef  int x, y, i = 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_i = 0;

  /* "PygameShader/shader.pyx":5624
 * 
 * 
 *     for y in range(0, screen_height * 2):             # <<<<<<<<<<<<<<
 *         sqy = pow(y - screen_height, 2)
 *         for x in range(0, screen_width * 2):
 */
  __pyx_t_10 = (__pyx_v_screen_height * 2);
  __pyx_t_11 = __pyx_t_10;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_11; __pyx_t_6+=1) {
    __pyx_v_y = __pyx_t_6;

    /* "PygameShader/shader.pyx":5625
 * 
 *     for y in range(0, screen_height * 2):
 *         sqy = pow(y - screen_height, 2)             # <<<<<<<<<<<<<<
 *         for x in range(0, screen_width * 2):
 *             sqx = pow(x - screen_width, 2)
 */
    __pyx_v_sqy = pow((__pyx_v_y - __pyx_v_screen_height), 2.0);

    /* "PygameShader/shader.pyx":5626
 *     for y in range(0, screen_height * 2):
 *         sqy = pow(y - screen_height, 2)
 *         for x in range(0, screen_width * 2):             # <<<<<<<<<<<<<<
 *             sqx = pow(x - screen_width, 2)
 *             if (sqx + sqy) == 0:
 */
    __pyx_t_12 = (__pyx_v_screen_width * 2);
    __pyx_t_13 = __pyx_t_12;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
      __pyx_v_x = __pyx_t_14;

      /* "PygameShader/shader.pyx":5627
 *         sqy = pow(y - screen_height, 2)
 *         for x in range(0, screen_width * 2):
 *             sqx = pow(x - screen_width, 2)             # <<<<<<<<<<<<<<
 *             if (sqx + sqy) == 0:
 *                 distances[i] = 1
 */
      __pyx_v_sqx = pow((__pyx_v_x - __pyx_v_screen_width), 2.0);

      /* "PygameShader/shader.pyx":5628
 *         for x in range(0, screen_width * 2):
 *             sqx = pow(x - screen_width, 2)
 *             if (sqx + sqy) == 0:             # <<<<<<<<<<<<<<
 *                 distances[i] = 1
 *             else:
 */
      __pyx_t_15 = (((__pyx_v_sqx + __pyx_v_sqy) == 0.0) != 0);
      if (__pyx_t_15) {

        /* "PygameShader/shader.pyx":5629
 *             sqx = pow(x - screen_width, 2)
 *             if (sqx + sqy) == 0:
 *                 distances[i] = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 distances[i] = <int>(floor(
 */
        __pyx_t_16 = __pyx_v_i;
        *((int *) ( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_16 * __pyx_v_distances.strides[0]) )) = 1;

        /* "PygameShader/shader.pyx":5628
 *         for x in range(0, screen_width * 2):
 *             sqx = pow(x - screen_width, 2)
 *             if (sqx + sqy) == 0:             # <<<<<<<<<<<<<<
 *                 distances[i] = 1
 *             else:
 */
        goto __pyx_L7;
      }

      /* "PygameShader/shader.pyx":5632
 *             else:
 *                 distances[i] = <int>(floor(
 *                     32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height             # <<<<<<<<<<<<<<
 *             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,
 *                                                              x - screen_width) / (<float>M_PI))
 */
      /*else*/ {

        /* "PygameShader/shader.pyx":5631
 *                 distances[i] = 1
 *             else:
 *                 distances[i] = <int>(floor(             # <<<<<<<<<<<<<<
 *                     32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height
 *             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,
 */
        __pyx_t_17 = (32.0 * ((float)__pyx_v_s_height));

        /* "PygameShader/shader.pyx":5632
 *             else:
 *                 distances[i] = <int>(floor(
 *                     32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height             # <<<<<<<<<<<<<<
 *             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,
 *                                                              x - screen_width) / (<float>M_PI))
 */
        __pyx_t_18 = ((float)sqrt((__pyx_v_sqx + __pyx_v_sqy)));
        if (unlikely(__pyx_t_18 == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
          __PYX_ERR(1, 5632, __pyx_L1_error)
        }

        /* "PygameShader/shader.pyx":5631
 *                 distances[i] = 1
 *             else:
 *                 distances[i] = <int>(floor(             # <<<<<<<<<<<<<<
 *                     32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height
 *             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,
 */
        __pyx_t_19 = ((int)floor((__pyx_t_17 / __pyx_t_18)));

        /* "PygameShader/shader.pyx":5632
 *             else:
 *                 distances[i] = <int>(floor(
 *                     32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height             # <<<<<<<<<<<<<<
 *             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,
 *                                                              x - screen_width) / (<float>M_PI))
 */
        if (unlikely(__pyx_v_s_height == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(1, 5632, __pyx_L1_error)
        }

        /* "PygameShader/shader.pyx":5631
 *                 distances[i] = 1
 *             else:
 *                 distances[i] = <int>(floor(             # <<<<<<<<<<<<<<
 *                     32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height
 *             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,
 */
        __pyx_t_16 = __pyx_v_i;
        *((int *) ( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_16 * __pyx_v_distances.strides[0]) )) = __Pyx_mod_int(__pyx_t_19, __pyx_v_s_height);
      }
      __pyx_L7:;

      /* "PygameShader/shader.pyx":5633
 *                 distances[i] = <int>(floor(
 *                     32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height
 *             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,             # <<<<<<<<<<<<<<
 *                                                              x - screen_width) / (<float>M_PI))
 *             shades[i]    = <int>min(sqrt(sqx + sqy)*10, 255)
 */
      __pyx_t_20 = (((float)__pyx_v_s_width) * atan2((__pyx_v_y - __pyx_v_screen_height), (__pyx_v_x - __pyx_v_screen_width)));

      /* "PygameShader/shader.pyx":5634
 *                     32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height
 *             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,
 *                                                              x - screen_width) / (<float>M_PI))             # <<<<<<<<<<<<<<
 *             shades[i]    = <int>min(sqrt(sqx + sqy)*10, 255)
 *             i = i + 1
 */
      if (unlikely(((float)__pyx_v_12PygameShader_6shader_M_PI) == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(1, 5634, __pyx_L1_error)
      }

      /* "PygameShader/shader.pyx":5633
 *                 distances[i] = <int>(floor(
 *                     32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height
 *             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,             # <<<<<<<<<<<<<<
 *                                                              x - screen_width) / (<float>M_PI))
 *             shades[i]    = <int>min(sqrt(sqx + sqy)*10, 255)
 */
      __pyx_t_16 = __pyx_v_i;
      *((int *) ( /* dim=0 */ (__pyx_v_angles.data + __pyx_t_16 * __pyx_v_angles.strides[0]) )) = ((int)round((__pyx_t_20 / ((float)__pyx_v_12PygameShader_6shader_M_PI))));

      /* "PygameShader/shader.pyx":5635
 *             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,
 *                                                              x - screen_width) / (<float>M_PI))
 *             shades[i]    = <int>min(sqrt(sqx + sqy)*10, 255)             # <<<<<<<<<<<<<<
 *             i = i + 1
 * 
 */
      __pyx_t_21 = 0xFF;
      __pyx_t_20 = (sqrt((__pyx_v_sqx + __pyx_v_sqy)) * 10.0);
      if (((__pyx_t_21 < __pyx_t_20) != 0)) {
        __pyx_t_22 = __pyx_t_21;
      } else {
        __pyx_t_22 = __pyx_t_20;
      }
      __pyx_t_16 = __pyx_v_i;
      *((int *) ( /* dim=0 */ (__pyx_v_shades.data + __pyx_t_16 * __pyx_v_shades.strides[0]) )) = ((int)__pyx_t_22);

      /* "PygameShader/shader.pyx":5636
 *                                                              x - screen_width) / (<float>M_PI))
 *             shades[i]    = <int>min(sqrt(sqx + sqy)*10, 255)
 *             i = i + 1             # <<<<<<<<<<<<<<
 * 
 *     return distances, angles, shades, scr_data
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
  }

  /* "PygameShader/shader.pyx":5638
 *             i = i + 1
 * 
 *     return distances, angles, shades, scr_data             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_distances, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_angles, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_shades, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_scr_data, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_5 = 0;
  __pyx_t_7 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":5576
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cpdef tunnel_modeling32(Py_ssize_t screen_width, Py_ssize_t screen_height):             # <<<<<<<<<<<<<<
 *     """
 *     THIS METHOD CREATE A TUNNEL MODEL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __Pyx_AddTraceback("PygameShader.shader.tunnel_modeling32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_distances, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_angles, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_shades, 1);
  __Pyx_XDECREF(__pyx_v_surface);
  __PYX_XDEC_MEMVIEW(&__pyx_v_scr_data, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_139tunnel_modeling32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_138tunnel_modeling32[] = "\n    THIS METHOD CREATE A TUNNEL MODEL\n\n    * This method must be called before rendering the tunnel in order to create\n      all the necessary buffers that will be called during the rendering of the tunnel effect.\n      tunnel_modeling32 must be call once only before the main loop of your game.\n\n    * Cython cpdef function, this function can be called directly and do not require a\n      hook function.\n\n    * The default tunnel texture is internally loaded (the texture is 256x256 pixels 24-bit)\n      check the line :\n      surface = pygame.image.load(\"Assets\\Graphics\\Background\\space1.jpg\").convert()\n\n    * This algorithm uses a 256x256 texture but reshape it to 512x512 pixels for a\n    better effect definition\n\n    :param screen_width     : integer; Game display size (width in pixels)\n    :param screen_height    : integer; Game display size (height in pixels)\n    :return                 : return a tuple containing the following (distances, angles,\n    shades, scr_data)\n    distances is a numpy.ndarray buffer containing float values representing the distance\n    of each pixels\n    angles is a numpy.ndarray buffer containing float values representing the angle of each pixels\n    shades is a numpy.ndarray buffer containing float values representing the shade of each pixels\n    scr_data is a numpy.ndarray buffer containing uint8 values representing the BGR (not RGB)\n    values of each pixels\n\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_139tunnel_modeling32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  Py_ssize_t __pyx_v_screen_width;
  Py_ssize_t __pyx_v_screen_height;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tunnel_modeling32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_screen_width,&__pyx_n_s_screen_height,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_width)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tunnel_modeling32", 1, 2, 2, 1); __PYX_ERR(1, 5576, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tunnel_modeling32") < 0)) __PYX_ERR(1, 5576, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_screen_width = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_screen_width == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5576, __pyx_L3_error)
    __pyx_v_screen_height = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_screen_height == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5576, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tunnel_modeling32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5576, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.tunnel_modeling32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_138tunnel_modeling32(__pyx_self, __pyx_v_screen_width, __pyx_v_screen_height);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_138tunnel_modeling32(CYTHON_UNUSED PyObject *__pyx_self, Py_ssize_t __pyx_v_screen_width, Py_ssize_t __pyx_v_screen_height) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tunnel_modeling32", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_tunnel_modeling32(__pyx_v_screen_width, __pyx_v_screen_height, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.tunnel_modeling32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":5648
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tunnel_render32(             # <<<<<<<<<<<<<<
 *         int t,
 *         Py_ssize_t screen_width,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_141tunnel_render32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_tunnel_render32(int __pyx_v_t, Py_ssize_t __pyx_v_screen_width, Py_ssize_t __pyx_v_screen_height, int __pyx_v_screen_w2, int __pyx_v_screen_h2, __Pyx_memviewslice __pyx_v_distances, __Pyx_memviewslice __pyx_v_angles, __Pyx_memviewslice __pyx_v_shades, __Pyx_memviewslice __pyx_v_scr_data, __Pyx_memviewslice __pyx_v_dest_array, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_s_width;
  int __pyx_v_s_height;
  float __pyx_v_timer;
  int __pyx_v_shiftx;
  int __pyx_v_shifty;
  int __pyx_v_centerx;
  int __pyx_v_centery;
  int __pyx_v_stride;
  int __pyx_v_dest_ofs;
  int __pyx_v_src_ofs;
  int __pyx_v_u;
  int __pyx_v_v;
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_pix_ofs;
  int __pyx_v_shade;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tunnel_render32", 0);

  /* "PygameShader/shader.pyx":5693
 *     """
 * 
 *     assert screen_width > 0, "Argument screen_width must be > 0"             # <<<<<<<<<<<<<<
 *     assert screen_height > 0, "Argument screen_height must be > 0"
 *     assert screen_w2 > 0, "Argument screen_w2 must be > 0"
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_screen_width > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_width_must_be_0);
      __PYX_ERR(1, 5693, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":5694
 * 
 *     assert screen_width > 0, "Argument screen_width must be > 0"
 *     assert screen_height > 0, "Argument screen_height must be > 0"             # <<<<<<<<<<<<<<
 *     assert screen_w2 > 0, "Argument screen_w2 must be > 0"
 *     assert screen_h2 > 0, "Argument screen_h2 must be > 0"
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_screen_height > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_height_must_be_0);
      __PYX_ERR(1, 5694, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":5695
 *     assert screen_width > 0, "Argument screen_width must be > 0"
 *     assert screen_height > 0, "Argument screen_height must be > 0"
 *     assert screen_w2 > 0, "Argument screen_w2 must be > 0"             # <<<<<<<<<<<<<<
 *     assert screen_h2 > 0, "Argument screen_h2 must be > 0"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_screen_w2 > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_w2_must_be_0);
      __PYX_ERR(1, 5695, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":5696
 *     assert screen_height > 0, "Argument screen_height must be > 0"
 *     assert screen_w2 > 0, "Argument screen_w2 must be > 0"
 *     assert screen_h2 > 0, "Argument screen_h2 must be > 0"             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_screen_h2 > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_h2_must_be_0);
      __PYX_ERR(1, 5696, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":5699
 * 
 *     cdef:
 *         int s_width  = 512             # <<<<<<<<<<<<<<
 *         int s_height = 512
 *         float timer = t * <float>1e-3
 */
  __pyx_v_s_width = 0x200;

  /* "PygameShader/shader.pyx":5700
 *     cdef:
 *         int s_width  = 512
 *         int s_height = 512             # <<<<<<<<<<<<<<
 *         float timer = t * <float>1e-3
 *         int shiftx  = <int>floor(s_width * timer)
 */
  __pyx_v_s_height = 0x200;

  /* "PygameShader/shader.pyx":5701
 *         int s_width  = 512
 *         int s_height = 512
 *         float timer = t * <float>1e-3             # <<<<<<<<<<<<<<
 *         int shiftx  = <int>floor(s_width * timer)
 *         int shifty  = <int>floor(s_height * <float>0.25 * timer)
 */
  __pyx_v_timer = (__pyx_v_t * ((float)1e-3));

  /* "PygameShader/shader.pyx":5702
 *         int s_height = 512
 *         float timer = t * <float>1e-3
 *         int shiftx  = <int>floor(s_width * timer)             # <<<<<<<<<<<<<<
 *         int shifty  = <int>floor(s_height * <float>0.25 * timer)
 *         int centerx = <int>(screen_w2 +
 */
  __pyx_v_shiftx = ((int)floor((__pyx_v_s_width * __pyx_v_timer)));

  /* "PygameShader/shader.pyx":5703
 *         float timer = t * <float>1e-3
 *         int shiftx  = <int>floor(s_width * timer)
 *         int shifty  = <int>floor(s_height * <float>0.25 * timer)             # <<<<<<<<<<<<<<
 *         int centerx = <int>(screen_w2 +
 *                             <float>floor((screen_w2 >> 1) * <float>sin(timer * <float>0.25)))
 */
  __pyx_v_shifty = ((int)floor(((__pyx_v_s_height * ((float)0.25)) * __pyx_v_timer)));

  /* "PygameShader/shader.pyx":5704
 *         int shiftx  = <int>floor(s_width * timer)
 *         int shifty  = <int>floor(s_height * <float>0.25 * timer)
 *         int centerx = <int>(screen_w2 +             # <<<<<<<<<<<<<<
 *                             <float>floor((screen_w2 >> 1) * <float>sin(timer * <float>0.25)))
 *         int centery = <int>(screen_h2 + <float>floor(
 */
  __pyx_v_centerx = ((int)(__pyx_v_screen_w2 + ((float)floor(((__pyx_v_screen_w2 >> 1) * ((float)sin((__pyx_v_timer * ((float)0.25)))))))));

  /* "PygameShader/shader.pyx":5706
 *         int centerx = <int>(screen_w2 +
 *                             <float>floor((screen_w2 >> 1) * <float>sin(timer * <float>0.25)))
 *         int centery = <int>(screen_h2 + <float>floor(             # <<<<<<<<<<<<<<
 *             (screen_h2 >> 1) * <float>sin(timer * <float>0.5)))
 *         int stride  = <int>screen_width * 2
 */
  __pyx_v_centery = ((int)(__pyx_v_screen_h2 + ((float)floor(((__pyx_v_screen_h2 >> 1) * ((float)sin((__pyx_v_timer * ((float)0.5)))))))));

  /* "PygameShader/shader.pyx":5708
 *         int centery = <int>(screen_h2 + <float>floor(
 *             (screen_h2 >> 1) * <float>sin(timer * <float>0.5)))
 *         int stride  = <int>screen_width * 2             # <<<<<<<<<<<<<<
 *         int dest_ofs = 0
 *         int src_ofs
 */
  __pyx_v_stride = (((int)__pyx_v_screen_width) * 2);

  /* "PygameShader/shader.pyx":5709
 *             (screen_h2 >> 1) * <float>sin(timer * <float>0.5)))
 *         int stride  = <int>screen_width * 2
 *         int dest_ofs = 0             # <<<<<<<<<<<<<<
 *         int src_ofs
 *         int u, v, x, y
 */
  __pyx_v_dest_ofs = 0;

  /* "PygameShader/shader.pyx":5736
 *     # return pygame.image.frombuffer(dest_array, (screen_width, screen_height), "RGBA")
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(0, screen_height, schedule='static', num_threads=4):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":5738
 *     with nogil:
 * 
 *         for y in prange(0, screen_height, schedule='static', num_threads=4):             # <<<<<<<<<<<<<<
 * 
 *             for x in range(0, screen_width):
 */
        __pyx_t_1 = __pyx_v_screen_height;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(4) private(__pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_dest_ofs) lastprivate(__pyx_v_pix_ofs) lastprivate(__pyx_v_shade) lastprivate(__pyx_v_src_ofs) lastprivate(__pyx_v_u) lastprivate(__pyx_v_v) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_dest_ofs = ((int)0xbad0bad0);
                            __pyx_v_pix_ofs = ((int)0xbad0bad0);
                            __pyx_v_shade = ((int)0xbad0bad0);
                            __pyx_v_src_ofs = ((int)0xbad0bad0);
                            __pyx_v_u = ((int)0xbad0bad0);
                            __pyx_v_v = ((int)0xbad0bad0);
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":5740
 *         for y in prange(0, screen_height, schedule='static', num_threads=4):
 * 
 *             for x in range(0, screen_width):             # <<<<<<<<<<<<<<
 * 
 *                 src_ofs = y * stride + centerx + centery * stride + x
 */
                            __pyx_t_4 = __pyx_v_screen_width;
                            __pyx_t_5 = __pyx_t_4;
                            for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
                              __pyx_v_x = __pyx_t_6;

                              /* "PygameShader/shader.pyx":5742
 *             for x in range(0, screen_width):
 * 
 *                 src_ofs = y * stride + centerx + centery * stride + x             # <<<<<<<<<<<<<<
 *                 dest_ofs = (y * screen_height + x) << 2
 * 
 */
                              __pyx_v_src_ofs = ((((__pyx_v_y * __pyx_v_stride) + __pyx_v_centerx) + (__pyx_v_centery * __pyx_v_stride)) + __pyx_v_x);

                              /* "PygameShader/shader.pyx":5743
 * 
 *                 src_ofs = y * stride + centerx + centery * stride + x
 *                 dest_ofs = (y * screen_height + x) << 2             # <<<<<<<<<<<<<<
 * 
 *                 u = (distances[src_ofs] + shiftx) & 0xff
 */
                              __pyx_v_dest_ofs = (((__pyx_v_y * __pyx_v_screen_height) + __pyx_v_x) << 2);

                              /* "PygameShader/shader.pyx":5745
 *                 dest_ofs = (y * screen_height + x) << 2
 * 
 *                 u = (distances[src_ofs] + shiftx) & 0xff             # <<<<<<<<<<<<<<
 *                 v = (angles[src_ofs] + shifty) & 0xff
 * 
 */
                              __pyx_t_7 = __pyx_v_src_ofs;
                              __pyx_v_u = (((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_distances.data) + __pyx_t_7)) ))) + __pyx_v_shiftx) & 0xff);

                              /* "PygameShader/shader.pyx":5746
 * 
 *                 u = (distances[src_ofs] + shiftx) & 0xff
 *                 v = (angles[src_ofs] + shifty) & 0xff             # <<<<<<<<<<<<<<
 * 
 *                 shade = <int> (shades[src_ofs] * ONE_255)
 */
                              __pyx_t_7 = __pyx_v_src_ofs;
                              __pyx_v_v = (((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_angles.data) + __pyx_t_7)) ))) + __pyx_v_shifty) & 0xff);

                              /* "PygameShader/shader.pyx":5748
 *                 v = (angles[src_ofs] + shifty) & 0xff
 * 
 *                 shade = <int> (shades[src_ofs] * ONE_255)             # <<<<<<<<<<<<<<
 * 
 *                 pix_ofs = (u + (v << 9)) << 3
 */
                              __pyx_t_7 = __pyx_v_src_ofs;
                              __pyx_v_shade = ((int)((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_shades.data) + __pyx_t_7)) ))) * 0.00392156862745098));

                              /* "PygameShader/shader.pyx":5750
 *                 shade = <int> (shades[src_ofs] * ONE_255)
 * 
 *                 pix_ofs = (u + (v << 9)) << 3             # <<<<<<<<<<<<<<
 * 
 *                 dest_array[dest_ofs] = scr_data[pix_ofs + 2] * shade
 */
                              __pyx_v_pix_ofs = ((__pyx_v_u + (__pyx_v_v << 9)) << 3);

                              /* "PygameShader/shader.pyx":5752
 *                 pix_ofs = (u + (v << 9)) << 3
 * 
 *                 dest_array[dest_ofs] = scr_data[pix_ofs + 2] * shade             # <<<<<<<<<<<<<<
 *                 dest_array[dest_ofs + 1] = scr_data[pix_ofs + 1] * shade
 *                 dest_array[dest_ofs + 2] = scr_data[pix_ofs + 0] * shade
 */
                              __pyx_t_7 = (__pyx_v_pix_ofs + 2);
                              __pyx_t_8 = __pyx_v_dest_ofs;
                              *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_dest_array.data) + __pyx_t_8)) )) = ((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_scr_data.data) + __pyx_t_7)) ))) * __pyx_v_shade);

                              /* "PygameShader/shader.pyx":5753
 * 
 *                 dest_array[dest_ofs] = scr_data[pix_ofs + 2] * shade
 *                 dest_array[dest_ofs + 1] = scr_data[pix_ofs + 1] * shade             # <<<<<<<<<<<<<<
 *                 dest_array[dest_ofs + 2] = scr_data[pix_ofs + 0] * shade
 *                 dest_array[dest_ofs + 3] = 255
 */
                              __pyx_t_7 = (__pyx_v_pix_ofs + 1);
                              __pyx_t_8 = (__pyx_v_dest_ofs + 1);
                              *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_dest_array.data) + __pyx_t_8)) )) = ((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_scr_data.data) + __pyx_t_7)) ))) * __pyx_v_shade);

                              /* "PygameShader/shader.pyx":5754
 *                 dest_array[dest_ofs] = scr_data[pix_ofs + 2] * shade
 *                 dest_array[dest_ofs + 1] = scr_data[pix_ofs + 1] * shade
 *                 dest_array[dest_ofs + 2] = scr_data[pix_ofs + 0] * shade             # <<<<<<<<<<<<<<
 *                 dest_array[dest_ofs + 3] = 255
 * 
 */
                              __pyx_t_7 = (__pyx_v_pix_ofs + 0);
                              __pyx_t_8 = (__pyx_v_dest_ofs + 2);
                              *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_dest_array.data) + __pyx_t_8)) )) = ((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_scr_data.data) + __pyx_t_7)) ))) * __pyx_v_shade);

                              /* "PygameShader/shader.pyx":5755
 *                 dest_array[dest_ofs + 1] = scr_data[pix_ofs + 1] * shade
 *                 dest_array[dest_ofs + 2] = scr_data[pix_ofs + 0] * shade
 *                 dest_array[dest_ofs + 3] = 255             # <<<<<<<<<<<<<<
 * 
 *     return pygame.image.frombuffer(dest_array, (screen_width, screen_height), "RGBA")
 */
                              __pyx_t_7 = (__pyx_v_dest_ofs + 3);
                              *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_dest_array.data) + __pyx_t_7)) )) = 0xFF;
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":5736
 *     # return pygame.image.frombuffer(dest_array, (screen_width, screen_height), "RGBA")
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(0, screen_height, schedule='static', num_threads=4):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":5757
 *                 dest_array[dest_ofs + 3] = 255
 * 
 *     return pygame.image.frombuffer(dest_array, (screen_width, screen_height), "RGBA")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pygame); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_image); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 5757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __pyx_memoryview_fromslice(__pyx_v_dest_array, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 5757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_screen_width); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 5757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_screen_height); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 5757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13);
  __pyx_t_12 = 0;
  __pyx_t_13 = 0;
  __pyx_t_13 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_t_11, __pyx_t_14, __pyx_n_s_RGBA};
    __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5757, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_t_11, __pyx_t_14, __pyx_n_s_RGBA};
    __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5757, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  } else
  #endif
  {
    __pyx_t_12 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 5757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (__pyx_t_13) {
      __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_t_14);
    __Pyx_INCREF(__pyx_n_s_RGBA);
    __Pyx_GIVEREF(__pyx_n_s_RGBA);
    PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_6, __pyx_n_s_RGBA);
    __pyx_t_11 = 0;
    __pyx_t_14 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":5648
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tunnel_render32(             # <<<<<<<<<<<<<<
 *         int t,
 *         Py_ssize_t screen_width,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("PygameShader.shader.tunnel_render32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_141tunnel_render32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_140tunnel_render32[] = "\n    TUNNEL EFFECT RENDERING METHOD\n\n    * Always call the method tunnel_modeling32 outside of your game main loop\n    before calling this method (from\n      the main loop)\n\n    * Return a pygame surface containing the tunnel rendering effect, the image\n    is 32 bit (with per-pixel information)\n\n    * Cython cpdef function, this function can be called directly and do not\n    require a hook function.\n\n    * The parameter t must change overtime\n\n    :param t            : integer; linear value (frame number)\n    :param screen_width : integer; Game display size (width in pixels)\n    :param screen_height: integer; Game display size (height in pixels)\n    :param screen_w2    : integer; Game display width / 2.0\n    :param screen_h2    : integer; game display height / 2.0\n    :param distances    : numpy.ndarray buffer containing float values\n    representing the distance of each pixels\n    :param angles       : numpy.ndarray buffer containing float values\n    representing the angle of each pixels\n    :param shades       : numpy.ndarray buffer containing float values\n    representing the shade of each pixels\n    :param scr_data     : numpy.ndarray buffer containing float values\n    representing the BGR values  of each pixels\n    :param dest_array   : numpy.ndarray buffer containing float values\n    representing the RGB values of each pixels\n    :return             : Return a pygame.Surface (w, h) 32 bit with per-pixel information\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_141tunnel_render32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_t;
  Py_ssize_t __pyx_v_screen_width;
  Py_ssize_t __pyx_v_screen_height;
  int __pyx_v_screen_w2;
  int __pyx_v_screen_h2;
  __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_angles = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_shades = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_scr_data = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dest_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tunnel_render32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t_2,&__pyx_n_s_screen_width,&__pyx_n_s_screen_height,&__pyx_n_s_screen_w2,&__pyx_n_s_screen_h2,&__pyx_n_s_distances,&__pyx_n_s_angles,&__pyx_n_s_shades,&__pyx_n_s_scr_data,&__pyx_n_s_dest_array,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 1); __PYX_ERR(1, 5648, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 2); __PYX_ERR(1, 5648, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_w2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 3); __PYX_ERR(1, 5648, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_h2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 4); __PYX_ERR(1, 5648, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distances)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 5); __PYX_ERR(1, 5648, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_angles)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 6); __PYX_ERR(1, 5648, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shades)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 7); __PYX_ERR(1, 5648, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scr_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 8); __PYX_ERR(1, 5648, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dest_array)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 9); __PYX_ERR(1, 5648, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tunnel_render32") < 0)) __PYX_ERR(1, 5648, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 10) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
    }
    __pyx_v_t = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_t == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5649, __pyx_L3_error)
    __pyx_v_screen_width = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_screen_width == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5650, __pyx_L3_error)
    __pyx_v_screen_height = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_screen_height == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5651, __pyx_L3_error)
    __pyx_v_screen_w2 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_screen_w2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5652, __pyx_L3_error)
    __pyx_v_screen_h2 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_screen_h2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5653, __pyx_L3_error)
    __pyx_v_distances = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_distances.memview)) __PYX_ERR(1, 5654, __pyx_L3_error)
    __pyx_v_angles = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_angles.memview)) __PYX_ERR(1, 5655, __pyx_L3_error)
    __pyx_v_shades = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shades.memview)) __PYX_ERR(1, 5656, __pyx_L3_error)
    __pyx_v_scr_data = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_scr_data.memview)) __PYX_ERR(1, 5657, __pyx_L3_error)
    __pyx_v_dest_array = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(values[9], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dest_array.memview)) __PYX_ERR(1, 5658, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5648, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.tunnel_render32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_140tunnel_render32(__pyx_self, __pyx_v_t, __pyx_v_screen_width, __pyx_v_screen_height, __pyx_v_screen_w2, __pyx_v_screen_h2, __pyx_v_distances, __pyx_v_angles, __pyx_v_shades, __pyx_v_scr_data, __pyx_v_dest_array);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_140tunnel_render32(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_t, Py_ssize_t __pyx_v_screen_width, Py_ssize_t __pyx_v_screen_height, int __pyx_v_screen_w2, int __pyx_v_screen_h2, __Pyx_memviewslice __pyx_v_distances, __Pyx_memviewslice __pyx_v_angles, __Pyx_memviewslice __pyx_v_shades, __Pyx_memviewslice __pyx_v_scr_data, __Pyx_memviewslice __pyx_v_dest_array) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tunnel_render32", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_distances.memview)) { __Pyx_RaiseUnboundLocalError("distances"); __PYX_ERR(1, 5648, __pyx_L1_error) }
  if (unlikely(!__pyx_v_angles.memview)) { __Pyx_RaiseUnboundLocalError("angles"); __PYX_ERR(1, 5648, __pyx_L1_error) }
  if (unlikely(!__pyx_v_shades.memview)) { __Pyx_RaiseUnboundLocalError("shades"); __PYX_ERR(1, 5648, __pyx_L1_error) }
  if (unlikely(!__pyx_v_scr_data.memview)) { __Pyx_RaiseUnboundLocalError("scr_data"); __PYX_ERR(1, 5648, __pyx_L1_error) }
  if (unlikely(!__pyx_v_dest_array.memview)) { __Pyx_RaiseUnboundLocalError("dest_array"); __PYX_ERR(1, 5648, __pyx_L1_error) }
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_tunnel_render32(__pyx_v_t, __pyx_v_screen_width, __pyx_v_screen_height, __pyx_v_screen_w2, __pyx_v_screen_h2, __pyx_v_distances, __pyx_v_angles, __pyx_v_shades, __pyx_v_scr_data, __pyx_v_dest_array, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.tunnel_render32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_distances, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_angles, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_shades, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_scr_data, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_dest_array, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":5868
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple heat_map(int wavelength, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH
 */

static PyObject *__pyx_pw_12PygameShader_6shader_143heat_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_heat_map(int __pyx_v_wavelength, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_heat_map *__pyx_optional_args) {
  float __pyx_v_gamma = ((float)1.0);
  struct rgb_color_int __pyx_v_rgb_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("heat_map", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_gamma = __pyx_optional_args->gamma;
    }
  }

  /* "PygameShader/shader.pyx":5893
 *     """
 *     cdef  rgb_color_int rgb_c
 *     rgb_c = wavelength_to_rgb(wavelength, gamma)             # <<<<<<<<<<<<<<
 *     return rgb_c.r, rgb_c.g, rgb_c.b
 * 
 */
  __pyx_v_rgb_c = wavelength_to_rgb(__pyx_v_wavelength, __pyx_v_gamma);

  /* "PygameShader/shader.pyx":5894
 *     cdef  rgb_color_int rgb_c
 *     rgb_c = wavelength_to_rgb(wavelength, gamma)
 *     return rgb_c.r, rgb_c.g, rgb_c.b             # <<<<<<<<<<<<<<
 * 
 * @cython.binding(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.r); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.g); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.b); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":5868
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple heat_map(int wavelength, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("PygameShader.shader.heat_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_143heat_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_142heat_map[] = "\n    RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    This function return a tuple (R,G,B) corresponding to the\n    color wavelength (wavelength_to_rgb is an External C\n    routine with pre-defined wavelength such as :\n    Color   Wavelength(nm) Frequency(THz)\n    Red     620-750        484-400\n    Orange  590-620        508-484\n    Yellow  570-590        526-508\n    Green   495-570        606-526\n    Blue    450-495        668-606\n    Violet  380-450        789-668\n    e.g If the routine is called with a wavelength of 620, the returned color\n    will be a red gradient\n\n    :param wavelength   : integer; Wavelength\n    :param gamma        : float; Gamma value\n    :return             : tuple RGB values (0 ... 255)\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_143heat_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_wavelength;
  float __pyx_v_gamma;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("heat_map (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wavelength,&__pyx_n_s_gamma,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavelength)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "heat_map") < 0)) __PYX_ERR(1, 5868, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_wavelength = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_wavelength == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5868, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 5868, __pyx_L3_error)
    } else {
      __pyx_v_gamma = ((float)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("heat_map", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5868, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.heat_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_142heat_map(__pyx_self, __pyx_v_wavelength, __pyx_v_gamma);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_142heat_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, float __pyx_v_gamma) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_heat_map __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("heat_map", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.gamma = __pyx_v_gamma;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_heat_map(__pyx_v_wavelength, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.heat_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":5901
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple custom_map(int wavelength, int [:] color_array_, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A CUSTOM WAVELENGTH
 */

static PyObject *__pyx_pw_12PygameShader_6shader_145custom_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_custom_map(int __pyx_v_wavelength, __Pyx_memviewslice __pyx_v_color_array_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_custom_map *__pyx_optional_args) {
  float __pyx_v_gamma = ((float)1.0);
  struct rgb_color_int __pyx_v_rgb_c;
  int *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("custom_map", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_gamma = __pyx_optional_args->gamma;
    }
  }

  /* "PygameShader/shader.pyx":5933
 *     cdef  rgb_color_int rgb_c
 *     cdef int *p
 *     p = &color_array_[0]             # <<<<<<<<<<<<<<
 *     rgb_c = wavelength_to_rgb_custom(wavelength, p, gamma)
 *     return rgb_c.r, rgb_c.g, rgb_c.b
 */
  __pyx_t_1 = 0;
  __pyx_v_p = (&(*((int *) ( /* dim=0 */ (__pyx_v_color_array_.data + __pyx_t_1 * __pyx_v_color_array_.strides[0]) ))));

  /* "PygameShader/shader.pyx":5934
 *     cdef int *p
 *     p = &color_array_[0]
 *     rgb_c = wavelength_to_rgb_custom(wavelength, p, gamma)             # <<<<<<<<<<<<<<
 *     return rgb_c.r, rgb_c.g, rgb_c.b
 * 
 */
  __pyx_v_rgb_c = wavelength_to_rgb_custom(__pyx_v_wavelength, __pyx_v_p, __pyx_v_gamma);

  /* "PygameShader/shader.pyx":5935
 *     p = &color_array_[0]
 *     rgb_c = wavelength_to_rgb_custom(wavelength, p, gamma)
 *     return rgb_c.r, rgb_c.g, rgb_c.b             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.r); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.g); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.b); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":5901
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple custom_map(int wavelength, int [:] color_array_, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A CUSTOM WAVELENGTH
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("PygameShader.shader.custom_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_145custom_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_144custom_map[] = "\n    RETURN AN RGB COLOR VALUE MATCHING A CUSTOM WAVELENGTH\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    This function return a tuple (R,G,B) corresponding to the\n    color wavelength define in color_array_\n    (wavelength_to_rgb_custom is an External C\n    routine with customize wavelength and allow the user to defined\n    a customize palette according to an input value)\n\n    example for a Fire palette\n    arr = numpy.array(\n        [0, 1,       # violet is not used\n         0, 1,       # blue is not used\n         0, 1,       # green is not used\n         2, 619,     # yellow, return a yellow gradient for values [2...619]\n         620, 650,   # orange return a orange gradient for values [620 ... 650]\n         651, 660    # red return a red gradient for values [651 ... 660]\n         ], numpy.int)\n\n\n    :param wavelength   : integer; Wavelength\n    :param gamma        : float; Gamma value\n    :param color_array_ : numpy array containing the min and max of each color (red,\n    orange, yellow, green, blue, violet)\n    :return             : tuple RGB values (0 ... 255)\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_145custom_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_wavelength;
  __Pyx_memviewslice __pyx_v_color_array_ = { 0, 0, { 0 }, { 0 }, { 0 } };
  float __pyx_v_gamma;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("custom_map (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wavelength,&__pyx_n_s_color_array,&__pyx_n_s_gamma,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavelength)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color_array)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("custom_map", 0, 2, 3, 1); __PYX_ERR(1, 5901, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "custom_map") < 0)) __PYX_ERR(1, 5901, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_wavelength = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_wavelength == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5901, __pyx_L3_error)
    __pyx_v_color_array_ = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_color_array_.memview)) __PYX_ERR(1, 5901, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 5901, __pyx_L3_error)
    } else {
      __pyx_v_gamma = ((float)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("custom_map", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5901, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.custom_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_144custom_map(__pyx_self, __pyx_v_wavelength, __pyx_v_color_array_, __pyx_v_gamma);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_144custom_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, __Pyx_memviewslice __pyx_v_color_array_, float __pyx_v_gamma) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_custom_map __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("custom_map", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_color_array_.memview)) { __Pyx_RaiseUnboundLocalError("color_array_"); __PYX_ERR(1, 5901, __pyx_L1_error) }
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.gamma = __pyx_v_gamma;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_custom_map(__pyx_v_wavelength, __pyx_v_color_array_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.custom_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_color_array_, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":5961
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void heatmap_convert(object surface_, bint rgb_=True):             # <<<<<<<<<<<<<<
 *     """
 *     TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT
 */

static PyObject *__pyx_pw_12PygameShader_6shader_147heatmap_convert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heatmap_convert(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_heatmap_convert *__pyx_optional_args) {
  int __pyx_v_rgb_ = ((int)1);
  CYTHON_UNUSED unsigned int __pyx_v_w;
  CYTHON_UNUSED unsigned int __pyx_v_h;
  __Pyx_memviewslice __pyx_v_rgb_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned int __pyx_v_s;
  int __pyx_v_i;
  CYTHON_UNUSED int __pyx_v_size;
  unsigned int __pyx_v_index;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  CYTHON_UNUSED short __pyx_v_bitsize;
  CYTHON_UNUSED short __pyx_v_bytesize;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  unsigned int __pyx_t_6;
  unsigned int __pyx_t_7;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_9;
  short __pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  long __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  size_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("heatmap_convert", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_rgb_ = __pyx_optional_args->rgb_;
    }
  }

  /* "PygameShader/shader.pyx":5975
 *     cdef:
 *         unsigned int w, h
 *     w, h = surface_.get_size()             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 5975, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 5975, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 5975, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5975, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5975, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_w = __pyx_t_6;
  __pyx_v_h = __pyx_t_7;

  /* "PygameShader/shader.pyx":5978
 * 
 *     cdef:
 *         unsigned char [::1] rgb_array  = surface_.get_buffer()             # <<<<<<<<<<<<<<
 *         unsigned int s
 *         int i
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5978, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rgb_array = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":5981
 *         unsigned int s
 *         int i
 *         int size = rgb_array.size             # <<<<<<<<<<<<<<
 *         unsigned int index = 0
 *         unsigned char *r
 */
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rgb_array, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5981, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_size = __pyx_t_9;

  /* "PygameShader/shader.pyx":5982
 *         int i
 *         int size = rgb_array.size
 *         unsigned int index = 0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_index = 0;

  /* "PygameShader/shader.pyx":5986
 *         unsigned char *g
 *         unsigned char *b
 *         short int bitsize = surface_.get_bitsize()             # <<<<<<<<<<<<<<
 *         short int bytesize = surface_.get_bytesize()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bitsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 5986, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_bitsize = __pyx_t_10;

  /* "PygameShader/shader.pyx":5987
 *         unsigned char *b
 *         short int bitsize = surface_.get_bitsize()
 *         short int bytesize = surface_.get_bytesize()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bytesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 5987, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_bytesize = __pyx_t_10;

  /* "PygameShader/shader.pyx":5989
 *         short int bytesize = surface_.get_bytesize()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # RGB
 *         if rgb_:
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":5991
 *     with nogil:
 *         # RGB
 *         if rgb_:             # <<<<<<<<<<<<<<
 *             for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):
 * 
 */
        __pyx_t_11 = (__pyx_v_rgb_ != 0);
        if (__pyx_t_11) {

          /* "PygameShader/shader.pyx":5992
 *         # RGB
 *         if rgb_:
 *             for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *                 r = &rgb_array[i]
 */
          __pyx_t_9 = __pyx_v_size;
          __pyx_t_10 = __pyx_v_bytesize;
          if ((__pyx_t_10 == 0)) abort();
          {
              unsigned char * __pyx_parallel_temp0 = ((unsigned char *)1);
              unsigned char * __pyx_parallel_temp1 = ((unsigned char *)1);
              int __pyx_parallel_temp2 = ((int)0xbad0bad0);
              unsigned int __pyx_parallel_temp3 = ((unsigned int)0xbad0bad0);
              unsigned char * __pyx_parallel_temp4 = ((unsigned char *)1);
              unsigned int __pyx_parallel_temp5 = ((unsigned int)0xbad0bad0);
              const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
              PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
              int __pyx_parallel_why;
              __pyx_parallel_why = 0;
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   (x)
                  #define unlikely(x) (x)
              #endif
              __pyx_t_13 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
              if (__pyx_t_13 > 0)
              {
                  #ifdef _OPENMP
                  #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_14, __pyx_t_15) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                  #endif /* _OPENMP */
                  {
                      #ifdef _OPENMP
                      #ifdef WITH_THREAD
                      PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                      #endif
                      Py_BEGIN_ALLOW_THREADS
                      #endif /* _OPENMP */
                      #ifdef _OPENMP
                      #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static)
                      #endif /* _OPENMP */
                      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){
                          if (__pyx_parallel_why < 2)
                          {
                              __pyx_v_i = (int)(0 + __pyx_t_10 * __pyx_t_12);
                              /* Initialize private variables to invalid values */
                              __pyx_v_b = ((unsigned char *)1);
                              __pyx_v_g = ((unsigned char *)1);
                              __pyx_v_index = ((unsigned int)0xbad0bad0);
                              __pyx_v_r = ((unsigned char *)1);
                              __pyx_v_s = ((unsigned int)0xbad0bad0);

                              /* "PygameShader/shader.pyx":5994
 *             for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):
 * 
 *                 r = &rgb_array[i]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array[i + 1]
 *                 b = &rgb_array[i + 2]
 */
                              __pyx_t_14 = __pyx_v_i;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

                              /* "PygameShader/shader.pyx":5995
 * 
 *                 r = &rgb_array[i]
 *                 g = &rgb_array[i + 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array[i + 2]
 * 
 */
                              __pyx_t_14 = (__pyx_v_i + 1);
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

                              /* "PygameShader/shader.pyx":5996
 *                 r = &rgb_array[i]
 *                 g = &rgb_array[i + 1]
 *                 b = &rgb_array[i + 2]             # <<<<<<<<<<<<<<
 * 
 *                 s = r[0] + g[0] + b[0]
 */
                              __pyx_t_14 = (__pyx_v_i + 2);
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

                              /* "PygameShader/shader.pyx":5998
 *                 b = &rgb_array[i + 2]
 * 
 *                 s = r[0] + g[0] + b[0]             # <<<<<<<<<<<<<<
 *                 index = <int>(s * f_map)
 * 
 */
                              __pyx_v_s = (((__pyx_v_r[0]) + (__pyx_v_g[0])) + (__pyx_v_b[0]));

                              /* "PygameShader/shader.pyx":5999
 * 
 *                 s = r[0] + g[0] + b[0]
 *                 index = <int>(s * f_map)             # <<<<<<<<<<<<<<
 * 
 *                 r[0] = <unsigned char>heatmap_array[index, 0]
 */
                              __pyx_v_index = ((int)(__pyx_v_s * __pyx_v_12PygameShader_6shader_f_map));

                              /* "PygameShader/shader.pyx":6001
 *                 index = <int>(s * f_map)
 * 
 *                 r[0] = <unsigned char>heatmap_array[index, 0]             # <<<<<<<<<<<<<<
 *                 g[0] = <unsigned char>heatmap_array[index, 1]
 *                 b[0] = <unsigned char>heatmap_array[index, 2]
 */
                              if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6001, __pyx_L11_error) }
                              __pyx_t_15 = __pyx_v_index;
                              __pyx_t_14 = 0;
                              (__pyx_v_r[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));

                              /* "PygameShader/shader.pyx":6002
 * 
 *                 r[0] = <unsigned char>heatmap_array[index, 0]
 *                 g[0] = <unsigned char>heatmap_array[index, 1]             # <<<<<<<<<<<<<<
 *                 b[0] = <unsigned char>heatmap_array[index, 2]
 *         # BGR
 */
                              if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6002, __pyx_L11_error) }
                              __pyx_t_15 = __pyx_v_index;
                              __pyx_t_14 = 1;
                              (__pyx_v_g[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));

                              /* "PygameShader/shader.pyx":6003
 *                 r[0] = <unsigned char>heatmap_array[index, 0]
 *                 g[0] = <unsigned char>heatmap_array[index, 1]
 *                 b[0] = <unsigned char>heatmap_array[index, 2]             # <<<<<<<<<<<<<<
 *         # BGR
 *         else:
 */
                              if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6003, __pyx_L11_error) }
                              __pyx_t_15 = __pyx_v_index;
                              __pyx_t_14 = 2;
                              (__pyx_v_b[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));
                              goto __pyx_L14;
                              __pyx_L11_error:;
                              {
                                  #ifdef WITH_THREAD
                                  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                  #endif
                                  #ifdef _OPENMP
                                  #pragma omp flush(__pyx_parallel_exc_type)
                                  #endif /* _OPENMP */
                                  if (!__pyx_parallel_exc_type) {
                                    __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                    __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                    __Pyx_GOTREF(__pyx_parallel_exc_type);
                                  }
                                  #ifdef WITH_THREAD
                                  __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                  #endif
                              }
                              __pyx_parallel_why = 4;
                              goto __pyx_L13;
                              __pyx_L13:;
                              #ifdef _OPENMP
                              #pragma omp critical(__pyx_parallel_lastprivates3)
                              #endif /* _OPENMP */
                              {
                                  __pyx_parallel_temp0 = __pyx_v_b;
                                  __pyx_parallel_temp1 = __pyx_v_g;
                                  __pyx_parallel_temp2 = __pyx_v_i;
                                  __pyx_parallel_temp3 = __pyx_v_index;
                                  __pyx_parallel_temp4 = __pyx_v_r;
                                  __pyx_parallel_temp5 = __pyx_v_s;
                              }
                              __pyx_L14:;
                              #ifdef _OPENMP
                              #pragma omp flush(__pyx_parallel_why)
                              #endif /* _OPENMP */
                          }
                      }
                      #ifdef _OPENMP
                      Py_END_ALLOW_THREADS
                      #else
{
#ifdef WITH_THREAD
                      PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                      #endif
                      #endif /* _OPENMP */
                      /* Clean up any temporaries */
                      #ifdef WITH_THREAD
                      __Pyx_PyGILState_Release(__pyx_gilstate_save);
                      #endif
                      #ifndef _OPENMP
}
#endif /* _OPENMP */
                  }
              }
              if (__pyx_parallel_exc_type) {
                /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                __pyx_parallel_why = 4;
              }
              if (__pyx_parallel_why) {
                __pyx_v_b = __pyx_parallel_temp0;
                __pyx_v_g = __pyx_parallel_temp1;
                __pyx_v_i = __pyx_parallel_temp2;
                __pyx_v_index = __pyx_parallel_temp3;
                __pyx_v_r = __pyx_parallel_temp4;
                __pyx_v_s = __pyx_parallel_temp5;
                switch (__pyx_parallel_why) {
                      case 4:
                  {
                      #ifdef WITH_THREAD
                      PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                      #endif
                      __Pyx_GIVEREF(__pyx_parallel_exc_type);
                      __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                      __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                      #ifdef WITH_THREAD
                      __Pyx_PyGILState_Release(__pyx_gilstate_save);
                      #endif
                  }
                  goto __pyx_L6_error;
                }
              }
          }
          #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
              #undef likely
              #undef unlikely
              #define likely(x)   __builtin_expect(!!(x), 1)
              #define unlikely(x) __builtin_expect(!!(x), 0)
          #endif

          /* "PygameShader/shader.pyx":5991
 *     with nogil:
 *         # RGB
 *         if rgb_:             # <<<<<<<<<<<<<<
 *             for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):
 * 
 */
          goto __pyx_L8;
        }

        /* "PygameShader/shader.pyx":6006
 *         # BGR
 *         else:
 *             for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *                 r = &rgb_array[i]
 */
        /*else*/ {
          __pyx_t_9 = __pyx_v_size;
          __pyx_t_10 = __pyx_v_bytesize;
          if ((__pyx_t_10 == 0)) abort();
          {
              unsigned char * __pyx_parallel_temp0 = ((unsigned char *)1);
              unsigned char * __pyx_parallel_temp1 = ((unsigned char *)1);
              int __pyx_parallel_temp2 = ((int)0xbad0bad0);
              unsigned int __pyx_parallel_temp3 = ((unsigned int)0xbad0bad0);
              unsigned char * __pyx_parallel_temp4 = ((unsigned char *)1);
              unsigned int __pyx_parallel_temp5 = ((unsigned int)0xbad0bad0);
              const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
              PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
              int __pyx_parallel_why;
              __pyx_parallel_why = 0;
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   (x)
                  #define unlikely(x) (x)
              #endif
              __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
              if (__pyx_t_12 > 0)
              {
                  #ifdef _OPENMP
                  #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_14, __pyx_t_15) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                  #endif /* _OPENMP */
                  {
                      #ifdef _OPENMP
                      #ifdef WITH_THREAD
                      PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                      #endif
                      Py_BEGIN_ALLOW_THREADS
                      #endif /* _OPENMP */
                      #ifdef _OPENMP
                      #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static)
                      #endif /* _OPENMP */
                      for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13++){
                          if (__pyx_parallel_why < 2)
                          {
                              __pyx_v_i = (int)(0 + __pyx_t_10 * __pyx_t_13);
                              /* Initialize private variables to invalid values */
                              __pyx_v_b = ((unsigned char *)1);
                              __pyx_v_g = ((unsigned char *)1);
                              __pyx_v_index = ((unsigned int)0xbad0bad0);
                              __pyx_v_r = ((unsigned char *)1);
                              __pyx_v_s = ((unsigned int)0xbad0bad0);

                              /* "PygameShader/shader.pyx":6008
 *             for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):
 * 
 *                 r = &rgb_array[i]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array[i + 1]
 *                 b = &rgb_array[i + 2]
 */
                              __pyx_t_14 = __pyx_v_i;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

                              /* "PygameShader/shader.pyx":6009
 * 
 *                 r = &rgb_array[i]
 *                 g = &rgb_array[i + 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array[i + 2]
 * 
 */
                              __pyx_t_14 = (__pyx_v_i + 1);
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

                              /* "PygameShader/shader.pyx":6010
 *                 r = &rgb_array[i]
 *                 g = &rgb_array[i + 1]
 *                 b = &rgb_array[i + 2]             # <<<<<<<<<<<<<<
 * 
 *                 s = r[0] + g[0] + b[0]
 */
                              __pyx_t_14 = (__pyx_v_i + 2);
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

                              /* "PygameShader/shader.pyx":6012
 *                 b = &rgb_array[i + 2]
 * 
 *                 s = r[0] + g[0] + b[0]             # <<<<<<<<<<<<<<
 *                 index = <int>(s * f_map)
 * 
 */
                              __pyx_v_s = (((__pyx_v_r[0]) + (__pyx_v_g[0])) + (__pyx_v_b[0]));

                              /* "PygameShader/shader.pyx":6013
 * 
 *                 s = r[0] + g[0] + b[0]
 *                 index = <int>(s * f_map)             # <<<<<<<<<<<<<<
 * 
 *                 r[0] = <unsigned char>heatmap_array[index, 2]
 */
                              __pyx_v_index = ((int)(__pyx_v_s * __pyx_v_12PygameShader_6shader_f_map));

                              /* "PygameShader/shader.pyx":6015
 *                 index = <int>(s * f_map)
 * 
 *                 r[0] = <unsigned char>heatmap_array[index, 2]             # <<<<<<<<<<<<<<
 *                 g[0] = <unsigned char>heatmap_array[index, 1]
 *                 b[0] = <unsigned char>heatmap_array[index, 0]
 */
                              if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6015, __pyx_L17_error) }
                              __pyx_t_15 = __pyx_v_index;
                              __pyx_t_14 = 2;
                              (__pyx_v_r[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));

                              /* "PygameShader/shader.pyx":6016
 * 
 *                 r[0] = <unsigned char>heatmap_array[index, 2]
 *                 g[0] = <unsigned char>heatmap_array[index, 1]             # <<<<<<<<<<<<<<
 *                 b[0] = <unsigned char>heatmap_array[index, 0]
 * 
 */
                              if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6016, __pyx_L17_error) }
                              __pyx_t_15 = __pyx_v_index;
                              __pyx_t_14 = 1;
                              (__pyx_v_g[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));

                              /* "PygameShader/shader.pyx":6017
 *                 r[0] = <unsigned char>heatmap_array[index, 2]
 *                 g[0] = <unsigned char>heatmap_array[index, 1]
 *                 b[0] = <unsigned char>heatmap_array[index, 0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6017, __pyx_L17_error) }
                              __pyx_t_15 = __pyx_v_index;
                              __pyx_t_14 = 0;
                              (__pyx_v_b[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));
                              goto __pyx_L20;
                              __pyx_L17_error:;
                              {
                                  #ifdef WITH_THREAD
                                  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                  #endif
                                  #ifdef _OPENMP
                                  #pragma omp flush(__pyx_parallel_exc_type)
                                  #endif /* _OPENMP */
                                  if (!__pyx_parallel_exc_type) {
                                    __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                    __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                    __Pyx_GOTREF(__pyx_parallel_exc_type);
                                  }
                                  #ifdef WITH_THREAD
                                  __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                  #endif
                              }
                              __pyx_parallel_why = 4;
                              goto __pyx_L19;
                              __pyx_L19:;
                              #ifdef _OPENMP
                              #pragma omp critical(__pyx_parallel_lastprivates4)
                              #endif /* _OPENMP */
                              {
                                  __pyx_parallel_temp0 = __pyx_v_b;
                                  __pyx_parallel_temp1 = __pyx_v_g;
                                  __pyx_parallel_temp2 = __pyx_v_i;
                                  __pyx_parallel_temp3 = __pyx_v_index;
                                  __pyx_parallel_temp4 = __pyx_v_r;
                                  __pyx_parallel_temp5 = __pyx_v_s;
                              }
                              __pyx_L20:;
                              #ifdef _OPENMP
                              #pragma omp flush(__pyx_parallel_why)
                              #endif /* _OPENMP */
                          }
                      }
                      #ifdef _OPENMP
                      Py_END_ALLOW_THREADS
                      #else
{
#ifdef WITH_THREAD
                      PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                      #endif
                      #endif /* _OPENMP */
                      /* Clean up any temporaries */
                      #ifdef WITH_THREAD
                      __Pyx_PyGILState_Release(__pyx_gilstate_save);
                      #endif
                      #ifndef _OPENMP
}
#endif /* _OPENMP */
                  }
              }
              if (__pyx_parallel_exc_type) {
                /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                __pyx_parallel_why = 4;
              }
              if (__pyx_parallel_why) {
                __pyx_v_b = __pyx_parallel_temp0;
                __pyx_v_g = __pyx_parallel_temp1;
                __pyx_v_i = __pyx_parallel_temp2;
                __pyx_v_index = __pyx_parallel_temp3;
                __pyx_v_r = __pyx_parallel_temp4;
                __pyx_v_s = __pyx_parallel_temp5;
                switch (__pyx_parallel_why) {
                      case 4:
                  {
                      #ifdef WITH_THREAD
                      PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                      #endif
                      __Pyx_GIVEREF(__pyx_parallel_exc_type);
                      __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                      __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                      #ifdef WITH_THREAD
                      __Pyx_PyGILState_Release(__pyx_gilstate_save);
                      #endif
                  }
                  goto __pyx_L6_error;
                }
              }
          }
          #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
              #undef likely
              #undef unlikely
              #define likely(x)   __builtin_expect(!!(x), 1)
              #define unlikely(x) __builtin_expect(!!(x), 0)
          #endif
        }
        __pyx_L8:;
      }

      /* "PygameShader/shader.pyx":5989
 *         short int bytesize = surface_.get_bytesize()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # RGB
 *         if rgb_:
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L6_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L7:;
      }
  }

  /* "PygameShader/shader.pyx":5961
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void heatmap_convert(object surface_, bint rgb_=True):             # <<<<<<<<<<<<<<
 *     """
 *     TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.heatmap_convert", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array, 1);
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_147heatmap_convert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_146heatmap_convert[] = "\n    TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param surface_ : pygame.Surface\n    :param rgb_     : boolean; True transformed the image into a RGB heatmap model of False (BGR)\n    :return         : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_147heatmap_convert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_rgb_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("heatmap_convert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_rgb,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rgb);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "heatmap_convert") < 0)) __PYX_ERR(1, 5961, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    if (values[1]) {
      __pyx_v_rgb_ = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_rgb_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5961, __pyx_L3_error)
    } else {
      __pyx_v_rgb_ = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("heatmap_convert", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5961, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.heatmap_convert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_146heatmap_convert(__pyx_self, __pyx_v_surface_, __pyx_v_rgb_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_146heatmap_convert(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_rgb_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_12PygameShader_6shader_heatmap_convert __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("heatmap_convert", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.rgb_ = __pyx_v_rgb_;
  __pyx_f_12PygameShader_6shader_heatmap_convert(__pyx_v_surface_, 0, &__pyx_t_1); 
  __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("PygameShader.shader.heatmap_convert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6026
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple blue_map(int wavelength, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH
 */

static PyObject *__pyx_pw_12PygameShader_6shader_149blue_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_blue_map(int __pyx_v_wavelength, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_blue_map *__pyx_optional_args) {
  float __pyx_v_gamma = ((float)1.0);
  struct rgb_color_int __pyx_v_rgb_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blue_map", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_gamma = __pyx_optional_args->gamma;
    }
  }

  /* "PygameShader/shader.pyx":6038
 *     """
 *     cdef  rgb_color_int rgb_c
 *     rgb_c = wavelength_to_rgb(wavelength, gamma)             # <<<<<<<<<<<<<<
 *     return rgb_c.r, rgb_c.g, rgb_c.b
 * 
 */
  __pyx_v_rgb_c = wavelength_to_rgb(__pyx_v_wavelength, __pyx_v_gamma);

  /* "PygameShader/shader.pyx":6039
 *     cdef  rgb_color_int rgb_c
 *     rgb_c = wavelength_to_rgb(wavelength, gamma)
 *     return rgb_c.r, rgb_c.g, rgb_c.b             # <<<<<<<<<<<<<<
 * 
 * i = 0
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.r); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.g); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.b); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":6026
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple blue_map(int wavelength, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("PygameShader.shader.blue_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_149blue_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_148blue_map[] = "\n    RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param wavelength   : integer; Wavelength\n    :param gamma        : float; Gamma value\n    :return             : tuple RGB values (0 ... 255)\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_149blue_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_wavelength;
  float __pyx_v_gamma;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blue_map (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wavelength,&__pyx_n_s_gamma,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavelength)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blue_map") < 0)) __PYX_ERR(1, 6026, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_wavelength = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_wavelength == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6026, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 6026, __pyx_L3_error)
    } else {
      __pyx_v_gamma = ((float)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blue_map", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 6026, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.blue_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_148blue_map(__pyx_self, __pyx_v_wavelength, __pyx_v_gamma);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_148blue_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, float __pyx_v_gamma) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_blue_map __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blue_map", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.gamma = __pyx_v_gamma;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_blue_map(__pyx_v_wavelength, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.blue_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6060
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void bluescale(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     MAP AN IMAGE INTO A BLUE EQUIVALENT FORMAT
 */

static PyObject *__pyx_pw_12PygameShader_6shader_151bluescale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bluescale(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  CYTHON_UNUSED unsigned int __pyx_v_w;
  CYTHON_UNUSED unsigned int __pyx_v_h;
  __Pyx_memviewslice __pyx_v_rgb_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned int __pyx_v_s;
  int __pyx_v_i;
  CYTHON_UNUSED int __pyx_v_size;
  unsigned int __pyx_v_index;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  CYTHON_UNUSED short __pyx_v_bitsize;
  CYTHON_UNUSED short __pyx_v_bytesize;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  unsigned int __pyx_t_6;
  unsigned int __pyx_t_7;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_9;
  short __pyx_t_10;
  long __pyx_t_11;
  long __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  size_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bluescale", 0);

  /* "PygameShader/shader.pyx":6076
 *     cdef:
 *         unsigned int w, h
 *     w, h = surface_.get_size()             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 6076, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 6076, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 6076, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6076, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6076, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_w = __pyx_t_6;
  __pyx_v_h = __pyx_t_7;

  /* "PygameShader/shader.pyx":6079
 * 
 *     cdef:
 *         unsigned char [::1] rgb_array  = surface_.get_buffer()             # <<<<<<<<<<<<<<
 *         unsigned int s
 *         int i
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 6079, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rgb_array = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":6082
 *         unsigned int s
 *         int i
 *         int size = rgb_array.size             # <<<<<<<<<<<<<<
 *         unsigned int index = 0
 *         unsigned char *r
 */
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rgb_array, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6082, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_size = __pyx_t_9;

  /* "PygameShader/shader.pyx":6083
 *         int i
 *         int size = rgb_array.size
 *         unsigned int index = 0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_index = 0;

  /* "PygameShader/shader.pyx":6087
 *         unsigned char *g
 *         unsigned char *b
 *         short int bitsize = surface_.get_bitsize()             # <<<<<<<<<<<<<<
 *         short int bytesize = surface_.get_bytesize()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bitsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 6087, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_bitsize = __pyx_t_10;

  /* "PygameShader/shader.pyx":6088
 *         unsigned char *b
 *         short int bitsize = surface_.get_bitsize()
 *         short int bytesize = surface_.get_bytesize()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bytesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 6088, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_bytesize = __pyx_t_10;

  /* "PygameShader/shader.pyx":6090
 *         short int bytesize = surface_.get_bytesize()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":6091
 * 
 *     with nogil:
 *         for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *             r = &rgb_array[i]
 */
        __pyx_t_9 = __pyx_v_size;
        __pyx_t_10 = __pyx_v_bytesize;
        if ((__pyx_t_10 == 0)) abort();
        {
            unsigned char * __pyx_parallel_temp0 = ((unsigned char *)1);
            unsigned char * __pyx_parallel_temp1 = ((unsigned char *)1);
            int __pyx_parallel_temp2 = ((int)0xbad0bad0);
            unsigned int __pyx_parallel_temp3 = ((unsigned int)0xbad0bad0);
            unsigned char * __pyx_parallel_temp4 = ((unsigned char *)1);
            unsigned int __pyx_parallel_temp5 = ((unsigned int)0xbad0bad0);
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
            if (__pyx_t_12 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_13, __pyx_t_14) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_i = (int)(0 + __pyx_t_10 * __pyx_t_11);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_index = ((unsigned int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_s = ((unsigned int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":6093
 *         for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):
 * 
 *             r = &rgb_array[i]             # <<<<<<<<<<<<<<
 *             g = &rgb_array[i + 1]
 *             b = &rgb_array[i + 2]
 */
                            __pyx_t_13 = __pyx_v_i;
                            __pyx_v_r = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

                            /* "PygameShader/shader.pyx":6094
 * 
 *             r = &rgb_array[i]
 *             g = &rgb_array[i + 1]             # <<<<<<<<<<<<<<
 *             b = &rgb_array[i + 2]
 * 
 */
                            __pyx_t_13 = (__pyx_v_i + 1);
                            __pyx_v_g = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

                            /* "PygameShader/shader.pyx":6095
 *             r = &rgb_array[i]
 *             g = &rgb_array[i + 1]
 *             b = &rgb_array[i + 2]             # <<<<<<<<<<<<<<
 * 
 *             s = r[0] + g[0] + b[0]
 */
                            __pyx_t_13 = (__pyx_v_i + 2);
                            __pyx_v_b = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

                            /* "PygameShader/shader.pyx":6097
 *             b = &rgb_array[i + 2]
 * 
 *             s = r[0] + g[0] + b[0]             # <<<<<<<<<<<<<<
 *             index = <int>(s * f_bluemap)
 * 
 */
                            __pyx_v_s = (((__pyx_v_r[0]) + (__pyx_v_g[0])) + (__pyx_v_b[0]));

                            /* "PygameShader/shader.pyx":6098
 * 
 *             s = r[0] + g[0] + b[0]
 *             index = <int>(s * f_bluemap)             # <<<<<<<<<<<<<<
 * 
 *             r[0] = <unsigned char>bluemap_array[index, 2]
 */
                            __pyx_v_index = ((int)(__pyx_v_s * __pyx_v_12PygameShader_6shader_f_bluemap));

                            /* "PygameShader/shader.pyx":6100
 *             index = <int>(s * f_bluemap)
 * 
 *             r[0] = <unsigned char>bluemap_array[index, 2]             # <<<<<<<<<<<<<<
 *             g[0] = <unsigned char>bluemap_array[index, 1]
 *             b[0] = <unsigned char>bluemap_array[index, 0]
 */
                            if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("bluemap_array"); __PYX_ERR(1, 6100, __pyx_L10_error) }
                            __pyx_t_14 = __pyx_v_index;
                            __pyx_t_13 = 2;
                            (__pyx_v_r[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_13)) ))));

                            /* "PygameShader/shader.pyx":6101
 * 
 *             r[0] = <unsigned char>bluemap_array[index, 2]
 *             g[0] = <unsigned char>bluemap_array[index, 1]             # <<<<<<<<<<<<<<
 *             b[0] = <unsigned char>bluemap_array[index, 0]
 * 
 */
                            if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("bluemap_array"); __PYX_ERR(1, 6101, __pyx_L10_error) }
                            __pyx_t_14 = __pyx_v_index;
                            __pyx_t_13 = 1;
                            (__pyx_v_g[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_13)) ))));

                            /* "PygameShader/shader.pyx":6102
 *             r[0] = <unsigned char>bluemap_array[index, 2]
 *             g[0] = <unsigned char>bluemap_array[index, 1]
 *             b[0] = <unsigned char>bluemap_array[index, 0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                            if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("bluemap_array"); __PYX_ERR(1, 6102, __pyx_L10_error) }
                            __pyx_t_14 = __pyx_v_index;
                            __pyx_t_13 = 0;
                            (__pyx_v_b[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_13)) ))));
                            goto __pyx_L13;
                            __pyx_L10_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L12;
                            __pyx_L12:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates5)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_b;
                                __pyx_parallel_temp1 = __pyx_v_g;
                                __pyx_parallel_temp2 = __pyx_v_i;
                                __pyx_parallel_temp3 = __pyx_v_index;
                                __pyx_parallel_temp4 = __pyx_v_r;
                                __pyx_parallel_temp5 = __pyx_v_s;
                            }
                            __pyx_L13:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_b = __pyx_parallel_temp0;
              __pyx_v_g = __pyx_parallel_temp1;
              __pyx_v_i = __pyx_parallel_temp2;
              __pyx_v_index = __pyx_parallel_temp3;
              __pyx_v_r = __pyx_parallel_temp4;
              __pyx_v_s = __pyx_parallel_temp5;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L6_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":6090
 *         short int bytesize = surface_.get_bytesize()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L6_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L7:;
      }
  }

  /* "PygameShader/shader.pyx":6060
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void bluescale(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     MAP AN IMAGE INTO A BLUE EQUIVALENT FORMAT
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.bluescale", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array, 1);
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_151bluescale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_150bluescale[] = "\n    MAP AN IMAGE INTO A BLUE EQUIVALENT FORMAT\n    THIS ALGORITHM IS USING THE WAVELENGTH FROM 450-495 NM TO\n    REPRESENT THE IMAGE IN BLUE SHADES\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param surface_ : pygame.Surface to transform\n    :return         : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_151bluescale(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bluescale (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_150bluescale(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_150bluescale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bluescale", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_bluescale(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.bluescale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6111
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple red_map(int wavelength, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH
 */

static PyObject *__pyx_pw_12PygameShader_6shader_153red_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_red_map(int __pyx_v_wavelength, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_red_map *__pyx_optional_args) {
  float __pyx_v_gamma = ((float)1.0);
  struct rgb_color_int __pyx_v_rgb_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("red_map", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_gamma = __pyx_optional_args->gamma;
    }
  }

  /* "PygameShader/shader.pyx":6123
 *     """
 *     cdef  rgb_color_int rgb_c
 *     rgb_c = wavelength_to_rgb(wavelength, gamma)             # <<<<<<<<<<<<<<
 *     return rgb_c.r, rgb_c.g, rgb_c.b
 * 
 */
  __pyx_v_rgb_c = wavelength_to_rgb(__pyx_v_wavelength, __pyx_v_gamma);

  /* "PygameShader/shader.pyx":6124
 *     cdef  rgb_color_int rgb_c
 *     rgb_c = wavelength_to_rgb(wavelength, gamma)
 *     return rgb_c.r, rgb_c.g, rgb_c.b             # <<<<<<<<<<<<<<
 * 
 * i = 0
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.r); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.g); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.b); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":6111
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple red_map(int wavelength, float gamma=1.0):             # <<<<<<<<<<<<<<
 *     """
 *     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("PygameShader.shader.red_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_153red_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_152red_map[] = "\n    RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param wavelength   : integer; Wavelength\n    :param gamma        : float; Gamma value\n    :return             : tuple RGB values (0 ... 255)\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_153red_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_wavelength;
  float __pyx_v_gamma;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("red_map (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wavelength,&__pyx_n_s_gamma,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavelength)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "red_map") < 0)) __PYX_ERR(1, 6111, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_wavelength = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_wavelength == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6111, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 6111, __pyx_L3_error)
    } else {
      __pyx_v_gamma = ((float)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("red_map", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 6111, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.red_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_152red_map(__pyx_self, __pyx_v_wavelength, __pyx_v_gamma);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_152red_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, float __pyx_v_gamma) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_red_map __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("red_map", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.gamma = __pyx_v_gamma;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_red_map(__pyx_v_wavelength, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.red_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6147
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void redscale(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     MAP AN IMAGE INTO A RED EQUIVALENT FORMAT
 */

static PyObject *__pyx_pw_12PygameShader_6shader_155redscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_redscale(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
  CYTHON_UNUSED unsigned int __pyx_v_w;
  CYTHON_UNUSED unsigned int __pyx_v_h;
  __Pyx_memviewslice __pyx_v_rgb_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned int __pyx_v_s;
  int __pyx_v_i;
  CYTHON_UNUSED int __pyx_v_size;
  unsigned int __pyx_v_index;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  CYTHON_UNUSED short __pyx_v_bitsize;
  CYTHON_UNUSED short __pyx_v_bytesize;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  unsigned int __pyx_t_6;
  unsigned int __pyx_t_7;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_9;
  short __pyx_t_10;
  long __pyx_t_11;
  long __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  size_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("redscale", 0);

  /* "PygameShader/shader.pyx":6163
 *     cdef:
 *         unsigned int w, h
 *     w, h = surface_.get_size()             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 6163, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 6163, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 6163, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_w = __pyx_t_6;
  __pyx_v_h = __pyx_t_7;

  /* "PygameShader/shader.pyx":6166
 * 
 *     cdef:
 *         unsigned char [::1] rgb_array  = surface_.get_buffer()             # <<<<<<<<<<<<<<
 *         unsigned int s
 *         int i
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 6166, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rgb_array = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":6169
 *         unsigned int s
 *         int i
 *         int size = rgb_array.size             # <<<<<<<<<<<<<<
 *         unsigned int index = 0
 *         unsigned char *r
 */
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rgb_array, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6169, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_size = __pyx_t_9;

  /* "PygameShader/shader.pyx":6170
 *         int i
 *         int size = rgb_array.size
 *         unsigned int index = 0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_index = 0;

  /* "PygameShader/shader.pyx":6174
 *         unsigned char *g
 *         unsigned char *b
 *         short int bitsize = surface_.get_bitsize()             # <<<<<<<<<<<<<<
 *         short int bytesize = surface_.get_bytesize()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bitsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 6174, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_bitsize = __pyx_t_10;

  /* "PygameShader/shader.pyx":6175
 *         unsigned char *b
 *         short int bitsize = surface_.get_bitsize()
 *         short int bytesize = surface_.get_bytesize()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bytesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 6175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_bytesize = __pyx_t_10;

  /* "PygameShader/shader.pyx":6177
 *         short int bytesize = surface_.get_bytesize()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":6178
 * 
 *     with nogil:
 *         for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *             r = &rgb_array[i]
 */
        __pyx_t_9 = __pyx_v_size;
        __pyx_t_10 = __pyx_v_bytesize;
        if ((__pyx_t_10 == 0)) abort();
        {
            unsigned char * __pyx_parallel_temp0 = ((unsigned char *)1);
            unsigned char * __pyx_parallel_temp1 = ((unsigned char *)1);
            int __pyx_parallel_temp2 = ((int)0xbad0bad0);
            unsigned int __pyx_parallel_temp3 = ((unsigned int)0xbad0bad0);
            unsigned char * __pyx_parallel_temp4 = ((unsigned char *)1);
            unsigned int __pyx_parallel_temp5 = ((unsigned int)0xbad0bad0);
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
            if (__pyx_t_12 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_13, __pyx_t_14) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_i = (int)(0 + __pyx_t_10 * __pyx_t_11);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_index = ((unsigned int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_s = ((unsigned int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":6180
 *         for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):
 * 
 *             r = &rgb_array[i]             # <<<<<<<<<<<<<<
 *             g = &rgb_array[i + 1]
 *             b = &rgb_array[i + 2]
 */
                            __pyx_t_13 = __pyx_v_i;
                            __pyx_v_r = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

                            /* "PygameShader/shader.pyx":6181
 * 
 *             r = &rgb_array[i]
 *             g = &rgb_array[i + 1]             # <<<<<<<<<<<<<<
 *             b = &rgb_array[i + 2]
 * 
 */
                            __pyx_t_13 = (__pyx_v_i + 1);
                            __pyx_v_g = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

                            /* "PygameShader/shader.pyx":6182
 *             r = &rgb_array[i]
 *             g = &rgb_array[i + 1]
 *             b = &rgb_array[i + 2]             # <<<<<<<<<<<<<<
 * 
 *             s = r[0] + g[0] + b[0]
 */
                            __pyx_t_13 = (__pyx_v_i + 2);
                            __pyx_v_b = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

                            /* "PygameShader/shader.pyx":6184
 *             b = &rgb_array[i + 2]
 * 
 *             s = r[0] + g[0] + b[0]             # <<<<<<<<<<<<<<
 *             index = <int>(s * f_redmap)
 * 
 */
                            __pyx_v_s = (((__pyx_v_r[0]) + (__pyx_v_g[0])) + (__pyx_v_b[0]));

                            /* "PygameShader/shader.pyx":6185
 * 
 *             s = r[0] + g[0] + b[0]
 *             index = <int>(s * f_redmap)             # <<<<<<<<<<<<<<
 * 
 *             r[0] = <unsigned char>redmap_array[index, 2]
 */
                            __pyx_v_index = ((int)(__pyx_v_s * __pyx_v_12PygameShader_6shader_f_redmap));

                            /* "PygameShader/shader.pyx":6187
 *             index = <int>(s * f_redmap)
 * 
 *             r[0] = <unsigned char>redmap_array[index, 2]             # <<<<<<<<<<<<<<
 *             g[0] = <unsigned char>redmap_array[index, 1]
 *             b[0] = <unsigned char>redmap_array[index, 0]
 */
                            if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("redmap_array"); __PYX_ERR(1, 6187, __pyx_L10_error) }
                            __pyx_t_14 = __pyx_v_index;
                            __pyx_t_13 = 2;
                            (__pyx_v_r[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_13)) ))));

                            /* "PygameShader/shader.pyx":6188
 * 
 *             r[0] = <unsigned char>redmap_array[index, 2]
 *             g[0] = <unsigned char>redmap_array[index, 1]             # <<<<<<<<<<<<<<
 *             b[0] = <unsigned char>redmap_array[index, 0]
 * 
 */
                            if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("redmap_array"); __PYX_ERR(1, 6188, __pyx_L10_error) }
                            __pyx_t_14 = __pyx_v_index;
                            __pyx_t_13 = 1;
                            (__pyx_v_g[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_13)) ))));

                            /* "PygameShader/shader.pyx":6189
 *             r[0] = <unsigned char>redmap_array[index, 2]
 *             g[0] = <unsigned char>redmap_array[index, 1]
 *             b[0] = <unsigned char>redmap_array[index, 0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                            if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("redmap_array"); __PYX_ERR(1, 6189, __pyx_L10_error) }
                            __pyx_t_14 = __pyx_v_index;
                            __pyx_t_13 = 0;
                            (__pyx_v_b[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_13)) ))));
                            goto __pyx_L13;
                            __pyx_L10_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L12;
                            __pyx_L12:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates6)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_b;
                                __pyx_parallel_temp1 = __pyx_v_g;
                                __pyx_parallel_temp2 = __pyx_v_i;
                                __pyx_parallel_temp3 = __pyx_v_index;
                                __pyx_parallel_temp4 = __pyx_v_r;
                                __pyx_parallel_temp5 = __pyx_v_s;
                            }
                            __pyx_L13:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_b = __pyx_parallel_temp0;
              __pyx_v_g = __pyx_parallel_temp1;
              __pyx_v_i = __pyx_parallel_temp2;
              __pyx_v_index = __pyx_parallel_temp3;
              __pyx_v_r = __pyx_parallel_temp4;
              __pyx_v_s = __pyx_parallel_temp5;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L6_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":6177
 *         short int bytesize = surface_.get_bytesize()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L6_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L7:;
      }
  }

  /* "PygameShader/shader.pyx":6147
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline void redscale(object surface_):             # <<<<<<<<<<<<<<
 *     """
 *     MAP AN IMAGE INTO A RED EQUIVALENT FORMAT
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.redscale", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array, 1);
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_155redscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
static char __pyx_doc_12PygameShader_6shader_154redscale[] = "\n    MAP AN IMAGE INTO A RED EQUIVALENT FORMAT\n    THIS ALGORITHM IS USING THE WAVELENGTH FROM 620 TO 750 NM TO\n    REPRESENT THE IMAGE IN RED SHADES\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param surface_ : pygame.Surface to transform\n    :return         : void\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_155redscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("redscale (wrapper)", 0);
  __pyx_r = __pyx_pf_12PygameShader_6shader_154redscale(__pyx_self, ((PyObject *)__pyx_v_surface_));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_154redscale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("redscale", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_redscale(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.redscale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6198
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_blood_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float [:, :] mask_, float perc_):
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_blood_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, __Pyx_memviewslice __pyx_v_mask_, float __pyx_v_perc_) {
  int __pyx_v_w;
  CYTHON_UNUSED int __pyx_v_h;
  CYTHON_UNUSED int __pyx_v_bytesize;
  int __pyx_v_i;
  int __pyx_v_j;
  unsigned int __pyx_v_index;
  unsigned char *__pyx_v_r;
  float __pyx_v_theta;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  long __pyx_t_11;
  long __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  unsigned char __pyx_t_17;
  size_t __pyx_t_18;
  float __pyx_t_19;
  float __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_blood_inplace_c", 0);

  /* "PygameShader/shader.pyx":6217
 *     :return: void
 *     """
 *     assert 0.0 <= perc_ <= 1.0, "perc_ variable must be in range[0.0 ... 1.0] got %s " % perc_             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (0.0 <= __pyx_v_perc_);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_perc_ <= 1.0);
    }
    if (unlikely(!(__pyx_t_1 != 0))) {
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_perc_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6217, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_perc__variable_must_be_in_range, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6217, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 6217, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":6221
 *     cdef:
 *         int w, h, bytesize
 *     w, h, bytesize = (<object> rgb_array_).shape             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 6221, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(1, 6221, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 6221, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6221, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6221, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6221, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_w = __pyx_t_8;
  __pyx_v_h = __pyx_t_9;
  __pyx_v_bytesize = __pyx_t_10;

  /* "PygameShader/shader.pyx":6226
 *         unsigned int s
 *         int i, j
 *         unsigned int index = 0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_index = 0;

  /* "PygameShader/shader.pyx":6233
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):
 *             for i in range(0, w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":6234
 * 
 *     with nogil:
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(0, w):
 * 
 */
        __pyx_t_10 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            int __pyx_parallel_temp0 = ((int)0xbad0bad0);
            unsigned int __pyx_parallel_temp1 = ((unsigned int)0xbad0bad0);
            int __pyx_parallel_temp2 = ((int)0xbad0bad0);
            unsigned char * __pyx_parallel_temp3 = ((unsigned char *)1);
            float __pyx_parallel_temp4 = ((float)__PYX_NAN());
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_12 = (__pyx_t_10 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_12 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_theta) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_11);
                            /* Initialize private variables to invalid values */
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_index = ((unsigned int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_theta = ((float)__PYX_NAN());

                            /* "PygameShader/shader.pyx":6235
 *     with nogil:
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):
 *             for i in range(0, w):             # <<<<<<<<<<<<<<
 * 
 *                 r = &rgb_array_[i, j, 0]
 */
                            __pyx_t_9 = __pyx_v_w;
                            __pyx_t_8 = __pyx_t_9;
                            for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_8; __pyx_t_13+=1) {
                              __pyx_v_i = __pyx_t_13;

                              /* "PygameShader/shader.pyx":6237
 *             for i in range(0, w):
 * 
 *                 r = &rgb_array_[i, j, 0]             # <<<<<<<<<<<<<<
 *                 # g = &rgb_array_[i, j, 1]
 *                 # b = &rgb_array_[i, j, 2]
 */
                              __pyx_t_14 = __pyx_v_i;
                              __pyx_t_15 = __pyx_v_j;
                              __pyx_t_16 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":6244
 *                 # index = <int>(s * f_redmap)
 * 
 *                 index = <int>(r[0] * f_redmap)             # <<<<<<<<<<<<<<
 *                 theta = <float>(mask_[i, j] * perc_)
 * 
 */
                              __pyx_v_index = ((int)((__pyx_v_r[0]) * __pyx_v_12PygameShader_6shader_f_redmap));

                              /* "PygameShader/shader.pyx":6245
 * 
 *                 index = <int>(r[0] * f_redmap)
 *                 theta = <float>(mask_[i, j] * perc_)             # <<<<<<<<<<<<<<
 * 
 *                 # BEST METHOD (SLOW)
 */
                              __pyx_t_16 = __pyx_v_i;
                              __pyx_t_15 = __pyx_v_j;
                              __pyx_v_theta = ((float)((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask_.data + __pyx_t_16 * __pyx_v_mask_.strides[0]) ) + __pyx_t_15 * __pyx_v_mask_.strides[1]) ))) * __pyx_v_perc_));

                              /* "PygameShader/shader.pyx":6257
 *                 # ALTERNATIVE WITH BEST PERFORMANCES
 *                 r[0] = <unsigned char> (
 *                     min(r[0] + <float> redmap_array[index, 0] * theta, <unsigned char>255))             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_17 = ((unsigned char)0xFF);
                              if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("redmap_array"); __PYX_ERR(1, 6257, __pyx_L10_error) }
                              __pyx_t_18 = __pyx_v_index;
                              __pyx_t_15 = 0;
                              __pyx_t_19 = ((__pyx_v_r[0]) + (((float)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_18 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_15)) )))) * __pyx_v_theta));
                              if (((__pyx_t_17 < __pyx_t_19) != 0)) {
                                __pyx_t_20 = __pyx_t_17;
                              } else {
                                __pyx_t_20 = __pyx_t_19;
                              }

                              /* "PygameShader/shader.pyx":6256
 * 
 *                 # ALTERNATIVE WITH BEST PERFORMANCES
 *                 r[0] = <unsigned char> (             # <<<<<<<<<<<<<<
 *                     min(r[0] + <float> redmap_array[index, 0] * theta, <unsigned char>255))
 * 
 */
                              (__pyx_v_r[0]) = ((unsigned char)__pyx_t_20);
                            }
                            goto __pyx_L15;
                            __pyx_L10_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L14;
                            __pyx_L14:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates7)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_i;
                                __pyx_parallel_temp1 = __pyx_v_index;
                                __pyx_parallel_temp2 = __pyx_v_j;
                                __pyx_parallel_temp3 = __pyx_v_r;
                                __pyx_parallel_temp4 = __pyx_v_theta;
                            }
                            __pyx_L15:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_i = __pyx_parallel_temp0;
              __pyx_v_index = __pyx_parallel_temp1;
              __pyx_v_j = __pyx_parallel_temp2;
              __pyx_v_r = __pyx_parallel_temp3;
              __pyx_v_theta = __pyx_parallel_temp4;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L6_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":6233
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(0, h, schedule='static', num_threads=THREADS):
 *             for i in range(0, w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L6_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L7:;
      }
  }

  /* "PygameShader/shader.pyx":6198
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_blood_inplace_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_, float [:, :] mask_, float perc_):
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_blood_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":6365
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline unsigned int rgb_to_int(int red, int green, int blue)nogil:             # <<<<<<<<<<<<<<
 *     """
 *     CONVERT RGB MODEL INTO A PYTHON INTEGER EQUIVALENT TO THE FUNCTION PYGAME MAP_RGB()
 */

static PyObject *__pyx_pw_12PygameShader_6shader_157rgb_to_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE unsigned int __pyx_f_12PygameShader_6shader_rgb_to_int(int __pyx_v_red, int __pyx_v_green, int __pyx_v_blue, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned int __pyx_r;

  /* "PygameShader/shader.pyx":6377
 *     :return      : returns a positive python integer representing the RGB values(int32)
 *     """
 *     return 65536 * red + 65536*10 + 256 * green + 256 + blue + 1             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_r = ((((((0x10000 * __pyx_v_red) + 0xA0000) + (0x100 * __pyx_v_green)) + 0x100) + __pyx_v_blue) + 1);
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":6365
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline unsigned int rgb_to_int(int red, int green, int blue)nogil:             # <<<<<<<<<<<<<<
 *     """
 *     CONVERT RGB MODEL INTO A PYTHON INTEGER EQUIVALENT TO THE FUNCTION PYGAME MAP_RGB()
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_157rgb_to_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_156rgb_to_int[] = "\n    CONVERT RGB MODEL INTO A PYTHON INTEGER EQUIVALENT TO THE FUNCTION PYGAME MAP_RGB()\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param red   : Red color value,  must be in range [0..255]\n    :param green : Green color value, must be in range [0..255]\n    :param blue  : Blue color, must be in range [0.255]\n    :return      : returns a positive python integer representing the RGB values(int32)\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_157rgb_to_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_red;
  int __pyx_v_green;
  int __pyx_v_blue;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rgb_to_int (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_red,&__pyx_n_s_green,&__pyx_n_s_blue,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_red)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_green)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rgb_to_int", 1, 3, 3, 1); __PYX_ERR(1, 6365, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blue)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rgb_to_int", 1, 3, 3, 2); __PYX_ERR(1, 6365, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rgb_to_int") < 0)) __PYX_ERR(1, 6365, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_red = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_red == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6365, __pyx_L3_error)
    __pyx_v_green = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_green == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6365, __pyx_L3_error)
    __pyx_v_blue = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_blue == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6365, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rgb_to_int", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 6365, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.rgb_to_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_156rgb_to_int(__pyx_self, __pyx_v_red, __pyx_v_green, __pyx_v_blue);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_156rgb_to_int(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_red, int __pyx_v_green, int __pyx_v_blue) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rgb_to_int", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_12PygameShader_6shader_rgb_to_int(__pyx_v_red, __pyx_v_green, __pyx_v_blue, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.rgb_to_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6383
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline rgb int_to_rgb(unsigned int n)nogil:             # <<<<<<<<<<<<<<
 *     """
 *     CONVERT A PYTHON INTEGER INTO A RGB COLOUR MODEL (UNSIGNED CHAR VALUES [0..255]).
 */

static PyObject *__pyx_pw_12PygameShader_6shader_159int_to_rgb(PyObject *__pyx_self, PyObject *__pyx_arg_n); /*proto*/
static CYTHON_INLINE struct rgb __pyx_f_12PygameShader_6shader_int_to_rgb(unsigned int __pyx_v_n, CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct rgb __pyx_v_rgb_;
  struct rgb __pyx_r;

  /* "PygameShader/shader.pyx":6397
 *         rgb rgb_
 * 
 *     rgb_.r = <float>((n >> 16) & 255)             # <<<<<<<<<<<<<<
 *     rgb_.g = <float>((n >> 8) & 255)
 *     rgb_.b = <float>(n & 255)
 */
  __pyx_v_rgb_.r = ((float)((__pyx_v_n >> 16) & 0xFF));

  /* "PygameShader/shader.pyx":6398
 * 
 *     rgb_.r = <float>((n >> 16) & 255)
 *     rgb_.g = <float>((n >> 8) & 255)             # <<<<<<<<<<<<<<
 *     rgb_.b = <float>(n & 255)
 *     return rgb_
 */
  __pyx_v_rgb_.g = ((float)((__pyx_v_n >> 8) & 0xFF));

  /* "PygameShader/shader.pyx":6399
 *     rgb_.r = <float>((n >> 16) & 255)
 *     rgb_.g = <float>((n >> 8) & 255)
 *     rgb_.b = <float>(n & 255)             # <<<<<<<<<<<<<<
 *     return rgb_
 * 
 */
  __pyx_v_rgb_.b = ((float)(__pyx_v_n & 0xFF));

  /* "PygameShader/shader.pyx":6400
 *     rgb_.g = <float>((n >> 8) & 255)
 *     rgb_.b = <float>(n & 255)
 *     return rgb_             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_rgb_;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":6383
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef inline rgb int_to_rgb(unsigned int n)nogil:             # <<<<<<<<<<<<<<
 *     """
 *     CONVERT A PYTHON INTEGER INTO A RGB COLOUR MODEL (UNSIGNED CHAR VALUES [0..255]).
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_159int_to_rgb(PyObject *__pyx_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_12PygameShader_6shader_158int_to_rgb[] = "\n    CONVERT A PYTHON INTEGER INTO A RGB COLOUR MODEL (UNSIGNED CHAR VALUES [0..255]).\n    EQUIVALENT TO PYGAME UNMAP_RGB()\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param n : positive integer value to convert\n    :return  : return a C structure rgb containing RGB values\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_159int_to_rgb(PyObject *__pyx_self, PyObject *__pyx_arg_n) {
  unsigned int __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("int_to_rgb (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_unsigned_int(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6383, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.int_to_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_158int_to_rgb(__pyx_self, ((unsigned int)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_158int_to_rgb(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("int_to_rgb", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert__to_py_struct__rgb(__pyx_f_12PygameShader_6shader_int_to_rgb(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.int_to_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6407
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline make_palette_c(int width, float fh, float fs, float fl):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A PALETTE (ARRAY) FROM HSL VALUES (HUE, SATURATION, LIGHTNESS)
 */

static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_make_palette_c(int __pyx_v_width, float __pyx_v_fh, float __pyx_v_fs, float __pyx_v_fl) {
  __Pyx_memviewslice __pyx_v_palette = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_x;
  float __pyx_v_h;
  float __pyx_v_s;
  float __pyx_v_l;
  struct rgb __pyx_v_rgb_;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_9;
  int __pyx_t_10;
  float __pyx_t_11;
  float __pyx_t_12;
  float __pyx_t_13;
  float __pyx_t_14;
  float __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_palette_c", 0);

  /* "PygameShader/shader.pyx":6423
 *     :return       : Return a tuple ndarray type uint32 and pygame.Surface (width, height)
 *     """
 *     assert width > 0, "Argument width should be > 0, got %s " % width             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_width > 0) != 0))) {
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Argument_width_should_be_0_got_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(1, 6423, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":6426
 * 
 *     cdef:
 *         unsigned int [::1] palette = numpy.empty(width, uint32)             # <<<<<<<<<<<<<<
 *         int x, y
 *         float h, s, l
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_uint32); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6426, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6426, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 6426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_1 = 0;
    __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 6426, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_palette = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":6431
 *         rgb rgb_
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(width, schedule='static', num_threads=THREADS):
 *             h, s, l = <float>x * fh,  min(fs, <float>255.0), min(<float>x * fl, <float>255.0)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":6432
 * 
 *     with nogil:
 *         for x in prange(width, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             h, s, l = <float>x * fh,  min(fs, <float>255.0), min(<float>x * fl, <float>255.0)
 *             rgb_ = struct_hsl_to_rgb(h * <float>ONE_360, s * <float>ONE_255, l * <float>ONE_255)
 */
        __pyx_t_6 = __pyx_v_width;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_10 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_10 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_h) lastprivate(__pyx_v_l) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_9);
                            /* Initialize private variables to invalid values */
                            __pyx_v_h = ((float)__PYX_NAN());
                            __pyx_v_l = ((float)__PYX_NAN());
                            __pyx_v_s = ((float)__PYX_NAN());

                            /* "PygameShader/shader.pyx":6433
 *     with nogil:
 *         for x in prange(width, schedule='static', num_threads=THREADS):
 *             h, s, l = <float>x * fh,  min(fs, <float>255.0), min(<float>x * fl, <float>255.0)             # <<<<<<<<<<<<<<
 *             rgb_ = struct_hsl_to_rgb(h * <float>ONE_360, s * <float>ONE_255, l * <float>ONE_255)
 *             # build the palette (1d buffer int values)
 */
                            __pyx_t_11 = (((float)__pyx_v_x) * __pyx_v_fh);
                            __pyx_t_12 = ((float)255.0);
                            __pyx_t_13 = __pyx_v_fs;
                            if (((__pyx_t_12 < __pyx_t_13) != 0)) {
                              __pyx_t_14 = __pyx_t_12;
                            } else {
                              __pyx_t_14 = __pyx_t_13;
                            }
                            __pyx_t_12 = __pyx_t_14;
                            __pyx_t_14 = ((float)255.0);
                            __pyx_t_13 = (((float)__pyx_v_x) * __pyx_v_fl);
                            if (((__pyx_t_14 < __pyx_t_13) != 0)) {
                              __pyx_t_15 = __pyx_t_14;
                            } else {
                              __pyx_t_15 = __pyx_t_13;
                            }
                            __pyx_t_14 = __pyx_t_15;
                            __pyx_v_h = __pyx_t_11;
                            __pyx_v_s = __pyx_t_12;
                            __pyx_v_l = __pyx_t_14;

                            /* "PygameShader/shader.pyx":6434
 *         for x in prange(width, schedule='static', num_threads=THREADS):
 *             h, s, l = <float>x * fh,  min(fs, <float>255.0), min(<float>x * fl, <float>255.0)
 *             rgb_ = struct_hsl_to_rgb(h * <float>ONE_360, s * <float>ONE_255, l * <float>ONE_255)             # <<<<<<<<<<<<<<
 *             # build the palette (1d buffer int values)
 *             palette[x] = rgb_to_int(<int>(rgb_.r * <float>255.0),
 */
                            __pyx_v_rgb_ = struct_hsl_to_rgb((__pyx_v_h * ((float)0.002777777777777778)), (__pyx_v_s * ((float)0.00392156862745098)), (__pyx_v_l * ((float)0.00392156862745098)));

                            /* "PygameShader/shader.pyx":6436
 *             rgb_ = struct_hsl_to_rgb(h * <float>ONE_360, s * <float>ONE_255, l * <float>ONE_255)
 *             # build the palette (1d buffer int values)
 *             palette[x] = rgb_to_int(<int>(rgb_.r * <float>255.0),             # <<<<<<<<<<<<<<
 *                                     <int>(rgb_.g * <float>255.0),
 *                                     <int>(rgb_.b * <float>255.0 * <float>0.5))
 */
                            __pyx_t_16 = __pyx_v_x;
                            *((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_palette.data) + __pyx_t_16)) )) = __pyx_f_12PygameShader_6shader_rgb_to_int(((int)(__pyx_v_rgb_.r * ((float)255.0))), ((int)(__pyx_v_rgb_.g * ((float)255.0))), ((int)((__pyx_v_rgb_.b * ((float)255.0)) * ((float)0.5))), 0);
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":6431
 *         rgb rgb_
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(width, schedule='static', num_threads=THREADS):
 *             h, s, l = <float>x * fh,  min(fs, <float>255.0), min(<float>x * fl, <float>255.0)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":6440
 *                                     <int>(rgb_.b * <float>255.0 * <float>0.5))
 * 
 *     return asarray(palette)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_palette, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 6440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":6407
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline make_palette_c(int width, float fh, float fs, float fl):             # <<<<<<<<<<<<<<
 *     """
 *     CREATE A PALETTE (ARRAY) FROM HSL VALUES (HUE, SATURATION, LIGHTNESS)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_AddTraceback("PygameShader.shader.make_palette_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_palette, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6446
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef fire_surface24_c(             # <<<<<<<<<<<<<<
 *         int width,
 *         int height,
 */

static PyObject *__pyx_f_12PygameShader_6shader_fire_surface24_c(int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_fire, struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c *__pyx_optional_args) {
  int __pyx_v_intensity = ((int)0);
  int __pyx_v_low = ((int)0);
  int __pyx_v_high = ((int)0);
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_x;
  int __pyx_v_y;
  float __pyx_v_d;
  unsigned int __pyx_v_ii;
  unsigned int __pyx_v_c1;
  unsigned int __pyx_v_c2;
  CYTHON_UNUSED int __pyx_v_min_;
  CYTHON_UNUSED int __pyx_v_max_;
  int __pyx_v_middle;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  long __pyx_t_14;
  long __pyx_t_15;
  long __pyx_t_16;
  long __pyx_t_17;
  size_t __pyx_t_18;
  size_t __pyx_t_19;
  size_t __pyx_t_20;
  long __pyx_t_21;
  size_t __pyx_t_22;
  long __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  size_t __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fire_surface24_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_intensity = __pyx_optional_args->intensity;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_low = __pyx_optional_args->low;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_high = __pyx_optional_args->high;
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":6476
 *     cdef:
 *         # flame opacity palette
 *         unsigned char [:, :, ::1] out = zeros((width, height, 3), dtype=uint8)             # <<<<<<<<<<<<<<
 *         int x = 0, y = 0
 *         float d
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 6476, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 6476, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_out = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":6477
 *         # flame opacity palette
 *         unsigned char [:, :, ::1] out = zeros((width, height, 3), dtype=uint8)
 *         int x = 0, y = 0             # <<<<<<<<<<<<<<
 *         float d
 *         unsigned int ii=0
 */
  __pyx_v_x = 0;
  __pyx_v_y = 0;

  /* "PygameShader/shader.pyx":6479
 *         int x = 0, y = 0
 *         float d
 *         unsigned int ii=0             # <<<<<<<<<<<<<<
 *         unsigned c1 = 0, c2 = 0
 * 
 */
  __pyx_v_ii = 0;

  /* "PygameShader/shader.pyx":6480
 *         float d
 *         unsigned int ii=0
 *         unsigned c1 = 0, c2 = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int min_, max_, middle
 */
  __pyx_v_c1 = 0;
  __pyx_v_c2 = 0;

  /* "PygameShader/shader.pyx":6485
 * 
 * 
 *     if low != 0 or high != 0:             # <<<<<<<<<<<<<<
 *         assert 0 <= low < high, "Argument low_ must be < high_"
 *         assert high <= width, "Argument high must be <= width"
 */
  __pyx_t_7 = ((__pyx_v_low != 0) != 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = ((__pyx_v_high != 0) != 0);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_6) {

    /* "PygameShader/shader.pyx":6486
 * 
 *     if low != 0 or high != 0:
 *         assert 0 <= low < high, "Argument low_ must be < high_"             # <<<<<<<<<<<<<<
 *         assert high <= width, "Argument high must be <= width"
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_6 = (0 <= __pyx_v_low);
      if (__pyx_t_6) {
        __pyx_t_6 = (__pyx_v_low < __pyx_v_high);
      }
      if (unlikely(!(__pyx_t_6 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_low__must_be_high);
        __PYX_ERR(1, 6486, __pyx_L1_error)
      }
    }
    #endif

    /* "PygameShader/shader.pyx":6487
 *     if low != 0 or high != 0:
 *         assert 0 <= low < high, "Argument low_ must be < high_"
 *         assert high <= width, "Argument high must be <= width"             # <<<<<<<<<<<<<<
 * 
 *         middle = low + ((high - low) >> 1)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_high <= __pyx_v_width) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_high_must_be_width);
        __PYX_ERR(1, 6487, __pyx_L1_error)
      }
    }
    #endif

    /* "PygameShader/shader.pyx":6489
 *         assert high <= width, "Argument high must be <= width"
 * 
 *         middle = low + ((high - low) >> 1)             # <<<<<<<<<<<<<<
 *         min_ = randRange(low, middle)
 *         max_ = randRange(middle + 1, high)
 */
    __pyx_v_middle = (__pyx_v_low + ((__pyx_v_high - __pyx_v_low) >> 1));

    /* "PygameShader/shader.pyx":6490
 * 
 *         middle = low + ((high - low) >> 1)
 *         min_ = randRange(low, middle)             # <<<<<<<<<<<<<<
 *         max_ = randRange(middle + 1, high)
 *     else:
 */
    __pyx_v_min_ = randRange(__pyx_v_low, __pyx_v_middle);

    /* "PygameShader/shader.pyx":6491
 *         middle = low + ((high - low) >> 1)
 *         min_ = randRange(low, middle)
 *         max_ = randRange(middle + 1, high)             # <<<<<<<<<<<<<<
 *     else:
 *         middle = width >> 1
 */
    __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_high);

    /* "PygameShader/shader.pyx":6485
 * 
 * 
 *     if low != 0 or high != 0:             # <<<<<<<<<<<<<<
 *         assert 0 <= low < high, "Argument low_ must be < high_"
 *         assert high <= width, "Argument high must be <= width"
 */
    goto __pyx_L3;
  }

  /* "PygameShader/shader.pyx":6493
 *         max_ = randRange(middle + 1, high)
 *     else:
 *         middle = width >> 1             # <<<<<<<<<<<<<<
 *         min_ = randRange(0, middle)
 *         max_ = randRange(middle +1, width)
 */
  /*else*/ {
    __pyx_v_middle = (__pyx_v_width >> 1);

    /* "PygameShader/shader.pyx":6494
 *     else:
 *         middle = width >> 1
 *         min_ = randRange(0, middle)             # <<<<<<<<<<<<<<
 *         max_ = randRange(middle +1, width)
 * 
 */
    __pyx_v_min_ = randRange(0, __pyx_v_middle);

    /* "PygameShader/shader.pyx":6495
 *         middle = width >> 1
 *         min_ = randRange(0, middle)
 *         max_ = randRange(middle +1, width)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_width);
  }
  __pyx_L3:;

  /* "PygameShader/shader.pyx":6498
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)
 *         for x in prange(min_, max_, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":6500
 *     with nogil:
 *         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)
 *         for x in prange(min_, max_, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *                 fire[height-1, x] = randRange(intensity, 260)
 * 
 */
        __pyx_t_8 = __pyx_v_min_;
        __pyx_t_9 = __pyx_v_max_;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_11 = (__pyx_t_9 - __pyx_t_8 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_11 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_12, __pyx_t_13)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){
                        {
                            __pyx_v_x = (int)(__pyx_t_8 + 1 * __pyx_t_10);

                            /* "PygameShader/shader.pyx":6501
 *         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)
 *         for x in prange(min_, max_, schedule='static', num_threads=THREADS):
 *                 fire[height-1, x] = randRange(intensity, 260)             # <<<<<<<<<<<<<<
 * 
 * 
 */
                            __pyx_t_12 = (__pyx_v_height - 1);
                            __pyx_t_13 = __pyx_v_x;
                            *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_12 * __pyx_v_fire.strides[0]) )) + __pyx_t_13)) )) = randRange(__pyx_v_intensity, 0x104);
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif

        /* "PygameShader/shader.pyx":6505
 * 
 *         # DILUTE THE FLAME EFFECT (DECREASE THE MAXIMUM INT VALUE) WHEN THE FLAME TRAVEL UPWARD
 *         for y in prange(1, height-1, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *             for x in range(0, width):
 */
        __pyx_t_14 = (__pyx_v_height - 1);
        if ((1 == 0)) abort();
        {
            unsigned int __pyx_parallel_temp0 = ((unsigned int)0xbad0bad0);
            unsigned int __pyx_parallel_temp1 = ((unsigned int)0xbad0bad0);
            float __pyx_parallel_temp2 = ((float)__PYX_NAN());
            unsigned int __pyx_parallel_temp3 = ((unsigned int)0xbad0bad0);
            int __pyx_parallel_temp4 = ((int)0xbad0bad0);
            int __pyx_parallel_temp5 = ((int)0xbad0bad0);
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_16 = (__pyx_t_14 - 1 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_16 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_6, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_d) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_y = (int)(1 + 1 * __pyx_t_15);
                            /* Initialize private variables to invalid values */
                            __pyx_v_c1 = ((unsigned int)0xbad0bad0);
                            __pyx_v_c2 = ((unsigned int)0xbad0bad0);
                            __pyx_v_d = ((float)__PYX_NAN());
                            __pyx_v_ii = ((unsigned int)0xbad0bad0);
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":6507
 *         for y in prange(1, height-1, schedule='static', num_threads=THREADS):
 * 
 *             for x in range(0, width):             # <<<<<<<<<<<<<<
 * 
 *                     c1 = (y + 1) % height
 */
                            __pyx_t_11 = __pyx_v_width;
                            __pyx_t_10 = __pyx_t_11;
                            for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9+=1) {
                              __pyx_v_x = __pyx_t_9;

                              /* "PygameShader/shader.pyx":6509
 *             for x in range(0, width):
 * 
 *                     c1 = (y + 1) % height             # <<<<<<<<<<<<<<
 *                     c2 = x % width
 *                     d = (fire[c1, (x - 1 + width) % width]
 */
                              __pyx_t_17 = (__pyx_v_y + 1);
                              if (unlikely(__pyx_v_height == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6509, __pyx_L17_error)
                              }
                              __pyx_v_c1 = __Pyx_mod_long(__pyx_t_17, __pyx_v_height);

                              /* "PygameShader/shader.pyx":6510
 * 
 *                     c1 = (y + 1) % height
 *                     c2 = x % width             # <<<<<<<<<<<<<<
 *                     d = (fire[c1, (x - 1 + width) % width]
 *                        + fire[c1, c2]
 */
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6510, __pyx_L17_error)
                              }
                              __pyx_v_c2 = __Pyx_mod_int(__pyx_v_x, __pyx_v_width);

                              /* "PygameShader/shader.pyx":6511
 *                     c1 = (y + 1) % height
 *                     c2 = x % width
 *                     d = (fire[c1, (x - 1 + width) % width]             # <<<<<<<<<<<<<<
 *                        + fire[c1, c2]
 *                        + fire[c1, (x + 1) % width]
 */
                              __pyx_t_17 = ((__pyx_v_x - 1) + __pyx_v_width);
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6511, __pyx_L17_error)
                              }
                              __pyx_t_18 = __pyx_v_c1;
                              __pyx_t_13 = __Pyx_mod_long(__pyx_t_17, __pyx_v_width);

                              /* "PygameShader/shader.pyx":6512
 *                     c2 = x % width
 *                     d = (fire[c1, (x - 1 + width) % width]
 *                        + fire[c1, c2]             # <<<<<<<<<<<<<<
 *                        + fire[c1, (x + 1) % width]
 *                        + fire[(y + 2) % height, c2]) * factor
 */
                              __pyx_t_19 = __pyx_v_c1;
                              __pyx_t_20 = __pyx_v_c2;

                              /* "PygameShader/shader.pyx":6513
 *                     d = (fire[c1, (x - 1 + width) % width]
 *                        + fire[c1, c2]
 *                        + fire[c1, (x + 1) % width]             # <<<<<<<<<<<<<<
 *                        + fire[(y + 2) % height, c2]) * factor
 * 
 */
                              __pyx_t_21 = (__pyx_v_x + 1);
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6513, __pyx_L17_error)
                              }
                              __pyx_t_22 = __pyx_v_c1;
                              __pyx_t_12 = __Pyx_mod_long(__pyx_t_21, __pyx_v_width);

                              /* "PygameShader/shader.pyx":6514
 *                        + fire[c1, c2]
 *                        + fire[c1, (x + 1) % width]
 *                        + fire[(y + 2) % height, c2]) * factor             # <<<<<<<<<<<<<<
 * 
 *                     d = d - <float>(rand() * 0.0001)
 */
                              __pyx_t_23 = (__pyx_v_y + 2);
                              if (unlikely(__pyx_v_height == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6514, __pyx_L17_error)
                              }
                              __pyx_t_24 = __Pyx_mod_long(__pyx_t_23, __pyx_v_height);
                              __pyx_t_25 = __pyx_v_c2;
                              __pyx_v_d = (((((*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_18 * __pyx_v_fire.strides[0]) )) + __pyx_t_13)) ))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_19 * __pyx_v_fire.strides[0]) )) + __pyx_t_20)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_22 * __pyx_v_fire.strides[0]) )) + __pyx_t_12)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_24 * __pyx_v_fire.strides[0]) )) + __pyx_t_25)) )))) * __pyx_v_factor);

                              /* "PygameShader/shader.pyx":6516
 *                        + fire[(y + 2) % height, c2]) * factor
 * 
 *                     d = d - <float>(rand() * 0.0001)             # <<<<<<<<<<<<<<
 * 
 *                     # Cap the values
 */
                              __pyx_v_d = (__pyx_v_d - ((float)(rand() * 0.0001)));

                              /* "PygameShader/shader.pyx":6519
 * 
 *                     # Cap the values
 *                     if d <0:             # <<<<<<<<<<<<<<
 *                         d = 0.0
 * 
 */
                              __pyx_t_6 = ((__pyx_v_d < 0.0) != 0);
                              if (__pyx_t_6) {

                                /* "PygameShader/shader.pyx":6520
 *                     # Cap the values
 *                     if d <0:
 *                         d = 0.0             # <<<<<<<<<<<<<<
 * 
 *                     # CAP THE VALUE TO 255
 */
                                __pyx_v_d = 0.0;

                                /* "PygameShader/shader.pyx":6519
 * 
 *                     # Cap the values
 *                     if d <0:             # <<<<<<<<<<<<<<
 *                         d = 0.0
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":6523
 * 
 *                     # CAP THE VALUE TO 255
 *                     if d>255.0:             # <<<<<<<<<<<<<<
 *                         d = <float>255.0
 *                     fire[y, x] = d
 */
                              __pyx_t_6 = ((__pyx_v_d > 255.0) != 0);
                              if (__pyx_t_6) {

                                /* "PygameShader/shader.pyx":6524
 *                     # CAP THE VALUE TO 255
 *                     if d>255.0:
 *                         d = <float>255.0             # <<<<<<<<<<<<<<
 *                     fire[y, x] = d
 * 
 */
                                __pyx_v_d = ((float)255.0);

                                /* "PygameShader/shader.pyx":6523
 * 
 *                     # CAP THE VALUE TO 255
 *                     if d>255.0:             # <<<<<<<<<<<<<<
 *                         d = <float>255.0
 *                     fire[y, x] = d
 */
                              }

                              /* "PygameShader/shader.pyx":6525
 *                     if d>255.0:
 *                         d = <float>255.0
 *                     fire[y, x] = d             # <<<<<<<<<<<<<<
 * 
 *                     ii = palette[<unsigned int>d % width]
 */
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_12 = __pyx_v_x;
                              *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_24 * __pyx_v_fire.strides[0]) )) + __pyx_t_12)) )) = __pyx_v_d;

                              /* "PygameShader/shader.pyx":6527
 *                     fire[y, x] = d
 * 
 *                     ii = palette[<unsigned int>d % width]             # <<<<<<<<<<<<<<
 * 
 *                     out[x, y, 0] = (ii >> 16) & 255
 */
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6527, __pyx_L17_error)
                              }
                              __pyx_t_25 = (((unsigned int)__pyx_v_d) % __pyx_v_width);
                              __pyx_v_ii = (*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_palette.data) + __pyx_t_25)) )));

                              /* "PygameShader/shader.pyx":6529
 *                     ii = palette[<unsigned int>d % width]
 * 
 *                     out[x, y, 0] = (ii >> 16) & 255             # <<<<<<<<<<<<<<
 *                     out[x, y, 1] = (ii >> 8) & 255
 *                     out[x, y, 2] = ii & 255
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_13 = 0;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_12 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_13)) )) = ((__pyx_v_ii >> 16) & 0xFF);

                              /* "PygameShader/shader.pyx":6530
 * 
 *                     out[x, y, 0] = (ii >> 16) & 255
 *                     out[x, y, 1] = (ii >> 8) & 255             # <<<<<<<<<<<<<<
 *                     out[x, y, 2] = ii & 255
 * 
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_12 = 1;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_13 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_12)) )) = ((__pyx_v_ii >> 8) & 0xFF);

                              /* "PygameShader/shader.pyx":6531
 *                     out[x, y, 0] = (ii >> 16) & 255
 *                     out[x, y, 1] = (ii >> 8) & 255
 *                     out[x, y, 2] = ii & 255             # <<<<<<<<<<<<<<
 * 
 *     return asarray(out)
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_13 = 2;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_12 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_13)) )) = (__pyx_v_ii & 0xFF);
                            }
                            goto __pyx_L24;
                            __pyx_L17_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L23;
                            __pyx_L23:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates8)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_c1;
                                __pyx_parallel_temp1 = __pyx_v_c2;
                                __pyx_parallel_temp2 = __pyx_v_d;
                                __pyx_parallel_temp3 = __pyx_v_ii;
                                __pyx_parallel_temp4 = __pyx_v_x;
                                __pyx_parallel_temp5 = __pyx_v_y;
                            }
                            __pyx_L24:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_c1 = __pyx_parallel_temp0;
              __pyx_v_c2 = __pyx_parallel_temp1;
              __pyx_v_d = __pyx_parallel_temp2;
              __pyx_v_ii = __pyx_parallel_temp3;
              __pyx_v_x = __pyx_parallel_temp4;
              __pyx_v_y = __pyx_parallel_temp5;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L7_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":6498
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)
 *         for x in prange(min_, max_, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L8;
        }
        __pyx_L7_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L8:;
      }
  }

  /* "PygameShader/shader.pyx":6533
 *                     out[x, y, 2] = ii & 255
 * 
 *     return asarray(out)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_out, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":6446
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef fire_surface24_c(             # <<<<<<<<<<<<<<
 *         int width,
 *         int height,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_AddTraceback("PygameShader.shader.fire_surface24_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6541
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef fire_surface24_c_border(             # <<<<<<<<<<<<<<
 *         int width,
 *         int height,
 */

static PyObject *__pyx_f_12PygameShader_6shader_fire_surface24_c_border(int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_fire, struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c_border *__pyx_optional_args) {
  int __pyx_v_intensity = ((int)0);
  int __pyx_v_low = ((int)0);
  int __pyx_v_high = ((int)0);
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_x;
  int __pyx_v_y;
  float __pyx_v_d;
  unsigned int __pyx_v_ii;
  unsigned int __pyx_v_c1;
  unsigned int __pyx_v_c2;
  CYTHON_UNUSED int __pyx_v_min_;
  CYTHON_UNUSED int __pyx_v_max_;
  int __pyx_v_middle;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  long __pyx_t_15;
  long __pyx_t_16;
  long __pyx_t_17;
  size_t __pyx_t_18;
  size_t __pyx_t_19;
  size_t __pyx_t_20;
  long __pyx_t_21;
  size_t __pyx_t_22;
  long __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  size_t __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fire_surface24_c_border", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_intensity = __pyx_optional_args->intensity;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_low = __pyx_optional_args->low;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_high = __pyx_optional_args->high;
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":6572
 *     cdef:
 *         # flame opacity palette
 *         unsigned char [:, :, ::1] out = zeros((width, height, 3), dtype=uint8)             # <<<<<<<<<<<<<<
 *         int x = 0, y = 0
 *         float d
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 6572, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 6572, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_out = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":6573
 *         # flame opacity palette
 *         unsigned char [:, :, ::1] out = zeros((width, height, 3), dtype=uint8)
 *         int x = 0, y = 0             # <<<<<<<<<<<<<<
 *         float d
 *         unsigned int ii=0
 */
  __pyx_v_x = 0;
  __pyx_v_y = 0;

  /* "PygameShader/shader.pyx":6575
 *         int x = 0, y = 0
 *         float d
 *         unsigned int ii=0             # <<<<<<<<<<<<<<
 *         unsigned c1 = 0, c2 = 0
 * 
 */
  __pyx_v_ii = 0;

  /* "PygameShader/shader.pyx":6576
 *         float d
 *         unsigned int ii=0
 *         unsigned c1 = 0, c2 = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int min_, max_, middle
 */
  __pyx_v_c1 = 0;
  __pyx_v_c2 = 0;

  /* "PygameShader/shader.pyx":6581
 * 
 * 
 *     if low != 0 or high != 0:             # <<<<<<<<<<<<<<
 *         assert 0 <= low < high, "Argument low_ must be < high_"
 *         assert high <= width, "Argument high must be <= width"
 */
  __pyx_t_7 = ((__pyx_v_low != 0) != 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = ((__pyx_v_high != 0) != 0);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_6) {

    /* "PygameShader/shader.pyx":6582
 * 
 *     if low != 0 or high != 0:
 *         assert 0 <= low < high, "Argument low_ must be < high_"             # <<<<<<<<<<<<<<
 *         assert high <= width, "Argument high must be <= width"
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_6 = (0 <= __pyx_v_low);
      if (__pyx_t_6) {
        __pyx_t_6 = (__pyx_v_low < __pyx_v_high);
      }
      if (unlikely(!(__pyx_t_6 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_low__must_be_high);
        __PYX_ERR(1, 6582, __pyx_L1_error)
      }
    }
    #endif

    /* "PygameShader/shader.pyx":6583
 *     if low != 0 or high != 0:
 *         assert 0 <= low < high, "Argument low_ must be < high_"
 *         assert high <= width, "Argument high must be <= width"             # <<<<<<<<<<<<<<
 * 
 *         middle = low + ((high - low) >> 1)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_high <= __pyx_v_width) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_high_must_be_width);
        __PYX_ERR(1, 6583, __pyx_L1_error)
      }
    }
    #endif

    /* "PygameShader/shader.pyx":6585
 *         assert high <= width, "Argument high must be <= width"
 * 
 *         middle = low + ((high - low) >> 1)             # <<<<<<<<<<<<<<
 *         min_ = randRange(low, middle)
 *         max_ = randRange(middle + 1, high)
 */
    __pyx_v_middle = (__pyx_v_low + ((__pyx_v_high - __pyx_v_low) >> 1));

    /* "PygameShader/shader.pyx":6586
 * 
 *         middle = low + ((high - low) >> 1)
 *         min_ = randRange(low, middle)             # <<<<<<<<<<<<<<
 *         max_ = randRange(middle + 1, high)
 *     else:
 */
    __pyx_v_min_ = randRange(__pyx_v_low, __pyx_v_middle);

    /* "PygameShader/shader.pyx":6587
 *         middle = low + ((high - low) >> 1)
 *         min_ = randRange(low, middle)
 *         max_ = randRange(middle + 1, high)             # <<<<<<<<<<<<<<
 *     else:
 *         middle = width >> 1
 */
    __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_high);

    /* "PygameShader/shader.pyx":6581
 * 
 * 
 *     if low != 0 or high != 0:             # <<<<<<<<<<<<<<
 *         assert 0 <= low < high, "Argument low_ must be < high_"
 *         assert high <= width, "Argument high must be <= width"
 */
    goto __pyx_L3;
  }

  /* "PygameShader/shader.pyx":6589
 *         max_ = randRange(middle + 1, high)
 *     else:
 *         middle = width >> 1             # <<<<<<<<<<<<<<
 *         min_ = randRange(0, middle)
 *         max_ = randRange(middle +1, width)
 */
  /*else*/ {
    __pyx_v_middle = (__pyx_v_width >> 1);

    /* "PygameShader/shader.pyx":6590
 *     else:
 *         middle = width >> 1
 *         min_ = randRange(0, middle)             # <<<<<<<<<<<<<<
 *         max_ = randRange(middle +1, width)
 * 
 */
    __pyx_v_min_ = randRange(0, __pyx_v_middle);

    /* "PygameShader/shader.pyx":6591
 *         middle = width >> 1
 *         min_ = randRange(0, middle)
 *         max_ = randRange(middle +1, width)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_width);
  }
  __pyx_L3:;

  /* "PygameShader/shader.pyx":6594
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)
 *         # for x in prange(min_, max_, schedule='static', num_threads=THREADS
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":6600
 * 
 *         # FIRE ARRAY IS [HEIGHT, WIDTH]
 *         for x in prange(min_, max_, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *                 fire[x % height, (height - 1) % width] = randRange(intensity, 260)
 * 
 */
        __pyx_t_8 = __pyx_v_min_;
        __pyx_t_9 = __pyx_v_max_;
        if ((1 == 0)) abort();
        {
            int __pyx_parallel_temp0 = ((int)0xbad0bad0);
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_11 = (__pyx_t_9 - __pyx_t_8 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_11 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_12, __pyx_t_13, __pyx_t_14) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_x = (int)(__pyx_t_8 + 1 * __pyx_t_10);

                            /* "PygameShader/shader.pyx":6601
 *         # FIRE ARRAY IS [HEIGHT, WIDTH]
 *         for x in prange(min_, max_, schedule='static', num_threads=THREADS):
 *                 fire[x % height, (height - 1) % width] = randRange(intensity, 260)             # <<<<<<<<<<<<<<
 * 
 * 
 */
                            if (unlikely(__pyx_v_height == 0)) {
                              #ifdef WITH_THREAD
                              PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                              #endif
                              PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                              #ifdef WITH_THREAD
                              __Pyx_PyGILState_Release(__pyx_gilstate_save);
                              #endif
                              __PYX_ERR(1, 6601, __pyx_L11_error)
                            }
                            __pyx_t_12 = (__pyx_v_height - 1);
                            if (unlikely(__pyx_v_width == 0)) {
                              #ifdef WITH_THREAD
                              PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                              #endif
                              PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                              #ifdef WITH_THREAD
                              __Pyx_PyGILState_Release(__pyx_gilstate_save);
                              #endif
                              __PYX_ERR(1, 6601, __pyx_L11_error)
                            }
                            __pyx_t_13 = __Pyx_mod_int(__pyx_v_x, __pyx_v_height);
                            __pyx_t_14 = __Pyx_mod_long(__pyx_t_12, __pyx_v_width);
                            *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_13 * __pyx_v_fire.strides[0]) )) + __pyx_t_14)) )) = randRange(__pyx_v_intensity, 0x104);
                            goto __pyx_L14;
                            __pyx_L11_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L13;
                            __pyx_L13:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates9)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_x;
                            }
                            __pyx_L14:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_x = __pyx_parallel_temp0;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L7_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif

        /* "PygameShader/shader.pyx":6605
 * 
 *         # DILUTE THE FLAME EFFECT (DECREASE THE MAXIMUM INT VALUE) WHEN THE FLAME TRAVEL UPWARD
 *         for y in prange(1, height - 1, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *             for x in range(0, width):
 */
        __pyx_t_12 = (__pyx_v_height - 1);
        if ((1 == 0)) abort();
        {
            unsigned int __pyx_parallel_temp0 = ((unsigned int)0xbad0bad0);
            unsigned int __pyx_parallel_temp1 = ((unsigned int)0xbad0bad0);
            float __pyx_parallel_temp2 = ((float)__PYX_NAN());
            unsigned int __pyx_parallel_temp3 = ((unsigned int)0xbad0bad0);
            int __pyx_parallel_temp4 = ((int)0xbad0bad0);
            int __pyx_parallel_temp5 = ((int)0xbad0bad0);
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_16 = (__pyx_t_12 - 1 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_16 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_13, __pyx_t_14, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_6, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_d) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_y = (int)(1 + 1 * __pyx_t_15);
                            /* Initialize private variables to invalid values */
                            __pyx_v_c1 = ((unsigned int)0xbad0bad0);
                            __pyx_v_c2 = ((unsigned int)0xbad0bad0);
                            __pyx_v_d = ((float)__PYX_NAN());
                            __pyx_v_ii = ((unsigned int)0xbad0bad0);
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":6607
 *         for y in prange(1, height - 1, schedule='static', num_threads=THREADS):
 * 
 *             for x in range(0, width):             # <<<<<<<<<<<<<<
 * 
 *                     c1 = (y + 1) % height
 */
                            __pyx_t_11 = __pyx_v_width;
                            __pyx_t_10 = __pyx_t_11;
                            for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9+=1) {
                              __pyx_v_x = __pyx_t_9;

                              /* "PygameShader/shader.pyx":6609
 *             for x in range(0, width):
 * 
 *                     c1 = (y + 1) % height             # <<<<<<<<<<<<<<
 *                     c2 = x % width
 *                     d = (fire[c1, (x - 1 + width) % width]
 */
                              __pyx_t_17 = (__pyx_v_y + 1);
                              if (unlikely(__pyx_v_height == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6609, __pyx_L17_error)
                              }
                              __pyx_v_c1 = __Pyx_mod_long(__pyx_t_17, __pyx_v_height);

                              /* "PygameShader/shader.pyx":6610
 * 
 *                     c1 = (y + 1) % height
 *                     c2 = x % width             # <<<<<<<<<<<<<<
 *                     d = (fire[c1, (x - 1 + width) % width]
 *                        + fire[c1, c2]
 */
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6610, __pyx_L17_error)
                              }
                              __pyx_v_c2 = __Pyx_mod_int(__pyx_v_x, __pyx_v_width);

                              /* "PygameShader/shader.pyx":6611
 *                     c1 = (y + 1) % height
 *                     c2 = x % width
 *                     d = (fire[c1, (x - 1 + width) % width]             # <<<<<<<<<<<<<<
 *                        + fire[c1, c2]
 *                        + fire[c1, (x + 1) % width]
 */
                              __pyx_t_17 = ((__pyx_v_x - 1) + __pyx_v_width);
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6611, __pyx_L17_error)
                              }
                              __pyx_t_18 = __pyx_v_c1;
                              __pyx_t_14 = __Pyx_mod_long(__pyx_t_17, __pyx_v_width);

                              /* "PygameShader/shader.pyx":6612
 *                     c2 = x % width
 *                     d = (fire[c1, (x - 1 + width) % width]
 *                        + fire[c1, c2]             # <<<<<<<<<<<<<<
 *                        + fire[c1, (x + 1) % width]
 *                        + fire[(y + 2) % height, c2]) * factor
 */
                              __pyx_t_19 = __pyx_v_c1;
                              __pyx_t_20 = __pyx_v_c2;

                              /* "PygameShader/shader.pyx":6613
 *                     d = (fire[c1, (x - 1 + width) % width]
 *                        + fire[c1, c2]
 *                        + fire[c1, (x + 1) % width]             # <<<<<<<<<<<<<<
 *                        + fire[(y + 2) % height, c2]) * factor
 * 
 */
                              __pyx_t_21 = (__pyx_v_x + 1);
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6613, __pyx_L17_error)
                              }
                              __pyx_t_22 = __pyx_v_c1;
                              __pyx_t_13 = __Pyx_mod_long(__pyx_t_21, __pyx_v_width);

                              /* "PygameShader/shader.pyx":6614
 *                        + fire[c1, c2]
 *                        + fire[c1, (x + 1) % width]
 *                        + fire[(y + 2) % height, c2]) * factor             # <<<<<<<<<<<<<<
 * 
 *                     d = d - <float>(rand() * 0.0001)
 */
                              __pyx_t_23 = (__pyx_v_y + 2);
                              if (unlikely(__pyx_v_height == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6614, __pyx_L17_error)
                              }
                              __pyx_t_24 = __Pyx_mod_long(__pyx_t_23, __pyx_v_height);
                              __pyx_t_25 = __pyx_v_c2;
                              __pyx_v_d = (((((*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_18 * __pyx_v_fire.strides[0]) )) + __pyx_t_14)) ))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_19 * __pyx_v_fire.strides[0]) )) + __pyx_t_20)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_22 * __pyx_v_fire.strides[0]) )) + __pyx_t_13)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_24 * __pyx_v_fire.strides[0]) )) + __pyx_t_25)) )))) * __pyx_v_factor);

                              /* "PygameShader/shader.pyx":6616
 *                        + fire[(y + 2) % height, c2]) * factor
 * 
 *                     d = d - <float>(rand() * 0.0001)             # <<<<<<<<<<<<<<
 * 
 *                     # Cap the values
 */
                              __pyx_v_d = (__pyx_v_d - ((float)(rand() * 0.0001)));

                              /* "PygameShader/shader.pyx":6619
 * 
 *                     # Cap the values
 *                     if d <0:             # <<<<<<<<<<<<<<
 *                         d = 0.0
 * 
 */
                              __pyx_t_6 = ((__pyx_v_d < 0.0) != 0);
                              if (__pyx_t_6) {

                                /* "PygameShader/shader.pyx":6620
 *                     # Cap the values
 *                     if d <0:
 *                         d = 0.0             # <<<<<<<<<<<<<<
 * 
 *                     if d>255.0:
 */
                                __pyx_v_d = 0.0;

                                /* "PygameShader/shader.pyx":6619
 * 
 *                     # Cap the values
 *                     if d <0:             # <<<<<<<<<<<<<<
 *                         d = 0.0
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":6622
 *                         d = 0.0
 * 
 *                     if d>255.0:             # <<<<<<<<<<<<<<
 *                         d = <float>255.0
 * 
 */
                              __pyx_t_6 = ((__pyx_v_d > 255.0) != 0);
                              if (__pyx_t_6) {

                                /* "PygameShader/shader.pyx":6623
 * 
 *                     if d>255.0:
 *                         d = <float>255.0             # <<<<<<<<<<<<<<
 * 
 *                     fire[x % height , y % width] = d
 */
                                __pyx_v_d = ((float)255.0);

                                /* "PygameShader/shader.pyx":6622
 *                         d = 0.0
 * 
 *                     if d>255.0:             # <<<<<<<<<<<<<<
 *                         d = <float>255.0
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":6625
 *                         d = <float>255.0
 * 
 *                     fire[x % height , y % width] = d             # <<<<<<<<<<<<<<
 * 
 *                     ii = palette[<unsigned int>d % width]
 */
                              if (unlikely(__pyx_v_height == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6625, __pyx_L17_error)
                              }
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6625, __pyx_L17_error)
                              }
                              __pyx_t_24 = __Pyx_mod_int(__pyx_v_x, __pyx_v_height);
                              __pyx_t_13 = __Pyx_mod_int(__pyx_v_y, __pyx_v_width);
                              *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_24 * __pyx_v_fire.strides[0]) )) + __pyx_t_13)) )) = __pyx_v_d;

                              /* "PygameShader/shader.pyx":6627
 *                     fire[x % height , y % width] = d
 * 
 *                     ii = palette[<unsigned int>d % width]             # <<<<<<<<<<<<<<
 * 
 *                     out[x, y, 0] = (ii >> 16) & 255
 */
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 6627, __pyx_L17_error)
                              }
                              __pyx_t_25 = (((unsigned int)__pyx_v_d) % __pyx_v_width);
                              __pyx_v_ii = (*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_palette.data) + __pyx_t_25)) )));

                              /* "PygameShader/shader.pyx":6629
 *                     ii = palette[<unsigned int>d % width]
 * 
 *                     out[x, y, 0] = (ii >> 16) & 255             # <<<<<<<<<<<<<<
 *                     out[x, y, 1] = (ii >> 8) & 255
 *                     out[x, y, 2] = ii & 255
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_14 = 0;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_13 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_14)) )) = ((__pyx_v_ii >> 16) & 0xFF);

                              /* "PygameShader/shader.pyx":6630
 * 
 *                     out[x, y, 0] = (ii >> 16) & 255
 *                     out[x, y, 1] = (ii >> 8) & 255             # <<<<<<<<<<<<<<
 *                     out[x, y, 2] = ii & 255
 * 
 */
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_13 = 1;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_14 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_13)) )) = ((__pyx_v_ii >> 8) & 0xFF);

                              /* "PygameShader/shader.pyx":6631
 *                     out[x, y, 0] = (ii >> 16) & 255
 *                     out[x, y, 1] = (ii >> 8) & 255
 *                     out[x, y, 2] = ii & 255             # <<<<<<<<<<<<<<
 * 
 *     return asarray(out)
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_14 = 2;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_13 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_14)) )) = (__pyx_v_ii & 0xFF);
                            }
                            goto __pyx_L24;
                            __pyx_L17_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L23;
                            __pyx_L23:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates10)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_c1;
                                __pyx_parallel_temp1 = __pyx_v_c2;
                                __pyx_parallel_temp2 = __pyx_v_d;
                                __pyx_parallel_temp3 = __pyx_v_ii;
                                __pyx_parallel_temp4 = __pyx_v_x;
                                __pyx_parallel_temp5 = __pyx_v_y;
                            }
                            __pyx_L24:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_c1 = __pyx_parallel_temp0;
              __pyx_v_c2 = __pyx_parallel_temp1;
              __pyx_v_d = __pyx_parallel_temp2;
              __pyx_v_ii = __pyx_parallel_temp3;
              __pyx_v_x = __pyx_parallel_temp4;
              __pyx_v_y = __pyx_parallel_temp5;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L7_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":6594
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)
 *         # for x in prange(min_, max_, schedule='static', num_threads=THREADS
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L8;
        }
        __pyx_L7_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L8:;
      }
  }

  /* "PygameShader/shader.pyx":6633
 *                     out[x, y, 2] = ii & 255
 * 
 *     return asarray(out)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_out, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":6541
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef fire_surface24_c_border(             # <<<<<<<<<<<<<<
 *         int width,
 *         int height,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_AddTraceback("PygameShader.shader.fire_surface24_c_border", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6673
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline shader_fire_effect_c(             # <<<<<<<<<<<<<<
 *         int width_,
 *         int height_,
 */

static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_fire_effect_c(int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_fire_, struct __pyx_opt_args_12PygameShader_6shader_shader_fire_effect_c *__pyx_optional_args) {
  unsigned short __pyx_v_reduce_factor_ = ((unsigned short)3);
  unsigned short __pyx_v_fire_intensity_ = ((unsigned short)32);

  /* "PygameShader/shader.pyx":6681
 *         unsigned short int reduce_factor_ = 3,
 *         unsigned short int fire_intensity_= 32,
 *         bint smooth_                      = True,             # <<<<<<<<<<<<<<
 *         bint bloom_                       = True,
 *         bint fast_bloom_                  = True,
 */
  int __pyx_v_smooth_ = ((int)1);

  /* "PygameShader/shader.pyx":6682
 *         unsigned short int fire_intensity_= 32,
 *         bint smooth_                      = True,
 *         bint bloom_                       = True,             # <<<<<<<<<<<<<<
 *         bint fast_bloom_                  = True,
 *         unsigned char bpf_threshold_      = 0,
 */
  int __pyx_v_bloom_ = ((int)1);

  /* "PygameShader/shader.pyx":6683
 *         bint smooth_                      = True,
 *         bint bloom_                       = True,
 *         bint fast_bloom_                  = True,             # <<<<<<<<<<<<<<
 *         unsigned char bpf_threshold_      = 0,
 *         unsigned int low_                 = 0,
 */
  int __pyx_v_fast_bloom_ = ((int)1);
  unsigned char __pyx_v_bpf_threshold_ = ((unsigned char)0);
  unsigned int __pyx_v_low_ = ((unsigned int)0);
  unsigned int __pyx_v_high_ = ((unsigned int)0x258);

  /* "PygameShader/shader.pyx":6687
 *         unsigned int low_                 = 0,
 *         unsigned int high_                = 600,
 *         bint brightness_                  = True,             # <<<<<<<<<<<<<<
 *         float brightness_intensity_       = 0.15,
 *         object surface_                   = None,
 */
  int __pyx_v_brightness_ = ((int)1);
  float __pyx_v_brightness_intensity_ = ((float)0.15);

  /* "PygameShader/shader.pyx":6689
 *         bint brightness_                  = True,
 *         float brightness_intensity_       = 0.15,
 *         object surface_                   = None,             # <<<<<<<<<<<<<<
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),
 */
  PyObject *__pyx_v_surface_ = ((PyObject *)Py_None);

  /* "PygameShader/shader.pyx":6690
 *         float brightness_intensity_       = 0.15,
 *         object surface_                   = None,
 *         bint adjust_palette_              = False,             # <<<<<<<<<<<<<<
 *         tuple hsl_                        = (10, 80, 1.8),
 *         bint transpose_                   = False,
 */
  int __pyx_v_adjust_palette_ = ((int)0);

  /* "PygameShader/shader.pyx":6691
 *         object surface_                   = None,
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),             # <<<<<<<<<<<<<<
 *         bint transpose_                   = False,
 *         bint border_                      = False,
 */
  PyObject *__pyx_v_hsl_ = ((PyObject*)__pyx_tuple__23);

  /* "PygameShader/shader.pyx":6692
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),
 *         bint transpose_                   = False,             # <<<<<<<<<<<<<<
 *         bint border_                      = False,
 *         bint blur_                        = True
 */
  int __pyx_v_transpose_ = ((int)0);

  /* "PygameShader/shader.pyx":6693
 *         tuple hsl_                        = (10, 80, 1.8),
 *         bint transpose_                   = False,
 *         bint border_                      = False,             # <<<<<<<<<<<<<<
 *         bint blur_                        = True
 *         ):
 */
  int __pyx_v_border_ = ((int)0);

  /* "PygameShader/shader.pyx":6694
 *         bint transpose_                   = False,
 *         bint border_                      = False,
 *         bint blur_                        = True             # <<<<<<<<<<<<<<
 *         ):
 *     """
 */
  int __pyx_v_blur_ = ((int)1);
  int __pyx_v_w4;
  int __pyx_v_h4;
  int __pyx_v_f_height;
  int __pyx_v_f_width;
  PyObject *__pyx_v_fire_surface_smallest = NULL;
  PyObject *__pyx_v_rgb_array_ = NULL;
  PyObject *__pyx_v_fire_effect = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  float __pyx_t_12;
  float __pyx_t_13;
  float __pyx_t_14;
  __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c_border __pyx_t_16;
  struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c __pyx_t_17;
  __Pyx_memviewslice __pyx_t_18 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_exclude_inplace_c __pyx_t_19;
  struct __pyx_opt_args_12PygameShader_6shader_shader_bloom_effect_array24_c __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_fire_effect_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_fire_intensity_ = __pyx_optional_args->fire_intensity_;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_smooth_ = __pyx_optional_args->smooth_;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_bloom_ = __pyx_optional_args->bloom_;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_fast_bloom_ = __pyx_optional_args->fast_bloom_;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_bpf_threshold_ = __pyx_optional_args->bpf_threshold_;
                if (__pyx_optional_args->__pyx_n > 6) {
                  __pyx_v_low_ = __pyx_optional_args->low_;
                  if (__pyx_optional_args->__pyx_n > 7) {
                    __pyx_v_high_ = __pyx_optional_args->high_;
                    if (__pyx_optional_args->__pyx_n > 8) {
                      __pyx_v_brightness_ = __pyx_optional_args->brightness_;
                      if (__pyx_optional_args->__pyx_n > 9) {
                        __pyx_v_brightness_intensity_ = __pyx_optional_args->brightness_intensity_;
                        if (__pyx_optional_args->__pyx_n > 10) {
                          __pyx_v_surface_ = __pyx_optional_args->surface_;
                          if (__pyx_optional_args->__pyx_n > 11) {
                            __pyx_v_adjust_palette_ = __pyx_optional_args->adjust_palette_;
                            if (__pyx_optional_args->__pyx_n > 12) {
                              __pyx_v_hsl_ = __pyx_optional_args->hsl_;
                              if (__pyx_optional_args->__pyx_n > 13) {
                                __pyx_v_transpose_ = __pyx_optional_args->transpose_;
                                if (__pyx_optional_args->__pyx_n > 14) {
                                  __pyx_v_border_ = __pyx_optional_args->border_;
                                  if (__pyx_optional_args->__pyx_n > 15) {
                                    __pyx_v_blur_ = __pyx_optional_args->blur_;
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  __PYX_INC_MEMVIEW(&__pyx_v_palette_, 1);

  /* "PygameShader/shader.pyx":6893
 * 
 *     # TEXTURE DIVIDE BY POWER OF 2
 *     if reduce_factor_ in (0, 1, 2):             # <<<<<<<<<<<<<<
 *         w4, h4 = width_ >> reduce_factor_, height_ >> reduce_factor_
 * 
 */
  switch (__pyx_v_reduce_factor_) {
    case 0:
    case 1:
    case 2:

    /* "PygameShader/shader.pyx":6894
 *     # TEXTURE DIVIDE BY POWER OF 2
 *     if reduce_factor_ in (0, 1, 2):
 *         w4, h4 = width_ >> reduce_factor_, height_ >> reduce_factor_             # <<<<<<<<<<<<<<
 * 
 *     # TEXTURE 150 x 150 * ratio
 */
    __pyx_t_1 = (__pyx_v_width_ >> __pyx_v_reduce_factor_);
    __pyx_t_2 = (__pyx_v_height_ >> __pyx_v_reduce_factor_);
    __pyx_v_w4 = __pyx_t_1;
    __pyx_v_h4 = __pyx_t_2;

    /* "PygameShader/shader.pyx":6893
 * 
 *     # TEXTURE DIVIDE BY POWER OF 2
 *     if reduce_factor_ in (0, 1, 2):             # <<<<<<<<<<<<<<
 *         w4, h4 = width_ >> reduce_factor_, height_ >> reduce_factor_
 * 
 */
    break;
    case 3:

    /* "PygameShader/shader.pyx":6899
 *     elif reduce_factor_ == 3:
 *         # CUSTOM SIZE WIDTH 150 AND RATIO * HIGH
 *         w4 = 150             # <<<<<<<<<<<<<<
 *         h4 = <int>(150 * height_/width_)
 *         low_ = <int>(low_ * low_/width_)
 */
    __pyx_v_w4 = 0x96;

    /* "PygameShader/shader.pyx":6900
 *         # CUSTOM SIZE WIDTH 150 AND RATIO * HIGH
 *         w4 = 150
 *         h4 = <int>(150 * height_/width_)             # <<<<<<<<<<<<<<
 *         low_ = <int>(low_ * low_/width_)
 *         high_ = <int>(high_ * 150/width_)
 */
    __pyx_v_h4 = ((int)((0x96 * __pyx_v_height_) / __pyx_v_width_));

    /* "PygameShader/shader.pyx":6901
 *         w4 = 150
 *         h4 = <int>(150 * height_/width_)
 *         low_ = <int>(low_ * low_/width_)             # <<<<<<<<<<<<<<
 *         high_ = <int>(high_ * 150/width_)
 *         reduce_factor_ = 0
 */
    __pyx_v_low_ = ((int)((__pyx_v_low_ * __pyx_v_low_) / __pyx_v_width_));

    /* "PygameShader/shader.pyx":6902
 *         h4 = <int>(150 * height_/width_)
 *         low_ = <int>(low_ * low_/width_)
 *         high_ = <int>(high_ * 150/width_)             # <<<<<<<<<<<<<<
 *         reduce_factor_ = 0
 * 
 */
    __pyx_v_high_ = ((int)((__pyx_v_high_ * 0x96) / __pyx_v_width_));

    /* "PygameShader/shader.pyx":6903
 *         low_ = <int>(low_ * low_/width_)
 *         high_ = <int>(high_ * 150/width_)
 *         reduce_factor_ = 0             # <<<<<<<<<<<<<<
 * 
 *     # TEXTURE 100 x 100 * ratio
 */
    __pyx_v_reduce_factor_ = 0;

    /* "PygameShader/shader.pyx":6897
 * 
 *     # TEXTURE 150 x 150 * ratio
 *     elif reduce_factor_ == 3:             # <<<<<<<<<<<<<<
 *         # CUSTOM SIZE WIDTH 150 AND RATIO * HIGH
 *         w4 = 150
 */
    break;
    case 4:

    /* "PygameShader/shader.pyx":6907
 *     # TEXTURE 100 x 100 * ratio
 *     elif reduce_factor_ == 4:
 *         w4 = 100             # <<<<<<<<<<<<<<
 *         h4 = <int> (100 * height_ / width_)
 *         low_ = <int> (low_ * low_ / width_)
 */
    __pyx_v_w4 = 0x64;

    /* "PygameShader/shader.pyx":6908
 *     elif reduce_factor_ == 4:
 *         w4 = 100
 *         h4 = <int> (100 * height_ / width_)             # <<<<<<<<<<<<<<
 *         low_ = <int> (low_ * low_ / width_)
 *         high_ = <int> (high_ * 100 / width_)
 */
    __pyx_v_h4 = ((int)((0x64 * __pyx_v_height_) / __pyx_v_width_));

    /* "PygameShader/shader.pyx":6909
 *         w4 = 100
 *         h4 = <int> (100 * height_ / width_)
 *         low_ = <int> (low_ * low_ / width_)             # <<<<<<<<<<<<<<
 *         high_ = <int> (high_ * 100 / width_)
 *         reduce_factor_ = 0
 */
    __pyx_v_low_ = ((int)((__pyx_v_low_ * __pyx_v_low_) / __pyx_v_width_));

    /* "PygameShader/shader.pyx":6910
 *         h4 = <int> (100 * height_ / width_)
 *         low_ = <int> (low_ * low_ / width_)
 *         high_ = <int> (high_ * 100 / width_)             # <<<<<<<<<<<<<<
 *         reduce_factor_ = 0
 * 
 */
    __pyx_v_high_ = ((int)((__pyx_v_high_ * 0x64) / __pyx_v_width_));

    /* "PygameShader/shader.pyx":6911
 *         low_ = <int> (low_ * low_ / width_)
 *         high_ = <int> (high_ * 100 / width_)
 *         reduce_factor_ = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int f_height, f_width
 */
    __pyx_v_reduce_factor_ = 0;

    /* "PygameShader/shader.pyx":6906
 * 
 *     # TEXTURE 100 x 100 * ratio
 *     elif reduce_factor_ == 4:             # <<<<<<<<<<<<<<
 *         w4 = 100
 *         h4 = <int> (100 * height_ / width_)
 */
    break;
    default: break;
  }

  /* "PygameShader/shader.pyx":6914
 * 
 *     cdef int f_height, f_width
 *     f_height, f_width = (<object>fire_).shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     assert f_width >= w4 or f_height >= h4,\
 */
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_fire_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_4, 0, 2, NULL, NULL, &__pyx_slice__24, 0, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 6914, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6914, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6914, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6914, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(1, 6914, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 6914, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6914, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6914, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_f_height = __pyx_t_2;
  __pyx_v_f_width = __pyx_t_1;

  /* "PygameShader/shader.pyx":6916
 *     f_height, f_width = (<object>fire_).shape[:2]
 * 
 *     assert f_width >= w4 or f_height >= h4,\             # <<<<<<<<<<<<<<
 *         "Fire array size mismatch the texture size.\n" \
 *         "Set fire_ array to numpy.empty((%s, %s), dtype=numpy.float32)" % (h4, w4)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_9 = ((__pyx_v_f_width >= __pyx_v_w4) != 0);
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_9 = ((__pyx_v_f_height >= __pyx_v_h4) != 0);
    __pyx_t_8 = __pyx_t_9;
    __pyx_L5_bool_binop_done:;
    if (unlikely(!__pyx_t_8)) {

      /* "PygameShader/shader.pyx":6918
 *     assert f_width >= w4 or f_height >= h4,\
 *         "Fire array size mismatch the texture size.\n" \
 *         "Set fire_ array to numpy.empty((%s, %s), dtype=numpy.float32)" % (h4, w4)             # <<<<<<<<<<<<<<
 * 
 *     if surface_ is None:
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
      __pyx_t_3 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Fire_array_size_mismatch_the_tex, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(1, 6916, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":6920
 *         "Set fire_ array to numpy.empty((%s, %s), dtype=numpy.float32)" % (h4, w4)
 * 
 *     if surface_ is None:             # <<<<<<<<<<<<<<
 *         fire_surface_smallest = pygame.Surface((w4, h4)).convert()
 * 
 */
  __pyx_t_8 = (__pyx_v_surface_ == Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "PygameShader/shader.pyx":6921
 * 
 *     if surface_ is None:
 *         fire_surface_smallest = pygame.Surface((w4, h4)).convert()             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Surface); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
    __pyx_t_3 = 0;
    __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_convert); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_fire_surface_smallest = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PygameShader/shader.pyx":6920
 *         "Set fire_ array to numpy.empty((%s, %s), dtype=numpy.float32)" % (h4, w4)
 * 
 *     if surface_ is None:             # <<<<<<<<<<<<<<
 *         fire_surface_smallest = pygame.Surface((w4, h4)).convert()
 * 
 */
    goto __pyx_L7;
  }

  /* "PygameShader/shader.pyx":6924
 * 
 *     else:
 *         if PyObject_IsInstance(surface_, pygame.Surface):             # <<<<<<<<<<<<<<
 *             assert surface_.get_width() == w4 and surface_.get_height() == h4, \
 *             "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\n" \
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Surface); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 6924, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = (__pyx_t_9 != 0);
    if (likely(__pyx_t_8)) {

      /* "PygameShader/shader.pyx":6925
 *     else:
 *         if PyObject_IsInstance(surface_, pygame.Surface):
 *             assert surface_.get_width() == w4 and surface_.get_height() == h4, \             # <<<<<<<<<<<<<<
 *             "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\n" \
 *             "Set argument surface_ to None to avoid this error message"\
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6925, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 6925, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_9) {
        } else {
          __pyx_t_8 = __pyx_t_9;
          goto __pyx_L9_bool_binop_done;
        }
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_height); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6925, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 6925, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_8 = __pyx_t_9;
        __pyx_L9_bool_binop_done:;
        if (unlikely(!__pyx_t_8)) {

          /* "PygameShader/shader.pyx":6928
 *             "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\n" \
 *             "Set argument surface_ to None to avoid this error message"\
 *             % (w4, h4, surface_.get_width(), surface_.get_height())             # <<<<<<<<<<<<<<
 *             fire_surface_smallest = surface_
 *         else:
 */
          __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6928, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6928, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_width); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6928, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_10 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_10)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6928, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_height); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6928, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_10, function);
            }
          }
          __pyx_t_11 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6928, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6928, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_11);
          PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_11);
          __pyx_t_6 = 0;
          __pyx_t_5 = 0;
          __pyx_t_4 = 0;
          __pyx_t_11 = 0;
          __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_Surface_argument_has_incorrect_d, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6928, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __PYX_ERR(1, 6925, __pyx_L1_error)
        }
      }
      #endif

      /* "PygameShader/shader.pyx":6929
 *             "Set argument surface_ to None to avoid this error message"\
 *             % (w4, h4, surface_.get_width(), surface_.get_height())
 *             fire_surface_smallest = surface_             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Argument surface_ must be a Surface type got %s " % type(surface_))
 */
      __Pyx_INCREF(__pyx_v_surface_);
      __pyx_v_fire_surface_smallest = __pyx_v_surface_;

      /* "PygameShader/shader.pyx":6924
 * 
 *     else:
 *         if PyObject_IsInstance(surface_, pygame.Surface):             # <<<<<<<<<<<<<<
 *             assert surface_.get_width() == w4 and surface_.get_height() == h4, \
 *             "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\n" \
 */
      goto __pyx_L8;
    }

    /* "PygameShader/shader.pyx":6931
 *             fire_surface_smallest = surface_
 *         else:
 *             raise ValueError("Argument surface_ must be a Surface type got %s " % type(surface_))             # <<<<<<<<<<<<<<
 * 
 *     if adjust_palette_:
 */
    /*else*/ {
      __pyx_t_11 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_Surf, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6931, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6931, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(1, 6931, __pyx_L1_error)
    }
    __pyx_L8:;
  }
  __pyx_L7:;

  /* "PygameShader/shader.pyx":6933
 *             raise ValueError("Argument surface_ must be a Surface type got %s " % type(surface_))
 * 
 *     if adjust_palette_:             # <<<<<<<<<<<<<<
 *         palette_= make_palette_c(w4, hsl_[0], hsl_[1], hsl_[2])
 * 
 */
  __pyx_t_8 = (__pyx_v_adjust_palette_ != 0);
  if (__pyx_t_8) {

    /* "PygameShader/shader.pyx":6934
 * 
 *     if adjust_palette_:
 *         palette_= make_palette_c(w4, hsl_[0], hsl_[1], hsl_[2])             # <<<<<<<<<<<<<<
 * 
 *     if border_:
 */
    if (unlikely(__pyx_v_hsl_ == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 6934, __pyx_L1_error)
    }
    __pyx_t_12 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v_hsl_, 0)); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 6934, __pyx_L1_error)
    if (unlikely(__pyx_v_hsl_ == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 6934, __pyx_L1_error)
    }
    __pyx_t_13 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v_hsl_, 1)); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 6934, __pyx_L1_error)
    if (unlikely(__pyx_v_hsl_ == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 6934, __pyx_L1_error)
    }
    __pyx_t_14 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v_hsl_, 2)); if (unlikely((__pyx_t_14 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 6934, __pyx_L1_error)
    __pyx_t_10 = __pyx_f_12PygameShader_6shader_make_palette_c(__pyx_v_w4, __pyx_t_12, __pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_10, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(1, 6934, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_palette_, 1);
    __pyx_v_palette_ = __pyx_t_15;
    __pyx_t_15.memview = NULL;
    __pyx_t_15.data = NULL;

    /* "PygameShader/shader.pyx":6933
 *             raise ValueError("Argument surface_ must be a Surface type got %s " % type(surface_))
 * 
 *     if adjust_palette_:             # <<<<<<<<<<<<<<
 *         palette_= make_palette_c(w4, hsl_[0], hsl_[1], hsl_[2])
 * 
 */
  }

  /* "PygameShader/shader.pyx":6936
 *         palette_= make_palette_c(w4, hsl_[0], hsl_[1], hsl_[2])
 * 
 *     if border_:             # <<<<<<<<<<<<<<
 *         # CREATE THE FIRE EFFECT ONTO A PYGAME SURFACE
 *         rgb_array_ = fire_surface24_c_border(
 */
  __pyx_t_8 = (__pyx_v_border_ != 0);
  if (__pyx_t_8) {

    /* "PygameShader/shader.pyx":6938
 *     if border_:
 *         # CREATE THE FIRE EFFECT ONTO A PYGAME SURFACE
 *         rgb_array_ = fire_surface24_c_border(             # <<<<<<<<<<<<<<
 *             w4, h4, <float>1.0 / factor_, palette_, fire_, fire_intensity_,
 *             low_ >> reduce_factor_, high_ >> reduce_factor_)
 */
    __pyx_t_16.__pyx_n = 3;
    __pyx_t_16.intensity = __pyx_v_fire_intensity_;
    __pyx_t_16.low = (__pyx_v_low_ >> __pyx_v_reduce_factor_);
    __pyx_t_16.high = (__pyx_v_high_ >> __pyx_v_reduce_factor_);
    __pyx_t_10 = __pyx_f_12PygameShader_6shader_fire_surface24_c_border(__pyx_v_w4, __pyx_v_h4, (((float)1.0) / __pyx_v_factor_), __pyx_v_palette_, __pyx_v_fire_, &__pyx_t_16); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_v_rgb_array_ = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PygameShader/shader.pyx":6936
 *         palette_= make_palette_c(w4, hsl_[0], hsl_[1], hsl_[2])
 * 
 *     if border_:             # <<<<<<<<<<<<<<
 *         # CREATE THE FIRE EFFECT ONTO A PYGAME SURFACE
 *         rgb_array_ = fire_surface24_c_border(
 */
    goto __pyx_L12;
  }

  /* "PygameShader/shader.pyx":6942
 *             low_ >> reduce_factor_, high_ >> reduce_factor_)
 *     else:
 *         rgb_array_ = fire_surface24_c(             # <<<<<<<<<<<<<<
 *             w4, h4, <float>1.0 / factor_, palette_, fire_, fire_intensity_,
 *                     low_ >> reduce_factor_, high_ >> reduce_factor_)
 */
  /*else*/ {

    /* "PygameShader/shader.pyx":6944
 *         rgb_array_ = fire_surface24_c(
 *             w4, h4, <float>1.0 / factor_, palette_, fire_, fire_intensity_,
 *                     low_ >> reduce_factor_, high_ >> reduce_factor_)             # <<<<<<<<<<<<<<
 * 
 *     # BRIGHTNESS SHADER
 */
    __pyx_t_17.__pyx_n = 3;
    __pyx_t_17.intensity = __pyx_v_fire_intensity_;
    __pyx_t_17.low = (__pyx_v_low_ >> __pyx_v_reduce_factor_);
    __pyx_t_17.high = (__pyx_v_high_ >> __pyx_v_reduce_factor_);
    __pyx_t_10 = __pyx_f_12PygameShader_6shader_fire_surface24_c(__pyx_v_w4, __pyx_v_h4, (((float)1.0) / __pyx_v_factor_), __pyx_v_palette_, __pyx_v_fire_, &__pyx_t_17); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_v_rgb_array_ = __pyx_t_10;
    __pyx_t_10 = 0;
  }
  __pyx_L12:;

  /* "PygameShader/shader.pyx":6947
 * 
 *     # BRIGHTNESS SHADER
 *     if brightness_:             # <<<<<<<<<<<<<<
 *         # EXCLUDE BLACK COLORS (DEFAULT)
 *         assert -1.0 <= brightness_intensity_ <= 1.0, \
 */
  __pyx_t_8 = (__pyx_v_brightness_ != 0);
  if (__pyx_t_8) {

    /* "PygameShader/shader.pyx":6949
 *     if brightness_:
 *         # EXCLUDE BLACK COLORS (DEFAULT)
 *         assert -1.0 <= brightness_intensity_ <= 1.0, \             # <<<<<<<<<<<<<<
 *             "Argument brightness intensity must be in range [-1.0 ... 1.0]"
 *         shader_brightness24_exclude_inplace_c(rgb_array_=rgb_array_,
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_8 = (-1.0 <= __pyx_v_brightness_intensity_);
      if (__pyx_t_8) {
        __pyx_t_8 = (__pyx_v_brightness_intensity_ <= 1.0);
      }
      if (unlikely(!(__pyx_t_8 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_brightness_intensity_mu);
        __PYX_ERR(1, 6949, __pyx_L1_error)
      }
    }
    #endif

    /* "PygameShader/shader.pyx":6951
 *         assert -1.0 <= brightness_intensity_ <= 1.0, \
 *             "Argument brightness intensity must be in range [-1.0 ... 1.0]"
 *         shader_brightness24_exclude_inplace_c(rgb_array_=rgb_array_,             # <<<<<<<<<<<<<<
 *                                               shift_=brightness_intensity_, color_=(0, 0, 0))
 * 
 */
    __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_rgb_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(1, 6951, __pyx_L1_error)

    /* "PygameShader/shader.pyx":6952
 *             "Argument brightness intensity must be in range [-1.0 ... 1.0]"
 *         shader_brightness24_exclude_inplace_c(rgb_array_=rgb_array_,
 *                                               shift_=brightness_intensity_, color_=(0, 0, 0))             # <<<<<<<<<<<<<<
 * 
 *     if blur_:
 */
    __pyx_t_19.__pyx_n = 2;
    __pyx_t_19.shift_ = __pyx_v_brightness_intensity_;
    __pyx_t_19.color_ = __pyx_tuple__9;
    __pyx_f_12PygameShader_6shader_shader_brightness24_exclude_inplace_c(__pyx_t_18, &__pyx_t_19); 
    __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
    __pyx_t_18.memview = NULL;
    __pyx_t_18.data = NULL;

    /* "PygameShader/shader.pyx":6947
 * 
 *     # BRIGHTNESS SHADER
 *     if brightness_:             # <<<<<<<<<<<<<<
 *         # EXCLUDE BLACK COLORS (DEFAULT)
 *         assert -1.0 <= brightness_intensity_ <= 1.0, \
 */
  }

  /* "PygameShader/shader.pyx":6954
 *                                               shift_=brightness_intensity_, color_=(0, 0, 0))
 * 
 *     if blur_:             # <<<<<<<<<<<<<<
 *         shader_blur5x5_array24_inplace_c(rgb_array_)
 * 
 */
  __pyx_t_8 = (__pyx_v_blur_ != 0);
  if (__pyx_t_8) {

    /* "PygameShader/shader.pyx":6955
 * 
 *     if blur_:
 *         shader_blur5x5_array24_inplace_c(rgb_array_)             # <<<<<<<<<<<<<<
 * 
 *     if transpose_:
 */
    __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_rgb_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(1, 6955, __pyx_L1_error)
    __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_18, NULL);
    __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
    __pyx_t_18.memview = NULL;
    __pyx_t_18.data = NULL;

    /* "PygameShader/shader.pyx":6954
 *                                               shift_=brightness_intensity_, color_=(0, 0, 0))
 * 
 *     if blur_:             # <<<<<<<<<<<<<<
 *         shader_blur5x5_array24_inplace_c(rgb_array_)
 * 
 */
  }

  /* "PygameShader/shader.pyx":6957
 *         shader_blur5x5_array24_inplace_c(rgb_array_)
 * 
 *     if transpose_:             # <<<<<<<<<<<<<<
 *         rgb_array_ = rgb_array_.transpose(1, 0, 2)
 *         fire_surface_smallest = rotate(fire_surface_smallest, 90)
 */
  __pyx_t_8 = (__pyx_v_transpose_ != 0);
  if (__pyx_t_8) {

    /* "PygameShader/shader.pyx":6958
 * 
 *     if transpose_:
 *         rgb_array_ = rgb_array_.transpose(1, 0, 2)             # <<<<<<<<<<<<<<
 *         fire_surface_smallest = rotate(fire_surface_smallest, 90)
 * 
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_rgb_array_, __pyx_n_s_transpose_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6958, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6958, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_rgb_array_, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "PygameShader/shader.pyx":6959
 *     if transpose_:
 *         rgb_array_ = rgb_array_.transpose(1, 0, 2)
 *         fire_surface_smallest = rotate(fire_surface_smallest, 90)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_rotate); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = NULL;
    __pyx_t_1 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
        __pyx_t_1 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_fire_surface_smallest, __pyx_int_90};
      __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6959, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_11);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_fire_surface_smallest, __pyx_int_90};
      __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6959, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_11);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6959, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_fire_surface_smallest);
      __Pyx_GIVEREF(__pyx_v_fire_surface_smallest);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_1, __pyx_v_fire_surface_smallest);
      __Pyx_INCREF(__pyx_int_90);
      __Pyx_GIVEREF(__pyx_int_90);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_1, __pyx_int_90);
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6959, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_fire_surface_smallest, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "PygameShader/shader.pyx":6957
 *         shader_blur5x5_array24_inplace_c(rgb_array_)
 * 
 *     if transpose_:             # <<<<<<<<<<<<<<
 *         rgb_array_ = rgb_array_.transpose(1, 0, 2)
 *         fire_surface_smallest = rotate(fire_surface_smallest, 90)
 */
  }

  /* "PygameShader/shader.pyx":6963
 * 
 *     # CONVERT THE ARRAY INTO A PYGAME SURFACE
 *     array_to_surface(fire_surface_smallest, rgb_array_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_array_to_surface); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = NULL;
  __pyx_t_1 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_1 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fire_surface_smallest, __pyx_v_rgb_array_};
    __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6963, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_11);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fire_surface_smallest, __pyx_v_rgb_array_};
    __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6963, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_11);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_fire_surface_smallest);
    __Pyx_GIVEREF(__pyx_v_fire_surface_smallest);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_1, __pyx_v_fire_surface_smallest);
    __Pyx_INCREF(__pyx_v_rgb_array_);
    __Pyx_GIVEREF(__pyx_v_rgb_array_);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_1, __pyx_v_rgb_array_);
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "PygameShader/shader.pyx":6967
 * 
 *     # BLOOM SHADER EFFECT
 *     if bloom_:             # <<<<<<<<<<<<<<
 *         assert 0 <= bpf_threshold_ < 256, \
 *             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_
 */
  __pyx_t_8 = (__pyx_v_bloom_ != 0);
  if (__pyx_t_8) {

    /* "PygameShader/shader.pyx":6968
 *     # BLOOM SHADER EFFECT
 *     if bloom_:
 *         assert 0 <= bpf_threshold_ < 256, \             # <<<<<<<<<<<<<<
 *             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_
 *         shader_bloom_effect_array24_c(fire_surface_smallest, bpf_threshold_, fast_=fast_bloom_)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_8 = (0 <= __pyx_v_bpf_threshold_);
      if (__pyx_t_8) {
        __pyx_t_8 = (__pyx_v_bpf_threshold_ < 0x100);
      }
      if (unlikely(!(__pyx_t_8 != 0))) {

        /* "PygameShader/shader.pyx":6969
 *     if bloom_:
 *         assert 0 <= bpf_threshold_ < 256, \
 *             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_             # <<<<<<<<<<<<<<
 *         shader_bloom_effect_array24_c(fire_surface_smallest, bpf_threshold_, fast_=fast_bloom_)
 * 
 */
        __pyx_t_11 = __Pyx_PyInt_From_unsigned_char(__pyx_v_bpf_threshold_); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6969, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_Argument_bpf_threshold__must_be, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6969, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        PyErr_SetObject(PyExc_AssertionError, __pyx_t_10);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __PYX_ERR(1, 6968, __pyx_L1_error)
      }
    }
    #endif

    /* "PygameShader/shader.pyx":6970
 *         assert 0 <= bpf_threshold_ < 256, \
 *             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_
 *         shader_bloom_effect_array24_c(fire_surface_smallest, bpf_threshold_, fast_=fast_bloom_)             # <<<<<<<<<<<<<<
 * 
 *     # RESCALE THE SURFACE TO THE FULL SIZE
 */
    __pyx_t_20.__pyx_n = 1;
    __pyx_t_20.fast_ = __pyx_v_fast_bloom_;
    __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(__pyx_v_fire_surface_smallest, __pyx_v_bpf_threshold_, &__pyx_t_20); 

    /* "PygameShader/shader.pyx":6967
 * 
 *     # BLOOM SHADER EFFECT
 *     if bloom_:             # <<<<<<<<<<<<<<
 *         assert 0 <= bpf_threshold_ < 256, \
 *             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_
 */
  }

  /* "PygameShader/shader.pyx":6973
 * 
 *     # RESCALE THE SURFACE TO THE FULL SIZE
 *     if smooth_:             # <<<<<<<<<<<<<<
 *         fire_effect = smoothscale(fire_surface_smallest, (width_, height_))
 *     else:
 */
  __pyx_t_8 = (__pyx_v_smooth_ != 0);
  if (__pyx_t_8) {

    /* "PygameShader/shader.pyx":6974
 *     # RESCALE THE SURFACE TO THE FULL SIZE
 *     if smooth_:
 *         fire_effect = smoothscale(fire_surface_smallest, (width_, height_))             # <<<<<<<<<<<<<<
 *     else:
 *         fire_effect = scale(fire_surface_smallest, (width_, height_))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_width_); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_height_); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_1 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_1 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fire_surface_smallest, __pyx_t_6};
      __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6974, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fire_surface_smallest, __pyx_t_6};
      __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6974, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6974, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_fire_surface_smallest);
      __Pyx_GIVEREF(__pyx_v_fire_surface_smallest);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_1, __pyx_v_fire_surface_smallest);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6974, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_fire_effect = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "PygameShader/shader.pyx":6973
 * 
 *     # RESCALE THE SURFACE TO THE FULL SIZE
 *     if smooth_:             # <<<<<<<<<<<<<<
 *         fire_effect = smoothscale(fire_surface_smallest, (width_, height_))
 *     else:
 */
    goto __pyx_L17;
  }

  /* "PygameShader/shader.pyx":6976
 *         fire_effect = smoothscale(fire_surface_smallest, (width_, height_))
 *     else:
 *         fire_effect = scale(fire_surface_smallest, (width_, height_))             # <<<<<<<<<<<<<<
 * 
 *     return fire_effect
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_scale); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_width_); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_height_); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_1 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_1 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_fire_surface_smallest, __pyx_t_5};
      __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6976, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_fire_surface_smallest, __pyx_t_5};
      __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6976, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6976, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_v_fire_surface_smallest);
      __Pyx_GIVEREF(__pyx_v_fire_surface_smallest);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_1, __pyx_v_fire_surface_smallest);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6976, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_fire_effect = __pyx_t_10;
    __pyx_t_10 = 0;
  }
  __pyx_L17:;

  /* "PygameShader/shader.pyx":6978
 *         fire_effect = scale(fire_surface_smallest, (width_, height_))
 * 
 *     return fire_effect             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fire_effect);
  __pyx_r = __pyx_v_fire_effect;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":6673
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline shader_fire_effect_c(             # <<<<<<<<<<<<<<
 *         int width_,
 *         int height_,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
  __Pyx_AddTraceback("PygameShader.shader.shader_fire_effect_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fire_surface_smallest);
  __Pyx_XDECREF(__pyx_v_rgb_array_);
  __Pyx_XDECREF(__pyx_v_fire_effect);
  __PYX_XDEC_MEMVIEW(&__pyx_v_palette_, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":6986
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef cloud_surface24_c(             # <<<<<<<<<<<<<<
 *         int width,
 *         int height,
 */

static PyObject *__pyx_f_12PygameShader_6shader_cloud_surface24_c(int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_cloud_, struct __pyx_opt_args_12PygameShader_6shader_cloud_surface24_c *__pyx_optional_args) {
  int __pyx_v_intensity = ((int)0);
  int __pyx_v_low = ((int)0);
  int __pyx_v_high = ((int)0);
  int __pyx_v_new_height;
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_x;
  int __pyx_v_y;
  float __pyx_v_d;
  unsigned int __pyx_v_ii;
  unsigned int __pyx_v_c1;
  unsigned int __pyx_v_c2;
  int __pyx_v_p_length;
  CYTHON_UNUSED int __pyx_v_min_;
  CYTHON_UNUSED int __pyx_v_max_;
  int __pyx_v_middle;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  long __pyx_t_15;
  long __pyx_t_16;
  long __pyx_t_17;
  size_t __pyx_t_18;
  size_t __pyx_t_19;
  size_t __pyx_t_20;
  long __pyx_t_21;
  size_t __pyx_t_22;
  long __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  size_t __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cloud_surface24_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_intensity = __pyx_optional_args->intensity;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_low = __pyx_optional_args->low;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_high = __pyx_optional_args->high;
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":7027
 * 
 *     cdef:
 *         int new_height = height             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, ::1] out = empty((width, new_height, 3), dtype=uint8)
 *         int x = 0, y = 0
 */
  __pyx_v_new_height = __pyx_v_height;

  /* "PygameShader/shader.pyx":7028
 *     cdef:
 *         int new_height = height
 *         unsigned char [:, :, ::1] out = empty((width, new_height, 3), dtype=uint8)             # <<<<<<<<<<<<<<
 *         int x = 0, y = 0
 *         float d
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_new_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 7028, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 7028, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_out = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "PygameShader/shader.pyx":7029
 *         int new_height = height
 *         unsigned char [:, :, ::1] out = empty((width, new_height, 3), dtype=uint8)
 *         int x = 0, y = 0             # <<<<<<<<<<<<<<
 *         float d
 *         unsigned int ii=0
 */
  __pyx_v_x = 0;
  __pyx_v_y = 0;

  /* "PygameShader/shader.pyx":7031
 *         int x = 0, y = 0
 *         float d
 *         unsigned int ii=0             # <<<<<<<<<<<<<<
 *         unsigned c1 = 0, c2 = 0
 *         int p_length = (<object>palette).size
 */
  __pyx_v_ii = 0;

  /* "PygameShader/shader.pyx":7032
 *         float d
 *         unsigned int ii=0
 *         unsigned c1 = 0, c2 = 0             # <<<<<<<<<<<<<<
 *         int p_length = (<object>palette).size
 * 
 */
  __pyx_v_c1 = 0;
  __pyx_v_c2 = 0;

  /* "PygameShader/shader.pyx":7033
 *         unsigned int ii=0
 *         unsigned c1 = 0, c2 = 0
 *         int p_length = (<object>palette).size             # <<<<<<<<<<<<<<
 * 
 *     cdef int min_, max_, middle
 */
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_palette, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7033, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_p_length = __pyx_t_6;

  /* "PygameShader/shader.pyx":7037
 *     cdef int min_, max_, middle
 * 
 *     if low != 0 or high != 0:             # <<<<<<<<<<<<<<
 *         assert 0 <= low < high, "Argument low_ must be < high_"
 *         assert high <= width,   "Argument high must be <= width"
 */
  __pyx_t_8 = ((__pyx_v_low != 0) != 0);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_8 = ((__pyx_v_high != 0) != 0);
  __pyx_t_7 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_7) {

    /* "PygameShader/shader.pyx":7038
 * 
 *     if low != 0 or high != 0:
 *         assert 0 <= low < high, "Argument low_ must be < high_"             # <<<<<<<<<<<<<<
 *         assert high <= width,   "Argument high must be <= width"
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_7 = (0 <= __pyx_v_low);
      if (__pyx_t_7) {
        __pyx_t_7 = (__pyx_v_low < __pyx_v_high);
      }
      if (unlikely(!(__pyx_t_7 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_low__must_be_high);
        __PYX_ERR(1, 7038, __pyx_L1_error)
      }
    }
    #endif

    /* "PygameShader/shader.pyx":7039
 *     if low != 0 or high != 0:
 *         assert 0 <= low < high, "Argument low_ must be < high_"
 *         assert high <= width,   "Argument high must be <= width"             # <<<<<<<<<<<<<<
 * 
 *         middle = low + ((high - low) >> 1)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_high <= __pyx_v_width) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_high_must_be_width);
        __PYX_ERR(1, 7039, __pyx_L1_error)
      }
    }
    #endif

    /* "PygameShader/shader.pyx":7041
 *         assert high <= width,   "Argument high must be <= width"
 * 
 *         middle = low + ((high - low) >> 1)             # <<<<<<<<<<<<<<
 *         min_ = randRange(low, middle)
 *         max_ = randRange(middle + 1, high)
 */
    __pyx_v_middle = (__pyx_v_low + ((__pyx_v_high - __pyx_v_low) >> 1));

    /* "PygameShader/shader.pyx":7042
 * 
 *         middle = low + ((high - low) >> 1)
 *         min_ = randRange(low, middle)             # <<<<<<<<<<<<<<
 *         max_ = randRange(middle + 1, high)
 *     else:
 */
    __pyx_v_min_ = randRange(__pyx_v_low, __pyx_v_middle);

    /* "PygameShader/shader.pyx":7043
 *         middle = low + ((high - low) >> 1)
 *         min_ = randRange(low, middle)
 *         max_ = randRange(middle + 1, high)             # <<<<<<<<<<<<<<
 *     else:
 *         middle = width >> 1
 */
    __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_high);

    /* "PygameShader/shader.pyx":7037
 *     cdef int min_, max_, middle
 * 
 *     if low != 0 or high != 0:             # <<<<<<<<<<<<<<
 *         assert 0 <= low < high, "Argument low_ must be < high_"
 *         assert high <= width,   "Argument high must be <= width"
 */
    goto __pyx_L3;
  }

  /* "PygameShader/shader.pyx":7045
 *         max_ = randRange(middle + 1, high)
 *     else:
 *         middle = width >> 1             # <<<<<<<<<<<<<<
 *         min_ = randRange(0, middle)
 *         max_ = randRange(middle +1, width)
 */
  /*else*/ {
    __pyx_v_middle = (__pyx_v_width >> 1);

    /* "PygameShader/shader.pyx":7046
 *     else:
 *         middle = width >> 1
 *         min_ = randRange(0, middle)             # <<<<<<<<<<<<<<
 *         max_ = randRange(middle +1, width)
 * 
 */
    __pyx_v_min_ = randRange(0, __pyx_v_middle);

    /* "PygameShader/shader.pyx":7047
 *         middle = width >> 1
 *         min_ = randRange(0, middle)
 *         max_ = randRange(middle +1, width)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_width);
  }
  __pyx_L3:;

  /* "PygameShader/shader.pyx":7050
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)
 *         for x in prange(min_, max_, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":7052
 *     with nogil:
 *         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)
 *         for x in prange(min_, max_, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *                 cloud_[(new_height - 1) % height, x % width] = randRange(intensity, 260)
 * 
 */
        __pyx_t_6 = __pyx_v_min_;
        __pyx_t_9 = __pyx_v_max_;
        if ((1 == 0)) abort();
        {
            int __pyx_parallel_temp0 = ((int)0xbad0bad0);
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_11 = (__pyx_t_9 - __pyx_t_6 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_11 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_12, __pyx_t_13, __pyx_t_14) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_x = (int)(__pyx_t_6 + 1 * __pyx_t_10);

                            /* "PygameShader/shader.pyx":7053
 *         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)
 *         for x in prange(min_, max_, schedule='static', num_threads=THREADS):
 *                 cloud_[(new_height - 1) % height, x % width] = randRange(intensity, 260)             # <<<<<<<<<<<<<<
 * 
 * 
 */
                            __pyx_t_12 = (__pyx_v_new_height - 1);
                            if (unlikely(__pyx_v_height == 0)) {
                              #ifdef WITH_THREAD
                              PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                              #endif
                              PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                              #ifdef WITH_THREAD
                              __Pyx_PyGILState_Release(__pyx_gilstate_save);
                              #endif
                              __PYX_ERR(1, 7053, __pyx_L11_error)
                            }
                            if (unlikely(__pyx_v_width == 0)) {
                              #ifdef WITH_THREAD
                              PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                              #endif
                              PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                              #ifdef WITH_THREAD
                              __Pyx_PyGILState_Release(__pyx_gilstate_save);
                              #endif
                              __PYX_ERR(1, 7053, __pyx_L11_error)
                            }
                            __pyx_t_13 = __Pyx_mod_long(__pyx_t_12, __pyx_v_height);
                            __pyx_t_14 = __Pyx_mod_int(__pyx_v_x, __pyx_v_width);
                            *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_13 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_14)) )) = randRange(__pyx_v_intensity, 0x104);
                            goto __pyx_L14;
                            __pyx_L11_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L13;
                            __pyx_L13:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates11)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_x;
                            }
                            __pyx_L14:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_x = __pyx_parallel_temp0;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L7_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif

        /* "PygameShader/shader.pyx":7057
 * 
 *         # DILUTE THE FLAME EFFECT (DECREASE THE MAXIMUM INT VALUE) WHEN THE FLAME TRAVEL UPWARD
 *         for y in prange(0, new_height - 1, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *             for x in range(0, width):
 */
        __pyx_t_12 = (__pyx_v_new_height - 1);
        if ((1 == 0)) abort();
        {
            unsigned int __pyx_parallel_temp0 = ((unsigned int)0xbad0bad0);
            unsigned int __pyx_parallel_temp1 = ((unsigned int)0xbad0bad0);
            float __pyx_parallel_temp2 = ((float)__PYX_NAN());
            unsigned int __pyx_parallel_temp3 = ((unsigned int)0xbad0bad0);
            int __pyx_parallel_temp4 = ((int)0xbad0bad0);
            int __pyx_parallel_temp5 = ((int)0xbad0bad0);
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_16 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_16 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_13, __pyx_t_14, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_7, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_d) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_y = (int)(0 + 1 * __pyx_t_15);
                            /* Initialize private variables to invalid values */
                            __pyx_v_c1 = ((unsigned int)0xbad0bad0);
                            __pyx_v_c2 = ((unsigned int)0xbad0bad0);
                            __pyx_v_d = ((float)__PYX_NAN());
                            __pyx_v_ii = ((unsigned int)0xbad0bad0);
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":7059
 *         for y in prange(0, new_height - 1, schedule='static', num_threads=THREADS):
 * 
 *             for x in range(0, width):             # <<<<<<<<<<<<<<
 * 
 *                     c1 = (y + 1) % height
 */
                            __pyx_t_11 = __pyx_v_width;
                            __pyx_t_10 = __pyx_t_11;
                            for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9+=1) {
                              __pyx_v_x = __pyx_t_9;

                              /* "PygameShader/shader.pyx":7061
 *             for x in range(0, width):
 * 
 *                     c1 = (y + 1) % height             # <<<<<<<<<<<<<<
 *                     c2 = x % width
 *                     d = (cloud_[c1, (x - 1 + width) % width]
 */
                              __pyx_t_17 = (__pyx_v_y + 1);
                              if (unlikely(__pyx_v_height == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 7061, __pyx_L17_error)
                              }
                              __pyx_v_c1 = __Pyx_mod_long(__pyx_t_17, __pyx_v_height);

                              /* "PygameShader/shader.pyx":7062
 * 
 *                     c1 = (y + 1) % height
 *                     c2 = x % width             # <<<<<<<<<<<<<<
 *                     d = (cloud_[c1, (x - 1 + width) % width]
 *                        + cloud_[c1, c2]
 */
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 7062, __pyx_L17_error)
                              }
                              __pyx_v_c2 = __Pyx_mod_int(__pyx_v_x, __pyx_v_width);

                              /* "PygameShader/shader.pyx":7063
 *                     c1 = (y + 1) % height
 *                     c2 = x % width
 *                     d = (cloud_[c1, (x - 1 + width) % width]             # <<<<<<<<<<<<<<
 *                        + cloud_[c1, c2]
 *                        + cloud_[c1, (x + 1) % width]
 */
                              __pyx_t_17 = ((__pyx_v_x - 1) + __pyx_v_width);
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 7063, __pyx_L17_error)
                              }
                              __pyx_t_18 = __pyx_v_c1;
                              __pyx_t_14 = __Pyx_mod_long(__pyx_t_17, __pyx_v_width);

                              /* "PygameShader/shader.pyx":7064
 *                     c2 = x % width
 *                     d = (cloud_[c1, (x - 1 + width) % width]
 *                        + cloud_[c1, c2]             # <<<<<<<<<<<<<<
 *                        + cloud_[c1, (x + 1) % width]
 *                        + cloud_[(y + 2) % height, c2]) * factor
 */
                              __pyx_t_19 = __pyx_v_c1;
                              __pyx_t_20 = __pyx_v_c2;

                              /* "PygameShader/shader.pyx":7065
 *                     d = (cloud_[c1, (x - 1 + width) % width]
 *                        + cloud_[c1, c2]
 *                        + cloud_[c1, (x + 1) % width]             # <<<<<<<<<<<<<<
 *                        + cloud_[(y + 2) % height, c2]) * factor
 * 
 */
                              __pyx_t_21 = (__pyx_v_x + 1);
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 7065, __pyx_L17_error)
                              }
                              __pyx_t_22 = __pyx_v_c1;
                              __pyx_t_13 = __Pyx_mod_long(__pyx_t_21, __pyx_v_width);

                              /* "PygameShader/shader.pyx":7066
 *                        + cloud_[c1, c2]
 *                        + cloud_[c1, (x + 1) % width]
 *                        + cloud_[(y + 2) % height, c2]) * factor             # <<<<<<<<<<<<<<
 * 
 *                     d = d - <float>(rand() * 0.0001)
 */
                              __pyx_t_23 = (__pyx_v_y + 2);
                              if (unlikely(__pyx_v_height == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 7066, __pyx_L17_error)
                              }
                              __pyx_t_24 = __Pyx_mod_long(__pyx_t_23, __pyx_v_height);
                              __pyx_t_25 = __pyx_v_c2;
                              __pyx_v_d = (((((*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_18 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_14)) ))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_19 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_20)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_22 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_13)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_24 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_25)) )))) * __pyx_v_factor);

                              /* "PygameShader/shader.pyx":7068
 *                        + cloud_[(y + 2) % height, c2]) * factor
 * 
 *                     d = d - <float>(rand() * 0.0001)             # <<<<<<<<<<<<<<
 * 
 *                     # Cap the values
 */
                              __pyx_v_d = (__pyx_v_d - ((float)(rand() * 0.0001)));

                              /* "PygameShader/shader.pyx":7071
 * 
 *                     # Cap the values
 *                     if d <0:             # <<<<<<<<<<<<<<
 *                         d = 0.0
 * 
 */
                              __pyx_t_7 = ((__pyx_v_d < 0.0) != 0);
                              if (__pyx_t_7) {

                                /* "PygameShader/shader.pyx":7072
 *                     # Cap the values
 *                     if d <0:
 *                         d = 0.0             # <<<<<<<<<<<<<<
 * 
 *                     # CAP THE VALUE TO 255
 */
                                __pyx_v_d = 0.0;

                                /* "PygameShader/shader.pyx":7071
 * 
 *                     # Cap the values
 *                     if d <0:             # <<<<<<<<<<<<<<
 *                         d = 0.0
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":7075
 * 
 *                     # CAP THE VALUE TO 255
 *                     if d>512.0:             # <<<<<<<<<<<<<<
 *                         d = <float>512.0
 *                     cloud_[y % height, x % width] = d
 */
                              __pyx_t_7 = ((__pyx_v_d > 512.0) != 0);
                              if (__pyx_t_7) {

                                /* "PygameShader/shader.pyx":7076
 *                     # CAP THE VALUE TO 255
 *                     if d>512.0:
 *                         d = <float>512.0             # <<<<<<<<<<<<<<
 *                     cloud_[y % height, x % width] = d
 * 
 */
                                __pyx_v_d = ((float)512.0);

                                /* "PygameShader/shader.pyx":7075
 * 
 *                     # CAP THE VALUE TO 255
 *                     if d>512.0:             # <<<<<<<<<<<<<<
 *                         d = <float>512.0
 *                     cloud_[y % height, x % width] = d
 */
                              }

                              /* "PygameShader/shader.pyx":7077
 *                     if d>512.0:
 *                         d = <float>512.0
 *                     cloud_[y % height, x % width] = d             # <<<<<<<<<<<<<<
 * 
 *                     ii = palette[<unsigned int>d % p_length]
 */
                              if (unlikely(__pyx_v_height == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 7077, __pyx_L17_error)
                              }
                              if (unlikely(__pyx_v_width == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 7077, __pyx_L17_error)
                              }
                              __pyx_t_24 = __Pyx_mod_int(__pyx_v_y, __pyx_v_height);
                              __pyx_t_13 = __Pyx_mod_int(__pyx_v_x, __pyx_v_width);
                              *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_24 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_13)) )) = __pyx_v_d;

                              /* "PygameShader/shader.pyx":7079
 *                     cloud_[y % height, x % width] = d
 * 
 *                     ii = palette[<unsigned int>d % p_length]             # <<<<<<<<<<<<<<
 * 
 *                     out[x, y, 0] = (ii >> 16) & 255
 */
                              if (unlikely(__pyx_v_p_length == 0)) {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                                __PYX_ERR(1, 7079, __pyx_L17_error)
                              }
                              __pyx_t_25 = (((unsigned int)__pyx_v_d) % __pyx_v_p_length);
                              __pyx_v_ii = (*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_palette.data) + __pyx_t_25)) )));

                              /* "PygameShader/shader.pyx":7081
 *                     ii = palette[<unsigned int>d % p_length]
 * 
 *                     out[x, y, 0] = (ii >> 16) & 255             # <<<<<<<<<<<<<<
 *                     out[x, y, 1] = (ii >> 8) & 255
 *                     out[x, y, 2] = ii & 255
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_14 = 0;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_13 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_14)) )) = ((__pyx_v_ii >> 16) & 0xFF);

                              /* "PygameShader/shader.pyx":7082
 * 
 *                     out[x, y, 0] = (ii >> 16) & 255
 *                     out[x, y, 1] = (ii >> 8) & 255             # <<<<<<<<<<<<<<
 *                     out[x, y, 2] = ii & 255
 * 
 */
                              __pyx_t_14 = __pyx_v_x;
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_13 = 1;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_14 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_13)) )) = ((__pyx_v_ii >> 8) & 0xFF);

                              /* "PygameShader/shader.pyx":7083
 *                     out[x, y, 0] = (ii >> 16) & 255
 *                     out[x, y, 1] = (ii >> 8) & 255
 *                     out[x, y, 2] = ii & 255             # <<<<<<<<<<<<<<
 * 
 *     return asarray(out[:, 0:height, :])
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_14 = 2;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_13 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_14)) )) = (__pyx_v_ii & 0xFF);
                            }
                            goto __pyx_L24;
                            __pyx_L17_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L23;
                            __pyx_L23:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates12)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_c1;
                                __pyx_parallel_temp1 = __pyx_v_c2;
                                __pyx_parallel_temp2 = __pyx_v_d;
                                __pyx_parallel_temp3 = __pyx_v_ii;
                                __pyx_parallel_temp4 = __pyx_v_x;
                                __pyx_parallel_temp5 = __pyx_v_y;
                            }
                            __pyx_L24:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_c1 = __pyx_parallel_temp0;
              __pyx_v_c2 = __pyx_parallel_temp1;
              __pyx_v_d = __pyx_parallel_temp2;
              __pyx_v_ii = __pyx_parallel_temp3;
              __pyx_v_x = __pyx_parallel_temp4;
              __pyx_v_y = __pyx_parallel_temp5;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L7_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":7050
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)
 *         for x in prange(min_, max_, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L8;
        }
        __pyx_L7_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L8:;
      }
  }

  /* "PygameShader/shader.pyx":7085
 *                     out[x, y, 2] = ii & 255
 * 
 *     return asarray(out[:, 0:height, :])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5.data = __pyx_v_out.data;
  __pyx_t_5.memview = __pyx_v_out.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_5, 0);
  __pyx_t_5.shape[0] = __pyx_v_out.shape[0];
__pyx_t_5.strides[0] = __pyx_v_out.strides[0];
    __pyx_t_5.suboffsets[0] = -1;

__pyx_t_11 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_5,
    __pyx_v_out.shape[1], __pyx_v_out.strides[1], __pyx_v_out.suboffsets[1],
    1,
    1,
    &__pyx_t_11,
    0,
    __pyx_v_height,
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(1, 7085, __pyx_L1_error)
}

__pyx_t_5.shape[2] = __pyx_v_out.shape[2];
__pyx_t_5.strides[2] = __pyx_v_out.strides[2];
    __pyx_t_5.suboffsets[2] = -1;

__pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_5, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":6986
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef cloud_surface24_c(             # <<<<<<<<<<<<<<
 *         int width,
 *         int height,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_AddTraceback("PygameShader.shader.cloud_surface24_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":7114
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef inline shader_cloud_effect_c(             # <<<<<<<<<<<<<<
 *         int width_,
 *         int height_,
 */

static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_cloud_effect_c(int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_cloud_, struct __pyx_opt_args_12PygameShader_6shader_shader_cloud_effect_c *__pyx_optional_args) {
  unsigned short __pyx_v_reduce_factor_ = ((unsigned short)2);
  unsigned short __pyx_v_cloud_intensity_ = ((unsigned short)16);

  /* "PygameShader/shader.pyx":7124
 *         unsigned short int reduce_factor_   = 2,
 *         unsigned short int cloud_intensity_ = 16,
 *         bint smooth_                        = True,             # <<<<<<<<<<<<<<
 *         bint bloom_                         = False,
 *         bint fast_bloom_                    = True,
 */
  int __pyx_v_smooth_ = ((int)1);

  /* "PygameShader/shader.pyx":7125
 *         unsigned short int cloud_intensity_ = 16,
 *         bint smooth_                        = True,
 *         bint bloom_                         = False,             # <<<<<<<<<<<<<<
 *         bint fast_bloom_                    = True,
 *         unsigned short int bpf_threshold_   = 128,
 */
  int __pyx_v_bloom_ = ((int)0);

  /* "PygameShader/shader.pyx":7126
 *         bint smooth_                        = True,
 *         bint bloom_                         = False,
 *         bint fast_bloom_                    = True,             # <<<<<<<<<<<<<<
 *         unsigned short int bpf_threshold_   = 128,
 *         unsigned int low_                   = 0,
 */
  int __pyx_v_fast_bloom_ = ((int)1);
  unsigned short __pyx_v_bpf_threshold_ = ((unsigned short)0x80);
  unsigned int __pyx_v_low_ = ((unsigned int)0);
  unsigned int __pyx_v_high_ = ((unsigned int)0);

  /* "PygameShader/shader.pyx":7130
 *         unsigned int low_                   = 0,
 *         unsigned int high_                  = 0,
 *         bint brightness_                    = False,             # <<<<<<<<<<<<<<
 *         float brightness_intensity_         = 0.0,
 *         object surface_                     = None,
 */
  int __pyx_v_brightness_ = ((int)0);
  float __pyx_v_brightness_intensity_ = ((float)0.0);

  /* "PygameShader/shader.pyx":7132
 *         bint brightness_                    = False,
 *         float brightness_intensity_         = 0.0,
 *         object surface_                     = None,             # <<<<<<<<<<<<<<
 *         bint transpose_                     = False,
 *         bint blur_                          = True
 */
  PyObject *__pyx_v_surface_ = ((PyObject *)Py_None);

  /* "PygameShader/shader.pyx":7133
 *         float brightness_intensity_         = 0.0,
 *         object surface_                     = None,
 *         bint transpose_                     = False,             # <<<<<<<<<<<<<<
 *         bint blur_                          = True
 *         ):
 */
  int __pyx_v_transpose_ = ((int)0);

  /* "PygameShader/shader.pyx":7134
 *         object surface_                     = None,
 *         bint transpose_                     = False,
 *         bint blur_                          = True             # <<<<<<<<<<<<<<
 *         ):
 *     """
 */
  int __pyx_v_blur_ = ((int)1);
  int __pyx_v_w4;
  int __pyx_v_h4;
  int __pyx_v_f_height;
  int __pyx_v_f_width;
  PyObject *__pyx_v_cloud_surface_smallest = NULL;
  PyObject *__pyx_v_rgb_array_ = NULL;
  PyObject *__pyx_v_cloud_effect = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  unsigned int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_cloud_surface24_c __pyx_t_14;
  __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_exclude_inplace_c __pyx_t_16;
  struct __pyx_opt_args_12PygameShader_6shader_shader_bloom_effect_array24_c __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_cloud_effect_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_cloud_intensity_ = __pyx_optional_args->cloud_intensity_;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_smooth_ = __pyx_optional_args->smooth_;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_bloom_ = __pyx_optional_args->bloom_;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_fast_bloom_ = __pyx_optional_args->fast_bloom_;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_bpf_threshold_ = __pyx_optional_args->bpf_threshold_;
                if (__pyx_optional_args->__pyx_n > 6) {
                  __pyx_v_low_ = __pyx_optional_args->low_;
                  if (__pyx_optional_args->__pyx_n > 7) {
                    __pyx_v_high_ = __pyx_optional_args->high_;
                    if (__pyx_optional_args->__pyx_n > 8) {
                      __pyx_v_brightness_ = __pyx_optional_args->brightness_;
                      if (__pyx_optional_args->__pyx_n > 9) {
                        __pyx_v_brightness_intensity_ = __pyx_optional_args->brightness_intensity_;
                        if (__pyx_optional_args->__pyx_n > 10) {
                          __pyx_v_surface_ = __pyx_optional_args->surface_;
                          if (__pyx_optional_args->__pyx_n > 11) {
                            __pyx_v_transpose_ = __pyx_optional_args->transpose_;
                            if (__pyx_optional_args->__pyx_n > 12) {
                              __pyx_v_blur_ = __pyx_optional_args->blur_;
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":7315
 * 
 *     # TEXTURE DIVIDE BY POWER OF 2
 *     if reduce_factor_ in (0, 1, 2):             # <<<<<<<<<<<<<<
 *         w4, h4 = width_ >> reduce_factor_, height_ >> reduce_factor_
 * 
 */
  switch (__pyx_v_reduce_factor_) {
    case 0:
    case 1:
    case 2:

    /* "PygameShader/shader.pyx":7316
 *     # TEXTURE DIVIDE BY POWER OF 2
 *     if reduce_factor_ in (0, 1, 2):
 *         w4, h4 = width_ >> reduce_factor_, height_ >> reduce_factor_             # <<<<<<<<<<<<<<
 * 
 *     # TEXTURE 150 x 150 * ratio
 */
    __pyx_t_1 = (__pyx_v_width_ >> __pyx_v_reduce_factor_);
    __pyx_t_2 = (__pyx_v_height_ >> __pyx_v_reduce_factor_);
    __pyx_v_w4 = __pyx_t_1;
    __pyx_v_h4 = __pyx_t_2;

    /* "PygameShader/shader.pyx":7315
 * 
 *     # TEXTURE DIVIDE BY POWER OF 2
 *     if reduce_factor_ in (0, 1, 2):             # <<<<<<<<<<<<<<
 *         w4, h4 = width_ >> reduce_factor_, height_ >> reduce_factor_
 * 
 */
    break;
    case 3:

    /* "PygameShader/shader.pyx":7321
 *     elif reduce_factor_ == 3:
 *         # CUSTOM SIZE WIDTH 150 AND RATIO * HIGH
 *         w4 = 150             # <<<<<<<<<<<<<<
 *         h4 = <int>(150 * height_/width_)
 *         low_ = <int>(low_ * low_/width_)
 */
    __pyx_v_w4 = 0x96;

    /* "PygameShader/shader.pyx":7322
 *         # CUSTOM SIZE WIDTH 150 AND RATIO * HIGH
 *         w4 = 150
 *         h4 = <int>(150 * height_/width_)             # <<<<<<<<<<<<<<
 *         low_ = <int>(low_ * low_/width_)
 *         high_ = <int>(high_ * 150/width_)
 */
    __pyx_t_3 = (0x96 * __pyx_v_height_);
    if (unlikely(__pyx_v_width_ == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 7322, __pyx_L1_error)
    }
    else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_width_ == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(1, 7322, __pyx_L1_error)
    }
    __pyx_v_h4 = ((int)__Pyx_div_long(__pyx_t_3, __pyx_v_width_));

    /* "PygameShader/shader.pyx":7323
 *         w4 = 150
 *         h4 = <int>(150 * height_/width_)
 *         low_ = <int>(low_ * low_/width_)             # <<<<<<<<<<<<<<
 *         high_ = <int>(high_ * 150/width_)
 *         reduce_factor_ = 0
 */
    __pyx_t_4 = (__pyx_v_low_ * __pyx_v_low_);
    if (unlikely(__pyx_v_width_ == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 7323, __pyx_L1_error)
    }
    __pyx_v_low_ = ((int)(__pyx_t_4 / __pyx_v_width_));

    /* "PygameShader/shader.pyx":7324
 *         h4 = <int>(150 * height_/width_)
 *         low_ = <int>(low_ * low_/width_)
 *         high_ = <int>(high_ * 150/width_)             # <<<<<<<<<<<<<<
 *         reduce_factor_ = 0
 * 
 */
    __pyx_t_3 = (__pyx_v_high_ * 0x96);
    if (unlikely(__pyx_v_width_ == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 7324, __pyx_L1_error)
    }
    else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_width_ == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(1, 7324, __pyx_L1_error)
    }
    __pyx_v_high_ = ((int)__Pyx_div_long(__pyx_t_3, __pyx_v_width_));

    /* "PygameShader/shader.pyx":7325
 *         low_ = <int>(low_ * low_/width_)
 *         high_ = <int>(high_ * 150/width_)
 *         reduce_factor_ = 0             # <<<<<<<<<<<<<<
 * 
 *     # TEXTURE 100 x 100 * ratio
 */
    __pyx_v_reduce_factor_ = 0;

    /* "PygameShader/shader.pyx":7319
 * 
 *     # TEXTURE 150 x 150 * ratio
 *     elif reduce_factor_ == 3:             # <<<<<<<<<<<<<<
 *         # CUSTOM SIZE WIDTH 150 AND RATIO * HIGH
 *         w4 = 150
 */
    break;
    case 4:

    /* "PygameShader/shader.pyx":7329
 *     # TEXTURE 100 x 100 * ratio
 *     elif reduce_factor_ == 4:
 *         w4 = 100             # <<<<<<<<<<<<<<
 *         h4 = <int> (100 * height_ / width_)
 *         low_ = <int> (low_ * low_ / width_)
 */
    __pyx_v_w4 = 0x64;

    /* "PygameShader/shader.pyx":7330
 *     elif reduce_factor_ == 4:
 *         w4 = 100
 *         h4 = <int> (100 * height_ / width_)             # <<<<<<<<<<<<<<
 *         low_ = <int> (low_ * low_ / width_)
 *         high_ = <int> (high_ * 100 / width_)
 */
    __pyx_t_3 = (0x64 * __pyx_v_height_);
    if (unlikely(__pyx_v_width_ == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 7330, __pyx_L1_error)
    }
    else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_width_ == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(1, 7330, __pyx_L1_error)
    }
    __pyx_v_h4 = ((int)__Pyx_div_long(__pyx_t_3, __pyx_v_width_));

    /* "PygameShader/shader.pyx":7331
 *         w4 = 100
 *         h4 = <int> (100 * height_ / width_)
 *         low_ = <int> (low_ * low_ / width_)             # <<<<<<<<<<<<<<
 *         high_ = <int> (high_ * 100 / width_)
 *         reduce_factor_ = 0
 */
    __pyx_t_4 = (__pyx_v_low_ * __pyx_v_low_);
    if (unlikely(__pyx_v_width_ == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 7331, __pyx_L1_error)
    }
    __pyx_v_low_ = ((int)(__pyx_t_4 / __pyx_v_width_));

    /* "PygameShader/shader.pyx":7332
 *         h4 = <int> (100 * height_ / width_)
 *         low_ = <int> (low_ * low_ / width_)
 *         high_ = <int> (high_ * 100 / width_)             # <<<<<<<<<<<<<<
 *         reduce_factor_ = 0
 * 
 */
    __pyx_t_3 = (__pyx_v_high_ * 0x64);
    if (unlikely(__pyx_v_width_ == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 7332, __pyx_L1_error)
    }
    else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_width_ == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(1, 7332, __pyx_L1_error)
    }
    __pyx_v_high_ = ((int)__Pyx_div_long(__pyx_t_3, __pyx_v_width_));

    /* "PygameShader/shader.pyx":7333
 *         low_ = <int> (low_ * low_ / width_)
 *         high_ = <int> (high_ * 100 / width_)
 *         reduce_factor_ = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int f_height, f_width
 */
    __pyx_v_reduce_factor_ = 0;

    /* "PygameShader/shader.pyx":7328
 * 
 *     # TEXTURE 100 x 100 * ratio
 *     elif reduce_factor_ == 4:             # <<<<<<<<<<<<<<
 *         w4 = 100
 *         h4 = <int> (100 * height_ / width_)
 */
    break;
    default: break;
  }

  /* "PygameShader/shader.pyx":7336
 * 
 *     cdef int f_height, f_width
 *     f_height, f_width = (<object> cloud_).shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     assert f_width >= w4 or f_height >= h4, \
 */
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_cloud_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_6, 0, 2, NULL, NULL, &__pyx_slice__24, 0, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 7336, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
    index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(1, 7336, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 7336, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7336, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7336, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_f_height = __pyx_t_2;
  __pyx_v_f_width = __pyx_t_1;

  /* "PygameShader/shader.pyx":7338
 *     f_height, f_width = (<object> cloud_).shape[:2]
 * 
 *     assert f_width >= w4 or f_height >= h4, \             # <<<<<<<<<<<<<<
 *         "Cloud array size mismatch the texture size.\n" \
 *         "Set cloud array to numpy.empty((%s, %s), dtype=numpy.float32)" % (h4, w4)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_11 = ((__pyx_v_f_width >= __pyx_v_w4) != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_10 = __pyx_t_11;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_11 = ((__pyx_v_f_height >= __pyx_v_h4) != 0);
    __pyx_t_10 = __pyx_t_11;
    __pyx_L5_bool_binop_done:;
    if (unlikely(!__pyx_t_10)) {

      /* "PygameShader/shader.pyx":7340
 *     assert f_width >= w4 or f_height >= h4, \
 *         "Cloud array size mismatch the texture size.\n" \
 *         "Set cloud array to numpy.empty((%s, %s), dtype=numpy.float32)" % (h4, w4)             # <<<<<<<<<<<<<<
 * 
 *     if surface_ is None:
 */
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7340, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7340, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7340, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
      __pyx_t_5 = 0;
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Cloud_array_size_mismatch_the_te, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7340, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_7);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(1, 7338, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":7342
 *         "Set cloud array to numpy.empty((%s, %s), dtype=numpy.float32)" % (h4, w4)
 * 
 *     if surface_ is None:             # <<<<<<<<<<<<<<
 *         cloud_surface_smallest = pygame.Surface((w4, h4)).convert()
 * 
 */
  __pyx_t_10 = (__pyx_v_surface_ == Py_None);
  __pyx_t_11 = (__pyx_t_10 != 0);
  if (__pyx_t_11) {

    /* "PygameShader/shader.pyx":7343
 * 
 *     if surface_ is None:
 *         cloud_surface_smallest = pygame.Surface((w4, h4)).convert()             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Surface); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12);
    __pyx_t_5 = 0;
    __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_12, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_13);
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_convert); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_cloud_surface_smallest = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PygameShader/shader.pyx":7342
 *         "Set cloud array to numpy.empty((%s, %s), dtype=numpy.float32)" % (h4, w4)
 * 
 *     if surface_ is None:             # <<<<<<<<<<<<<<
 *         cloud_surface_smallest = pygame.Surface((w4, h4)).convert()
 * 
 */
    goto __pyx_L7;
  }

  /* "PygameShader/shader.pyx":7346
 * 
 *     else:
 *         if PyObject_IsInstance(surface_, pygame.Surface):             # <<<<<<<<<<<<<<
 *             assert surface_.get_width() == w4 and surface_.get_height() == h4, \
 *             "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\n" \
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Surface); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_11 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_8); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 7346, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_10 = (__pyx_t_11 != 0);
    if (likely(__pyx_t_10)) {

      /* "PygameShader/shader.pyx":7347
 *     else:
 *         if PyObject_IsInstance(surface_, pygame.Surface):
 *             assert surface_.get_width() == w4 and surface_.get_height() == h4, \             # <<<<<<<<<<<<<<
 *             "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\n" \
 *             "Set argument surface_ to None to avoid this error message"\
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_width); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = PyObject_RichCompare(__pyx_t_8, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7347, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(1, 7347, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (__pyx_t_11) {
        } else {
          __pyx_t_10 = __pyx_t_11;
          goto __pyx_L9_bool_binop_done;
        }
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_height); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7347, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(1, 7347, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_10 = __pyx_t_11;
        __pyx_L9_bool_binop_done:;
        if (unlikely(!__pyx_t_10)) {

          /* "PygameShader/shader.pyx":7350
 *             "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\n" \
 *             "Set argument surface_ to None to avoid this error message"\
 *             % (w4, h4, surface_.get_width(), surface_.get_height())             # <<<<<<<<<<<<<<
 *             cloud_surface_smallest = surface_
 *         else:
 */
          __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7350, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7350, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_width); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7350, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_13, function);
            }
          }
          __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7350, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_height); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7350, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_5 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_12);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_12, function);
            }
          }
          __pyx_t_13 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7350, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7350, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_13);
          PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_13);
          __pyx_t_8 = 0;
          __pyx_t_7 = 0;
          __pyx_t_6 = 0;
          __pyx_t_13 = 0;
          __pyx_t_13 = __Pyx_PyString_Format(__pyx_kp_s_Surface_argument_has_incorrect_d, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7350, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_13);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __PYX_ERR(1, 7347, __pyx_L1_error)
        }
      }
      #endif

      /* "PygameShader/shader.pyx":7351
 *             "Set argument surface_ to None to avoid this error message"\
 *             % (w4, h4, surface_.get_width(), surface_.get_height())
 *             cloud_surface_smallest = surface_             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Argument surface_ must be a Surface type got %s " % type(surface_))
 */
      __Pyx_INCREF(__pyx_v_surface_);
      __pyx_v_cloud_surface_smallest = __pyx_v_surface_;

      /* "PygameShader/shader.pyx":7346
 * 
 *     else:
 *         if PyObject_IsInstance(surface_, pygame.Surface):             # <<<<<<<<<<<<<<
 *             assert surface_.get_width() == w4 and surface_.get_height() == h4, \
 *             "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\n" \
 */
      goto __pyx_L8;
    }

    /* "PygameShader/shader.pyx":7353
 *             cloud_surface_smallest = surface_
 *         else:
 *             raise ValueError("Argument surface_ must be a Surface type got %s " % type(surface_))             # <<<<<<<<<<<<<<
 * 
 *     rgb_array_ = cloud_surface24_c(
 */
    /*else*/ {
      __pyx_t_13 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_Surf, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7353, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7353, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_Raise(__pyx_t_12, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __PYX_ERR(1, 7353, __pyx_L1_error)
    }
    __pyx_L8:;
  }
  __pyx_L7:;

  /* "PygameShader/shader.pyx":7356
 * 
 *     rgb_array_ = cloud_surface24_c(
 *         w4, h4, <float>1.0 / factor_, palette_, cloud_, cloud_intensity_,             # <<<<<<<<<<<<<<
 *                 low_ >> reduce_factor_, high_ >> reduce_factor_)
 * 
 */
  if (unlikely(__pyx_v_factor_ == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(1, 7356, __pyx_L1_error)
  }

  /* "PygameShader/shader.pyx":7355
 *             raise ValueError("Argument surface_ must be a Surface type got %s " % type(surface_))
 * 
 *     rgb_array_ = cloud_surface24_c(             # <<<<<<<<<<<<<<
 *         w4, h4, <float>1.0 / factor_, palette_, cloud_, cloud_intensity_,
 *                 low_ >> reduce_factor_, high_ >> reduce_factor_)
 */
  __pyx_t_14.__pyx_n = 3;
  __pyx_t_14.intensity = __pyx_v_cloud_intensity_;
  __pyx_t_14.low = (__pyx_v_low_ >> __pyx_v_reduce_factor_);
  __pyx_t_14.high = (__pyx_v_high_ >> __pyx_v_reduce_factor_);
  __pyx_t_12 = __pyx_f_12PygameShader_6shader_cloud_surface24_c(__pyx_v_w4, __pyx_v_h4, (((float)1.0) / __pyx_v_factor_), __pyx_v_palette_, __pyx_v_cloud_, &__pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_v_rgb_array_ = __pyx_t_12;
  __pyx_t_12 = 0;

  /* "PygameShader/shader.pyx":7360
 * 
 *     # BRIGHTNESS SHADER
 *     if brightness_:             # <<<<<<<<<<<<<<
 *         # EXCLUDE BLACK COLORS (DEFAULT)
 *         assert -1.0 <= brightness_intensity_ <= 1.0, \
 */
  __pyx_t_10 = (__pyx_v_brightness_ != 0);
  if (__pyx_t_10) {

    /* "PygameShader/shader.pyx":7362
 *     if brightness_:
 *         # EXCLUDE BLACK COLORS (DEFAULT)
 *         assert -1.0 <= brightness_intensity_ <= 1.0, \             # <<<<<<<<<<<<<<
 *             "Argument brightness intensity must be in range [-1.0 ... 1.0]"
 *         shader_brightness24_exclude_inplace_c(rgb_array_=rgb_array_,
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_10 = (-1.0 <= __pyx_v_brightness_intensity_);
      if (__pyx_t_10) {
        __pyx_t_10 = (__pyx_v_brightness_intensity_ <= 1.0);
      }
      if (unlikely(!(__pyx_t_10 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_brightness_intensity_mu);
        __PYX_ERR(1, 7362, __pyx_L1_error)
      }
    }
    #endif

    /* "PygameShader/shader.pyx":7364
 *         assert -1.0 <= brightness_intensity_ <= 1.0, \
 *             "Argument brightness intensity must be in range [-1.0 ... 1.0]"
 *         shader_brightness24_exclude_inplace_c(rgb_array_=rgb_array_,             # <<<<<<<<<<<<<<
 *                                               shift_=brightness_intensity_, color_=(0, 0, 0))
 * 
 */
    __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_rgb_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(1, 7364, __pyx_L1_error)

    /* "PygameShader/shader.pyx":7365
 *             "Argument brightness intensity must be in range [-1.0 ... 1.0]"
 *         shader_brightness24_exclude_inplace_c(rgb_array_=rgb_array_,
 *                                               shift_=brightness_intensity_, color_=(0, 0, 0))             # <<<<<<<<<<<<<<
 * 
 *     if blur_:
 */
    __pyx_t_16.__pyx_n = 2;
    __pyx_t_16.shift_ = __pyx_v_brightness_intensity_;
    __pyx_t_16.color_ = __pyx_tuple__9;
    __pyx_f_12PygameShader_6shader_shader_brightness24_exclude_inplace_c(__pyx_t_15, &__pyx_t_16); 
    __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
    __pyx_t_15.memview = NULL;
    __pyx_t_15.data = NULL;

    /* "PygameShader/shader.pyx":7360
 * 
 *     # BRIGHTNESS SHADER
 *     if brightness_:             # <<<<<<<<<<<<<<
 *         # EXCLUDE BLACK COLORS (DEFAULT)
 *         assert -1.0 <= brightness_intensity_ <= 1.0, \
 */
  }

  /* "PygameShader/shader.pyx":7367
 *                                               shift_=brightness_intensity_, color_=(0, 0, 0))
 * 
 *     if blur_:             # <<<<<<<<<<<<<<
 *         shader_blur5x5_array24_inplace_c(rgb_array_)
 * 
 */
  __pyx_t_10 = (__pyx_v_blur_ != 0);
  if (__pyx_t_10) {

    /* "PygameShader/shader.pyx":7368
 * 
 *     if blur_:
 *         shader_blur5x5_array24_inplace_c(rgb_array_)             # <<<<<<<<<<<<<<
 * 
 *     if transpose_:
 */
    __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_rgb_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(1, 7368, __pyx_L1_error)
    __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_15, NULL);
    __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
    __pyx_t_15.memview = NULL;
    __pyx_t_15.data = NULL;

    /* "PygameShader/shader.pyx":7367
 *                                               shift_=brightness_intensity_, color_=(0, 0, 0))
 * 
 *     if blur_:             # <<<<<<<<<<<<<<
 *         shader_blur5x5_array24_inplace_c(rgb_array_)
 * 
 */
  }

  /* "PygameShader/shader.pyx":7370
 *         shader_blur5x5_array24_inplace_c(rgb_array_)
 * 
 *     if transpose_:             # <<<<<<<<<<<<<<
 *         rgb_array_ = rgb_array_.transpose(1, 0, 2)
 *         cloud_surface_smallest = make_surface(rgb_array_)
 */
  __pyx_t_10 = (__pyx_v_transpose_ != 0);
  if (__pyx_t_10) {

    /* "PygameShader/shader.pyx":7371
 * 
 *     if transpose_:
 *         rgb_array_ = rgb_array_.transpose(1, 0, 2)             # <<<<<<<<<<<<<<
 *         cloud_surface_smallest = make_surface(rgb_array_)
 *     else:
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_rgb_array_, __pyx_n_s_transpose_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF_SET(__pyx_v_rgb_array_, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "PygameShader/shader.pyx":7372
 *     if transpose_:
 *         rgb_array_ = rgb_array_.transpose(1, 0, 2)
 *         cloud_surface_smallest = make_surface(rgb_array_)             # <<<<<<<<<<<<<<
 *     else:
 *         # CONVERT THE ARRAY INTO A PYGAME SURFACE
 */
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    __pyx_t_13 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_6, __pyx_v_rgb_array_) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_rgb_array_);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF_SET(__pyx_v_cloud_surface_smallest, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "PygameShader/shader.pyx":7370
 *         shader_blur5x5_array24_inplace_c(rgb_array_)
 * 
 *     if transpose_:             # <<<<<<<<<<<<<<
 *         rgb_array_ = rgb_array_.transpose(1, 0, 2)
 *         cloud_surface_smallest = make_surface(rgb_array_)
 */
    goto __pyx_L13;
  }

  /* "PygameShader/shader.pyx":7375
 *     else:
 *         # CONVERT THE ARRAY INTO A PYGAME SURFACE
 *         array_to_surface(cloud_surface_smallest, rgb_array_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_array_to_surface); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_6 = NULL;
    __pyx_t_1 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
        __pyx_t_1 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_cloud_surface_smallest, __pyx_v_rgb_array_};
      __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7375, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_13);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_cloud_surface_smallest, __pyx_v_rgb_array_};
      __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7375, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_13);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7375, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_v_cloud_surface_smallest);
      __Pyx_GIVEREF(__pyx_v_cloud_surface_smallest);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_1, __pyx_v_cloud_surface_smallest);
      __Pyx_INCREF(__pyx_v_rgb_array_);
      __Pyx_GIVEREF(__pyx_v_rgb_array_);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_1, __pyx_v_rgb_array_);
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_7, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7375, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  }
  __pyx_L13:;

  /* "PygameShader/shader.pyx":7379
 * 
 *     # BLOOM SHADER EFFECT
 *     if bloom_:             # <<<<<<<<<<<<<<
 *         assert 0 <= bpf_threshold_ < 256, \
 *             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_
 */
  __pyx_t_10 = (__pyx_v_bloom_ != 0);
  if (__pyx_t_10) {

    /* "PygameShader/shader.pyx":7380
 *     # BLOOM SHADER EFFECT
 *     if bloom_:
 *         assert 0 <= bpf_threshold_ < 256, \             # <<<<<<<<<<<<<<
 *             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_
 *         shader_bloom_effect_array24_c(cloud_surface_smallest, bpf_threshold_, fast_=fast_bloom_)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_10 = (0 <= __pyx_v_bpf_threshold_);
      if (__pyx_t_10) {
        __pyx_t_10 = (__pyx_v_bpf_threshold_ < 0x100);
      }
      if (unlikely(!(__pyx_t_10 != 0))) {

        /* "PygameShader/shader.pyx":7381
 *     if bloom_:
 *         assert 0 <= bpf_threshold_ < 256, \
 *             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_             # <<<<<<<<<<<<<<
 *         shader_bloom_effect_array24_c(cloud_surface_smallest, bpf_threshold_, fast_=fast_bloom_)
 * 
 */
        __pyx_t_13 = __Pyx_PyInt_From_unsigned_short(__pyx_v_bpf_threshold_); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7381, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_12 = __Pyx_PyString_Format(__pyx_kp_s_Argument_bpf_threshold__must_be, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7381, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        PyErr_SetObject(PyExc_AssertionError, __pyx_t_12);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __PYX_ERR(1, 7380, __pyx_L1_error)
      }
    }
    #endif

    /* "PygameShader/shader.pyx":7382
 *         assert 0 <= bpf_threshold_ < 256, \
 *             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_
 *         shader_bloom_effect_array24_c(cloud_surface_smallest, bpf_threshold_, fast_=fast_bloom_)             # <<<<<<<<<<<<<<
 * 
 *     # RESCALE THE SURFACE TO THE FULL SIZE
 */
    __pyx_t_17.__pyx_n = 1;
    __pyx_t_17.fast_ = __pyx_v_fast_bloom_;
    __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(__pyx_v_cloud_surface_smallest, __pyx_v_bpf_threshold_, &__pyx_t_17); 

    /* "PygameShader/shader.pyx":7379
 * 
 *     # BLOOM SHADER EFFECT
 *     if bloom_:             # <<<<<<<<<<<<<<
 *         assert 0 <= bpf_threshold_ < 256, \
 *             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_
 */
  }

  /* "PygameShader/shader.pyx":7385
 * 
 *     # RESCALE THE SURFACE TO THE FULL SIZE
 *     if smooth_:             # <<<<<<<<<<<<<<
 *         cloud_effect = smoothscale(cloud_surface_smallest, (width_, height_))
 *     else:
 */
  __pyx_t_10 = (__pyx_v_smooth_ != 0);
  if (__pyx_t_10) {

    /* "PygameShader/shader.pyx":7386
 *     # RESCALE THE SURFACE TO THE FULL SIZE
 *     if smooth_:
 *         cloud_effect = smoothscale(cloud_surface_smallest, (width_, height_))             # <<<<<<<<<<<<<<
 *     else:
 *         cloud_effect = scale(cloud_surface_smallest, (width_, height_))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_width_); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_height_); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
    __pyx_t_7 = 0;
    __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_1 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
        __pyx_t_1 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_cloud_surface_smallest, __pyx_t_8};
      __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7386, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_cloud_surface_smallest, __pyx_t_8};
      __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7386, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7386, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_v_cloud_surface_smallest);
      __Pyx_GIVEREF(__pyx_v_cloud_surface_smallest);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_1, __pyx_v_cloud_surface_smallest);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_1, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_7, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7386, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_cloud_effect = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "PygameShader/shader.pyx":7385
 * 
 *     # RESCALE THE SURFACE TO THE FULL SIZE
 *     if smooth_:             # <<<<<<<<<<<<<<
 *         cloud_effect = smoothscale(cloud_surface_smallest, (width_, height_))
 *     else:
 */
    goto __pyx_L15;
  }

  /* "PygameShader/shader.pyx":7388
 *         cloud_effect = smoothscale(cloud_surface_smallest, (width_, height_))
 *     else:
 *         cloud_effect = scale(cloud_surface_smallest, (width_, height_))             # <<<<<<<<<<<<<<
 * 
 *     return cloud_effect
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_scale); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_width_); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_height_); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8);
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_1 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
        __pyx_t_1 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_cloud_surface_smallest, __pyx_t_6};
      __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7388, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_cloud_surface_smallest, __pyx_t_6};
      __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7388, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_v_cloud_surface_smallest);
      __Pyx_GIVEREF(__pyx_v_cloud_surface_smallest);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_1, __pyx_v_cloud_surface_smallest);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_7, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_cloud_effect = __pyx_t_12;
    __pyx_t_12 = 0;
  }
  __pyx_L15:;

  /* "PygameShader/shader.pyx":7390
 *         cloud_effect = scale(cloud_surface_smallest, (width_, height_))
 * 
 *     return cloud_effect             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_cloud_effect);
  __pyx_r = __pyx_v_cloud_effect;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":7114
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cdef inline shader_cloud_effect_c(             # <<<<<<<<<<<<<<
 *         int width_,
 *         int height_,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
  __Pyx_AddTraceback("PygameShader.shader.shader_cloud_effect_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cloud_surface_smallest);
  __Pyx_XDECREF(__pyx_v_rgb_array_);
  __Pyx_XDECREF(__pyx_v_cloud_effect);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":7398
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline mirroring_c(unsigned char[:, :, :] rgb_array_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_mirroring_c(__Pyx_memviewslice __pyx_v_rgb_array_) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_x2;
  int __pyx_v_x3;
  int __pyx_v_x;
  int __pyx_v_y;
  __Pyx_memviewslice __pyx_v_new_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mirroring_c", 0);

  /* "PygameShader/shader.pyx":7418
 *         Py_ssize_t w, h
 *         int x2, x3
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":7423
 *     cdef:
 *         int x, y
 *         unsigned char [:, :, :] new_array = empty((w, h, 3), uint8)             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_3);
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_uint8); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_8, __pyx_t_7};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7423, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_8, __pyx_t_7};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7423, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
    __pyx_t_8 = 0;
    __pyx_t_7 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 7423, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_new_array = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "PygameShader/shader.pyx":7428
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":7429
 * 
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for y in range(h):
 * 
 */
        __pyx_t_3 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_12 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_r) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_x3) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_12; __pyx_t_2++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_x2 = ((int)0xbad0bad0);
                            __pyx_v_x3 = ((int)0xbad0bad0);
                            __pyx_v_y = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":7430
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):             # <<<<<<<<<<<<<<
 * 
 *                 r = &rgb_array_[x, y, 0]
 */
                            __pyx_t_13 = __pyx_v_h;
                            __pyx_t_14 = __pyx_t_13;
                            for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_14; __pyx_t_9+=1) {
                              __pyx_v_y = __pyx_t_9;

                              /* "PygameShader/shader.pyx":7432
 *             for y in range(h):
 * 
 *                 r = &rgb_array_[x, y, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array_[x, y, 1]
 *                 b = &rgb_array_[x, y, 2]
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_17 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7433
 * 
 *                 r = &rgb_array_[x, y, 0]
 *                 g = &rgb_array_[x, y, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array_[x, y, 2]
 * 
 */
                              __pyx_t_17 = __pyx_v_x;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_15 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_17 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7434
 *                 r = &rgb_array_[x, y, 0]
 *                 g = &rgb_array_[x, y, 1]
 *                 b = &rgb_array_[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 *                 x2 = x >> 1
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_17 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7436
 *                 b = &rgb_array_[x, y, 2]
 * 
 *                 x2 = x >> 1             # <<<<<<<<<<<<<<
 *                 new_array[x2, y, 0] = r[0]
 *                 new_array[x2, y, 1] = g[0]
 */
                              __pyx_v_x2 = (__pyx_v_x >> 1);

                              /* "PygameShader/shader.pyx":7437
 * 
 *                 x2 = x >> 1
 *                 new_array[x2, y, 0] = r[0]             # <<<<<<<<<<<<<<
 *                 new_array[x2, y, 1] = g[0]
 *                 new_array[x2, y, 2] = b[0]
 */
                              __pyx_t_17 = __pyx_v_x2;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_15 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_17 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_15 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_r[0]);

                              /* "PygameShader/shader.pyx":7438
 *                 x2 = x >> 1
 *                 new_array[x2, y, 0] = r[0]
 *                 new_array[x2, y, 1] = g[0]             # <<<<<<<<<<<<<<
 *                 new_array[x2, y, 2] = b[0]
 *                 x3 = <int>w - x2 -1
 */
                              __pyx_t_15 = __pyx_v_x2;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_17 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_15 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_17 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_g[0]);

                              /* "PygameShader/shader.pyx":7439
 *                 new_array[x2, y, 0] = r[0]
 *                 new_array[x2, y, 1] = g[0]
 *                 new_array[x2, y, 2] = b[0]             # <<<<<<<<<<<<<<
 *                 x3 = <int>w - x2 -1
 *                 new_array[x3, y, 0] = r[0]
 */
                              __pyx_t_17 = __pyx_v_x2;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_15 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_17 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_15 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_b[0]);

                              /* "PygameShader/shader.pyx":7440
 *                 new_array[x2, y, 1] = g[0]
 *                 new_array[x2, y, 2] = b[0]
 *                 x3 = <int>w - x2 -1             # <<<<<<<<<<<<<<
 *                 new_array[x3, y, 0] = r[0]
 *                 new_array[x3, y, 1] = g[0]
 */
                              __pyx_v_x3 = ((((int)__pyx_v_w) - __pyx_v_x2) - 1);

                              /* "PygameShader/shader.pyx":7441
 *                 new_array[x2, y, 2] = b[0]
 *                 x3 = <int>w - x2 -1
 *                 new_array[x3, y, 0] = r[0]             # <<<<<<<<<<<<<<
 *                 new_array[x3, y, 1] = g[0]
 *                 new_array[x3, y, 2] = b[0]
 */
                              __pyx_t_15 = __pyx_v_x3;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_17 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_15 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_17 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_r[0]);

                              /* "PygameShader/shader.pyx":7442
 *                 x3 = <int>w - x2 -1
 *                 new_array[x3, y, 0] = r[0]
 *                 new_array[x3, y, 1] = g[0]             # <<<<<<<<<<<<<<
 *                 new_array[x3, y, 2] = b[0]
 * 
 */
                              __pyx_t_17 = __pyx_v_x3;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_15 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_17 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_15 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_g[0]);

                              /* "PygameShader/shader.pyx":7443
 *                 new_array[x3, y, 0] = r[0]
 *                 new_array[x3, y, 1] = g[0]
 *                 new_array[x3, y, 2] = b[0]             # <<<<<<<<<<<<<<
 * 
 *     return asarray(new_array)
 */
                              __pyx_t_15 = __pyx_v_x3;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_17 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_15 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_17 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_b[0]);
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":7428
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":7445
 *                 new_array[x3, y, 2] = b[0]
 * 
 *     return asarray(new_array)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = __pyx_memoryview_fromslice(__pyx_v_new_array, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_10);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":7398
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline mirroring_c(unsigned char[:, :, :] rgb_array_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_AddTraceback("PygameShader.shader.mirroring_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_new_array, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":7453
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline mirroring_inplace_c(unsigned char[:, :, :] rgb_array_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_mirroring_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  int __pyx_v_x2;
  int __pyx_v_x3;
  int __pyx_v_x;
  int __pyx_v_y;
  __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mirroring_inplace_c", 0);

  /* "PygameShader/shader.pyx":7472
 *         Py_ssize_t w, h
 *         int x2, x3
 *     w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":7476
 *     cdef:
 *         int x, y
 *         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=True)             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 7476, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 7476, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_rgb_array_copy = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":7481
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":7482
 * 
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for y in range(h):
 * 
 */
        __pyx_t_3 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_9 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_r) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_x3) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_x2 = ((int)0xbad0bad0);
                            __pyx_v_x3 = ((int)0xbad0bad0);
                            __pyx_v_y = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":7483
 *     with nogil:
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):             # <<<<<<<<<<<<<<
 * 
 *                 r = &rgb_array_copy[x, y, 0]
 */
                            __pyx_t_10 = __pyx_v_h;
                            __pyx_t_11 = __pyx_t_10;
                            for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                              __pyx_v_y = __pyx_t_12;

                              /* "PygameShader/shader.pyx":7485
 *             for y in range(h):
 * 
 *                 r = &rgb_array_copy[x, y, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array_copy[x, y, 1]
 *                 b = &rgb_array_copy[x, y, 2]
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7486
 * 
 *                 r = &rgb_array_copy[x, y, 0]
 *                 g = &rgb_array_copy[x, y, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array_copy[x, y, 2]
 * 
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7487
 *                 r = &rgb_array_copy[x, y, 0]
 *                 g = &rgb_array_copy[x, y, 1]
 *                 b = &rgb_array_copy[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 *                 x2 = x >> 1
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7489
 *                 b = &rgb_array_copy[x, y, 2]
 * 
 *                 x2 = x >> 1             # <<<<<<<<<<<<<<
 *                 rgb_array_[x2, y, 0] = r[0]
 *                 rgb_array_[x2, y, 1] = g[0]
 */
                              __pyx_v_x2 = (__pyx_v_x >> 1);

                              /* "PygameShader/shader.pyx":7490
 * 
 *                 x2 = x >> 1
 *                 rgb_array_[x2, y, 0] = r[0]             # <<<<<<<<<<<<<<
 *                 rgb_array_[x2, y, 1] = g[0]
 *                 rgb_array_[x2, y, 2] = b[0]
 */
                              __pyx_t_15 = __pyx_v_x2;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_r[0]);

                              /* "PygameShader/shader.pyx":7491
 *                 x2 = x >> 1
 *                 rgb_array_[x2, y, 0] = r[0]
 *                 rgb_array_[x2, y, 1] = g[0]             # <<<<<<<<<<<<<<
 *                 rgb_array_[x2, y, 2] = b[0]
 * 
 */
                              __pyx_t_13 = __pyx_v_x2;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_g[0]);

                              /* "PygameShader/shader.pyx":7492
 *                 rgb_array_[x2, y, 0] = r[0]
 *                 rgb_array_[x2, y, 1] = g[0]
 *                 rgb_array_[x2, y, 2] = b[0]             # <<<<<<<<<<<<<<
 * 
 *                 x3 = <int>w - x2 - 1
 */
                              __pyx_t_15 = __pyx_v_x2;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_b[0]);

                              /* "PygameShader/shader.pyx":7494
 *                 rgb_array_[x2, y, 2] = b[0]
 * 
 *                 x3 = <int>w - x2 - 1             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x3, y, 0] = r[0]
 */
                              __pyx_v_x3 = ((((int)__pyx_v_w) - __pyx_v_x2) - 1);

                              /* "PygameShader/shader.pyx":7496
 *                 x3 = <int>w - x2 - 1
 * 
 *                 rgb_array_[x3, y, 0] = r[0]             # <<<<<<<<<<<<<<
 *                 rgb_array_[x3, y, 1] = g[0]
 *                 rgb_array_[x3, y, 2] = b[0]
 */
                              __pyx_t_13 = __pyx_v_x3;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_r[0]);

                              /* "PygameShader/shader.pyx":7497
 * 
 *                 rgb_array_[x3, y, 0] = r[0]
 *                 rgb_array_[x3, y, 1] = g[0]             # <<<<<<<<<<<<<<
 *                 rgb_array_[x3, y, 2] = b[0]
 * 
 */
                              __pyx_t_15 = __pyx_v_x3;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_g[0]);

                              /* "PygameShader/shader.pyx":7498
 *                 rgb_array_[x3, y, 0] = r[0]
 *                 rgb_array_[x3, y, 1] = g[0]
 *                 rgb_array_[x3, y, 2] = b[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_13 = __pyx_v_x3;
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_b[0]);
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":7481
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for x in prange(w, schedule='static', num_threads=THREADS):
 *             for y in range(h):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":7453
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline mirroring_inplace_c(unsigned char[:, :, :] rgb_array_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_AddTraceback("PygameShader.shader.mirroring_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":7505
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple dampening(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int frame_,
 */

static PyObject *__pyx_pw_12PygameShader_6shader_161dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12PygameShader_6shader_dampening(PyObject *__pyx_v_surface_, int __pyx_v_frame_, int __pyx_v_display_width, int __pyx_v_display_height_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dampening *__pyx_optional_args) {
  float __pyx_v_amplitude_ = ((float)50.0);
  int __pyx_v_duration_ = ((int)30);
  float __pyx_v_freq_ = ((float)20.0);
  float __pyx_v_t;
  int __pyx_v_width;
  int __pyx_v_height;
  float __pyx_v_tm;
  PyObject *__pyx_v_surf = 0;
  int __pyx_v_new_width;
  int __pyx_v_new_height;
  int __pyx_v_diff_x;
  int __pyx_v_diff_y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dampening", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_amplitude_ = __pyx_optional_args->amplitude_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_duration_ = __pyx_optional_args->duration_;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_freq_ = __pyx_optional_args->freq_;
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":7543
 *     """
 * 
 *     assert freq_ > 0.0, "Argument freq_ must be > 0"             # <<<<<<<<<<<<<<
 *     assert duration_ > 0.0, "Argument duration_ must be > 0"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_freq_ > 0.0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_freq__must_be_0);
      __PYX_ERR(1, 7543, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":7544
 * 
 *     assert freq_ > 0.0, "Argument freq_ must be > 0"
 *     assert duration_ > 0.0, "Argument duration_ must be > 0"             # <<<<<<<<<<<<<<
 * 
 *     cdef float t = damped_oscillation((frame_ / freq_) % duration_)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_duration_ > 0.0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_duration__must_be_0);
      __PYX_ERR(1, 7544, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":7546
 *     assert duration_ > 0.0, "Argument duration_ must be > 0"
 * 
 *     cdef float t = damped_oscillation((frame_ / freq_) % duration_)             # <<<<<<<<<<<<<<
 *     cdef int width, height,
 *     cdef float tm = t * amplitude_
 */
  __pyx_v_t = __pyx_f_12PygameShader_6shader_damped_oscillation(fmodf((__pyx_v_frame_ / __pyx_v_freq_), __pyx_v_duration_));

  /* "PygameShader/shader.pyx":7548
 *     cdef float t = damped_oscillation((frame_ / freq_) % duration_)
 *     cdef int width, height,
 *     cdef float tm = t * amplitude_             # <<<<<<<<<<<<<<
 * 
 *     width, height = surface_.get_size()
 */
  __pyx_v_tm = (__pyx_v_t * __pyx_v_amplitude_);

  /* "PygameShader/shader.pyx":7550
 *     cdef float tm = t * amplitude_
 * 
 *     width, height = surface_.get_size()             # <<<<<<<<<<<<<<
 * 
 *     if width + tm < 0:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 7550, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 7550, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 7550, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7550, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7550, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_width = __pyx_t_6;
  __pyx_v_height = __pyx_t_7;

  /* "PygameShader/shader.pyx":7552
 *     width, height = surface_.get_size()
 * 
 *     if width + tm < 0:             # <<<<<<<<<<<<<<
 *         tm = 0
 *     if height + tm < 0:
 */
  __pyx_t_8 = (((__pyx_v_width + __pyx_v_tm) < 0.0) != 0);
  if (__pyx_t_8) {

    /* "PygameShader/shader.pyx":7553
 * 
 *     if width + tm < 0:
 *         tm = 0             # <<<<<<<<<<<<<<
 *     if height + tm < 0:
 *         tm = 0
 */
    __pyx_v_tm = 0.0;

    /* "PygameShader/shader.pyx":7552
 *     width, height = surface_.get_size()
 * 
 *     if width + tm < 0:             # <<<<<<<<<<<<<<
 *         tm = 0
 *     if height + tm < 0:
 */
  }

  /* "PygameShader/shader.pyx":7554
 *     if width + tm < 0:
 *         tm = 0
 *     if height + tm < 0:             # <<<<<<<<<<<<<<
 *         tm = 0
 *     cdef object surf = smoothscale(surface_, (<int>tm +<int> (width + <int>tm),
 */
  __pyx_t_8 = (((__pyx_v_height + __pyx_v_tm) < 0.0) != 0);
  if (__pyx_t_8) {

    /* "PygameShader/shader.pyx":7555
 *         tm = 0
 *     if height + tm < 0:
 *         tm = 0             # <<<<<<<<<<<<<<
 *     cdef object surf = smoothscale(surface_, (<int>tm +<int> (width + <int>tm),
 *                                               <int>tm +<int> (height + <int>tm)))
 */
    __pyx_v_tm = 0.0;

    /* "PygameShader/shader.pyx":7554
 *     if width + tm < 0:
 *         tm = 0
 *     if height + tm < 0:             # <<<<<<<<<<<<<<
 *         tm = 0
 *     cdef object surf = smoothscale(surface_, (<int>tm +<int> (width + <int>tm),
 */
  }

  /* "PygameShader/shader.pyx":7556
 *     if height + tm < 0:
 *         tm = 0
 *     cdef object surf = smoothscale(surface_, (<int>tm +<int> (width + <int>tm),             # <<<<<<<<<<<<<<
 *                                               <int>tm +<int> (height + <int>tm)))
 *     cdef int new_width, new_height
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyInt_From_int((((int)__pyx_v_tm) + ((int)(__pyx_v_width + ((int)__pyx_v_tm))))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "PygameShader/shader.pyx":7557
 *         tm = 0
 *     cdef object surf = smoothscale(surface_, (<int>tm +<int> (width + <int>tm),
 *                                               <int>tm +<int> (height + <int>tm)))             # <<<<<<<<<<<<<<
 *     cdef int new_width, new_height
 *     new_width, new_height = surf.get_size()
 */
  __pyx_t_4 = __Pyx_PyInt_From_int((((int)__pyx_v_tm) + ((int)(__pyx_v_height + ((int)__pyx_v_tm))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PygameShader/shader.pyx":7556
 *     if height + tm < 0:
 *         tm = 0
 *     cdef object surf = smoothscale(surface_, (<int>tm +<int> (width + <int>tm),             # <<<<<<<<<<<<<<
 *                                               <int>tm +<int> (height + <int>tm)))
 *     cdef int new_width, new_height
 */
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface_, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7556, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface_, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7556, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_surface_);
    __Pyx_GIVEREF(__pyx_v_surface_);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_v_surface_);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_surf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":7559
 *                                               <int>tm +<int> (height + <int>tm)))
 *     cdef int new_width, new_height
 *     new_width, new_height = surf.get_size()             # <<<<<<<<<<<<<<
 * 
 *     cdef int diff_x = display_width - new_width
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surf, __pyx_n_s_get_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 7559, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_9), 2) < 0) __PYX_ERR(1, 7559, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 7559, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7559, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7559, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_new_width = __pyx_t_7;
  __pyx_v_new_height = __pyx_t_6;

  /* "PygameShader/shader.pyx":7561
 *     new_width, new_height = surf.get_size()
 * 
 *     cdef int diff_x = display_width - new_width             # <<<<<<<<<<<<<<
 *     cdef int diff_y = display_height_ - new_height
 * 
 */
  __pyx_v_diff_x = (__pyx_v_display_width - __pyx_v_new_width);

  /* "PygameShader/shader.pyx":7562
 * 
 *     cdef int diff_x = display_width - new_width
 *     cdef int diff_y = display_height_ - new_height             # <<<<<<<<<<<<<<
 * 
 *     return surf, diff_x >> 1, diff_y >> 1
 */
  __pyx_v_diff_y = (__pyx_v_display_height_ - __pyx_v_new_height);

  /* "PygameShader/shader.pyx":7564
 *     cdef int diff_y = display_height_ - new_height
 * 
 *     return surf, diff_x >> 1, diff_y >> 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_diff_x >> 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_diff_y >> 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_surf);
  __Pyx_GIVEREF(__pyx_v_surf);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_surf);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":7505
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef tuple dampening(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int frame_,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("PygameShader.shader.dampening", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_surf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_161dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_160dampening[] = "\n    DAMPENING EFFECT\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    Compatible with image 24-32 bit\n    The length of the effect equal duration_ * freq_\n\n    e.g :\n    surf, xx, yy = dampening(BCK, frame, width, height,\n    amplitude_=100, duration_=40, freq_=15)\n    SCREEN.blit(surf, (xx, yy))\n\n    :param surface_       : pygame.Surface (compatible 24 - 32 bit)\n    :param frame_         : integer; Frame number (linear variable changing overtime)\n    :param display_width  : integer; Size of your game display (width)\n    :param display_height_: integer; size of your game display (height)\n    :param amplitude_     : float; Amplitude of the dampening effect  (default is 50)\n    :param duration_      : integer; Duration of the effect (default value is 30)\n    :param freq_          : float; change the speed of the effect default value is 20.0.\n    A small value will decrease\n    the overall timing of the effect while a larger value will increase the duration of the effect.\n    :return               : Tuple values containing the Surface and the position (x, y)\n    with x & y are the top\n     left corner of the\n    image\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_161dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surface_ = 0;
  int __pyx_v_frame_;
  int __pyx_v_display_width;
  int __pyx_v_display_height_;
  float __pyx_v_amplitude_;
  int __pyx_v_duration_;
  float __pyx_v_freq_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dampening (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_frame_2,&__pyx_n_s_display_width,&__pyx_n_s_display_height,&__pyx_n_s_amplitude,&__pyx_n_s_duration,&__pyx_n_s_freq,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dampening", 0, 4, 7, 1); __PYX_ERR(1, 7505, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_display_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dampening", 0, 4, 7, 2); __PYX_ERR(1, 7505, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_display_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dampening", 0, 4, 7, 3); __PYX_ERR(1, 7505, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amplitude);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_duration);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freq);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dampening") < 0)) __PYX_ERR(1, 7505, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surface_ = values[0];
    __pyx_v_frame_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_frame_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7507, __pyx_L3_error)
    __pyx_v_display_width = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_display_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7508, __pyx_L3_error)
    __pyx_v_display_height_ = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_display_height_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7509, __pyx_L3_error)
    if (values[4]) {
      __pyx_v_amplitude_ = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_amplitude_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 7510, __pyx_L3_error)
    } else {
      __pyx_v_amplitude_ = ((float)50.0);
    }
    if (values[5]) {
      __pyx_v_duration_ = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_duration_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7511, __pyx_L3_error)
    } else {
      __pyx_v_duration_ = ((int)30);
    }
    if (values[6]) {
      __pyx_v_freq_ = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_freq_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 7512, __pyx_L3_error)
    } else {
      __pyx_v_freq_ = ((float)20.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dampening", 0, 4, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 7505, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.dampening", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_160dampening(__pyx_self, __pyx_v_surface_, __pyx_v_frame_, __pyx_v_display_width, __pyx_v_display_height_, __pyx_v_amplitude_, __pyx_v_duration_, __pyx_v_freq_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_160dampening(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_frame_, int __pyx_v_display_width, int __pyx_v_display_height_, float __pyx_v_amplitude_, int __pyx_v_duration_, float __pyx_v_freq_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12PygameShader_6shader_dampening __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dampening", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.amplitude_ = __pyx_v_amplitude_;
  __pyx_t_2.duration_ = __pyx_v_duration_;
  __pyx_t_2.freq_ = __pyx_v_freq_;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_dampening(__pyx_v_surface_, __pyx_v_frame_, __pyx_v_display_width, __pyx_v_display_height_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("PygameShader.shader.dampening", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":7571
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cpdef inline float lateral_dampening(int frame_, float amplitude_=50.0,             # <<<<<<<<<<<<<<
 *                                      int duration_=30, float freq_=20.0):
 *     """
 */

static PyObject *__pyx_pw_12PygameShader_6shader_163lateral_dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE float __pyx_f_12PygameShader_6shader_lateral_dampening(int __pyx_v_frame_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_lateral_dampening *__pyx_optional_args) {
  float __pyx_v_amplitude_ = ((float)50.0);
  int __pyx_v_duration_ = ((int)30);
  float __pyx_v_freq_ = ((float)20.0);
  float __pyx_v_t;
  float __pyx_r;
  __Pyx_RefNannyDeclarations
  float __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lateral_dampening", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_amplitude_ = __pyx_optional_args->amplitude_;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_duration_ = __pyx_optional_args->duration_;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_freq_ = __pyx_optional_args->freq_;
        }
      }
    }
  }

  /* "PygameShader/shader.pyx":7597
 *     :return          : Return a float corresponding to the lateral displacement (x)
 *     """
 *     assert freq_ > 0, "Argument freq_ must be > 0"             # <<<<<<<<<<<<<<
 *     assert duration_ > 0, "Argument duration_ must be > 0"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_freq_ > 0.0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_freq__must_be_0);
      __PYX_ERR(1, 7597, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":7598
 *     """
 *     assert freq_ > 0, "Argument freq_ must be > 0"
 *     assert duration_ > 0, "Argument duration_ must be > 0"             # <<<<<<<<<<<<<<
 * 
 *     cdef float t = damped_oscillation((<float>frame_ / freq_) % duration_) * amplitude_
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_duration_ > 0) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_duration__must_be_0);
      __PYX_ERR(1, 7598, __pyx_L1_error)
    }
  }
  #endif

  /* "PygameShader/shader.pyx":7600
 *     assert duration_ > 0, "Argument duration_ must be > 0"
 * 
 *     cdef float t = damped_oscillation((<float>frame_ / freq_) % duration_) * amplitude_             # <<<<<<<<<<<<<<
 *     return t
 * 
 */
  if (unlikely(__pyx_v_freq_ == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(1, 7600, __pyx_L1_error)
  }
  __pyx_t_1 = (((float)__pyx_v_frame_) / __pyx_v_freq_);
  if (unlikely(__pyx_v_duration_ == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
    __PYX_ERR(1, 7600, __pyx_L1_error)
  }
  __pyx_v_t = (__pyx_f_12PygameShader_6shader_damped_oscillation(__Pyx_mod_float(__pyx_t_1, __pyx_v_duration_)) * __pyx_v_amplitude_);

  /* "PygameShader/shader.pyx":7601
 * 
 *     cdef float t = damped_oscillation((<float>frame_ / freq_) % duration_) * amplitude_
 *     return t             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------------------------------------------
 */
  __pyx_r = __pyx_v_t;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":7571
 * @cython.nonecheck(False)
 * @cython.cdivision(False)
 * cpdef inline float lateral_dampening(int frame_, float amplitude_=50.0,             # <<<<<<<<<<<<<<
 *                                      int duration_=30, float freq_=20.0):
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("PygameShader.shader.lateral_dampening", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12PygameShader_6shader_163lateral_dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12PygameShader_6shader_162lateral_dampening[] = "\n    DAMPENING EFFECT\n\n    * This method return the lateral displacement (x)\n\n    e.g:\n    tm = lateral_dampening(frame, amplitude_=50.0, duration_=35, freq_=5.0)\n    SCREEN.blit(BCK, (tm, 0), special_flags=0)\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    The length of the effect equal duration_ * freq_\n\n    :param frame_    : integer; Your game frame number\n    :param amplitude_: float; Represent the amplitude of the dampening effect.\n                       An amplitude of 1.0 will have no effect.Default value is 50.0\n    :param duration_ : float; This represent the duration of the effect, default value is 30\n    :param freq_     : float; change the speed of the effect default value is 20.0.\n                       A small value will decrease\n                       the overall timing of the effect while a larger value will increase the \n                       duration of the effect.\n    :return          : Return a float corresponding to the lateral displacement (x)\n    ";
static PyObject *__pyx_pw_12PygameShader_6shader_163lateral_dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_frame_;
  float __pyx_v_amplitude_;
  int __pyx_v_duration_;
  float __pyx_v_freq_;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lateral_dampening (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame_2,&__pyx_n_s_amplitude,&__pyx_n_s_duration,&__pyx_n_s_freq,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amplitude);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_duration);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freq);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lateral_dampening") < 0)) __PYX_ERR(1, 7571, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_frame_ = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_frame_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7571, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_amplitude_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_amplitude_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 7571, __pyx_L3_error)
    } else {
      __pyx_v_amplitude_ = ((float)50.0);
    }
    if (values[2]) {
      __pyx_v_duration_ = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_duration_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7572, __pyx_L3_error)
    } else {
      __pyx_v_duration_ = ((int)30);
    }
    if (values[3]) {
      __pyx_v_freq_ = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_freq_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 7572, __pyx_L3_error)
    } else {
      __pyx_v_freq_ = ((float)20.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lateral_dampening", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 7571, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("PygameShader.shader.lateral_dampening", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12PygameShader_6shader_162lateral_dampening(__pyx_self, __pyx_v_frame_, __pyx_v_amplitude_, __pyx_v_duration_, __pyx_v_freq_);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12PygameShader_6shader_162lateral_dampening(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_frame_, float __pyx_v_amplitude_, int __pyx_v_duration_, float __pyx_v_freq_) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  float __pyx_t_1;
  struct __pyx_opt_args_12PygameShader_6shader_lateral_dampening __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lateral_dampening", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.amplitude_ = __pyx_v_amplitude_;
  __pyx_t_2.duration_ = __pyx_v_duration_;
  __pyx_t_2.freq_ = __pyx_v_freq_;
  __pyx_t_1 = __pyx_f_12PygameShader_6shader_lateral_dampening(__pyx_v_frame_, 0, &__pyx_t_2); 
  __pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("PygameShader.shader.lateral_dampening", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":7614
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_sharpen_filter_inplace_c(unsigned char [:, :, :] rgb_array_):             # <<<<<<<<<<<<<<
 *         """
 *         SHARPEN IMAGE APPLYING THE BELOW 3 X 3 KERNEL OVER EVERY PIXELS.
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sharpen_filter_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  __Pyx_memviewslice __pyx_v_rgb_array_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_xx;
  int __pyx_v_yy;
  short __pyx_v_kernel_offset_y;
  short __pyx_v_kernel_offset_x;
  float __pyx_v_r;
  float __pyx_v_g;
  float __pyx_v_b;
  float __pyx_v_k;
  unsigned char *__pyx_v_rr;
  unsigned char *__pyx_v_gg;
  unsigned char *__pyx_v_bb;
  int __pyx_v_w_1;
  int __pyx_v_h_1;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  float __pyx_t_18;
  float __pyx_t_19;
  float __pyx_t_20;
  long __pyx_t_21;
  long __pyx_t_22;
  short __pyx_t_23;
  long __pyx_t_24;
  long __pyx_t_25;
  short __pyx_t_26;
  int __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shader_sharpen_filter_inplace_c", 0);

  /* "PygameShader/shader.pyx":7636
 *         # texture sizes
 *         cdef Py_ssize_t w, h
 *         w, h = rgb_array_.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *         cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array_.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":7640
 *         cdef:
 * 
 *             unsigned char [:, :, :] rgb_array_1 = numpy.empty((w, h, 3), uint8)             # <<<<<<<<<<<<<<
 *             int x, y, xx, yy
 *             short kernel_offset_y, kernel_offset_x
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_3);
  __pyx_t_5 = 0;
  __pyx_t_7 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_uint8); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_8, __pyx_t_7};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7640, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_8, __pyx_t_7};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7640, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7640, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
    __pyx_t_8 = 0;
    __pyx_t_7 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7640, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 7640, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rgb_array_1 = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "PygameShader/shader.pyx":7647
 *             unsigned char *gg
 *             unsigned char *bb
 *             int w_1 = <int>w - 1             # <<<<<<<<<<<<<<
 *             int h_1 = <int>h - 1
 * 
 */
  __pyx_v_w_1 = (((int)__pyx_v_w) - 1);

  /* "PygameShader/shader.pyx":7648
 *             unsigned char *bb
 *             int w_1 = <int>w - 1
 *             int h_1 = <int>h - 1             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_v_h_1 = (((int)__pyx_v_h) - 1);

  /* "PygameShader/shader.pyx":7650
 *             int h_1 = <int>h - 1
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 * 
 *             for y in prange(h, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":7652
 *         with nogil:
 * 
 *             for y in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *                 for x in range(w):
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            float __pyx_parallel_temp0 = ((float)__PYX_NAN());
            unsigned char * __pyx_parallel_temp1 = ((unsigned char *)1);
            float __pyx_parallel_temp2 = ((float)__PYX_NAN());
            unsigned char * __pyx_parallel_temp3 = ((unsigned char *)1);
            float __pyx_parallel_temp4 = ((float)__PYX_NAN());
            short __pyx_parallel_temp5 = ((short)0xbad0bad0);
            short __pyx_parallel_temp6 = ((short)0xbad0bad0);
            float __pyx_parallel_temp7 = ((float)__PYX_NAN());
            unsigned char * __pyx_parallel_temp8 = ((unsigned char *)1);
            int __pyx_parallel_temp9 = ((int)0xbad0bad0);
            int __pyx_parallel_temp10 = ((int)0xbad0bad0);
            int __pyx_parallel_temp11 = ((int)0xbad0bad0);
            int __pyx_parallel_temp12 = ((int)0xbad0bad0);
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_12 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_12; __pyx_t_2++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((float)__PYX_NAN());
                            __pyx_v_bb = ((unsigned char *)1);
                            __pyx_v_g = ((float)__PYX_NAN());
                            __pyx_v_gg = ((unsigned char *)1);
                            __pyx_v_k = ((float)__PYX_NAN());
                            __pyx_v_kernel_offset_x = ((short)0xbad0bad0);
                            __pyx_v_kernel_offset_y = ((short)0xbad0bad0);
                            __pyx_v_r = ((float)__PYX_NAN());
                            __pyx_v_rr = ((unsigned char *)1);
                            __pyx_v_x = ((int)0xbad0bad0);
                            __pyx_v_xx = ((int)0xbad0bad0);
                            __pyx_v_yy = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":7654
 *             for y in prange(h, schedule='static', num_threads=THREADS):
 * 
 *                 for x in range(w):             # <<<<<<<<<<<<<<
 * 
 *                     rr = &rgb_array_1[x, y, 0]
 */
                            __pyx_t_13 = __pyx_v_w;
                            __pyx_t_14 = __pyx_t_13;
                            for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_14; __pyx_t_9+=1) {
                              __pyx_v_x = __pyx_t_9;

                              /* "PygameShader/shader.pyx":7656
 *                 for x in range(w):
 * 
 *                     rr = &rgb_array_1[x, y, 0]             # <<<<<<<<<<<<<<
 *                     gg = &rgb_array_1[x, y, 1]
 *                     bb = &rgb_array_1[x, y, 2]
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_17 = 0;
                              __pyx_v_rr = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_15 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb_array_1.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7657
 * 
 *                     rr = &rgb_array_1[x, y, 0]
 *                     gg = &rgb_array_1[x, y, 1]             # <<<<<<<<<<<<<<
 *                     bb = &rgb_array_1[x, y, 2]
 * 
 */
                              __pyx_t_17 = __pyx_v_x;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_15 = 1;
                              __pyx_v_gg = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_17 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_1.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7658
 *                     rr = &rgb_array_1[x, y, 0]
 *                     gg = &rgb_array_1[x, y, 1]
 *                     bb = &rgb_array_1[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 *                     r, g, b = 0, 0, 0
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_16 = __pyx_v_y;
                              __pyx_t_17 = 2;
                              __pyx_v_bb = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_15 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb_array_1.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7660
 *                     bb = &rgb_array_1[x, y, 2]
 * 
 *                     r, g, b = 0, 0, 0             # <<<<<<<<<<<<<<
 * 
 *                     for kernel_offset_y in range(-HALF_KERNEL, HALF_KERNEL + 1):
 */
                              __pyx_t_18 = 0.0;
                              __pyx_t_19 = 0.0;
                              __pyx_t_20 = 0.0;
                              __pyx_v_r = __pyx_t_18;
                              __pyx_v_g = __pyx_t_19;
                              __pyx_v_b = __pyx_t_20;

                              /* "PygameShader/shader.pyx":7662
 *                     r, g, b = 0, 0, 0
 * 
 *                     for kernel_offset_y in range(-HALF_KERNEL, HALF_KERNEL + 1):             # <<<<<<<<<<<<<<
 * 
 *                         for kernel_offset_x in range(-HALF_KERNEL, HALF_KERNEL + 1):
 */
                              __pyx_t_21 = (__pyx_v_12PygameShader_6shader_HALF_KERNEL + 1);
                              __pyx_t_22 = __pyx_t_21;
                              for (__pyx_t_23 = (-__pyx_v_12PygameShader_6shader_HALF_KERNEL); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
                                __pyx_v_kernel_offset_y = __pyx_t_23;

                                /* "PygameShader/shader.pyx":7664
 *                     for kernel_offset_y in range(-HALF_KERNEL, HALF_KERNEL + 1):
 * 
 *                         for kernel_offset_x in range(-HALF_KERNEL, HALF_KERNEL + 1):             # <<<<<<<<<<<<<<
 * 
 *                             xx = x + kernel_offset_x
 */
                                __pyx_t_24 = (__pyx_v_12PygameShader_6shader_HALF_KERNEL + 1);
                                __pyx_t_25 = __pyx_t_24;
                                for (__pyx_t_26 = (-__pyx_v_12PygameShader_6shader_HALF_KERNEL); __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
                                  __pyx_v_kernel_offset_x = __pyx_t_26;

                                  /* "PygameShader/shader.pyx":7666
 *                         for kernel_offset_x in range(-HALF_KERNEL, HALF_KERNEL + 1):
 * 
 *                             xx = x + kernel_offset_x             # <<<<<<<<<<<<<<
 *                             yy = y + kernel_offset_y
 * 
 */
                                  __pyx_v_xx = (__pyx_v_x + __pyx_v_kernel_offset_x);

                                  /* "PygameShader/shader.pyx":7667
 * 
 *                             xx = x + kernel_offset_x
 *                             yy = y + kernel_offset_y             # <<<<<<<<<<<<<<
 * 
 *                             if xx < 0:
 */
                                  __pyx_v_yy = (__pyx_v_y + __pyx_v_kernel_offset_y);

                                  /* "PygameShader/shader.pyx":7669
 *                             yy = y + kernel_offset_y
 * 
 *                             if xx < 0:             # <<<<<<<<<<<<<<
 *                                 xx = 0
 *                             elif xx > w_1:
 */
                                  __pyx_t_27 = ((__pyx_v_xx < 0) != 0);
                                  if (__pyx_t_27) {

                                    /* "PygameShader/shader.pyx":7670
 * 
 *                             if xx < 0:
 *                                 xx = 0             # <<<<<<<<<<<<<<
 *                             elif xx > w_1:
 *                                 xx = w_1
 */
                                    __pyx_v_xx = 0;

                                    /* "PygameShader/shader.pyx":7669
 *                             yy = y + kernel_offset_y
 * 
 *                             if xx < 0:             # <<<<<<<<<<<<<<
 *                                 xx = 0
 *                             elif xx > w_1:
 */
                                    goto __pyx_L16;
                                  }

                                  /* "PygameShader/shader.pyx":7671
 *                             if xx < 0:
 *                                 xx = 0
 *                             elif xx > w_1:             # <<<<<<<<<<<<<<
 *                                 xx = w_1
 * 
 */
                                  __pyx_t_27 = ((__pyx_v_xx > __pyx_v_w_1) != 0);
                                  if (__pyx_t_27) {

                                    /* "PygameShader/shader.pyx":7672
 *                                 xx = 0
 *                             elif xx > w_1:
 *                                 xx = w_1             # <<<<<<<<<<<<<<
 * 
 *                             if yy < 0:
 */
                                    __pyx_v_xx = __pyx_v_w_1;

                                    /* "PygameShader/shader.pyx":7671
 *                             if xx < 0:
 *                                 xx = 0
 *                             elif xx > w_1:             # <<<<<<<<<<<<<<
 *                                 xx = w_1
 * 
 */
                                  }
                                  __pyx_L16:;

                                  /* "PygameShader/shader.pyx":7674
 *                                 xx = w_1
 * 
 *                             if yy < 0:             # <<<<<<<<<<<<<<
 *                                 yy = 0
 *                             elif yy > h_1:
 */
                                  __pyx_t_27 = ((__pyx_v_yy < 0) != 0);
                                  if (__pyx_t_27) {

                                    /* "PygameShader/shader.pyx":7675
 * 
 *                             if yy < 0:
 *                                 yy = 0             # <<<<<<<<<<<<<<
 *                             elif yy > h_1:
 *                                 yy = h_1
 */
                                    __pyx_v_yy = 0;

                                    /* "PygameShader/shader.pyx":7674
 *                                 xx = w_1
 * 
 *                             if yy < 0:             # <<<<<<<<<<<<<<
 *                                 yy = 0
 *                             elif yy > h_1:
 */
                                    goto __pyx_L17;
                                  }

                                  /* "PygameShader/shader.pyx":7676
 *                             if yy < 0:
 *                                 yy = 0
 *                             elif yy > h_1:             # <<<<<<<<<<<<<<
 *                                 yy = h_1
 * 
 */
                                  __pyx_t_27 = ((__pyx_v_yy > __pyx_v_h_1) != 0);
                                  if (__pyx_t_27) {

                                    /* "PygameShader/shader.pyx":7677
 *                                 yy = 0
 *                             elif yy > h_1:
 *                                 yy = h_1             # <<<<<<<<<<<<<<
 * 
 *                             k = SHARPEN_KERNEL[kernel_offset_y + HALF_KERNEL,
 */
                                    __pyx_v_yy = __pyx_v_h_1;

                                    /* "PygameShader/shader.pyx":7676
 *                             if yy < 0:
 *                                 yy = 0
 *                             elif yy > h_1:             # <<<<<<<<<<<<<<
 *                                 yy = h_1
 * 
 */
                                  }
                                  __pyx_L17:;

                                  /* "PygameShader/shader.pyx":7679
 *                                 yy = h_1
 * 
 *                             k = SHARPEN_KERNEL[kernel_offset_y + HALF_KERNEL,             # <<<<<<<<<<<<<<
 *                                                kernel_offset_x + HALF_KERNEL]
 * 
 */
                                  if (unlikely(!__pyx_v_12PygameShader_6shader_SHARPEN_KERNEL.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("SHARPEN_KERNEL"); __PYX_ERR(1, 7679, __pyx_L8_error) }

                                  /* "PygameShader/shader.pyx":7680
 * 
 *                             k = SHARPEN_KERNEL[kernel_offset_y + HALF_KERNEL,
 *                                                kernel_offset_x + HALF_KERNEL]             # <<<<<<<<<<<<<<
 * 
 *                             r = r + rgb_array_[xx, yy, 0] * k
 */
                                  __pyx_t_17 = (__pyx_v_kernel_offset_y + __pyx_v_12PygameShader_6shader_HALF_KERNEL);
                                  __pyx_t_16 = (__pyx_v_kernel_offset_x + __pyx_v_12PygameShader_6shader_HALF_KERNEL);
                                  __pyx_v_k = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_12PygameShader_6shader_SHARPEN_KERNEL.data + __pyx_t_17 * __pyx_v_12PygameShader_6shader_SHARPEN_KERNEL.strides[0]) ) + __pyx_t_16 * __pyx_v_12PygameShader_6shader_SHARPEN_KERNEL.strides[1]) )));

                                  /* "PygameShader/shader.pyx":7682
 *                                                kernel_offset_x + HALF_KERNEL]
 * 
 *                             r = r + rgb_array_[xx, yy, 0] * k             # <<<<<<<<<<<<<<
 *                             g = g + rgb_array_[xx, yy, 1] * k
 *                             b = b + rgb_array_[xx, yy, 2] * k
 */
                                  __pyx_t_16 = __pyx_v_xx;
                                  __pyx_t_17 = __pyx_v_yy;
                                  __pyx_t_15 = 0;
                                  __pyx_v_r = (__pyx_v_r + ((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))) * __pyx_v_k));

                                  /* "PygameShader/shader.pyx":7683
 * 
 *                             r = r + rgb_array_[xx, yy, 0] * k
 *                             g = g + rgb_array_[xx, yy, 1] * k             # <<<<<<<<<<<<<<
 *                             b = b + rgb_array_[xx, yy, 2] * k
 * 
 */
                                  __pyx_t_15 = __pyx_v_xx;
                                  __pyx_t_17 = __pyx_v_yy;
                                  __pyx_t_16 = 1;
                                  __pyx_v_g = (__pyx_v_g + ((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) ))) * __pyx_v_k));

                                  /* "PygameShader/shader.pyx":7684
 *                             r = r + rgb_array_[xx, yy, 0] * k
 *                             g = g + rgb_array_[xx, yy, 1] * k
 *                             b = b + rgb_array_[xx, yy, 2] * k             # <<<<<<<<<<<<<<
 * 
 *                     if r < 0:
 */
                                  __pyx_t_16 = __pyx_v_xx;
                                  __pyx_t_17 = __pyx_v_yy;
                                  __pyx_t_15 = 2;
                                  __pyx_v_b = (__pyx_v_b + ((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))) * __pyx_v_k));
                                }
                              }

                              /* "PygameShader/shader.pyx":7686
 *                             b = b + rgb_array_[xx, yy, 2] * k
 * 
 *                     if r < 0:             # <<<<<<<<<<<<<<
 *                         r = 0
 *                     if g < 0:
 */
                              __pyx_t_27 = ((__pyx_v_r < 0.0) != 0);
                              if (__pyx_t_27) {

                                /* "PygameShader/shader.pyx":7687
 * 
 *                     if r < 0:
 *                         r = 0             # <<<<<<<<<<<<<<
 *                     if g < 0:
 *                         g = 0
 */
                                __pyx_v_r = 0.0;

                                /* "PygameShader/shader.pyx":7686
 *                             b = b + rgb_array_[xx, yy, 2] * k
 * 
 *                     if r < 0:             # <<<<<<<<<<<<<<
 *                         r = 0
 *                     if g < 0:
 */
                              }

                              /* "PygameShader/shader.pyx":7688
 *                     if r < 0:
 *                         r = 0
 *                     if g < 0:             # <<<<<<<<<<<<<<
 *                         g = 0
 *                     if b < 0:
 */
                              __pyx_t_27 = ((__pyx_v_g < 0.0) != 0);
                              if (__pyx_t_27) {

                                /* "PygameShader/shader.pyx":7689
 *                         r = 0
 *                     if g < 0:
 *                         g = 0             # <<<<<<<<<<<<<<
 *                     if b < 0:
 *                         b = 0
 */
                                __pyx_v_g = 0.0;

                                /* "PygameShader/shader.pyx":7688
 *                     if r < 0:
 *                         r = 0
 *                     if g < 0:             # <<<<<<<<<<<<<<
 *                         g = 0
 *                     if b < 0:
 */
                              }

                              /* "PygameShader/shader.pyx":7690
 *                     if g < 0:
 *                         g = 0
 *                     if b < 0:             # <<<<<<<<<<<<<<
 *                         b = 0
 *                     if r > 255:
 */
                              __pyx_t_27 = ((__pyx_v_b < 0.0) != 0);
                              if (__pyx_t_27) {

                                /* "PygameShader/shader.pyx":7691
 *                         g = 0
 *                     if b < 0:
 *                         b = 0             # <<<<<<<<<<<<<<
 *                     if r > 255:
 *                         r= 255
 */
                                __pyx_v_b = 0.0;

                                /* "PygameShader/shader.pyx":7690
 *                     if g < 0:
 *                         g = 0
 *                     if b < 0:             # <<<<<<<<<<<<<<
 *                         b = 0
 *                     if r > 255:
 */
                              }

                              /* "PygameShader/shader.pyx":7692
 *                     if b < 0:
 *                         b = 0
 *                     if r > 255:             # <<<<<<<<<<<<<<
 *                         r= 255
 *                     if g > 255:
 */
                              __pyx_t_27 = ((__pyx_v_r > 255.0) != 0);
                              if (__pyx_t_27) {

                                /* "PygameShader/shader.pyx":7693
 *                         b = 0
 *                     if r > 255:
 *                         r= 255             # <<<<<<<<<<<<<<
 *                     if g > 255:
 *                         g = 255
 */
                                __pyx_v_r = 255.0;

                                /* "PygameShader/shader.pyx":7692
 *                     if b < 0:
 *                         b = 0
 *                     if r > 255:             # <<<<<<<<<<<<<<
 *                         r= 255
 *                     if g > 255:
 */
                              }

                              /* "PygameShader/shader.pyx":7694
 *                     if r > 255:
 *                         r= 255
 *                     if g > 255:             # <<<<<<<<<<<<<<
 *                         g = 255
 *                     if b > 255:
 */
                              __pyx_t_27 = ((__pyx_v_g > 255.0) != 0);
                              if (__pyx_t_27) {

                                /* "PygameShader/shader.pyx":7695
 *                         r= 255
 *                     if g > 255:
 *                         g = 255             # <<<<<<<<<<<<<<
 *                     if b > 255:
 *                         b = 255
 */
                                __pyx_v_g = 255.0;

                                /* "PygameShader/shader.pyx":7694
 *                     if r > 255:
 *                         r= 255
 *                     if g > 255:             # <<<<<<<<<<<<<<
 *                         g = 255
 *                     if b > 255:
 */
                              }

                              /* "PygameShader/shader.pyx":7696
 *                     if g > 255:
 *                         g = 255
 *                     if b > 255:             # <<<<<<<<<<<<<<
 *                         b = 255
 * 
 */
                              __pyx_t_27 = ((__pyx_v_b > 255.0) != 0);
                              if (__pyx_t_27) {

                                /* "PygameShader/shader.pyx":7697
 *                         g = 255
 *                     if b > 255:
 *                         b = 255             # <<<<<<<<<<<<<<
 * 
 *                     rr[0] = <unsigned char>r
 */
                                __pyx_v_b = 255.0;

                                /* "PygameShader/shader.pyx":7696
 *                     if g > 255:
 *                         g = 255
 *                     if b > 255:             # <<<<<<<<<<<<<<
 *                         b = 255
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":7699
 *                         b = 255
 * 
 *                     rr[0] = <unsigned char>r             # <<<<<<<<<<<<<<
 *                     gg[0] = <unsigned char>g
 *                     bb[0] = <unsigned char>b
 */
                              (__pyx_v_rr[0]) = ((unsigned char)__pyx_v_r);

                              /* "PygameShader/shader.pyx":7700
 * 
 *                     rr[0] = <unsigned char>r
 *                     gg[0] = <unsigned char>g             # <<<<<<<<<<<<<<
 *                     bb[0] = <unsigned char>b
 * 
 */
                              (__pyx_v_gg[0]) = ((unsigned char)__pyx_v_g);

                              /* "PygameShader/shader.pyx":7701
 *                     rr[0] = <unsigned char>r
 *                     gg[0] = <unsigned char>g
 *                     bb[0] = <unsigned char>b             # <<<<<<<<<<<<<<
 * 
 *             for y in prange(h, schedule='static', num_threads=THREADS):
 */
                              (__pyx_v_bb[0]) = ((unsigned char)__pyx_v_b);
                            }
                            goto __pyx_L25;
                            __pyx_L8_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L24;
                            __pyx_L24:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates13)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_b;
                                __pyx_parallel_temp1 = __pyx_v_bb;
                                __pyx_parallel_temp2 = __pyx_v_g;
                                __pyx_parallel_temp3 = __pyx_v_gg;
                                __pyx_parallel_temp4 = __pyx_v_k;
                                __pyx_parallel_temp5 = __pyx_v_kernel_offset_x;
                                __pyx_parallel_temp6 = __pyx_v_kernel_offset_y;
                                __pyx_parallel_temp7 = __pyx_v_r;
                                __pyx_parallel_temp8 = __pyx_v_rr;
                                __pyx_parallel_temp9 = __pyx_v_x;
                                __pyx_parallel_temp10 = __pyx_v_xx;
                                __pyx_parallel_temp11 = __pyx_v_y;
                                __pyx_parallel_temp12 = __pyx_v_yy;
                            }
                            __pyx_L25:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_b = __pyx_parallel_temp0;
              __pyx_v_bb = __pyx_parallel_temp1;
              __pyx_v_g = __pyx_parallel_temp2;
              __pyx_v_gg = __pyx_parallel_temp3;
              __pyx_v_k = __pyx_parallel_temp4;
              __pyx_v_kernel_offset_x = __pyx_parallel_temp5;
              __pyx_v_kernel_offset_y = __pyx_parallel_temp6;
              __pyx_v_r = __pyx_parallel_temp7;
              __pyx_v_rr = __pyx_parallel_temp8;
              __pyx_v_x = __pyx_parallel_temp9;
              __pyx_v_xx = __pyx_parallel_temp10;
              __pyx_v_y = __pyx_parallel_temp11;
              __pyx_v_yy = __pyx_parallel_temp12;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L4_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif

        /* "PygameShader/shader.pyx":7703
 *                     bb[0] = <unsigned char>b
 * 
 *             for y in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *                 for x in range(w):
 */
        __pyx_t_12 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":7705
 *             for y in prange(h, schedule='static', num_threads=THREADS):
 * 
 *                 for x in range(w):             # <<<<<<<<<<<<<<
 *                     rgb_array_[x, y, 0] = rgb_array_1[x, y, 0]
 *                     rgb_array_[x, y, 1] = rgb_array_1[x, y, 1]
 */
                            __pyx_t_13 = __pyx_v_w;
                            __pyx_t_14 = __pyx_t_13;
                            for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_14; __pyx_t_9+=1) {
                              __pyx_v_x = __pyx_t_9;

                              /* "PygameShader/shader.pyx":7706
 * 
 *                 for x in range(w):
 *                     rgb_array_[x, y, 0] = rgb_array_1[x, y, 0]             # <<<<<<<<<<<<<<
 *                     rgb_array_[x, y, 1] = rgb_array_1[x, y, 1]
 *                     rgb_array_[x, y, 2] = rgb_array_1[x, y, 2]
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_17 = __pyx_v_y;
                              __pyx_t_16 = 0;
                              __pyx_t_28 = __pyx_v_x;
                              __pyx_t_29 = __pyx_v_y;
                              __pyx_t_30 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_28 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_29 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_30 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_15 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_1.strides[2]) )));

                              /* "PygameShader/shader.pyx":7707
 *                 for x in range(w):
 *                     rgb_array_[x, y, 0] = rgb_array_1[x, y, 0]
 *                     rgb_array_[x, y, 1] = rgb_array_1[x, y, 1]             # <<<<<<<<<<<<<<
 *                     rgb_array_[x, y, 2] = rgb_array_1[x, y, 2]
 * 
 */
                              __pyx_t_16 = __pyx_v_x;
                              __pyx_t_17 = __pyx_v_y;
                              __pyx_t_15 = 1;
                              __pyx_t_30 = __pyx_v_x;
                              __pyx_t_29 = __pyx_v_y;
                              __pyx_t_28 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_30 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_29 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_28 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_16 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_1.strides[2]) )));

                              /* "PygameShader/shader.pyx":7708
 *                     rgb_array_[x, y, 0] = rgb_array_1[x, y, 0]
 *                     rgb_array_[x, y, 1] = rgb_array_1[x, y, 1]
 *                     rgb_array_[x, y, 2] = rgb_array_1[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_17 = __pyx_v_y;
                              __pyx_t_16 = 2;
                              __pyx_t_28 = __pyx_v_x;
                              __pyx_t_29 = __pyx_v_y;
                              __pyx_t_30 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_28 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_29 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_30 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_15 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_1.strides[2]) )));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":7650
 *             int h_1 = <int>h - 1
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 * 
 *             for y in prange(h, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":7614
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void shader_sharpen_filter_inplace_c(unsigned char [:, :, :] rgb_array_):             # <<<<<<<<<<<<<<
 *         """
 *         SHARPEN IMAGE APPLYING THE BELOW 3 X 3 KERNEL OVER EVERY PIXELS.
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_WriteUnraisable("PygameShader.shader.shader_sharpen_filter_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_1, 1);
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":7716
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef cartoon_effect(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int sobel_threshold_,
 */

static PyObject *__pyx_f_12PygameShader_6shader_cartoon_effect(PyObject *__pyx_v_surface_, int __pyx_v_sobel_threshold_, int __pyx_v_median_kernel_, int __pyx_v_color_, int __pyx_v_flag_) {
  PyObject *__pyx_v_surface_branch_1 = NULL;
  PyObject *__pyx_v_array_ = NULL;
  PyObject *__pyx_v_arr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_inplace_c __pyx_t_5;
  struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_c __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cartoon_effect", 0);

  /* "PygameShader/shader.pyx":7734
 *     # First branch from the surface_
 *     # surface_branch_1
 *     surface_branch_1 = surface_.copy()             # <<<<<<<<<<<<<<
 *     array_ = canny_blur5x5_surface24_c(surface_branch_1)
 *     shader_greyscale_luminosity24_inplace_c(array_)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_surface_branch_1 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":7735
 *     # surface_branch_1
 *     surface_branch_1 = surface_.copy()
 *     array_ = canny_blur5x5_surface24_c(surface_branch_1)             # <<<<<<<<<<<<<<
 *     shader_greyscale_luminosity24_inplace_c(array_)
 *     shader_sobel24_inplace_c(array_, sobel_threshold_)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_canny_blur5x5_surface24_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_surface_branch_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_surface_branch_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_array_ = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":7736
 *     surface_branch_1 = surface_.copy()
 *     array_ = canny_blur5x5_surface24_c(surface_branch_1)
 *     shader_greyscale_luminosity24_inplace_c(array_)             # <<<<<<<<<<<<<<
 *     shader_sobel24_inplace_c(array_, sobel_threshold_)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 7736, __pyx_L1_error)
  __pyx_f_12PygameShader_6shader_shader_greyscale_luminosity24_inplace_c(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "PygameShader/shader.pyx":7737
 *     array_ = canny_blur5x5_surface24_c(surface_branch_1)
 *     shader_greyscale_luminosity24_inplace_c(array_)
 *     shader_sobel24_inplace_c(array_, sobel_threshold_)             # <<<<<<<<<<<<<<
 * 
 *     # Second branch
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 7737, __pyx_L1_error)
  __pyx_t_5.__pyx_n = 1;
  __pyx_t_5.threshold = __pyx_v_sobel_threshold_;
  __pyx_f_12PygameShader_6shader_shader_sobel24_inplace_c(__pyx_t_4, &__pyx_t_5); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "PygameShader/shader.pyx":7740
 * 
 *     # Second branch
 *     arr = pixels3d(surface_)             # <<<<<<<<<<<<<<
 *     shader_median_filter24_inplace_c(arr, median_kernel_)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_surface_);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_arr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":7741
 *     # Second branch
 *     arr = pixels3d(surface_)
 *     shader_median_filter24_inplace_c(arr, median_kernel_)             # <<<<<<<<<<<<<<
 * 
 *     # median_fast(
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 7741, __pyx_L1_error)
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.kernel_size_ = __pyx_v_median_kernel_;
  __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_c(__pyx_t_4, &__pyx_t_6); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "PygameShader/shader.pyx":7749
 * 
 *     # Color reduction
 *     shader_color_reduction24_inplace_c(arr, color_)             # <<<<<<<<<<<<<<
 * 
 *     del arr
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 7749, __pyx_L1_error)
  __pyx_f_12PygameShader_6shader_shader_color_reduction24_inplace_c(__pyx_t_4, __pyx_v_color_);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "PygameShader/shader.pyx":7751
 *     shader_color_reduction24_inplace_c(arr, color_)
 * 
 *     del arr             # <<<<<<<<<<<<<<
 * 
 *     # Blend both branch
 */
  __Pyx_DECREF(__pyx_v_arr);
  __pyx_v_arr = NULL;

  /* "PygameShader/shader.pyx":7754
 * 
 *     # Blend both branch
 *     surface_.blit(make_surface(array_), (0, 0), special_flags=flag_)             # <<<<<<<<<<<<<<
 * 
 *     return surface_
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_v_array_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_array_);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_tuple__12);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_flag_); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_special_flags, __pyx_t_7) < 0) __PYX_ERR(1, 7754, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "PygameShader/shader.pyx":7756
 *     surface_.blit(make_surface(array_), (0, 0), special_flags=flag_)
 * 
 *     return surface_             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_surface_);
  __pyx_r = __pyx_v_surface_;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":7716
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef cartoon_effect(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int sobel_threshold_,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("PygameShader.shader.cartoon_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_surface_branch_1);
  __Pyx_XDECREF(__pyx_v_array_);
  __Pyx_XDECREF(__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":7766
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef object blending(object source_, object destination_, float percentage_):             # <<<<<<<<<<<<<<
 *     """
 *     BLEND A SOURCE TEXTURE TOWARD A DESTINATION TEXTURE (TRANSITION EFFECT)
 */

static PyObject *__pyx_f_12PygameShader_6shader_blending(PyObject *__pyx_v_source_, PyObject *__pyx_v_destination_, float __pyx_v_percentage_) {
  __Pyx_memviewslice __pyx_v_source_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_destination_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_e = NULL;
  int __pyx_v_c1;
  int __pyx_v_c2;
  int __pyx_v_c3;
  int __pyx_v_i;
  int __pyx_v_j;
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  __Pyx_memviewslice __pyx_v_final_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  float __pyx_v_c4;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  long __pyx_t_20;
  int __pyx_t_21;
  long __pyx_t_22;
  int __pyx_t_23;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blending", 0);

  /* "PygameShader/shader.pyx":7787
 *             unsigned char [:, :, :] destination_array
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         source_array      = pixels3d(source_)
 * 
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "PygameShader/shader.pyx":7788
 * 
 *     try:
 *         source_array      = pixels3d(source_)             # <<<<<<<<<<<<<<
 * 
 *     except Exception as e:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7788, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_source_) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_source_);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7788, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 7788, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_source_array = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;

      /* "PygameShader/shader.pyx":7787
 *             unsigned char [:, :, :] destination_array
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         source_array      = pixels3d(source_)
 * 
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);

    /* "PygameShader/shader.pyx":7790
 *         source_array      = pixels3d(source_)
 * 
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         raise ValueError("\nCannot reference source pixels into a 3d array.\n %s " % e)
 * 
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("PygameShader.shader.blending", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(1, 7790, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_e = __pyx_t_5;

      /* "PygameShader/shader.pyx":7791
 * 
 *     except Exception as e:
 *         raise ValueError("\nCannot reference source pixels into a 3d array.\n %s " % e)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
      __pyx_t_9 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_reference_source_pixels, __pyx_v_e); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7791, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7791, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(1, 7791, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "PygameShader/shader.pyx":7787
 *             unsigned char [:, :, :] destination_array
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         source_array      = pixels3d(source_)
 * 
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "PygameShader/shader.pyx":7793
 *         raise ValueError("\nCannot reference source pixels into a 3d array.\n %s " % e)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         destination_array = pixels3d(destination_)
 * 
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "PygameShader/shader.pyx":7794
 * 
 *     try:
 *         destination_array = pixels3d(destination_)             # <<<<<<<<<<<<<<
 * 
 *     except Exception as e:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7794, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_destination_) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_destination_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7794, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 7794, __pyx_L11_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_destination_array = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;

      /* "PygameShader/shader.pyx":7793
 *         raise ValueError("\nCannot reference source pixels into a 3d array.\n %s " % e)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         destination_array = pixels3d(destination_)
 * 
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L16_try_end;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "PygameShader/shader.pyx":7796
 *         destination_array = pixels3d(destination_)
 * 
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         raise ValueError("\nCannot reference destination pixels into a 3d array.\n %s " % e)
 * 
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("PygameShader.shader.blending", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(1, 7796, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_e = __pyx_t_5;

      /* "PygameShader/shader.pyx":7797
 * 
 *     except Exception as e:
 *         raise ValueError("\nCannot reference destination pixels into a 3d array.\n %s " % e)             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
      __pyx_t_10 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_reference_destination_pi, __pyx_v_e); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7797, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7797, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 7797, __pyx_L13_except_error)
    }
    goto __pyx_L13_except_error;
    __pyx_L13_except_error:;

    /* "PygameShader/shader.pyx":7793
 *         raise ValueError("\nCannot reference source pixels into a 3d array.\n %s " % e)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         destination_array = pixels3d(destination_)
 * 
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L16_try_end:;
  }

  /* "PygameShader/shader.pyx":7802
 * 
 *         int c1, c2, c3
 *         int i=0, j=0             # <<<<<<<<<<<<<<
 *         Py_ssize_t w = source_array.shape[0]
 *         Py_ssize_t h = source_array.shape[1]
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "PygameShader/shader.pyx":7803
 *         int c1, c2, c3
 *         int i=0, j=0
 *         Py_ssize_t w = source_array.shape[0]             # <<<<<<<<<<<<<<
 *         Py_ssize_t h = source_array.shape[1]
 *         unsigned char[:, :, ::1] final_array = empty((h, w, 3), dtype=uint8)
 */
  __pyx_v_w = (__pyx_v_source_array.shape[0]);

  /* "PygameShader/shader.pyx":7804
 *         int i=0, j=0
 *         Py_ssize_t w = source_array.shape[0]
 *         Py_ssize_t h = source_array.shape[1]             # <<<<<<<<<<<<<<
 *         unsigned char[:, :, ::1] final_array = empty((h, w, 3), dtype=uint8)
 *         float c4 = percentage_ / <float> 100.0
 */
  __pyx_v_h = (__pyx_v_source_array.shape[1]);

  /* "PygameShader/shader.pyx":7805
 *         Py_ssize_t w = source_array.shape[0]
 *         Py_ssize_t h = source_array.shape[1]
 *         unsigned char[:, :, ::1] final_array = empty((h, w, 3), dtype=uint8)             # <<<<<<<<<<<<<<
 *         float c4 = percentage_ / <float> 100.0
 *         unsigned char *r
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_3);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 7805, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 7805, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_final_array = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "PygameShader/shader.pyx":7806
 *         Py_ssize_t h = source_array.shape[1]
 *         unsigned char[:, :, ::1] final_array = empty((h, w, 3), dtype=uint8)
 *         float c4 = percentage_ / <float> 100.0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_c4 = (__pyx_v_percentage_ / ((float)100.0));

  /* "PygameShader/shader.pyx":7811
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":7812
 * 
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for i in range(w):
 * 
 */
        __pyx_t_12 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_14 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_14 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_8)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_c3) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){
                        {
                            __pyx_v_j = (int)(0 + 1 * __pyx_t_13);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_c1 = ((int)0xbad0bad0);
                            __pyx_v_c2 = ((int)0xbad0bad0);
                            __pyx_v_c3 = ((int)0xbad0bad0);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_i = ((int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);

                            /* "PygameShader/shader.pyx":7813
 *     with nogil:
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):             # <<<<<<<<<<<<<<
 * 
 *                 r = &source_array[i, j, 0]
 */
                            __pyx_t_15 = __pyx_v_w;
                            __pyx_t_16 = __pyx_t_15;
                            for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_16; __pyx_t_8+=1) {
                              __pyx_v_i = __pyx_t_8;

                              /* "PygameShader/shader.pyx":7815
 *             for i in range(w):
 * 
 *                 r = &source_array[i, j, 0]             # <<<<<<<<<<<<<<
 *                 g = &source_array[i, j, 1]
 *                 b = &source_array[i, j, 2]
 */
                              __pyx_t_17 = __pyx_v_i;
                              __pyx_t_18 = __pyx_v_j;
                              __pyx_t_19 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_17 * __pyx_v_source_array.strides[0]) ) + __pyx_t_18 * __pyx_v_source_array.strides[1]) ) + __pyx_t_19 * __pyx_v_source_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7816
 * 
 *                 r = &source_array[i, j, 0]
 *                 g = &source_array[i, j, 1]             # <<<<<<<<<<<<<<
 *                 b = &source_array[i, j, 2]
 * 
 */
                              __pyx_t_19 = __pyx_v_i;
                              __pyx_t_18 = __pyx_v_j;
                              __pyx_t_17 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_19 * __pyx_v_source_array.strides[0]) ) + __pyx_t_18 * __pyx_v_source_array.strides[1]) ) + __pyx_t_17 * __pyx_v_source_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7817
 *                 r = &source_array[i, j, 0]
 *                 g = &source_array[i, j, 1]
 *                 b = &source_array[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 *                 c1 = min(<int> (<float> destination_array[i, j, 0] * c4 +
 */
                              __pyx_t_17 = __pyx_v_i;
                              __pyx_t_18 = __pyx_v_j;
                              __pyx_t_19 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_17 * __pyx_v_source_array.strides[0]) ) + __pyx_t_18 * __pyx_v_source_array.strides[1]) ) + __pyx_t_19 * __pyx_v_source_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":7819
 *                 b = &source_array[i, j, 2]
 * 
 *                 c1 = min(<int> (<float> destination_array[i, j, 0] * c4 +             # <<<<<<<<<<<<<<
 *                                 r[0] * (<float> 1.0 - c4)), 255)
 *                 c2 = min(<int> (<float> destination_array[i, j, 1] * c4 +
 */
                              __pyx_t_20 = 0xFF;
                              __pyx_t_19 = __pyx_v_i;
                              __pyx_t_18 = __pyx_v_j;
                              __pyx_t_17 = 0;

                              /* "PygameShader/shader.pyx":7820
 * 
 *                 c1 = min(<int> (<float> destination_array[i, j, 0] * c4 +
 *                                 r[0] * (<float> 1.0 - c4)), 255)             # <<<<<<<<<<<<<<
 *                 c2 = min(<int> (<float> destination_array[i, j, 1] * c4 +
 *                                 g[0] * (<float> 1.0 - c4)), 255)
 */
                              __pyx_t_21 = ((int)((((float)(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_destination_array.data + __pyx_t_19 * __pyx_v_destination_array.strides[0]) ) + __pyx_t_18 * __pyx_v_destination_array.strides[1]) ) + __pyx_t_17 * __pyx_v_destination_array.strides[2]) )))) * __pyx_v_c4) + ((__pyx_v_r[0]) * (((float)1.0) - __pyx_v_c4))));
                              if (((__pyx_t_20 < __pyx_t_21) != 0)) {
                                __pyx_t_22 = __pyx_t_20;
                              } else {
                                __pyx_t_22 = __pyx_t_21;
                              }
                              __pyx_v_c1 = __pyx_t_22;

                              /* "PygameShader/shader.pyx":7821
 *                 c1 = min(<int> (<float> destination_array[i, j, 0] * c4 +
 *                                 r[0] * (<float> 1.0 - c4)), 255)
 *                 c2 = min(<int> (<float> destination_array[i, j, 1] * c4 +             # <<<<<<<<<<<<<<
 *                                 g[0] * (<float> 1.0 - c4)), 255)
 *                 c3 = min(<int> (<float> destination_array[i, j, 2] * c4 +
 */
                              __pyx_t_22 = 0xFF;
                              __pyx_t_17 = __pyx_v_i;
                              __pyx_t_18 = __pyx_v_j;
                              __pyx_t_19 = 1;

                              /* "PygameShader/shader.pyx":7822
 *                                 r[0] * (<float> 1.0 - c4)), 255)
 *                 c2 = min(<int> (<float> destination_array[i, j, 1] * c4 +
 *                                 g[0] * (<float> 1.0 - c4)), 255)             # <<<<<<<<<<<<<<
 *                 c3 = min(<int> (<float> destination_array[i, j, 2] * c4 +
 *                                 b[0] * (<float> 1.0 - c4)), 255)
 */
                              __pyx_t_21 = ((int)((((float)(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_destination_array.data + __pyx_t_17 * __pyx_v_destination_array.strides[0]) ) + __pyx_t_18 * __pyx_v_destination_array.strides[1]) ) + __pyx_t_19 * __pyx_v_destination_array.strides[2]) )))) * __pyx_v_c4) + ((__pyx_v_g[0]) * (((float)1.0) - __pyx_v_c4))));
                              if (((__pyx_t_22 < __pyx_t_21) != 0)) {
                                __pyx_t_20 = __pyx_t_22;
                              } else {
                                __pyx_t_20 = __pyx_t_21;
                              }
                              __pyx_v_c2 = __pyx_t_20;

                              /* "PygameShader/shader.pyx":7823
 *                 c2 = min(<int> (<float> destination_array[i, j, 1] * c4 +
 *                                 g[0] * (<float> 1.0 - c4)), 255)
 *                 c3 = min(<int> (<float> destination_array[i, j, 2] * c4 +             # <<<<<<<<<<<<<<
 *                                 b[0] * (<float> 1.0 - c4)), 255)
 *                 if c1 < 0:
 */
                              __pyx_t_20 = 0xFF;
                              __pyx_t_19 = __pyx_v_i;
                              __pyx_t_18 = __pyx_v_j;
                              __pyx_t_17 = 2;

                              /* "PygameShader/shader.pyx":7824
 *                                 g[0] * (<float> 1.0 - c4)), 255)
 *                 c3 = min(<int> (<float> destination_array[i, j, 2] * c4 +
 *                                 b[0] * (<float> 1.0 - c4)), 255)             # <<<<<<<<<<<<<<
 *                 if c1 < 0:
 *                     c1 = 0
 */
                              __pyx_t_21 = ((int)((((float)(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_destination_array.data + __pyx_t_19 * __pyx_v_destination_array.strides[0]) ) + __pyx_t_18 * __pyx_v_destination_array.strides[1]) ) + __pyx_t_17 * __pyx_v_destination_array.strides[2]) )))) * __pyx_v_c4) + ((__pyx_v_b[0]) * (((float)1.0) - __pyx_v_c4))));
                              if (((__pyx_t_20 < __pyx_t_21) != 0)) {
                                __pyx_t_22 = __pyx_t_20;
                              } else {
                                __pyx_t_22 = __pyx_t_21;
                              }
                              __pyx_v_c3 = __pyx_t_22;

                              /* "PygameShader/shader.pyx":7825
 *                 c3 = min(<int> (<float> destination_array[i, j, 2] * c4 +
 *                                 b[0] * (<float> 1.0 - c4)), 255)
 *                 if c1 < 0:             # <<<<<<<<<<<<<<
 *                     c1 = 0
 *                 if c2 < 0:
 */
                              __pyx_t_23 = ((__pyx_v_c1 < 0) != 0);
                              if (__pyx_t_23) {

                                /* "PygameShader/shader.pyx":7826
 *                                 b[0] * (<float> 1.0 - c4)), 255)
 *                 if c1 < 0:
 *                     c1 = 0             # <<<<<<<<<<<<<<
 *                 if c2 < 0:
 *                     c2 = 0
 */
                                __pyx_v_c1 = 0;

                                /* "PygameShader/shader.pyx":7825
 *                 c3 = min(<int> (<float> destination_array[i, j, 2] * c4 +
 *                                 b[0] * (<float> 1.0 - c4)), 255)
 *                 if c1 < 0:             # <<<<<<<<<<<<<<
 *                     c1 = 0
 *                 if c2 < 0:
 */
                              }

                              /* "PygameShader/shader.pyx":7827
 *                 if c1 < 0:
 *                     c1 = 0
 *                 if c2 < 0:             # <<<<<<<<<<<<<<
 *                     c2 = 0
 *                 if c3 < 0:
 */
                              __pyx_t_23 = ((__pyx_v_c2 < 0) != 0);
                              if (__pyx_t_23) {

                                /* "PygameShader/shader.pyx":7828
 *                     c1 = 0
 *                 if c2 < 0:
 *                     c2 = 0             # <<<<<<<<<<<<<<
 *                 if c3 < 0:
 *                     c3 = 0
 */
                                __pyx_v_c2 = 0;

                                /* "PygameShader/shader.pyx":7827
 *                 if c1 < 0:
 *                     c1 = 0
 *                 if c2 < 0:             # <<<<<<<<<<<<<<
 *                     c2 = 0
 *                 if c3 < 0:
 */
                              }

                              /* "PygameShader/shader.pyx":7829
 *                 if c2 < 0:
 *                     c2 = 0
 *                 if c3 < 0:             # <<<<<<<<<<<<<<
 *                     c3 = 0
 *                 final_array[j, i, 0] = c1
 */
                              __pyx_t_23 = ((__pyx_v_c3 < 0) != 0);
                              if (__pyx_t_23) {

                                /* "PygameShader/shader.pyx":7830
 *                     c2 = 0
 *                 if c3 < 0:
 *                     c3 = 0             # <<<<<<<<<<<<<<
 *                 final_array[j, i, 0] = c1
 *                 final_array[j, i, 1] = c2
 */
                                __pyx_v_c3 = 0;

                                /* "PygameShader/shader.pyx":7829
 *                 if c2 < 0:
 *                     c2 = 0
 *                 if c3 < 0:             # <<<<<<<<<<<<<<
 *                     c3 = 0
 *                 final_array[j, i, 0] = c1
 */
                              }

                              /* "PygameShader/shader.pyx":7831
 *                 if c3 < 0:
 *                     c3 = 0
 *                 final_array[j, i, 0] = c1             # <<<<<<<<<<<<<<
 *                 final_array[j, i, 1] = c2
 *                 final_array[j, i, 2] = c3
 */
                              __pyx_t_17 = __pyx_v_j;
                              __pyx_t_18 = __pyx_v_i;
                              __pyx_t_19 = 0;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_final_array.data + __pyx_t_17 * __pyx_v_final_array.strides[0]) ) + __pyx_t_18 * __pyx_v_final_array.strides[1]) )) + __pyx_t_19)) )) = __pyx_v_c1;

                              /* "PygameShader/shader.pyx":7832
 *                     c3 = 0
 *                 final_array[j, i, 0] = c1
 *                 final_array[j, i, 1] = c2             # <<<<<<<<<<<<<<
 *                 final_array[j, i, 2] = c3
 * 
 */
                              __pyx_t_19 = __pyx_v_j;
                              __pyx_t_18 = __pyx_v_i;
                              __pyx_t_17 = 1;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_final_array.data + __pyx_t_19 * __pyx_v_final_array.strides[0]) ) + __pyx_t_18 * __pyx_v_final_array.strides[1]) )) + __pyx_t_17)) )) = __pyx_v_c2;

                              /* "PygameShader/shader.pyx":7833
 *                 final_array[j, i, 0] = c1
 *                 final_array[j, i, 1] = c2
 *                 final_array[j, i, 2] = c3             # <<<<<<<<<<<<<<
 * 
 *     return pygame.image.frombuffer(final_array, (w, h), 'RGB').convert()
 */
                              __pyx_t_17 = __pyx_v_j;
                              __pyx_t_18 = __pyx_v_i;
                              __pyx_t_19 = 2;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_final_array.data + __pyx_t_17 * __pyx_v_final_array.strides[0]) ) + __pyx_t_18 * __pyx_v_final_array.strides[1]) )) + __pyx_t_19)) )) = __pyx_v_c3;
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":7811
 *         unsigned char *b
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for j in prange(h, schedule='static', num_threads=THREADS):
 *             for i in range(w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L21;
        }
        __pyx_L21:;
      }
  }

  /* "PygameShader/shader.pyx":7835
 *                 final_array[j, i, 2] = c3
 * 
 *     return pygame.image.frombuffer(final_array, (w, h), 'RGB').convert()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pygame); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_image); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_final_array, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_24 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 7835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 7835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_25);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_24);
  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_24);
  __pyx_t_10 = 0;
  __pyx_t_24 = 0;
  __pyx_t_24 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_24)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_24);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[4] = {__pyx_t_24, __pyx_t_4, __pyx_t_25, __pyx_n_s_RGB};
    __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7835, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[4] = {__pyx_t_24, __pyx_t_4, __pyx_t_25, __pyx_n_s_RGB};
    __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7835, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7835, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_24) {
      __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_24); __pyx_t_24 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_25);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_t_25);
    __Pyx_INCREF(__pyx_n_s_RGB);
    __Pyx_GIVEREF(__pyx_n_s_RGB);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, __pyx_n_s_RGB);
    __pyx_t_4 = 0;
    __pyx_t_25 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7835, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_convert); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":7766
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef object blending(object source_, object destination_, float percentage_):             # <<<<<<<<<<<<<<
 *     """
 *     BLEND A SOURCE TEXTURE TOWARD A DESTINATION TEXTURE (TRANSITION EFFECT)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_XDECREF(__pyx_t_24);
  __Pyx_XDECREF(__pyx_t_25);
  __Pyx_AddTraceback("PygameShader.shader.blending", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_source_array, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_destination_array, 1);
  __Pyx_XDECREF(__pyx_v_e);
  __PYX_XDEC_MEMVIEW(&__pyx_v_final_array, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":7842
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void dirt_lens_c(             # <<<<<<<<<<<<<<
 *         object source_,
 *         object lens_model_,
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dirt_lens_c(PyObject *__pyx_v_source_, PyObject *__pyx_v_lens_model_, int __pyx_v_flag_, struct __pyx_opt_args_12PygameShader_6shader_dirt_lens_c *__pyx_optional_args) {
  float __pyx_v_light_ = ((float)0.0);
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dirt_lens_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_light_ = __pyx_optional_args->light_;
    }
  }

  /* "PygameShader/shader.pyx":7848
 *         float light_=0.0):
 * 
 *     if light_!=0.0:             # <<<<<<<<<<<<<<
 *         brightness(lens_model_, light_)
 *     source_.blit(lens_model_, (0, 0), special_flags=flag_)
 */
  __pyx_t_1 = ((__pyx_v_light_ != 0.0) != 0);
  if (__pyx_t_1) {

    /* "PygameShader/shader.pyx":7849
 * 
 *     if light_!=0.0:
 *         brightness(lens_model_, light_)             # <<<<<<<<<<<<<<
 *     source_.blit(lens_model_, (0, 0), special_flags=flag_)
 * 
 */
    __pyx_f_12PygameShader_6shader_brightness(__pyx_v_lens_model_, __pyx_v_light_, 0);

    /* "PygameShader/shader.pyx":7848
 *         float light_=0.0):
 * 
 *     if light_!=0.0:             # <<<<<<<<<<<<<<
 *         brightness(lens_model_, light_)
 *     source_.blit(lens_model_, (0, 0), special_flags=flag_)
 */
  }

  /* "PygameShader/shader.pyx":7850
 *     if light_!=0.0:
 *         brightness(lens_model_, light_)
 *     source_.blit(lens_model_, (0, 0), special_flags=flag_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source_, __pyx_n_s_blit); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_lens_model_);
  __Pyx_GIVEREF(__pyx_v_lens_model_);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_lens_model_);
  __Pyx_INCREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_tuple__12);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_flag_); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_special_flags, __pyx_t_5) < 0) __PYX_ERR(1, 7850, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PygameShader/shader.pyx":7842
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void dirt_lens_c(             # <<<<<<<<<<<<<<
 *         object source_,
 *         object lens_model_,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("PygameShader.shader.dirt_lens_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":7858
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef object dithering_c(float [:, :, :] rgb_array_, int factor_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

static PyObject *__pyx_f_12PygameShader_6shader_dithering_c(__Pyx_memviewslice __pyx_v_rgb_array_, int __pyx_v_factor_) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_x;
  int __pyx_v_y;
  float __pyx_v_new_red;
  float __pyx_v_new_green;
  float __pyx_v_new_blue;
  float __pyx_v_quantization_error_red;
  float __pyx_v_quantization_error_green;
  float __pyx_v_quantization_error_blue;
  float __pyx_v_oldr;
  float __pyx_v_oldg;
  float __pyx_v_oldb;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  long __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dithering_c", 0);

  /* "PygameShader/shader.pyx":7879
 * 
 *     cdef Py_ssize_t w, h
 *     w = <object> rgb_array_.shape[ 0 ] - 1             # <<<<<<<<<<<<<<
 *     h = <object> rgb_array_.shape[ 1 ] - 1
 * 
 */
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 7879, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_w = __pyx_t_3;

  /* "PygameShader/shader.pyx":7880
 *     cdef Py_ssize_t w, h
 *     w = <object> rgb_array_.shape[ 0 ] - 1
 *     h = <object> rgb_array_.shape[ 1 ] - 1             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 7880, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":7883
 * 
 *     cdef:
 *         int x=0, y=0             # <<<<<<<<<<<<<<
 *         float new_red, new_green, new_blue
 *         float quantization_error_red, quantization_error_green, quantization_error_blue
 */
  __pyx_v_x = 0;
  __pyx_v_y = 0;

  /* "PygameShader/shader.pyx":7888
 *         float oldr, oldg, oldb
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(1, h, schedule='static', num_threads=THREADS, chunksize=2**8):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":7890
 *     with nogil:
 * 
 *         for y in prange(1, h, schedule='static', num_threads=THREADS, chunksize=2**8):             # <<<<<<<<<<<<<<
 * 
 *             for x in range(1, w):
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            __pyx_t_6 = __Pyx_pow_long(2, 8);
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_5 = (__pyx_t_3 - 1 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_5 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_new_blue) lastprivate(__pyx_v_new_green) lastprivate(__pyx_v_new_red) lastprivate(__pyx_v_oldb) lastprivate(__pyx_v_oldg) lastprivate(__pyx_v_oldr) lastprivate(__pyx_v_quantization_error_blue) lastprivate(__pyx_v_quantization_error_green) lastprivate(__pyx_v_quantization_error_red) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static, __pyx_t_6)
                    #endif /* _OPENMP */
                    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4++){
                        {
                            __pyx_v_y = (int)(1 + 1 * __pyx_t_4);
                            /* Initialize private variables to invalid values */
                            __pyx_v_new_blue = ((float)__PYX_NAN());
                            __pyx_v_new_green = ((float)__PYX_NAN());
                            __pyx_v_new_red = ((float)__PYX_NAN());
                            __pyx_v_oldb = ((float)__PYX_NAN());
                            __pyx_v_oldg = ((float)__PYX_NAN());
                            __pyx_v_oldr = ((float)__PYX_NAN());
                            __pyx_v_quantization_error_blue = ((float)__PYX_NAN());
                            __pyx_v_quantization_error_green = ((float)__PYX_NAN());
                            __pyx_v_quantization_error_red = ((float)__PYX_NAN());
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":7892
 *         for y in prange(1, h, schedule='static', num_threads=THREADS, chunksize=2**8):
 * 
 *             for x in range(1, w):             # <<<<<<<<<<<<<<
 * 
 *                 oldr = rgb_array_[x, y, 0]
 */
                            __pyx_t_7 = __pyx_v_w;
                            __pyx_t_8 = __pyx_t_7;
                            for (__pyx_t_9 = 1; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
                              __pyx_v_x = __pyx_t_9;

                              /* "PygameShader/shader.pyx":7894
 *             for x in range(1, w):
 * 
 *                 oldr = rgb_array_[x, y, 0]             # <<<<<<<<<<<<<<
 *                 oldg = rgb_array_[x, y, 1]
 *                 oldb = rgb_array_[x, y, 2]
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_12 = 0;
                              __pyx_v_oldr = (*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));

                              /* "PygameShader/shader.pyx":7895
 * 
 *                 oldr = rgb_array_[x, y, 0]
 *                 oldg = rgb_array_[x, y, 1]             # <<<<<<<<<<<<<<
 *                 oldb = rgb_array_[x, y, 2]
 * 
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_10 = 1;
                              __pyx_v_oldg = (*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )));

                              /* "PygameShader/shader.pyx":7896
 *                 oldr = rgb_array_[x, y, 0]
 *                 oldg = rgb_array_[x, y, 1]
 *                 oldb = rgb_array_[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 *                 new_red   = <float>round_c(oldr * (factor_ - 1)) / (factor_ - 1)
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_12 = 2;
                              __pyx_v_oldb = (*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));

                              /* "PygameShader/shader.pyx":7898
 *                 oldb = rgb_array_[x, y, 2]
 * 
 *                 new_red   = <float>round_c(oldr * (factor_ - 1)) / (factor_ - 1)             # <<<<<<<<<<<<<<
 *                 new_green = <float>round_c(oldg * (factor_ - 1)) / (factor_ - 1)
 *                 new_blue  = <float>round_c(oldb * (factor_ - 1)) / (factor_ - 1)
 */
                              __pyx_v_new_red = (((float)round((__pyx_v_oldr * (__pyx_v_factor_ - 1)))) / (__pyx_v_factor_ - 1));

                              /* "PygameShader/shader.pyx":7899
 * 
 *                 new_red   = <float>round_c(oldr * (factor_ - 1)) / (factor_ - 1)
 *                 new_green = <float>round_c(oldg * (factor_ - 1)) / (factor_ - 1)             # <<<<<<<<<<<<<<
 *                 new_blue  = <float>round_c(oldb * (factor_ - 1)) / (factor_ - 1)
 * 
 */
                              __pyx_v_new_green = (((float)round((__pyx_v_oldg * (__pyx_v_factor_ - 1)))) / (__pyx_v_factor_ - 1));

                              /* "PygameShader/shader.pyx":7900
 *                 new_red   = <float>round_c(oldr * (factor_ - 1)) / (factor_ - 1)
 *                 new_green = <float>round_c(oldg * (factor_ - 1)) / (factor_ - 1)
 *                 new_blue  = <float>round_c(oldb * (factor_ - 1)) / (factor_ - 1)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x, y, 0] = new_red
 */
                              __pyx_v_new_blue = (((float)round((__pyx_v_oldb * (__pyx_v_factor_ - 1)))) / (__pyx_v_factor_ - 1));

                              /* "PygameShader/shader.pyx":7902
 *                 new_blue  = <float>round_c(oldb * (factor_ - 1)) / (factor_ - 1)
 * 
 *                 rgb_array_[x, y, 0] = new_red             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y, 1] = new_green
 *                 rgb_array_[x, y, 2] = new_blue
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_10 = 0;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_red;

                              /* "PygameShader/shader.pyx":7903
 * 
 *                 rgb_array_[x, y, 0] = new_red
 *                 rgb_array_[x, y, 1] = new_green             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y, 2] = new_blue
 * 
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_12 = 1;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_green;

                              /* "PygameShader/shader.pyx":7904
 *                 rgb_array_[x, y, 0] = new_red
 *                 rgb_array_[x, y, 1] = new_green
 *                 rgb_array_[x, y, 2] = new_blue             # <<<<<<<<<<<<<<
 * 
 *                 quantization_error_red   = <float>(oldr - new_red)
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_10 = 2;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_blue;

                              /* "PygameShader/shader.pyx":7906
 *                 rgb_array_[x, y, 2] = new_blue
 * 
 *                 quantization_error_red   = <float>(oldr - new_red)             # <<<<<<<<<<<<<<
 *                 quantization_error_green = <float>(oldg - new_green)
 *                 quantization_error_blue  = <float>(oldb - new_blue)
 */
                              __pyx_v_quantization_error_red = ((float)(__pyx_v_oldr - __pyx_v_new_red));

                              /* "PygameShader/shader.pyx":7907
 * 
 *                 quantization_error_red   = <float>(oldr - new_red)
 *                 quantization_error_green = <float>(oldg - new_green)             # <<<<<<<<<<<<<<
 *                 quantization_error_blue  = <float>(oldb - new_blue)
 * 
 */
                              __pyx_v_quantization_error_green = ((float)(__pyx_v_oldg - __pyx_v_new_green));

                              /* "PygameShader/shader.pyx":7908
 *                 quantization_error_red   = <float>(oldr - new_red)
 *                 quantization_error_green = <float>(oldg - new_green)
 *                 quantization_error_blue  = <float>(oldb - new_blue)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x + 1, y, 0] = \
 */
                              __pyx_v_quantization_error_blue = ((float)(__pyx_v_oldb - __pyx_v_new_blue));

                              /* "PygameShader/shader.pyx":7911
 * 
 *                 rgb_array_[x + 1, y, 0] = \
 *                     rgb_array_[x + 1, y, 0] + quantization_error_red * C1             # <<<<<<<<<<<<<<
 *                 rgb_array_[x + 1, y, 1] = \
 *                     rgb_array_[x + 1, y, 1] + quantization_error_green * C1
 */
                              __pyx_t_10 = (__pyx_v_x + 1);
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_12 = 0;

                              /* "PygameShader/shader.pyx":7910
 *                 quantization_error_blue  = <float>(oldb - new_blue)
 * 
 *                 rgb_array_[x + 1, y, 0] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x + 1, y, 0] + quantization_error_red * C1
 *                 rgb_array_[x + 1, y, 1] = \
 */
                              __pyx_t_13 = (__pyx_v_x + 1);
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 0;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C1));

                              /* "PygameShader/shader.pyx":7913
 *                     rgb_array_[x + 1, y, 0] + quantization_error_red * C1
 *                 rgb_array_[x + 1, y, 1] = \
 *                     rgb_array_[x + 1, y, 1] + quantization_error_green * C1             # <<<<<<<<<<<<<<
 *                 rgb_array_[x + 1, y, 2] = \
 *                     rgb_array_[x + 1, y, 2] + quantization_error_blue * C1
 */
                              __pyx_t_12 = (__pyx_v_x + 1);
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_10 = 1;

                              /* "PygameShader/shader.pyx":7912
 *                 rgb_array_[x + 1, y, 0] = \
 *                     rgb_array_[x + 1, y, 0] + quantization_error_red * C1
 *                 rgb_array_[x + 1, y, 1] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x + 1, y, 1] + quantization_error_green * C1
 *                 rgb_array_[x + 1, y, 2] = \
 */
                              __pyx_t_15 = (__pyx_v_x + 1);
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 1;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C1));

                              /* "PygameShader/shader.pyx":7915
 *                     rgb_array_[x + 1, y, 1] + quantization_error_green * C1
 *                 rgb_array_[x + 1, y, 2] = \
 *                     rgb_array_[x + 1, y, 2] + quantization_error_blue * C1             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x - 1, y + 1, 0] = \
 */
                              __pyx_t_10 = (__pyx_v_x + 1);
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_12 = 2;

                              /* "PygameShader/shader.pyx":7914
 *                 rgb_array_[x + 1, y, 1] = \
 *                     rgb_array_[x + 1, y, 1] + quantization_error_green * C1
 *                 rgb_array_[x + 1, y, 2] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x + 1, y, 2] + quantization_error_blue * C1
 * 
 */
                              __pyx_t_13 = (__pyx_v_x + 1);
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 2;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C1));

                              /* "PygameShader/shader.pyx":7918
 * 
 *                 rgb_array_[x - 1, y + 1, 0] = \
 *                     rgb_array_[x - 1, y + 1, 0] + quantization_error_red * C2             # <<<<<<<<<<<<<<
 *                 rgb_array_[x - 1, y + 1, 1] = \
 *                     rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2
 */
                              __pyx_t_12 = (__pyx_v_x - 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_10 = 0;

                              /* "PygameShader/shader.pyx":7917
 *                     rgb_array_[x + 1, y, 2] + quantization_error_blue * C1
 * 
 *                 rgb_array_[x - 1, y + 1, 0] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x - 1, y + 1, 0] + quantization_error_red * C2
 *                 rgb_array_[x - 1, y + 1, 1] = \
 */
                              __pyx_t_15 = (__pyx_v_x - 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_13 = 0;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C2));

                              /* "PygameShader/shader.pyx":7920
 *                     rgb_array_[x - 1, y + 1, 0] + quantization_error_red * C2
 *                 rgb_array_[x - 1, y + 1, 1] = \
 *                     rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2             # <<<<<<<<<<<<<<
 *                 rgb_array_[x - 1, y + 1, 2] = \
 *                     rgb_array_[x - 1, y + 1, 2] + quantization_error_blue * C2
 */
                              __pyx_t_10 = (__pyx_v_x - 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_12 = 1;

                              /* "PygameShader/shader.pyx":7919
 *                 rgb_array_[x - 1, y + 1, 0] = \
 *                     rgb_array_[x - 1, y + 1, 0] + quantization_error_red * C2
 *                 rgb_array_[x - 1, y + 1, 1] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2
 *                 rgb_array_[x - 1, y + 1, 2] = \
 */
                              __pyx_t_13 = (__pyx_v_x - 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_15 = 1;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C2));

                              /* "PygameShader/shader.pyx":7922
 *                     rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2
 *                 rgb_array_[x - 1, y + 1, 2] = \
 *                     rgb_array_[x - 1, y + 1, 2] + quantization_error_blue * C2             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x, y + 1, 0] = \
 */
                              __pyx_t_12 = (__pyx_v_x - 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_10 = 2;

                              /* "PygameShader/shader.pyx":7921
 *                 rgb_array_[x - 1, y + 1, 1] = \
 *                     rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2
 *                 rgb_array_[x - 1, y + 1, 2] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x - 1, y + 1, 2] + quantization_error_blue * C2
 * 
 */
                              __pyx_t_15 = (__pyx_v_x - 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_13 = 2;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C2));

                              /* "PygameShader/shader.pyx":7925
 * 
 *                 rgb_array_[x, y + 1, 0] = \
 *                     rgb_array_[x, y + 1, 0] + quantization_error_red * C3             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y + 1, 1] = \
 *                     rgb_array_[x, y + 1, 1] + quantization_error_green * C3
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_12 = 0;

                              /* "PygameShader/shader.pyx":7924
 *                     rgb_array_[x - 1, y + 1, 2] + quantization_error_blue * C2
 * 
 *                 rgb_array_[x, y + 1, 0] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x, y + 1, 0] + quantization_error_red * C3
 *                 rgb_array_[x, y + 1, 1] = \
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_15 = 0;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C3));

                              /* "PygameShader/shader.pyx":7927
 *                     rgb_array_[x, y + 1, 0] + quantization_error_red * C3
 *                 rgb_array_[x, y + 1, 1] = \
 *                     rgb_array_[x, y + 1, 1] + quantization_error_green * C3             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y + 1, 2] = \
 *                     rgb_array_[x, y + 1, 2] + quantization_error_blue * C3
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_10 = 1;

                              /* "PygameShader/shader.pyx":7926
 *                 rgb_array_[x, y + 1, 0] = \
 *                     rgb_array_[x, y + 1, 0] + quantization_error_red * C3
 *                 rgb_array_[x, y + 1, 1] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x, y + 1, 1] + quantization_error_green * C3
 *                 rgb_array_[x, y + 1, 2] = \
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_13 = 1;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C3));

                              /* "PygameShader/shader.pyx":7929
 *                     rgb_array_[x, y + 1, 1] + quantization_error_green * C3
 *                 rgb_array_[x, y + 1, 2] = \
 *                     rgb_array_[x, y + 1, 2] + quantization_error_blue * C3             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x + 1, y + 1, 0] = \
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_12 = 2;

                              /* "PygameShader/shader.pyx":7928
 *                 rgb_array_[x, y + 1, 1] = \
 *                     rgb_array_[x, y + 1, 1] + quantization_error_green * C3
 *                 rgb_array_[x, y + 1, 2] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x, y + 1, 2] + quantization_error_blue * C3
 * 
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_15 = 2;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C3));

                              /* "PygameShader/shader.pyx":7932
 * 
 *                 rgb_array_[x + 1, y + 1, 0] = \
 *                     rgb_array_[x + 1, y + 1, 0] + quantization_error_red * C4             # <<<<<<<<<<<<<<
 *                 rgb_array_[x + 1, y + 1, 1] = \
 *                     rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4
 */
                              __pyx_t_12 = (__pyx_v_x + 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_10 = 0;

                              /* "PygameShader/shader.pyx":7931
 *                     rgb_array_[x, y + 1, 2] + quantization_error_blue * C3
 * 
 *                 rgb_array_[x + 1, y + 1, 0] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x + 1, y + 1, 0] + quantization_error_red * C4
 *                 rgb_array_[x + 1, y + 1, 1] = \
 */
                              __pyx_t_15 = (__pyx_v_x + 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_13 = 0;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C4));

                              /* "PygameShader/shader.pyx":7934
 *                     rgb_array_[x + 1, y + 1, 0] + quantization_error_red * C4
 *                 rgb_array_[x + 1, y + 1, 1] = \
 *                     rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4             # <<<<<<<<<<<<<<
 *                 rgb_array_[x + 1, y + 1, 2] = \
 *                     rgb_array_[x + 1, y + 1, 2] + quantization_error_blue * C4
 */
                              __pyx_t_10 = (__pyx_v_x + 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_12 = 1;

                              /* "PygameShader/shader.pyx":7933
 *                 rgb_array_[x + 1, y + 1, 0] = \
 *                     rgb_array_[x + 1, y + 1, 0] + quantization_error_red * C4
 *                 rgb_array_[x + 1, y + 1, 1] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4
 *                 rgb_array_[x + 1, y + 1, 2] = \
 */
                              __pyx_t_13 = (__pyx_v_x + 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_15 = 1;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C4));

                              /* "PygameShader/shader.pyx":7936
 *                     rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4
 *                 rgb_array_[x + 1, y + 1, 2] = \
 *                     rgb_array_[x + 1, y + 1, 2] + quantization_error_blue * C4             # <<<<<<<<<<<<<<
 * 
 *     return make_surface(numpy.multiply(asarray(rgb_array_), 255.0).astype(dtype=uint8)).convert()
 */
                              __pyx_t_12 = (__pyx_v_x + 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_10 = 2;

                              /* "PygameShader/shader.pyx":7935
 *                 rgb_array_[x + 1, y + 1, 1] = \
 *                     rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4
 *                 rgb_array_[x + 1, y + 1, 2] = \             # <<<<<<<<<<<<<<
 *                     rgb_array_[x + 1, y + 1, 2] + quantization_error_blue * C4
 * 
 */
                              __pyx_t_15 = (__pyx_v_x + 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_13 = 2;
                              *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C4));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":7888
 *         float oldr, oldg, oldb
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(1, h, schedule='static', num_threads=THREADS, chunksize=2**8):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":7938
 *                     rgb_array_[x + 1, y + 1, 2] + quantization_error_blue * C4
 * 
 *     return make_surface(numpy.multiply(asarray(rgb_array_), 255.0).astype(dtype=uint8)).convert()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_numpy); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_multiply); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_asarray); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_21 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __pyx_t_22 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
    __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_20);
    if (likely(__pyx_t_22)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
      __Pyx_INCREF(__pyx_t_22);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_20, function);
    }
  }
  __pyx_t_18 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_22, __pyx_t_21) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
    __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19);
    if (likely(__pyx_t_20)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
      __Pyx_INCREF(__pyx_t_20);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_19, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_19)) {
    PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_18, __pyx_float_255_0};
    __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 7938, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
    PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_18, __pyx_float_255_0};
    __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 7938, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  } else
  #endif
  {
    __pyx_t_21 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 7938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    if (__pyx_t_20) {
      __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_20); __pyx_t_20 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_18);
    PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_9, __pyx_t_18);
    __Pyx_INCREF(__pyx_float_255_0);
    __Pyx_GIVEREF(__pyx_float_255_0);
    PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_9, __pyx_float_255_0);
    __pyx_t_18 = 0;
    __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_21, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 7938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  }
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_astype); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_uint8); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_dtype, __pyx_t_21) < 0) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_empty_tuple, __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_t_17 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
    __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_16);
    if (likely(__pyx_t_17)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_17);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_16, function);
    }
  }
  __pyx_t_2 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_17, __pyx_t_21) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_21);
  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_convert); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_16);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_16, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":7858
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef object dithering_c(float [:, :, :] rgb_array_, int factor_):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_AddTraceback("PygameShader.shader.dithering_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":7946
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void dithering_int_c(unsigned char[:, :, :] rgb_array_, int factor_):             # <<<<<<<<<<<<<<
 * 
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dithering_int_c(__Pyx_memviewslice __pyx_v_rgb_array_, int __pyx_v_factor_) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_x;
  int __pyx_v_y;
  unsigned char __pyx_v_new_red;
  unsigned char __pyx_v_new_green;
  unsigned char __pyx_v_new_blue;
  int __pyx_v_quantization_error_red;
  int __pyx_v_quantization_error_green;
  int __pyx_v_quantization_error_blue;
  unsigned char __pyx_v_oldr;
  unsigned char __pyx_v_oldg;
  unsigned char __pyx_v_oldb;
  float __pyx_v_c5;
  float __pyx_v_c6;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  long __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dithering_int_c", 0);

  /* "PygameShader/shader.pyx":7950
 * 
 *     cdef Py_ssize_t w, h
 *     w = <object> rgb_array_.shape[ 0 ] - 1             # <<<<<<<<<<<<<<
 *     h = <object> rgb_array_.shape[ 1 ] - 1
 * 
 */
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 7950, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_w = __pyx_t_3;

  /* "PygameShader/shader.pyx":7951
 *     cdef Py_ssize_t w, h
 *     w = <object> rgb_array_.shape[ 0 ] - 1
 *     h = <object> rgb_array_.shape[ 1 ] - 1             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 7951, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":7954
 * 
 *     cdef:
 *         int x=0, y=0             # <<<<<<<<<<<<<<
 *         unsigned char new_red, new_green, new_blue
 *         int quantization_error_red, quantization_error_green, quantization_error_blue
 */
  __pyx_v_x = 0;
  __pyx_v_y = 0;

  /* "PygameShader/shader.pyx":7958
 *         int quantization_error_red, quantization_error_green, quantization_error_blue
 *         unsigned char oldr, oldg, oldb
 *         float c5 = <float>255.0 / <float>(factor_ -1)             # <<<<<<<<<<<<<<
 *         float c6 = <float>(factor_ -1) * ONE_255
 * 
 */
  __pyx_v_c5 = (((float)255.0) / ((float)(__pyx_v_factor_ - 1)));

  /* "PygameShader/shader.pyx":7959
 *         unsigned char oldr, oldg, oldb
 *         float c5 = <float>255.0 / <float>(factor_ -1)
 *         float c6 = <float>(factor_ -1) * ONE_255             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_c6 = (((float)(__pyx_v_factor_ - 1)) * 0.00392156862745098);

  /* "PygameShader/shader.pyx":7962
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(1, h, schedule='static', num_threads=THREADS, chunksize=2**8):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":7964
 *     with nogil:
 * 
 *         for y in prange(1, h, schedule='static', num_threads=THREADS, chunksize=2**8):             # <<<<<<<<<<<<<<
 * 
 *             for x in range(1, w):
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            __pyx_t_6 = __Pyx_pow_long(2, 8);
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_5 = (__pyx_t_3 - 1 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_5 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_new_blue) lastprivate(__pyx_v_new_green) lastprivate(__pyx_v_new_red) lastprivate(__pyx_v_oldb) lastprivate(__pyx_v_oldg) lastprivate(__pyx_v_oldr) lastprivate(__pyx_v_quantization_error_blue) lastprivate(__pyx_v_quantization_error_green) lastprivate(__pyx_v_quantization_error_red) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static, __pyx_t_6)
                    #endif /* _OPENMP */
                    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4++){
                        {
                            __pyx_v_y = (int)(1 + 1 * __pyx_t_4);
                            /* Initialize private variables to invalid values */
                            __pyx_v_new_blue = ((unsigned char)'?');
                            __pyx_v_new_green = ((unsigned char)'?');
                            __pyx_v_new_red = ((unsigned char)'?');
                            __pyx_v_oldb = ((unsigned char)'?');
                            __pyx_v_oldg = ((unsigned char)'?');
                            __pyx_v_oldr = ((unsigned char)'?');
                            __pyx_v_quantization_error_blue = ((int)0xbad0bad0);
                            __pyx_v_quantization_error_green = ((int)0xbad0bad0);
                            __pyx_v_quantization_error_red = ((int)0xbad0bad0);
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":7966
 *         for y in prange(1, h, schedule='static', num_threads=THREADS, chunksize=2**8):
 * 
 *             for x in range(1, w):             # <<<<<<<<<<<<<<
 * 
 *                 oldr = rgb_array_[x, y, 0]
 */
                            __pyx_t_7 = __pyx_v_w;
                            __pyx_t_8 = __pyx_t_7;
                            for (__pyx_t_9 = 1; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
                              __pyx_v_x = __pyx_t_9;

                              /* "PygameShader/shader.pyx":7968
 *             for x in range(1, w):
 * 
 *                 oldr = rgb_array_[x, y, 0]             # <<<<<<<<<<<<<<
 *                 oldg = rgb_array_[x, y, 1]
 *                 oldb = rgb_array_[x, y, 2]
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_12 = 0;
                              __pyx_v_oldr = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));

                              /* "PygameShader/shader.pyx":7969
 * 
 *                 oldr = rgb_array_[x, y, 0]
 *                 oldg = rgb_array_[x, y, 1]             # <<<<<<<<<<<<<<
 *                 oldb = rgb_array_[x, y, 2]
 * 
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_10 = 1;
                              __pyx_v_oldg = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )));

                              /* "PygameShader/shader.pyx":7970
 *                 oldr = rgb_array_[x, y, 0]
 *                 oldg = rgb_array_[x, y, 1]
 *                 oldb = rgb_array_[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_12 = 2;
                              __pyx_v_oldb = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));

                              /* "PygameShader/shader.pyx":7973
 * 
 * 
 *                 new_red = <unsigned int> (<int>nearbyint(c6 * oldr) * <int>c5)             # <<<<<<<<<<<<<<
 *                 new_green = <unsigned int> (<int>nearbyint(c6 * oldg) * <int>c5)
 *                 new_blue = <unsigned int> (<int>nearbyint(c6 * oldb) * <int>c5)
 */
                              __pyx_v_new_red = ((unsigned int)(((int)nearbyint((__pyx_v_c6 * __pyx_v_oldr))) * ((int)__pyx_v_c5)));

                              /* "PygameShader/shader.pyx":7974
 * 
 *                 new_red = <unsigned int> (<int>nearbyint(c6 * oldr) * <int>c5)
 *                 new_green = <unsigned int> (<int>nearbyint(c6 * oldg) * <int>c5)             # <<<<<<<<<<<<<<
 *                 new_blue = <unsigned int> (<int>nearbyint(c6 * oldb) * <int>c5)
 * 
 */
                              __pyx_v_new_green = ((unsigned int)(((int)nearbyint((__pyx_v_c6 * __pyx_v_oldg))) * ((int)__pyx_v_c5)));

                              /* "PygameShader/shader.pyx":7975
 *                 new_red = <unsigned int> (<int>nearbyint(c6 * oldr) * <int>c5)
 *                 new_green = <unsigned int> (<int>nearbyint(c6 * oldg) * <int>c5)
 *                 new_blue = <unsigned int> (<int>nearbyint(c6 * oldb) * <int>c5)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x, y, 0] = new_red
 */
                              __pyx_v_new_blue = ((unsigned int)(((int)nearbyint((__pyx_v_c6 * __pyx_v_oldb))) * ((int)__pyx_v_c5)));

                              /* "PygameShader/shader.pyx":7977
 *                 new_blue = <unsigned int> (<int>nearbyint(c6 * oldb) * <int>c5)
 * 
 *                 rgb_array_[x, y, 0] = new_red             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y, 1] = new_green
 *                 rgb_array_[x, y, 2] = new_blue
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_10 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_red;

                              /* "PygameShader/shader.pyx":7978
 * 
 *                 rgb_array_[x, y, 0] = new_red
 *                 rgb_array_[x, y, 1] = new_green             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y, 2] = new_blue
 * 
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_12 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_green;

                              /* "PygameShader/shader.pyx":7979
 *                 rgb_array_[x, y, 0] = new_red
 *                 rgb_array_[x, y, 1] = new_green
 *                 rgb_array_[x, y, 2] = new_blue             # <<<<<<<<<<<<<<
 * 
 *                 quantization_error_red   = int(oldr - new_red)
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_10 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_blue;

                              /* "PygameShader/shader.pyx":7981
 *                 rgb_array_[x, y, 2] = new_blue
 * 
 *                 quantization_error_red   = int(oldr - new_red)             # <<<<<<<<<<<<<<
 *                 quantization_error_green = int(oldg - new_green)
 *                 quantization_error_blue  = int(oldb - new_blue)
 */
                              __pyx_v_quantization_error_red = (__pyx_v_oldr - __pyx_v_new_red);

                              /* "PygameShader/shader.pyx":7982
 * 
 *                 quantization_error_red   = int(oldr - new_red)
 *                 quantization_error_green = int(oldg - new_green)             # <<<<<<<<<<<<<<
 *                 quantization_error_blue  = int(oldb - new_blue)
 * 
 */
                              __pyx_v_quantization_error_green = (__pyx_v_oldg - __pyx_v_new_green);

                              /* "PygameShader/shader.pyx":7983
 *                 quantization_error_red   = int(oldr - new_red)
 *                 quantization_error_green = int(oldg - new_green)
 *                 quantization_error_blue  = int(oldb - new_blue)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x + 1, y, 0] = \
 */
                              __pyx_v_quantization_error_blue = (__pyx_v_oldb - __pyx_v_new_blue);

                              /* "PygameShader/shader.pyx":7986
 * 
 *                 rgb_array_[x + 1, y, 0] = \
 *                     <unsigned char>(rgb_array_[x + 1, y, 0] + quantization_error_red * C1)             # <<<<<<<<<<<<<<
 *                 rgb_array_[x + 1, y, 1] = \
 *                     <unsigned char>(rgb_array_[x + 1, y, 1] + quantization_error_green * C1)
 */
                              __pyx_t_10 = (__pyx_v_x + 1);
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_12 = 0;

                              /* "PygameShader/shader.pyx":7985
 *                 quantization_error_blue  = int(oldb - new_blue)
 * 
 *                 rgb_array_[x + 1, y, 0] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x + 1, y, 0] + quantization_error_red * C1)
 *                 rgb_array_[x + 1, y, 1] = \
 */
                              __pyx_t_13 = (__pyx_v_x + 1);
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C1)));

                              /* "PygameShader/shader.pyx":7988
 *                     <unsigned char>(rgb_array_[x + 1, y, 0] + quantization_error_red * C1)
 *                 rgb_array_[x + 1, y, 1] = \
 *                     <unsigned char>(rgb_array_[x + 1, y, 1] + quantization_error_green * C1)             # <<<<<<<<<<<<<<
 *                 rgb_array_[x + 1, y, 2] = \
 *                     <unsigned char>(rgb_array_[x + 1, y, 2] + quantization_error_blue * C1)
 */
                              __pyx_t_12 = (__pyx_v_x + 1);
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_10 = 1;

                              /* "PygameShader/shader.pyx":7987
 *                 rgb_array_[x + 1, y, 0] = \
 *                     <unsigned char>(rgb_array_[x + 1, y, 0] + quantization_error_red * C1)
 *                 rgb_array_[x + 1, y, 1] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x + 1, y, 1] + quantization_error_green * C1)
 *                 rgb_array_[x + 1, y, 2] = \
 */
                              __pyx_t_15 = (__pyx_v_x + 1);
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_13 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C1)));

                              /* "PygameShader/shader.pyx":7990
 *                     <unsigned char>(rgb_array_[x + 1, y, 1] + quantization_error_green * C1)
 *                 rgb_array_[x + 1, y, 2] = \
 *                     <unsigned char>(rgb_array_[x + 1, y, 2] + quantization_error_blue * C1)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x - 1, y + 1, 0] = \
 */
                              __pyx_t_10 = (__pyx_v_x + 1);
                              __pyx_t_11 = __pyx_v_y;
                              __pyx_t_12 = 2;

                              /* "PygameShader/shader.pyx":7989
 *                 rgb_array_[x + 1, y, 1] = \
 *                     <unsigned char>(rgb_array_[x + 1, y, 1] + quantization_error_green * C1)
 *                 rgb_array_[x + 1, y, 2] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x + 1, y, 2] + quantization_error_blue * C1)
 * 
 */
                              __pyx_t_13 = (__pyx_v_x + 1);
                              __pyx_t_14 = __pyx_v_y;
                              __pyx_t_15 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C1)));

                              /* "PygameShader/shader.pyx":7993
 * 
 *                 rgb_array_[x - 1, y + 1, 0] = \
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 0] + quantization_error_red * C2)             # <<<<<<<<<<<<<<
 *                 rgb_array_[x - 1, y + 1, 1] = \
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2)
 */
                              __pyx_t_12 = (__pyx_v_x - 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_10 = 0;

                              /* "PygameShader/shader.pyx":7992
 *                     <unsigned char>(rgb_array_[x + 1, y, 2] + quantization_error_blue * C1)
 * 
 *                 rgb_array_[x - 1, y + 1, 0] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 0] + quantization_error_red * C2)
 *                 rgb_array_[x - 1, y + 1, 1] = \
 */
                              __pyx_t_15 = (__pyx_v_x - 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_13 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C2)));

                              /* "PygameShader/shader.pyx":7995
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 0] + quantization_error_red * C2)
 *                 rgb_array_[x - 1, y + 1, 1] = \
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2)             # <<<<<<<<<<<<<<
 *                 rgb_array_[x - 1, y + 1, 2] = \
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 2] + quantization_error_blue * C2)
 */
                              __pyx_t_10 = (__pyx_v_x - 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_12 = 1;

                              /* "PygameShader/shader.pyx":7994
 *                 rgb_array_[x - 1, y + 1, 0] = \
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 0] + quantization_error_red * C2)
 *                 rgb_array_[x - 1, y + 1, 1] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2)
 *                 rgb_array_[x - 1, y + 1, 2] = \
 */
                              __pyx_t_13 = (__pyx_v_x - 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_15 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C2)));

                              /* "PygameShader/shader.pyx":7997
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2)
 *                 rgb_array_[x - 1, y + 1, 2] = \
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 2] + quantization_error_blue * C2)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x, y + 1, 0] = \
 */
                              __pyx_t_12 = (__pyx_v_x - 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_10 = 2;

                              /* "PygameShader/shader.pyx":7996
 *                 rgb_array_[x - 1, y + 1, 1] = \
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2)
 *                 rgb_array_[x - 1, y + 1, 2] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 2] + quantization_error_blue * C2)
 * 
 */
                              __pyx_t_15 = (__pyx_v_x - 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_13 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C2)));

                              /* "PygameShader/shader.pyx":8000
 * 
 *                 rgb_array_[x, y + 1, 0] = \
 *                     <unsigned char>(rgb_array_[x, y + 1, 0] + quantization_error_red * C3)             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y + 1, 1] = \
 *                     <unsigned char>(rgb_array_[x, y + 1, 1] + quantization_error_green * C3)
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_12 = 0;

                              /* "PygameShader/shader.pyx":7999
 *                     <unsigned char>(rgb_array_[x - 1, y + 1, 2] + quantization_error_blue * C2)
 * 
 *                 rgb_array_[x, y + 1, 0] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x, y + 1, 0] + quantization_error_red * C3)
 *                 rgb_array_[x, y + 1, 1] = \
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_15 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C3)));

                              /* "PygameShader/shader.pyx":8002
 *                     <unsigned char>(rgb_array_[x, y + 1, 0] + quantization_error_red * C3)
 *                 rgb_array_[x, y + 1, 1] = \
 *                     <unsigned char>(rgb_array_[x, y + 1, 1] + quantization_error_green * C3)             # <<<<<<<<<<<<<<
 *                 rgb_array_[x, y + 1, 2] = \
 *                     <unsigned char>(rgb_array_[x, y + 1, 2] + quantization_error_blue * C3)
 */
                              __pyx_t_12 = __pyx_v_x;
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_10 = 1;

                              /* "PygameShader/shader.pyx":8001
 *                 rgb_array_[x, y + 1, 0] = \
 *                     <unsigned char>(rgb_array_[x, y + 1, 0] + quantization_error_red * C3)
 *                 rgb_array_[x, y + 1, 1] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x, y + 1, 1] + quantization_error_green * C3)
 *                 rgb_array_[x, y + 1, 2] = \
 */
                              __pyx_t_15 = __pyx_v_x;
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_13 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C3)));

                              /* "PygameShader/shader.pyx":8004
 *                     <unsigned char>(rgb_array_[x, y + 1, 1] + quantization_error_green * C3)
 *                 rgb_array_[x, y + 1, 2] = \
 *                     <unsigned char>(rgb_array_[x, y + 1, 2] + quantization_error_blue * C3)             # <<<<<<<<<<<<<<
 * 
 *                 rgb_array_[x + 1, y + 1, 0] = \
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_12 = 2;

                              /* "PygameShader/shader.pyx":8003
 *                 rgb_array_[x, y + 1, 1] = \
 *                     <unsigned char>(rgb_array_[x, y + 1, 1] + quantization_error_green * C3)
 *                 rgb_array_[x, y + 1, 2] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x, y + 1, 2] + quantization_error_blue * C3)
 * 
 */
                              __pyx_t_13 = __pyx_v_x;
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_15 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C3)));

                              /* "PygameShader/shader.pyx":8007
 * 
 *                 rgb_array_[x + 1, y + 1, 0] = \
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 0] + quantization_error_red * C4)             # <<<<<<<<<<<<<<
 *                 rgb_array_[x + 1, y + 1, 1] = \
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4)
 */
                              __pyx_t_12 = (__pyx_v_x + 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_10 = 0;

                              /* "PygameShader/shader.pyx":8006
 *                     <unsigned char>(rgb_array_[x, y + 1, 2] + quantization_error_blue * C3)
 * 
 *                 rgb_array_[x + 1, y + 1, 0] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 0] + quantization_error_red * C4)
 *                 rgb_array_[x + 1, y + 1, 1] = \
 */
                              __pyx_t_15 = (__pyx_v_x + 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_13 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C4)));

                              /* "PygameShader/shader.pyx":8009
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 0] + quantization_error_red * C4)
 *                 rgb_array_[x + 1, y + 1, 1] = \
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4)             # <<<<<<<<<<<<<<
 *                 rgb_array_[x + 1, y + 1, 2] = \
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 2] + quantization_error_blue * C4)
 */
                              __pyx_t_10 = (__pyx_v_x + 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_12 = 1;

                              /* "PygameShader/shader.pyx":8008
 *                 rgb_array_[x + 1, y + 1, 0] = \
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 0] + quantization_error_red * C4)
 *                 rgb_array_[x + 1, y + 1, 1] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4)
 *                 rgb_array_[x + 1, y + 1, 2] = \
 */
                              __pyx_t_13 = (__pyx_v_x + 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_15 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C4)));

                              /* "PygameShader/shader.pyx":8011
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4)
 *                 rgb_array_[x + 1, y + 1, 2] = \
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 2] + quantization_error_blue * C4)             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_12 = (__pyx_v_x + 1);
                              __pyx_t_11 = (__pyx_v_y + 1);
                              __pyx_t_10 = 2;

                              /* "PygameShader/shader.pyx":8010
 *                 rgb_array_[x + 1, y + 1, 1] = \
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4)
 *                 rgb_array_[x + 1, y + 1, 2] = \             # <<<<<<<<<<<<<<
 *                     <unsigned char>(rgb_array_[x + 1, y + 1, 2] + quantization_error_blue * C4)
 * 
 */
                              __pyx_t_15 = (__pyx_v_x + 1);
                              __pyx_t_14 = (__pyx_v_y + 1);
                              __pyx_t_13 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C4)));
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":7962
 * 
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for y in prange(1, h, schedule='static', num_threads=THREADS, chunksize=2**8):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":7946
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void dithering_int_c(unsigned char[:, :, :] rgb_array_, int factor_):             # <<<<<<<<<<<<<<
 * 
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("PygameShader.shader.dithering_int_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":8019
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void convert_27colors_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array):
 * 
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_convert_27colors_c(__Pyx_memviewslice __pyx_v_rgb_array) {
  Py_ssize_t __pyx_v_w;
  CYTHON_UNUSED Py_ssize_t __pyx_v_h;
  int __pyx_v_x;
  int __pyx_v_y;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  float __pyx_v_f;
  float __pyx_v_c1;
  CYTHON_UNUSED int __pyx_v_index;
  float __pyx_v_rr;
  float __pyx_v_gg;
  float __pyx_v_bb;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  __Pyx_RefNannySetupContext("convert_27colors_c", 0);

  /* "PygameShader/shader.pyx":8029
 *     """
 *     cdef Py_ssize_t w, h
 *     w, h = rgb_array.shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = __pyx_v_rgb_array.shape;
  __pyx_t_2 = (__pyx_t_1[0]);
  __pyx_t_3 = (__pyx_t_1[1]);
  __pyx_v_w = __pyx_t_2;
  __pyx_v_h = __pyx_t_3;

  /* "PygameShader/shader.pyx":8032
 * 
 *     cdef:
 *         int x=0             # <<<<<<<<<<<<<<
 *         int y=0
 *         unsigned char *r
 */
  __pyx_v_x = 0;

  /* "PygameShader/shader.pyx":8033
 *     cdef:
 *         int x=0
 *         int y=0             # <<<<<<<<<<<<<<
 *         unsigned char *r
 *         unsigned char *g
 */
  __pyx_v_y = 0;

  /* "PygameShader/shader.pyx":8037
 *         unsigned char *g
 *         unsigned char *b
 *         float f = <float> 255.0 / <float> 2             # <<<<<<<<<<<<<<
 *         float c1 = <float>2 / <float>255.0
 *         int index = 0
 */
  __pyx_v_f = (((float)255.0) / ((float)2));

  /* "PygameShader/shader.pyx":8038
 *         unsigned char *b
 *         float f = <float> 255.0 / <float> 2
 *         float c1 = <float>2 / <float>255.0             # <<<<<<<<<<<<<<
 *         int index = 0
 *         float rr, gg, bb
 */
  __pyx_v_c1 = (((float)2) / ((float)255.0));

  /* "PygameShader/shader.pyx":8039
 *         float f = <float> 255.0 / <float> 2
 *         float c1 = <float>2 / <float>255.0
 *         int index = 0             # <<<<<<<<<<<<<<
 *         float rr, gg, bb
 * 
 */
  __pyx_v_index = 0;

  /* "PygameShader/shader.pyx":8042
 *         float rr, gg, bb
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 *             for x in range(0, w):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":8043
 * 
 *     with nogil:
 *         for y in prange(h, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for x in range(0, w):
 * 
 */
        __pyx_t_3 = __pyx_v_h;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                        {
                            __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_bb = ((float)__PYX_NAN());
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_gg = ((float)__PYX_NAN());
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_rr = ((float)__PYX_NAN());
                            __pyx_v_x = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":8044
 *     with nogil:
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 *             for x in range(0, w):             # <<<<<<<<<<<<<<
 * 
 *                 r = &rgb_array[x, y, 0]
 */
                            __pyx_t_5 = __pyx_v_w;
                            __pyx_t_6 = __pyx_t_5;
                            for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                              __pyx_v_x = __pyx_t_7;

                              /* "PygameShader/shader.pyx":8046
 *             for x in range(0, w):
 * 
 *                 r = &rgb_array[x, y, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array[x, y, 1]
 *                 b = &rgb_array[x, y, 2]
 */
                              __pyx_t_8 = __pyx_v_x;
                              __pyx_t_9 = __pyx_v_y;
                              __pyx_t_10 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":8047
 * 
 *                 r = &rgb_array[x, y, 0]
 *                 g = &rgb_array[x, y, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array[x, y, 2]
 * 
 */
                              __pyx_t_10 = __pyx_v_x;
                              __pyx_t_9 = __pyx_v_y;
                              __pyx_t_8 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":8048
 *                 r = &rgb_array[x, y, 0]
 *                 g = &rgb_array[x, y, 1]
 *                 b = &rgb_array[x, y, 2]             # <<<<<<<<<<<<<<
 * 
 *                 rr = <float>round_c(c1 * <float> r[ 0 ] ) * f
 */
                              __pyx_t_8 = __pyx_v_x;
                              __pyx_t_9 = __pyx_v_y;
                              __pyx_t_10 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":8050
 *                 b = &rgb_array[x, y, 2]
 * 
 *                 rr = <float>round_c(c1 * <float> r[ 0 ] ) * f             # <<<<<<<<<<<<<<
 *                 gg = <float>round_c(c1 * <float> g[ 0 ] ) * f
 *                 bb = <float>round_c(c1 * <float> b[ 0 ] ) * f
 */
                              __pyx_v_rr = (((float)round((__pyx_v_c1 * ((float)(__pyx_v_r[0]))))) * __pyx_v_f);

                              /* "PygameShader/shader.pyx":8051
 * 
 *                 rr = <float>round_c(c1 * <float> r[ 0 ] ) * f
 *                 gg = <float>round_c(c1 * <float> g[ 0 ] ) * f             # <<<<<<<<<<<<<<
 *                 bb = <float>round_c(c1 * <float> b[ 0 ] ) * f
 * 
 */
                              __pyx_v_gg = (((float)round((__pyx_v_c1 * ((float)(__pyx_v_g[0]))))) * __pyx_v_f);

                              /* "PygameShader/shader.pyx":8052
 *                 rr = <float>round_c(c1 * <float> r[ 0 ] ) * f
 *                 gg = <float>round_c(c1 * <float> g[ 0 ] ) * f
 *                 bb = <float>round_c(c1 * <float> b[ 0 ] ) * f             # <<<<<<<<<<<<<<
 * 
 *                 r[ 0 ] = <unsigned char>rr
 */
                              __pyx_v_bb = (((float)round((__pyx_v_c1 * ((float)(__pyx_v_b[0]))))) * __pyx_v_f);

                              /* "PygameShader/shader.pyx":8054
 *                 bb = <float>round_c(c1 * <float> b[ 0 ] ) * f
 * 
 *                 r[ 0 ] = <unsigned char>rr             # <<<<<<<<<<<<<<
 *                 g[ 0 ] = <unsigned char>gg
 *                 b[ 0 ] = <unsigned char>bb
 */
                              (__pyx_v_r[0]) = ((unsigned char)__pyx_v_rr);

                              /* "PygameShader/shader.pyx":8055
 * 
 *                 r[ 0 ] = <unsigned char>rr
 *                 g[ 0 ] = <unsigned char>gg             # <<<<<<<<<<<<<<
 *                 b[ 0 ] = <unsigned char>bb
 * 
 */
                              (__pyx_v_g[0]) = ((unsigned char)__pyx_v_gg);

                              /* "PygameShader/shader.pyx":8056
 *                 r[ 0 ] = <unsigned char>rr
 *                 g[ 0 ] = <unsigned char>gg
 *                 b[ 0 ] = <unsigned char>bb             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              (__pyx_v_b[0]) = ((unsigned char)__pyx_v_bb);
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":8042
 *         float rr, gg, bb
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for y in prange(h, schedule='static', num_threads=THREADS):
 *             for x in range(0, w):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":8019
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void convert_27colors_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array):
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":8064
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef object spectrum_c(int width, int height, float gamma=1.0):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

static PyObject *__pyx_f_12PygameShader_6shader_spectrum_c(int __pyx_v_width, int __pyx_v_height, struct __pyx_opt_args_12PygameShader_6shader_spectrum_c *__pyx_optional_args) {
  float __pyx_v_gamma = ((float)1.0);
  int __pyx_v_i;
  int __pyx_v_k;
  struct rgb_color_int __pyx_v_rgb_c;
  __Pyx_memviewslice __pyx_v_spectrum_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_surface = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  long __pyx_t_8;
  long __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("spectrum_c", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_gamma = __pyx_optional_args->gamma;
    }
  }

  /* "PygameShader/shader.pyx":8089
 *         rgb_color_int rgb_c
 *         unsigned char [:, :, :] spectrum_array =\
 *             numpy.empty((370, 1, 3), numpy.uint8)             # <<<<<<<<<<<<<<
 *         object surface
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_tuple__26, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8089, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_tuple__26, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8089, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 8089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_tuple__26);
    __Pyx_GIVEREF(__pyx_tuple__26);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_tuple__26);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 8089, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_spectrum_array = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;

  /* "PygameShader/shader.pyx":8092
 *         object surface
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(380, 750, schedule='static', num_threads=THREADS):
 *             rgb_c = wavelength_to_rgb(i, gamma)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":8093
 * 
 *     with nogil:
 *         for i in prange(380, 750, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             rgb_c = wavelength_to_rgb(i, gamma)
 *             k = i - 380
 */
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_9 = (0x2EE - 0x17C + 1 - 1/abs(1)) / 1;
            if (__pyx_t_9 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_5)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_k) lastprivate(__pyx_v_rgb_c) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){
                        {
                            __pyx_v_i = (int)(0x17C + 1 * __pyx_t_8);
                            /* Initialize private variables to invalid values */
                            __pyx_v_k = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":8094
 *     with nogil:
 *         for i in prange(380, 750, schedule='static', num_threads=THREADS):
 *             rgb_c = wavelength_to_rgb(i, gamma)             # <<<<<<<<<<<<<<
 *             k = i - 380
 *             spectrum_array[ k, 0, 0 ] = rgb_c.r
 */
                            __pyx_v_rgb_c = wavelength_to_rgb(__pyx_v_i, __pyx_v_gamma);

                            /* "PygameShader/shader.pyx":8095
 *         for i in prange(380, 750, schedule='static', num_threads=THREADS):
 *             rgb_c = wavelength_to_rgb(i, gamma)
 *             k = i - 380             # <<<<<<<<<<<<<<
 *             spectrum_array[ k, 0, 0 ] = rgb_c.r
 *             spectrum_array[ k, 0, 1 ] = rgb_c.g
 */
                            __pyx_v_k = (__pyx_v_i - 0x17C);

                            /* "PygameShader/shader.pyx":8096
 *             rgb_c = wavelength_to_rgb(i, gamma)
 *             k = i - 380
 *             spectrum_array[ k, 0, 0 ] = rgb_c.r             # <<<<<<<<<<<<<<
 *             spectrum_array[ k, 0, 1 ] = rgb_c.g
 *             spectrum_array[ k, 0, 2 ] = rgb_c.b
 */
                            __pyx_t_5 = __pyx_v_rgb_c.r;
                            __pyx_t_10 = __pyx_v_k;
                            __pyx_t_11 = 0;
                            __pyx_t_12 = 0;
                            *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_10 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_12 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;

                            /* "PygameShader/shader.pyx":8097
 *             k = i - 380
 *             spectrum_array[ k, 0, 0 ] = rgb_c.r
 *             spectrum_array[ k, 0, 1 ] = rgb_c.g             # <<<<<<<<<<<<<<
 *             spectrum_array[ k, 0, 2 ] = rgb_c.b
 *             spectrum_array[ k, 1, 0 ] = rgb_c.r
 */
                            __pyx_t_5 = __pyx_v_rgb_c.g;
                            __pyx_t_12 = __pyx_v_k;
                            __pyx_t_11 = 0;
                            __pyx_t_10 = 1;
                            *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_12 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_10 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;

                            /* "PygameShader/shader.pyx":8098
 *             spectrum_array[ k, 0, 0 ] = rgb_c.r
 *             spectrum_array[ k, 0, 1 ] = rgb_c.g
 *             spectrum_array[ k, 0, 2 ] = rgb_c.b             # <<<<<<<<<<<<<<
 *             spectrum_array[ k, 1, 0 ] = rgb_c.r
 *             spectrum_array[ k, 1, 1 ] = rgb_c.g
 */
                            __pyx_t_5 = __pyx_v_rgb_c.b;
                            __pyx_t_10 = __pyx_v_k;
                            __pyx_t_11 = 0;
                            __pyx_t_12 = 2;
                            *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_10 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_12 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;

                            /* "PygameShader/shader.pyx":8099
 *             spectrum_array[ k, 0, 1 ] = rgb_c.g
 *             spectrum_array[ k, 0, 2 ] = rgb_c.b
 *             spectrum_array[ k, 1, 0 ] = rgb_c.r             # <<<<<<<<<<<<<<
 *             spectrum_array[ k, 1, 1 ] = rgb_c.g
 *             spectrum_array[ k, 1, 2 ] = rgb_c.b
 */
                            __pyx_t_5 = __pyx_v_rgb_c.r;
                            __pyx_t_12 = __pyx_v_k;
                            __pyx_t_11 = 1;
                            __pyx_t_10 = 0;
                            *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_12 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_10 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;

                            /* "PygameShader/shader.pyx":8100
 *             spectrum_array[ k, 0, 2 ] = rgb_c.b
 *             spectrum_array[ k, 1, 0 ] = rgb_c.r
 *             spectrum_array[ k, 1, 1 ] = rgb_c.g             # <<<<<<<<<<<<<<
 *             spectrum_array[ k, 1, 2 ] = rgb_c.b
 * 
 */
                            __pyx_t_5 = __pyx_v_rgb_c.g;
                            __pyx_t_10 = __pyx_v_k;
                            __pyx_t_11 = 1;
                            __pyx_t_12 = 1;
                            *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_10 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_12 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;

                            /* "PygameShader/shader.pyx":8101
 *             spectrum_array[ k, 1, 0 ] = rgb_c.r
 *             spectrum_array[ k, 1, 1 ] = rgb_c.g
 *             spectrum_array[ k, 1, 2 ] = rgb_c.b             # <<<<<<<<<<<<<<
 * 
 *     surface = make_surface(asarray(spectrum_array))
 */
                            __pyx_t_5 = __pyx_v_rgb_c.b;
                            __pyx_t_12 = __pyx_v_k;
                            __pyx_t_11 = 1;
                            __pyx_t_10 = 2;
                            *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_12 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_10 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":8092
 *         object surface
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(380, 750, schedule='static', num_threads=THREADS):
 *             rgb_c = wavelength_to_rgb(i, gamma)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":8103
 *             spectrum_array[ k, 1, 2 ] = rgb_c.b
 * 
 *     surface = make_surface(asarray(spectrum_array))             # <<<<<<<<<<<<<<
 *     surface = scale(surface, (width, height)).convert()
 *     return surface
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_spectrum_array, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_13 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_6 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_13, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 8103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_surface = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":8104
 * 
 *     surface = make_surface(asarray(spectrum_array))
 *     surface = scale(surface, (width, height)).convert()             # <<<<<<<<<<<<<<
 *     return surface
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_scale); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 8104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 8104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_2);
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_surface, __pyx_t_13};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8104, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_surface, __pyx_t_13};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8104, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_surface);
    __Pyx_GIVEREF(__pyx_v_surface);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_surface);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_13);
    __pyx_t_13 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_convert); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 8104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_surface, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":8105
 *     surface = make_surface(asarray(spectrum_array))
 *     surface = scale(surface, (width, height)).convert()
 *     return surface             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_surface);
  __pyx_r = __pyx_v_surface;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":8064
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef object spectrum_c(int width, int height, float gamma=1.0):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("PygameShader.shader.spectrum_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_spectrum_array, 1);
  __Pyx_XDECREF(__pyx_v_surface);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":8115
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void palette_change_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array,
 *         float [:, :] palette_):
 */

static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_palette_change_c(__Pyx_memviewslice __pyx_v_rgb_array, __Pyx_memviewslice __pyx_v_palette_) {
  int __pyx_v_i;
  int __pyx_v_j;
  CYTHON_UNUSED Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  struct rgb __pyx_v_rgb_;
  struct rgb __pyx_v_rgb_c;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  Py_ssize_t __pyx_v_p_length;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("palette_change_c", 0);

  /* "PygameShader/shader.pyx":8122
 *     cdef:
 *         int i, j
 *         Py_ssize_t w = <object>rgb_array.shape[0]             # <<<<<<<<<<<<<<
 *         Py_ssize_t h = <object>rgb_array.shape[1]
 *         rgb rgb_
 */
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8122, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_w = __pyx_t_2;

  /* "PygameShader/shader.pyx":8123
 *         int i, j
 *         Py_ssize_t w = <object>rgb_array.shape[0]
 *         Py_ssize_t h = <object>rgb_array.shape[1]             # <<<<<<<<<<<<<<
 *         rgb rgb_
 *         rgb rgb_c
 */
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array.shape[1])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8123, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_h = __pyx_t_2;

  /* "PygameShader/shader.pyx":8129
 *         unsigned char *g
 *         unsigned char *b
 *         Py_ssize_t p_length = <object>palette_.shape[0]             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_palette_.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8129, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_p_length = __pyx_t_2;

  /* "PygameShader/shader.pyx":8131
 *         Py_ssize_t p_length = <object>palette_.shape[0]
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=w * h):
 *             for j in range(h):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":8132
 * 
 *     with nogil:
 *         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=w * h):             # <<<<<<<<<<<<<<
 *             for j in range(h):
 *                 r = &rgb_array[i, j, 0]
 */
        __pyx_t_2 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            __pyx_t_5 = (__pyx_v_w * __pyx_v_h);
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_4 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_4 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static, __pyx_t_5)
                    #endif /* _OPENMP */
                    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_3);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_j = ((int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);

                            /* "PygameShader/shader.pyx":8133
 *     with nogil:
 *         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=w * h):
 *             for j in range(h):             # <<<<<<<<<<<<<<
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]
 */
                            __pyx_t_6 = __pyx_v_h;
                            __pyx_t_7 = __pyx_t_6;
                            for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
                              __pyx_v_j = __pyx_t_8;

                              /* "PygameShader/shader.pyx":8134
 *         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=w * h):
 *             for j in range(h):
 *                 r = &rgb_array[i, j, 0]             # <<<<<<<<<<<<<<
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]
 */
                              __pyx_t_9 = __pyx_v_i;
                              __pyx_t_10 = __pyx_v_j;
                              __pyx_t_11 = 0;
                              __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_9 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":8135
 *             for j in range(h):
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]             # <<<<<<<<<<<<<<
 *                 b = &rgb_array[i, j, 2]
 * 
 */
                              __pyx_t_11 = __pyx_v_i;
                              __pyx_t_10 = __pyx_v_j;
                              __pyx_t_9 = 1;
                              __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_11 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":8136
 *                 r = &rgb_array[i, j, 0]
 *                 g = &rgb_array[i, j, 1]
 *                 b = &rgb_array[i, j, 2]             # <<<<<<<<<<<<<<
 * 
 *                 rgb_c.r = r[0]
 */
                              __pyx_t_9 = __pyx_v_i;
                              __pyx_t_10 = __pyx_v_j;
                              __pyx_t_11 = 2;
                              __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_9 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_array.strides[2]) ))));

                              /* "PygameShader/shader.pyx":8138
 *                 b = &rgb_array[i, j, 2]
 * 
 *                 rgb_c.r = r[0]             # <<<<<<<<<<<<<<
 *                 rgb_c.g = g[0]
 *                 rgb_c.b = b[0]
 */
                              __pyx_v_rgb_c.r = (__pyx_v_r[0]);

                              /* "PygameShader/shader.pyx":8139
 * 
 *                 rgb_c.r = r[0]
 *                 rgb_c.g = g[0]             # <<<<<<<<<<<<<<
 *                 rgb_c.b = b[0]
 * 
 */
                              __pyx_v_rgb_c.g = (__pyx_v_g[0]);

                              /* "PygameShader/shader.pyx":8140
 *                 rgb_c.r = r[0]
 *                 rgb_c.g = g[0]
 *                 rgb_c.b = b[0]             # <<<<<<<<<<<<<<
 * 
 *                 rgb_ = close_color(rgb_c, palette_, p_length)
 */
                              __pyx_v_rgb_c.b = (__pyx_v_b[0]);

                              /* "PygameShader/shader.pyx":8142
 *                 rgb_c.b = b[0]
 * 
 *                 rgb_ = close_color(rgb_c, palette_, p_length)             # <<<<<<<<<<<<<<
 * 
 *                 r[0] = <unsigned char>rgb_.r
 */
                              __pyx_v_rgb_ = __pyx_f_12PygameShader_4misc_close_color(__pyx_v_rgb_c, __pyx_v_palette_, __pyx_v_p_length);

                              /* "PygameShader/shader.pyx":8144
 *                 rgb_ = close_color(rgb_c, palette_, p_length)
 * 
 *                 r[0] = <unsigned char>rgb_.r             # <<<<<<<<<<<<<<
 *                 g[0] = <unsigned char>rgb_.g
 *                 b[0] = <unsigned char>rgb_.b
 */
                              (__pyx_v_r[0]) = ((unsigned char)__pyx_v_rgb_.r);

                              /* "PygameShader/shader.pyx":8145
 * 
 *                 r[0] = <unsigned char>rgb_.r
 *                 g[0] = <unsigned char>rgb_.g             # <<<<<<<<<<<<<<
 *                 b[0] = <unsigned char>rgb_.b
 * 
 */
                              (__pyx_v_g[0]) = ((unsigned char)__pyx_v_rgb_.g);

                              /* "PygameShader/shader.pyx":8146
 *                 r[0] = <unsigned char>rgb_.r
 *                 g[0] = <unsigned char>rgb_.g
 *                 b[0] = <unsigned char>rgb_.b             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              (__pyx_v_b[0]) = ((unsigned char)__pyx_v_rgb_.b);
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":8131
 *         Py_ssize_t p_length = <object>palette_.shape[0]
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=w * h):
 *             for j in range(h):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":8115
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef inline void palette_change_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array,
 *         float [:, :] palette_):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("PygameShader.shader.palette_change_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PygameShader/shader.pyx":8155
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef float distance_ (float x1, float y1, float x2, float y2)nogil:             # <<<<<<<<<<<<<<
 *   return <float>sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
 * 
 */

static float __pyx_f_12PygameShader_6shader_distance_(float __pyx_v_x1, float __pyx_v_y1, float __pyx_v_x2, float __pyx_v_y2) {
  float __pyx_r;

  /* "PygameShader/shader.pyx":8156
 * @cython.cdivision(True)
 * cdef float distance_ (float x1, float y1, float x2, float y2)nogil:
 *   return <float>sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_r = ((float)sqrt((((__pyx_v_x1 - __pyx_v_x2) * (__pyx_v_x1 - __pyx_v_x2)) + ((__pyx_v_y1 - __pyx_v_y2) * (__pyx_v_y1 - __pyx_v_y2)))));
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":8155
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef float distance_ (float x1, float y1, float x2, float y2)nogil:             # <<<<<<<<<<<<<<
 *   return <float>sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PygameShader/shader.pyx":8162
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef float gaussian_ (float v, float sigma2)nogil:             # <<<<<<<<<<<<<<
 *   return (<float>1.0 / (<float>M_PI * sigma2)) * <float>exp(-(v * v ) / sigma2)
 * 
 */

static float __pyx_f_12PygameShader_6shader_gaussian_(float __pyx_v_v, float __pyx_v_sigma2) {
  float __pyx_r;

  /* "PygameShader/shader.pyx":8163
 * @cython.cdivision(True)
 * cdef float gaussian_ (float v, float sigma2)nogil:
 *   return (<float>1.0 / (<float>M_PI * sigma2)) * <float>exp(-(v * v ) / sigma2)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_r = ((((float)1.0) / (((float)__pyx_v_12PygameShader_6shader_M_PI) * __pyx_v_sigma2)) * ((float)exp(((-(__pyx_v_v * __pyx_v_v)) / __pyx_v_sigma2))));
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":8162
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef float gaussian_ (float v, float sigma2)nogil:             # <<<<<<<<<<<<<<
 *   return (<float>1.0 / (<float>M_PI * sigma2)) * <float>exp(-(v * v ) / sigma2)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PygameShader/shader.pyx":8169
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef bilateral_filter24_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float sigma_s_,
 */

static PyObject *__pyx_f_12PygameShader_6shader_bilateral_filter24_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_sigma_s_, float __pyx_v_sigma_i_) {
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  __Pyx_memviewslice __pyx_v_bilateral = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_xx;
  int __pyx_v_yy;
  int __pyx_v_k;
  int __pyx_v_kx;
  int __pyx_v_ky;
  float __pyx_v_gs;
  float __pyx_v_wr;
  float __pyx_v_wg;
  float __pyx_v_wb;
  float __pyx_v_ir;
  float __pyx_v_ig;
  float __pyx_v_ib;
  float __pyx_v_wpr;
  float __pyx_v_wpg;
  float __pyx_v_wpb;
  unsigned char *__pyx_v_r;
  unsigned char *__pyx_v_g;
  unsigned char *__pyx_v_b;
  float __pyx_v_sigma_i2;
  float __pyx_v_sigma_s2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  float __pyx_t_12;
  float __pyx_t_13;
  float __pyx_t_14;
  long __pyx_t_15;
  long __pyx_t_16;
  int __pyx_t_17;
  long __pyx_t_18;
  long __pyx_t_19;
  int __pyx_t_20;
  int __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bilateral_filter24_c", 0);

  /* "PygameShader/shader.pyx":8199
 * 
 *     cdef Py_ssize_t w, h
 *     w = <object>rgb_array_.shape[ 0 ]             # <<<<<<<<<<<<<<
 *     h = <object> rgb_array_.shape[ 1 ]
 * 
 */
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_w = __pyx_t_2;

  /* "PygameShader/shader.pyx":8200
 *     cdef Py_ssize_t w, h
 *     w = <object>rgb_array_.shape[ 0 ]
 *     h = <object> rgb_array_.shape[ 1 ]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[1])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8200, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_h = __pyx_t_2;

  /* "PygameShader/shader.pyx":8203
 * 
 *     cdef:
 *         unsigned char [:, :, :] bilateral = empty((h, w, 3), dtype=uint8)             # <<<<<<<<<<<<<<
 *         int x, y, xx, yy
 *         int k = 3
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_3);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(1, 8203, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(1, 8203, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_bilateral = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "PygameShader/shader.pyx":8205
 *         unsigned char [:, :, :] bilateral = empty((h, w, 3), dtype=uint8)
 *         int x, y, xx, yy
 *         int k = 3             # <<<<<<<<<<<<<<
 *         int kx, ky
 *         float gs, wr, wg, wb, ir, ig, ib , wpr, wpg, wpb
 */
  __pyx_v_k = 3;

  /* "PygameShader/shader.pyx":8211
 *         unsigned char *g
 *         unsigned char *b
 *         float sigma_i2 = 2 * sigma_i_ * sigma_i_             # <<<<<<<<<<<<<<
 *         float sigma_s2 = 2 * sigma_s_ * sigma_s_
 * 
 */
  __pyx_v_sigma_i2 = ((2.0 * __pyx_v_sigma_i_) * __pyx_v_sigma_i_);

  /* "PygameShader/shader.pyx":8212
 *         unsigned char *b
 *         float sigma_i2 = 2 * sigma_i_ * sigma_i_
 *         float sigma_s2 = 2 * sigma_s_ * sigma_s_             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
  __pyx_v_sigma_s2 = ((2.0 * __pyx_v_sigma_s_) * __pyx_v_sigma_s_);

  /* "PygameShader/shader.pyx":8214
 *         float sigma_s2 = 2 * sigma_s_ * sigma_s_
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for x in prange(0, w, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":8216
 *     with nogil:
 * 
 *         for x in prange(0, w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 *             for y in range(0, h):
 * 
 */
        __pyx_t_2 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_8 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_8 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_9)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gs) lastprivate(__pyx_v_ib) lastprivate(__pyx_v_ig) lastprivate(__pyx_v_ir) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_r) lastprivate(__pyx_v_wb) lastprivate(__pyx_v_wg) lastprivate(__pyx_v_wpb) lastprivate(__pyx_v_wpg) lastprivate(__pyx_v_wpr) lastprivate(__pyx_v_wr) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_7);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((unsigned char *)1);
                            __pyx_v_g = ((unsigned char *)1);
                            __pyx_v_gs = ((float)__PYX_NAN());
                            __pyx_v_ib = ((float)__PYX_NAN());
                            __pyx_v_ig = ((float)__PYX_NAN());
                            __pyx_v_ir = ((float)__PYX_NAN());
                            __pyx_v_kx = ((int)0xbad0bad0);
                            __pyx_v_ky = ((int)0xbad0bad0);
                            __pyx_v_r = ((unsigned char *)1);
                            __pyx_v_wb = ((float)__PYX_NAN());
                            __pyx_v_wg = ((float)__PYX_NAN());
                            __pyx_v_wpb = ((float)__PYX_NAN());
                            __pyx_v_wpg = ((float)__PYX_NAN());
                            __pyx_v_wpr = ((float)__PYX_NAN());
                            __pyx_v_wr = ((float)__PYX_NAN());
                            __pyx_v_xx = ((int)0xbad0bad0);
                            __pyx_v_y = ((int)0xbad0bad0);
                            __pyx_v_yy = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":8217
 * 
 *         for x in prange(0, w, schedule='static', num_threads=THREADS):
 *             for y in range(0, h):             # <<<<<<<<<<<<<<
 * 
 *                 ir, ig, ib = 0, 0, 0
 */
                            __pyx_t_9 = __pyx_v_h;
                            __pyx_t_10 = __pyx_t_9;
                            for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
                              __pyx_v_y = __pyx_t_11;

                              /* "PygameShader/shader.pyx":8219
 *             for y in range(0, h):
 * 
 *                 ir, ig, ib = 0, 0, 0             # <<<<<<<<<<<<<<
 *                 wpr, wpg, wpb = 0, 0, 0
 * 
 */
                              __pyx_t_12 = 0.0;
                              __pyx_t_13 = 0.0;
                              __pyx_t_14 = 0.0;
                              __pyx_v_ir = __pyx_t_12;
                              __pyx_v_ig = __pyx_t_13;
                              __pyx_v_ib = __pyx_t_14;

                              /* "PygameShader/shader.pyx":8220
 * 
 *                 ir, ig, ib = 0, 0, 0
 *                 wpr, wpg, wpb = 0, 0, 0             # <<<<<<<<<<<<<<
 * 
 *                 for ky in range(-k, k + 1):
 */
                              __pyx_t_14 = 0.0;
                              __pyx_t_13 = 0.0;
                              __pyx_t_12 = 0.0;
                              __pyx_v_wpr = __pyx_t_14;
                              __pyx_v_wpg = __pyx_t_13;
                              __pyx_v_wpb = __pyx_t_12;

                              /* "PygameShader/shader.pyx":8222
 *                 wpr, wpg, wpb = 0, 0, 0
 * 
 *                 for ky in range(-k, k + 1):             # <<<<<<<<<<<<<<
 *                     for kx in range(-k, k + 1):
 * 
 */
                              __pyx_t_15 = (__pyx_v_k + 1);
                              __pyx_t_16 = __pyx_t_15;
                              for (__pyx_t_17 = (-__pyx_v_k); __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
                                __pyx_v_ky = __pyx_t_17;

                                /* "PygameShader/shader.pyx":8223
 * 
 *                 for ky in range(-k, k + 1):
 *                     for kx in range(-k, k + 1):             # <<<<<<<<<<<<<<
 * 
 *                         xx = x + kx
 */
                                __pyx_t_18 = (__pyx_v_k + 1);
                                __pyx_t_19 = __pyx_t_18;
                                for (__pyx_t_20 = (-__pyx_v_k); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
                                  __pyx_v_kx = __pyx_t_20;

                                  /* "PygameShader/shader.pyx":8225
 *                     for kx in range(-k, k + 1):
 * 
 *                         xx = x + kx             # <<<<<<<<<<<<<<
 *                         yy = y + ky
 * 
 */
                                  __pyx_v_xx = (__pyx_v_x + __pyx_v_kx);

                                  /* "PygameShader/shader.pyx":8226
 * 
 *                         xx = x + kx
 *                         yy = y + ky             # <<<<<<<<<<<<<<
 * 
 *                         if xx < 0:
 */
                                  __pyx_v_yy = (__pyx_v_y + __pyx_v_ky);

                                  /* "PygameShader/shader.pyx":8228
 *                         yy = y + ky
 * 
 *                         if xx < 0:             # <<<<<<<<<<<<<<
 *                             xx = 0
 *                         elif xx > w:
 */
                                  __pyx_t_21 = ((__pyx_v_xx < 0) != 0);
                                  if (__pyx_t_21) {

                                    /* "PygameShader/shader.pyx":8229
 * 
 *                         if xx < 0:
 *                             xx = 0             # <<<<<<<<<<<<<<
 *                         elif xx > w:
 *                             xx = w
 */
                                    __pyx_v_xx = 0;

                                    /* "PygameShader/shader.pyx":8228
 *                         yy = y + ky
 * 
 *                         if xx < 0:             # <<<<<<<<<<<<<<
 *                             xx = 0
 *                         elif xx > w:
 */
                                    goto __pyx_L16;
                                  }

                                  /* "PygameShader/shader.pyx":8230
 *                         if xx < 0:
 *                             xx = 0
 *                         elif xx > w:             # <<<<<<<<<<<<<<
 *                             xx = w
 * 
 */
                                  __pyx_t_21 = ((__pyx_v_xx > __pyx_v_w) != 0);
                                  if (__pyx_t_21) {

                                    /* "PygameShader/shader.pyx":8231
 *                             xx = 0
 *                         elif xx > w:
 *                             xx = w             # <<<<<<<<<<<<<<
 * 
 *                         if yy < 0:
 */
                                    __pyx_v_xx = __pyx_v_w;

                                    /* "PygameShader/shader.pyx":8230
 *                         if xx < 0:
 *                             xx = 0
 *                         elif xx > w:             # <<<<<<<<<<<<<<
 *                             xx = w
 * 
 */
                                  }
                                  __pyx_L16:;

                                  /* "PygameShader/shader.pyx":8233
 *                             xx = w
 * 
 *                         if yy < 0:             # <<<<<<<<<<<<<<
 *                             yy = 0
 *                         elif yy > h:
 */
                                  __pyx_t_21 = ((__pyx_v_yy < 0) != 0);
                                  if (__pyx_t_21) {

                                    /* "PygameShader/shader.pyx":8234
 * 
 *                         if yy < 0:
 *                             yy = 0             # <<<<<<<<<<<<<<
 *                         elif yy > h:
 *                             yy = h
 */
                                    __pyx_v_yy = 0;

                                    /* "PygameShader/shader.pyx":8233
 *                             xx = w
 * 
 *                         if yy < 0:             # <<<<<<<<<<<<<<
 *                             yy = 0
 *                         elif yy > h:
 */
                                    goto __pyx_L17;
                                  }

                                  /* "PygameShader/shader.pyx":8235
 *                         if yy < 0:
 *                             yy = 0
 *                         elif yy > h:             # <<<<<<<<<<<<<<
 *                             yy = h
 * 
 */
                                  __pyx_t_21 = ((__pyx_v_yy > __pyx_v_h) != 0);
                                  if (__pyx_t_21) {

                                    /* "PygameShader/shader.pyx":8236
 *                             yy = 0
 *                         elif yy > h:
 *                             yy = h             # <<<<<<<<<<<<<<
 * 
 *                         gs = gaussian_(distance_(xx, yy, x, y), sigma_s2)
 */
                                    __pyx_v_yy = __pyx_v_h;

                                    /* "PygameShader/shader.pyx":8235
 *                         if yy < 0:
 *                             yy = 0
 *                         elif yy > h:             # <<<<<<<<<<<<<<
 *                             yy = h
 * 
 */
                                  }
                                  __pyx_L17:;

                                  /* "PygameShader/shader.pyx":8238
 *                             yy = h
 * 
 *                         gs = gaussian_(distance_(xx, yy, x, y), sigma_s2)             # <<<<<<<<<<<<<<
 * 
 *                         r = &rgb_array_[xx, yy, 0]
 */
                                  __pyx_v_gs = __pyx_f_12PygameShader_6shader_gaussian_(__pyx_f_12PygameShader_6shader_distance_(__pyx_v_xx, __pyx_v_yy, __pyx_v_x, __pyx_v_y), __pyx_v_sigma_s2);

                                  /* "PygameShader/shader.pyx":8240
 *                         gs = gaussian_(distance_(xx, yy, x, y), sigma_s2)
 * 
 *                         r = &rgb_array_[xx, yy, 0]             # <<<<<<<<<<<<<<
 *                         g = &rgb_array_[xx, yy, 1]
 *                         b = &rgb_array_[xx, yy, 2]
 */
                                  __pyx_t_22 = __pyx_v_xx;
                                  __pyx_t_23 = __pyx_v_yy;
                                  __pyx_t_24 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_22 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":8241
 * 
 *                         r = &rgb_array_[xx, yy, 0]
 *                         g = &rgb_array_[xx, yy, 1]             # <<<<<<<<<<<<<<
 *                         b = &rgb_array_[xx, yy, 2]
 * 
 */
                                  __pyx_t_24 = __pyx_v_xx;
                                  __pyx_t_23 = __pyx_v_yy;
                                  __pyx_t_22 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_24 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":8242
 *                         r = &rgb_array_[xx, yy, 0]
 *                         g = &rgb_array_[xx, yy, 1]
 *                         b = &rgb_array_[xx, yy, 2]             # <<<<<<<<<<<<<<
 * 
 *                         wr = gaussian_(r[0] - rgb_array_[x, y, 0], sigma_i2) * gs
 */
                                  __pyx_t_22 = __pyx_v_xx;
                                  __pyx_t_23 = __pyx_v_yy;
                                  __pyx_t_24 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_22 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[2]) ))));

                                  /* "PygameShader/shader.pyx":8244
 *                         b = &rgb_array_[xx, yy, 2]
 * 
 *                         wr = gaussian_(r[0] - rgb_array_[x, y, 0], sigma_i2) * gs             # <<<<<<<<<<<<<<
 *                         wg = gaussian_(g[0] - rgb_array_[x, y, 1], sigma_i2) * gs
 *                         wb = gaussian_(b[0] - rgb_array_[x, y, 2], sigma_i2) * gs
 */
                                  __pyx_t_24 = __pyx_v_x;
                                  __pyx_t_23 = __pyx_v_y;
                                  __pyx_t_22 = 0;
                                  __pyx_v_wr = (__pyx_f_12PygameShader_6shader_gaussian_(((__pyx_v_r[0]) - (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_24 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array_.strides[2]) )))), __pyx_v_sigma_i2) * __pyx_v_gs);

                                  /* "PygameShader/shader.pyx":8245
 * 
 *                         wr = gaussian_(r[0] - rgb_array_[x, y, 0], sigma_i2) * gs
 *                         wg = gaussian_(g[0] - rgb_array_[x, y, 1], sigma_i2) * gs             # <<<<<<<<<<<<<<
 *                         wb = gaussian_(b[0] - rgb_array_[x, y, 2], sigma_i2) * gs
 * 
 */
                                  __pyx_t_22 = __pyx_v_x;
                                  __pyx_t_23 = __pyx_v_y;
                                  __pyx_t_24 = 1;
                                  __pyx_v_wg = (__pyx_f_12PygameShader_6shader_gaussian_(((__pyx_v_g[0]) - (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_22 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[2]) )))), __pyx_v_sigma_i2) * __pyx_v_gs);

                                  /* "PygameShader/shader.pyx":8246
 *                         wr = gaussian_(r[0] - rgb_array_[x, y, 0], sigma_i2) * gs
 *                         wg = gaussian_(g[0] - rgb_array_[x, y, 1], sigma_i2) * gs
 *                         wb = gaussian_(b[0] - rgb_array_[x, y, 2], sigma_i2) * gs             # <<<<<<<<<<<<<<
 * 
 *                         ir = ir + r[0] * wr
 */
                                  __pyx_t_24 = __pyx_v_x;
                                  __pyx_t_23 = __pyx_v_y;
                                  __pyx_t_22 = 2;
                                  __pyx_v_wb = (__pyx_f_12PygameShader_6shader_gaussian_(((__pyx_v_b[0]) - (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_24 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array_.strides[2]) )))), __pyx_v_sigma_i2) * __pyx_v_gs);

                                  /* "PygameShader/shader.pyx":8248
 *                         wb = gaussian_(b[0] - rgb_array_[x, y, 2], sigma_i2) * gs
 * 
 *                         ir = ir + r[0] * wr             # <<<<<<<<<<<<<<
 *                         ig = ig + g[0] * wg
 *                         ib = ib + b[0] * wb
 */
                                  __pyx_v_ir = (__pyx_v_ir + ((__pyx_v_r[0]) * __pyx_v_wr));

                                  /* "PygameShader/shader.pyx":8249
 * 
 *                         ir = ir + r[0] * wr
 *                         ig = ig + g[0] * wg             # <<<<<<<<<<<<<<
 *                         ib = ib + b[0] * wb
 * 
 */
                                  __pyx_v_ig = (__pyx_v_ig + ((__pyx_v_g[0]) * __pyx_v_wg));

                                  /* "PygameShader/shader.pyx":8250
 *                         ir = ir + r[0] * wr
 *                         ig = ig + g[0] * wg
 *                         ib = ib + b[0] * wb             # <<<<<<<<<<<<<<
 * 
 *                         wpr = wpr + wr
 */
                                  __pyx_v_ib = (__pyx_v_ib + ((__pyx_v_b[0]) * __pyx_v_wb));

                                  /* "PygameShader/shader.pyx":8252
 *                         ib = ib + b[0] * wb
 * 
 *                         wpr = wpr + wr             # <<<<<<<<<<<<<<
 *                         wpg = wpg + wg
 *                         wpb = wpb + wb
 */
                                  __pyx_v_wpr = (__pyx_v_wpr + __pyx_v_wr);

                                  /* "PygameShader/shader.pyx":8253
 * 
 *                         wpr = wpr + wr
 *                         wpg = wpg + wg             # <<<<<<<<<<<<<<
 *                         wpb = wpb + wb
 * 
 */
                                  __pyx_v_wpg = (__pyx_v_wpg + __pyx_v_wg);

                                  /* "PygameShader/shader.pyx":8254
 *                         wpr = wpr + wr
 *                         wpg = wpg + wg
 *                         wpb = wpb + wb             # <<<<<<<<<<<<<<
 * 
 *                 ir = ir / wpr
 */
                                  __pyx_v_wpb = (__pyx_v_wpb + __pyx_v_wb);
                                }
                              }

                              /* "PygameShader/shader.pyx":8256
 *                         wpb = wpb + wb
 * 
 *                 ir = ir / wpr             # <<<<<<<<<<<<<<
 *                 ig = ig / wpg
 *                 ib = ib / wpb
 */
                              __pyx_v_ir = (__pyx_v_ir / __pyx_v_wpr);

                              /* "PygameShader/shader.pyx":8257
 * 
 *                 ir = ir / wpr
 *                 ig = ig / wpg             # <<<<<<<<<<<<<<
 *                 ib = ib / wpb
 * 
 */
                              __pyx_v_ig = (__pyx_v_ig / __pyx_v_wpg);

                              /* "PygameShader/shader.pyx":8258
 *                 ir = ir / wpr
 *                 ig = ig / wpg
 *                 ib = ib / wpb             # <<<<<<<<<<<<<<
 * 
 *                 bilateral[y, x, 0] = <int>ir
 */
                              __pyx_v_ib = (__pyx_v_ib / __pyx_v_wpb);

                              /* "PygameShader/shader.pyx":8260
 *                 ib = ib / wpb
 * 
 *                 bilateral[y, x, 0] = <int>ir             # <<<<<<<<<<<<<<
 *                 bilateral[y, x, 1] = <int>ig
 *                 bilateral[y, x, 2] = <int>ib
 */
                              __pyx_t_22 = __pyx_v_y;
                              __pyx_t_23 = __pyx_v_x;
                              __pyx_t_24 = 0;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_bilateral.data + __pyx_t_22 * __pyx_v_bilateral.strides[0]) ) + __pyx_t_23 * __pyx_v_bilateral.strides[1]) ) + __pyx_t_24 * __pyx_v_bilateral.strides[2]) )) = ((int)__pyx_v_ir);

                              /* "PygameShader/shader.pyx":8261
 * 
 *                 bilateral[y, x, 0] = <int>ir
 *                 bilateral[y, x, 1] = <int>ig             # <<<<<<<<<<<<<<
 *                 bilateral[y, x, 2] = <int>ib
 * 
 */
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_23 = __pyx_v_x;
                              __pyx_t_22 = 1;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_bilateral.data + __pyx_t_24 * __pyx_v_bilateral.strides[0]) ) + __pyx_t_23 * __pyx_v_bilateral.strides[1]) ) + __pyx_t_22 * __pyx_v_bilateral.strides[2]) )) = ((int)__pyx_v_ig);

                              /* "PygameShader/shader.pyx":8262
 *                 bilateral[y, x, 0] = <int>ir
 *                 bilateral[y, x, 1] = <int>ig
 *                 bilateral[y, x, 2] = <int>ib             # <<<<<<<<<<<<<<
 * 
 * 
 */
                              __pyx_t_22 = __pyx_v_y;
                              __pyx_t_23 = __pyx_v_x;
                              __pyx_t_24 = 2;
                              *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_bilateral.data + __pyx_t_22 * __pyx_v_bilateral.strides[0]) ) + __pyx_t_23 * __pyx_v_bilateral.strides[1]) ) + __pyx_t_24 * __pyx_v_bilateral.strides[2]) )) = ((int)__pyx_v_ib);
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":8214
 *         float sigma_s2 = 2 * sigma_s_ * sigma_s_
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for x in prange(0, w, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":8265
 * 
 * 
 *     return frombuffer(bilateral, (w, h), 'RGB')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_bilateral, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_25 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 8265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_25);
  __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 8265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_26);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_25);
  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_25);
  __pyx_t_1 = 0;
  __pyx_t_25 = 0;
  __pyx_t_25 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_25)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_25);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_25, __pyx_t_4, __pyx_t_26, __pyx_n_s_RGB};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8265, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_25, __pyx_t_4, __pyx_t_26, __pyx_n_s_RGB};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8265, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_25) {
      __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_25); __pyx_t_25 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_11, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_26);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_11, __pyx_t_26);
    __Pyx_INCREF(__pyx_n_s_RGB);
    __Pyx_GIVEREF(__pyx_n_s_RGB);
    PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_11, __pyx_n_s_RGB);
    __pyx_t_4 = 0;
    __pyx_t_26 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":8169
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef bilateral_filter24_c(             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, :] rgb_array_,
 *         float sigma_s_,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  __Pyx_XDECREF(__pyx_t_25);
  __Pyx_XDECREF(__pyx_t_26);
  __Pyx_AddTraceback("PygameShader.shader.bilateral_filter24_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_bilateral, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PygameShader/shader.pyx":8282
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef object emboss5x5_c(unsigned char [:, :, :] rgb_array_):             # <<<<<<<<<<<<<<
 * 
 *     k_weight = numpy.sum(EMBOSS_KERNEL)
 */

static PyObject *__pyx_f_12PygameShader_6shader_emboss5x5_c(__Pyx_memviewslice __pyx_v_rgb_array_) {
  PyObject *__pyx_v_k_weight = NULL;
  Py_ssize_t __pyx_v_k_length;
  Py_ssize_t __pyx_v_half_kernel;
  Py_ssize_t __pyx_v_w;
  Py_ssize_t __pyx_v_h;
  __Pyx_memviewslice __pyx_v_kernel = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED float __pyx_v_kernel_weight;
  short __pyx_v_kernel_half;
  __Pyx_memviewslice __pyx_v_emboss = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED int __pyx_v_kernel_length;
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_xx;
  int __pyx_v_yy;
  unsigned short __pyx_v_red;
  unsigned short __pyx_v_green;
  unsigned short __pyx_v_blue;
  short __pyx_v_kernel_offset_y;
  short __pyx_v_kernel_offset_x;
  float __pyx_v_r;
  float __pyx_v_g;
  float __pyx_v_b;
  float __pyx_v_k;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  float __pyx_t_7;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  float __pyx_t_14;
  float __pyx_t_15;
  long __pyx_t_16;
  long __pyx_t_17;
  short __pyx_t_18;
  long __pyx_t_19;
  long __pyx_t_20;
  short __pyx_t_21;
  int __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  unsigned char __pyx_t_26;
  unsigned char __pyx_t_27;
  unsigned char __pyx_t_28;
  PyObject *__pyx_t_29 = NULL;
  PyObject *__pyx_t_30 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("emboss5x5_c", 0);

  /* "PygameShader/shader.pyx":8284
 * cdef object emboss5x5_c(unsigned char [:, :, :] rgb_array_):
 * 
 *     k_weight = numpy.sum(EMBOSS_KERNEL)             # <<<<<<<<<<<<<<
 *     k_length = len(EMBOSS_KERNEL)
 *     half_kernel = len(EMBOSS_KERNEL) >> 1
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_EMBOSS_KERNEL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_k_weight = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":8285
 * 
 *     k_weight = numpy.sum(EMBOSS_KERNEL)
 *     k_length = len(EMBOSS_KERNEL)             # <<<<<<<<<<<<<<
 *     half_kernel = len(EMBOSS_KERNEL) >> 1
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_EMBOSS_KERNEL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 8285, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_k_length = __pyx_t_5;

  /* "PygameShader/shader.pyx":8286
 *     k_weight = numpy.sum(EMBOSS_KERNEL)
 *     k_length = len(EMBOSS_KERNEL)
 *     half_kernel = len(EMBOSS_KERNEL) >> 1             # <<<<<<<<<<<<<<
 * 
 *     # texture sizes
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_EMBOSS_KERNEL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 8286, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_half_kernel = (__pyx_t_5 >> 1);

  /* "PygameShader/shader.pyx":8290
 *     # texture sizes
 *     cdef Py_ssize_t w, h
 *     w = <object>rgb_array_.shape[0]             # <<<<<<<<<<<<<<
 *     h = <object>rgb_array_.shape[1]
 * 
 */
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8290, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_w = __pyx_t_5;

  /* "PygameShader/shader.pyx":8291
 *     cdef Py_ssize_t w, h
 *     w = <object>rgb_array_.shape[0]
 *     h = <object>rgb_array_.shape[1]             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[1])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8291, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_h = __pyx_t_5;

  /* "PygameShader/shader.pyx":8294
 * 
 *     cdef:
 *         float [:, :] kernel = EMBOSS_KERNEL             # <<<<<<<<<<<<<<
 *         float kernel_weight = k_weight
 *         short kernel_half = half_kernel
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_EMBOSS_KERNEL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(1, 8294, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_kernel = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "PygameShader/shader.pyx":8295
 *     cdef:
 *         float [:, :] kernel = EMBOSS_KERNEL
 *         float kernel_weight = k_weight             # <<<<<<<<<<<<<<
 *         short kernel_half = half_kernel
 *         unsigned char [:, :, ::1] emboss = empty((h, w, 3), order='C', dtype=uint8)
 */
  __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_v_k_weight); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 8295, __pyx_L1_error)
  __pyx_v_kernel_weight = __pyx_t_7;

  /* "PygameShader/shader.pyx":8296
 *         float [:, :] kernel = EMBOSS_KERNEL
 *         float kernel_weight = k_weight
 *         short kernel_half = half_kernel             # <<<<<<<<<<<<<<
 *         unsigned char [:, :, ::1] emboss = empty((h, w, 3), order='C', dtype=uint8)
 *         int kernel_length = k_length
 */
  __pyx_v_kernel_half = __pyx_v_half_kernel;

  /* "PygameShader/shader.pyx":8297
 *         float kernel_weight = k_weight
 *         short kernel_half = half_kernel
 *         unsigned char [:, :, ::1] emboss = empty((h, w, 3), order='C', dtype=uint8)             # <<<<<<<<<<<<<<
 *         int kernel_length = k_length
 *         int x, y, xx, yy
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_3);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 8297, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_emboss = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "PygameShader/shader.pyx":8298
 *         short kernel_half = half_kernel
 *         unsigned char [:, :, ::1] emboss = empty((h, w, 3), order='C', dtype=uint8)
 *         int kernel_length = k_length             # <<<<<<<<<<<<<<
 *         int x, y, xx, yy
 *         unsigned short red, green, blue,
 */
  __pyx_v_kernel_length = __pyx_v_k_length;

  /* "PygameShader/shader.pyx":8304
 *         float r, g, b, k
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for x in prange(0, w, schedule='static', num_threads=THREADS):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "PygameShader/shader.pyx":8306
 *     with nogil:
 * 
 *         for x in prange(0, w, schedule='static', num_threads=THREADS):             # <<<<<<<<<<<<<<
 * 
 *             for y in range(0, h):
 */
        __pyx_t_5 = __pyx_v_w;
        if ((1 == 0)) abort();
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_10 = (__pyx_t_5 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_10 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel num_threads(__pyx_v_12PygameShader_6shader_THREADS) private(__pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_7)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_blue) lastprivate(__pyx_v_g) lastprivate(__pyx_v_green) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_r) lastprivate(__pyx_v_red) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
                    #endif /* _OPENMP */
                    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){
                        {
                            __pyx_v_x = (int)(0 + 1 * __pyx_t_9);
                            /* Initialize private variables to invalid values */
                            __pyx_v_b = ((float)__PYX_NAN());
                            __pyx_v_blue = ((unsigned short)0xbad0bad0);
                            __pyx_v_g = ((float)__PYX_NAN());
                            __pyx_v_green = ((unsigned short)0xbad0bad0);
                            __pyx_v_k = ((float)__PYX_NAN());
                            __pyx_v_kernel_offset_x = ((short)0xbad0bad0);
                            __pyx_v_kernel_offset_y = ((short)0xbad0bad0);
                            __pyx_v_r = ((float)__PYX_NAN());
                            __pyx_v_red = ((unsigned short)0xbad0bad0);
                            __pyx_v_xx = ((int)0xbad0bad0);
                            __pyx_v_y = ((int)0xbad0bad0);
                            __pyx_v_yy = ((int)0xbad0bad0);

                            /* "PygameShader/shader.pyx":8308
 *         for x in prange(0, w, schedule='static', num_threads=THREADS):
 * 
 *             for y in range(0, h):             # <<<<<<<<<<<<<<
 * 
 *                 r, g, b = 0, 0, 0
 */
                            __pyx_t_11 = __pyx_v_h;
                            __pyx_t_12 = __pyx_t_11;
                            for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
                              __pyx_v_y = __pyx_t_13;

                              /* "PygameShader/shader.pyx":8310
 *             for y in range(0, h):
 * 
 *                 r, g, b = 0, 0, 0             # <<<<<<<<<<<<<<
 * 
 *                 for kernel_offset_y in range(-kernel_half, kernel_half + 1):
 */
                              __pyx_t_7 = 0.0;
                              __pyx_t_14 = 0.0;
                              __pyx_t_15 = 0.0;
                              __pyx_v_r = __pyx_t_7;
                              __pyx_v_g = __pyx_t_14;
                              __pyx_v_b = __pyx_t_15;

                              /* "PygameShader/shader.pyx":8312
 *                 r, g, b = 0, 0, 0
 * 
 *                 for kernel_offset_y in range(-kernel_half, kernel_half + 1):             # <<<<<<<<<<<<<<
 * 
 *                     for kernel_offset_x in range(-kernel_half, kernel_half + 1):
 */
                              __pyx_t_16 = (__pyx_v_kernel_half + 1);
                              __pyx_t_17 = __pyx_t_16;
                              for (__pyx_t_18 = (-__pyx_v_kernel_half); __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                                __pyx_v_kernel_offset_y = __pyx_t_18;

                                /* "PygameShader/shader.pyx":8314
 *                 for kernel_offset_y in range(-kernel_half, kernel_half + 1):
 * 
 *                     for kernel_offset_x in range(-kernel_half, kernel_half + 1):             # <<<<<<<<<<<<<<
 * 
 *                         xx = x + kernel_offset_x
 */
                                __pyx_t_19 = (__pyx_v_kernel_half + 1);
                                __pyx_t_20 = __pyx_t_19;
                                for (__pyx_t_21 = (-__pyx_v_kernel_half); __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
                                  __pyx_v_kernel_offset_x = __pyx_t_21;

                                  /* "PygameShader/shader.pyx":8316
 *                     for kernel_offset_x in range(-kernel_half, kernel_half + 1):
 * 
 *                         xx = x + kernel_offset_x             # <<<<<<<<<<<<<<
 *                         yy = y + kernel_offset_y
 * 
 */
                                  __pyx_v_xx = (__pyx_v_x + __pyx_v_kernel_offset_x);

                                  /* "PygameShader/shader.pyx":8317
 * 
 *                         xx = x + kernel_offset_x
 *                         yy = y + kernel_offset_y             # <<<<<<<<<<<<<<
 * 
 *                         if xx < 0:
 */
                                  __pyx_v_yy = (__pyx_v_y + __pyx_v_kernel_offset_y);

                                  /* "PygameShader/shader.pyx":8319
 *                         yy = y + kernel_offset_y
 * 
 *                         if xx < 0:             # <<<<<<<<<<<<<<
 *                             xx = 0
 *                         elif xx > w:
 */
                                  __pyx_t_22 = ((__pyx_v_xx < 0) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":8320
 * 
 *                         if xx < 0:
 *                             xx = 0             # <<<<<<<<<<<<<<
 *                         elif xx > w:
 *                             xx = w
 */
                                    __pyx_v_xx = 0;

                                    /* "PygameShader/shader.pyx":8319
 *                         yy = y + kernel_offset_y
 * 
 *                         if xx < 0:             # <<<<<<<<<<<<<<
 *                             xx = 0
 *                         elif xx > w:
 */
                                    goto __pyx_L16;
                                  }

                                  /* "PygameShader/shader.pyx":8321
 *                         if xx < 0:
 *                             xx = 0
 *                         elif xx > w:             # <<<<<<<<<<<<<<
 *                             xx = w
 * 
 */
                                  __pyx_t_22 = ((__pyx_v_xx > __pyx_v_w) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":8322
 *                             xx = 0
 *                         elif xx > w:
 *                             xx = w             # <<<<<<<<<<<<<<
 * 
 *                         if yy < 0:
 */
                                    __pyx_v_xx = __pyx_v_w;

                                    /* "PygameShader/shader.pyx":8321
 *                         if xx < 0:
 *                             xx = 0
 *                         elif xx > w:             # <<<<<<<<<<<<<<
 *                             xx = w
 * 
 */
                                  }
                                  __pyx_L16:;

                                  /* "PygameShader/shader.pyx":8324
 *                             xx = w
 * 
 *                         if yy < 0:             # <<<<<<<<<<<<<<
 *                             yy = 0
 *                         elif yy > h:
 */
                                  __pyx_t_22 = ((__pyx_v_yy < 0) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":8325
 * 
 *                         if yy < 0:
 *                             yy = 0             # <<<<<<<<<<<<<<
 *                         elif yy > h:
 *                             yy = h
 */
                                    __pyx_v_yy = 0;

                                    /* "PygameShader/shader.pyx":8324
 *                             xx = w
 * 
 *                         if yy < 0:             # <<<<<<<<<<<<<<
 *                             yy = 0
 *                         elif yy > h:
 */
                                    goto __pyx_L17;
                                  }

                                  /* "PygameShader/shader.pyx":8326
 *                         if yy < 0:
 *                             yy = 0
 *                         elif yy > h:             # <<<<<<<<<<<<<<
 *                             yy = h
 * 
 */
                                  __pyx_t_22 = ((__pyx_v_yy > __pyx_v_h) != 0);
                                  if (__pyx_t_22) {

                                    /* "PygameShader/shader.pyx":8327
 *                             yy = 0
 *                         elif yy > h:
 *                             yy = h             # <<<<<<<<<<<<<<
 * 
 * 
 */
                                    __pyx_v_yy = __pyx_v_h;

                                    /* "PygameShader/shader.pyx":8326
 *                         if yy < 0:
 *                             yy = 0
 *                         elif yy > h:             # <<<<<<<<<<<<<<
 *                             yy = h
 * 
 */
                                  }
                                  __pyx_L17:;

                                  /* "PygameShader/shader.pyx":8331
 * 
 *                         red, green, blue = \
 *                             rgb_array_[xx, yy, 0], \             # <<<<<<<<<<<<<<
 *                             rgb_array_[xx, yy, 1],\
 *                             rgb_array_[xx, yy, 2]
 */
                                  __pyx_t_23 = __pyx_v_xx;
                                  __pyx_t_24 = __pyx_v_yy;
                                  __pyx_t_25 = 0;
                                  __pyx_t_26 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )));

                                  /* "PygameShader/shader.pyx":8332
 *                         red, green, blue = \
 *                             rgb_array_[xx, yy, 0], \
 *                             rgb_array_[xx, yy, 1],\             # <<<<<<<<<<<<<<
 *                             rgb_array_[xx, yy, 2]
 * 
 */
                                  __pyx_t_25 = __pyx_v_xx;
                                  __pyx_t_24 = __pyx_v_yy;
                                  __pyx_t_23 = 1;
                                  __pyx_t_27 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) )));

                                  /* "PygameShader/shader.pyx":8333
 *                             rgb_array_[xx, yy, 0], \
 *                             rgb_array_[xx, yy, 1],\
 *                             rgb_array_[xx, yy, 2]             # <<<<<<<<<<<<<<
 * 
 *                         k = kernel[kernel_offset_y + kernel_half, kernel_offset_x + kernel_half]
 */
                                  __pyx_t_23 = __pyx_v_xx;
                                  __pyx_t_24 = __pyx_v_yy;
                                  __pyx_t_25 = 2;
                                  __pyx_t_28 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )));
                                  __pyx_v_red = __pyx_t_26;
                                  __pyx_v_green = __pyx_t_27;
                                  __pyx_v_blue = __pyx_t_28;

                                  /* "PygameShader/shader.pyx":8335
 *                             rgb_array_[xx, yy, 2]
 * 
 *                         k = kernel[kernel_offset_y + kernel_half, kernel_offset_x + kernel_half]             # <<<<<<<<<<<<<<
 *                         r = r + red * k
 *                         g = g + green * k
 */
                                  __pyx_t_25 = (__pyx_v_kernel_offset_y + __pyx_v_kernel_half);
                                  __pyx_t_24 = (__pyx_v_kernel_offset_x + __pyx_v_kernel_half);
                                  __pyx_v_k = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_kernel.data + __pyx_t_25 * __pyx_v_kernel.strides[0]) ) + __pyx_t_24 * __pyx_v_kernel.strides[1]) )));

                                  /* "PygameShader/shader.pyx":8336
 * 
 *                         k = kernel[kernel_offset_y + kernel_half, kernel_offset_x + kernel_half]
 *                         r = r + red * k             # <<<<<<<<<<<<<<
 *                         g = g + green * k
 *                         b = b + blue * k
 */
                                  __pyx_v_r = (__pyx_v_r + (__pyx_v_red * __pyx_v_k));

                                  /* "PygameShader/shader.pyx":8337
 *                         k = kernel[kernel_offset_y + kernel_half, kernel_offset_x + kernel_half]
 *                         r = r + red * k
 *                         g = g + green * k             # <<<<<<<<<<<<<<
 *                         b = b + blue * k
 * 
 */
                                  __pyx_v_g = (__pyx_v_g + (__pyx_v_green * __pyx_v_k));

                                  /* "PygameShader/shader.pyx":8338
 *                         r = r + red * k
 *                         g = g + green * k
 *                         b = b + blue * k             # <<<<<<<<<<<<<<
 * 
 *                 if r < 0:
 */
                                  __pyx_v_b = (__pyx_v_b + (__pyx_v_blue * __pyx_v_k));
                                }
                              }

                              /* "PygameShader/shader.pyx":8340
 *                         b = b + blue * k
 * 
 *                 if r < 0:             # <<<<<<<<<<<<<<
 *                     r = 0
 *                 if g < 0:
 */
                              __pyx_t_22 = ((__pyx_v_r < 0.0) != 0);
                              if (__pyx_t_22) {

                                /* "PygameShader/shader.pyx":8341
 * 
 *                 if r < 0:
 *                     r = 0             # <<<<<<<<<<<<<<
 *                 if g < 0:
 *                     g = 0
 */
                                __pyx_v_r = 0.0;

                                /* "PygameShader/shader.pyx":8340
 *                         b = b + blue * k
 * 
 *                 if r < 0:             # <<<<<<<<<<<<<<
 *                     r = 0
 *                 if g < 0:
 */
                              }

                              /* "PygameShader/shader.pyx":8342
 *                 if r < 0:
 *                     r = 0
 *                 if g < 0:             # <<<<<<<<<<<<<<
 *                     g = 0
 *                 if b < 0:
 */
                              __pyx_t_22 = ((__pyx_v_g < 0.0) != 0);
                              if (__pyx_t_22) {

                                /* "PygameShader/shader.pyx":8343
 *                     r = 0
 *                 if g < 0:
 *                     g = 0             # <<<<<<<<<<<<<<
 *                 if b < 0:
 *                     b = 0
 */
                                __pyx_v_g = 0.0;

                                /* "PygameShader/shader.pyx":8342
 *                 if r < 0:
 *                     r = 0
 *                 if g < 0:             # <<<<<<<<<<<<<<
 *                     g = 0
 *                 if b < 0:
 */
                              }

                              /* "PygameShader/shader.pyx":8344
 *                 if g < 0:
 *                     g = 0
 *                 if b < 0:             # <<<<<<<<<<<<<<
 *                     b = 0
 *                 if r > 255:
 */
                              __pyx_t_22 = ((__pyx_v_b < 0.0) != 0);
                              if (__pyx_t_22) {

                                /* "PygameShader/shader.pyx":8345
 *                     g = 0
 *                 if b < 0:
 *                     b = 0             # <<<<<<<<<<<<<<
 *                 if r > 255:
 *                     r= 255
 */
                                __pyx_v_b = 0.0;

                                /* "PygameShader/shader.pyx":8344
 *                 if g < 0:
 *                     g = 0
 *                 if b < 0:             # <<<<<<<<<<<<<<
 *                     b = 0
 *                 if r > 255:
 */
                              }

                              /* "PygameShader/shader.pyx":8346
 *                 if b < 0:
 *                     b = 0
 *                 if r > 255:             # <<<<<<<<<<<<<<
 *                     r= 255
 *                 if g > 255:
 */
                              __pyx_t_22 = ((__pyx_v_r > 255.0) != 0);
                              if (__pyx_t_22) {

                                /* "PygameShader/shader.pyx":8347
 *                     b = 0
 *                 if r > 255:
 *                     r= 255             # <<<<<<<<<<<<<<
 *                 if g > 255:
 *                     g = 255
 */
                                __pyx_v_r = 255.0;

                                /* "PygameShader/shader.pyx":8346
 *                 if b < 0:
 *                     b = 0
 *                 if r > 255:             # <<<<<<<<<<<<<<
 *                     r= 255
 *                 if g > 255:
 */
                              }

                              /* "PygameShader/shader.pyx":8348
 *                 if r > 255:
 *                     r= 255
 *                 if g > 255:             # <<<<<<<<<<<<<<
 *                     g = 255
 *                 if b > 255:
 */
                              __pyx_t_22 = ((__pyx_v_g > 255.0) != 0);
                              if (__pyx_t_22) {

                                /* "PygameShader/shader.pyx":8349
 *                     r= 255
 *                 if g > 255:
 *                     g = 255             # <<<<<<<<<<<<<<
 *                 if b > 255:
 *                     b = 255
 */
                                __pyx_v_g = 255.0;

                                /* "PygameShader/shader.pyx":8348
 *                 if r > 255:
 *                     r= 255
 *                 if g > 255:             # <<<<<<<<<<<<<<
 *                     g = 255
 *                 if b > 255:
 */
                              }

                              /* "PygameShader/shader.pyx":8350
 *                 if g > 255:
 *                     g = 255
 *                 if b > 255:             # <<<<<<<<<<<<<<
 *                     b = 255
 * 
 */
                              __pyx_t_22 = ((__pyx_v_b > 255.0) != 0);
                              if (__pyx_t_22) {

                                /* "PygameShader/shader.pyx":8351
 *                     g = 255
 *                 if b > 255:
 *                     b = 255             # <<<<<<<<<<<<<<
 * 
 *                 emboss[y, x, 0], emboss[y, x, 1], \
 */
                                __pyx_v_b = 255.0;

                                /* "PygameShader/shader.pyx":8350
 *                 if g > 255:
 *                     g = 255
 *                 if b > 255:             # <<<<<<<<<<<<<<
 *                     b = 255
 * 
 */
                              }

                              /* "PygameShader/shader.pyx":8354
 * 
 *                 emboss[y, x, 0], emboss[y, x, 1], \
 *                 emboss[y, x, 2] = <unsigned char>r, <unsigned char>g, <unsigned char>b             # <<<<<<<<<<<<<<
 * 
 *     return frombuffer(asarray(emboss), (w, h), 'RGB')
 */
                              __pyx_t_28 = ((unsigned char)__pyx_v_r);
                              __pyx_t_27 = ((unsigned char)__pyx_v_g);
                              __pyx_t_26 = ((unsigned char)__pyx_v_b);

                              /* "PygameShader/shader.pyx":8353
 *                     b = 255
 * 
 *                 emboss[y, x, 0], emboss[y, x, 1], \             # <<<<<<<<<<<<<<
 *                 emboss[y, x, 2] = <unsigned char>r, <unsigned char>g, <unsigned char>b
 * 
 */
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_25 = __pyx_v_x;
                              __pyx_t_23 = 0;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_emboss.data + __pyx_t_24 * __pyx_v_emboss.strides[0]) ) + __pyx_t_25 * __pyx_v_emboss.strides[1]) )) + __pyx_t_23)) )) = __pyx_t_28;
                              __pyx_t_23 = __pyx_v_y;
                              __pyx_t_25 = __pyx_v_x;
                              __pyx_t_24 = 1;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_emboss.data + __pyx_t_23 * __pyx_v_emboss.strides[0]) ) + __pyx_t_25 * __pyx_v_emboss.strides[1]) )) + __pyx_t_24)) )) = __pyx_t_27;

                              /* "PygameShader/shader.pyx":8354
 * 
 *                 emboss[y, x, 0], emboss[y, x, 1], \
 *                 emboss[y, x, 2] = <unsigned char>r, <unsigned char>g, <unsigned char>b             # <<<<<<<<<<<<<<
 * 
 *     return frombuffer(asarray(emboss), (w, h), 'RGB')
 */
                              __pyx_t_24 = __pyx_v_y;
                              __pyx_t_25 = __pyx_v_x;
                              __pyx_t_23 = 2;
                              *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_emboss.data + __pyx_t_24 * __pyx_v_emboss.strides[0]) ) + __pyx_t_25 * __pyx_v_emboss.strides[1]) )) + __pyx_t_23)) )) = __pyx_t_26;
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "PygameShader/shader.pyx":8304
 *         float r, g, b, k
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 * 
 *         for x in prange(0, w, schedule='static', num_threads=THREADS):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "PygameShader/shader.pyx":8356
 *                 emboss[y, x, 2] = <unsigned char>r, <unsigned char>g, <unsigned char>b
 * 
 *     return frombuffer(asarray(emboss), (w, h), 'RGB')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_29 = __pyx_memoryview_fromslice(__pyx_v_emboss, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 8356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_29);
  __pyx_t_30 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_30 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_30)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_30);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_30) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_30, __pyx_t_29) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_29);
  __Pyx_XDECREF(__pyx_t_30); __pyx_t_30 = 0;
  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_29 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 8356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_29);
  __pyx_t_30 = PyTuple_New(2); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 8356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_30, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_29);
  PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_29);
  __pyx_t_1 = 0;
  __pyx_t_29 = 0;
  __pyx_t_29 = NULL;
  __pyx_t_13 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_29 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_29)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_29);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_13 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_29, __pyx_t_2, __pyx_t_30, __pyx_n_s_RGB};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8356, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_29); __pyx_t_29 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_29, __pyx_t_2, __pyx_t_30, __pyx_n_s_RGB};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8356, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_29); __pyx_t_29 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_29) {
      __Pyx_GIVEREF(__pyx_t_29); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_29); __pyx_t_29 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_13, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_30);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_13, __pyx_t_30);
    __Pyx_INCREF(__pyx_n_s_RGB);
    __Pyx_GIVEREF(__pyx_n_s_RGB);
    PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_13, __pyx_n_s_RGB);
    __pyx_t_2 = 0;
    __pyx_t_30 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PygameShader/shader.pyx":8282
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cdef object emboss5x5_c(unsigned char [:, :, :] rgb_array_):             # <<<<<<<<<<<<<<
 * 
 *     k_weight = numpy.sum(EMBOSS_KERNEL)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_XDECREF(__pyx_t_29);
  __Pyx_XDECREF(__pyx_t_30);
  __Pyx_AddTraceback("PygameShader.shader.emboss5x5_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k_weight);
  __PYX_XDEC_MEMVIEW(&__pyx_v_kernel, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_emboss, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":742
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":743
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":742
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":745
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":746
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":745
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":748
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":749
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":748
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":751
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":752
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":751
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":754
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":755
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":754
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":757
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":758
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
  if (__pyx_t_1) {

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":759
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
 *     else:
 *         return ()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
    __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
    goto __pyx_L0;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":758
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  }

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":761
 *         return <tuple>d.subarray.shape
 *     else:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    goto __pyx_L0;
  }

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":757
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":763
 *         return ()
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  long __pyx_t_8;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_util_dtypestring", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":768
 * 
 *     cdef dtype child
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":769
 *     cdef dtype child
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":772
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(__pyx_v_descr->names == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(2, 772, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 772, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":773
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    if (unlikely(__pyx_v_descr->fields == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(2, 773, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 773, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(2, 773, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":774
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 */
    if (likely(__pyx_v_fields != Py_None)) {
      PyObject* sequence = __pyx_v_fields;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(2, 774, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 774, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 774, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 774, __pyx_L1_error)
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 774, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":776
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 776, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
    if (unlikely(__pyx_t_6)) {

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":777
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(2, 777, __pyx_L1_error)

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":776
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    }

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":779
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
    if (!__pyx_t_7) {
      goto __pyx_L8_next_or;
    } else {
    }
    __pyx_t_7 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_L8_next_or:;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":780
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_6 = __pyx_t_7;
    __pyx_L7_bool_binop_done:;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":779
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    if (unlikely(__pyx_t_6)) {

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":781
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 781, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(2, 781, __pyx_L1_error)

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":779
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    }

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":791
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 791, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 791, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_6) break;

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":792
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 0x78;

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":793
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":794
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_8 = 0;
      (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
    }

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":796
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_8 = 0;
    (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":798
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
    if (__pyx_t_6) {

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":799
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 799, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":800
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
      if (unlikely(__pyx_t_6)) {

        /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":801
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 801, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(2, 801, __pyx_L1_error)

        /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":800
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":804
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 804, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 804, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":805
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 805, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 805, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":806
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 806, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 806, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x68;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":807
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 807, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 807, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 807, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":808
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 808, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 808, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 808, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x69;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":809
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 809, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 809, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 809, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":810
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 810, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 810, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 810, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x6C;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":811
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 811, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 811, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 811, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":812
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 812, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 812, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 812, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x71;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":813
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 813, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 813, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 813, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":814
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 814, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 814, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 814, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x66;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":815
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 815, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 815, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 815, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x64;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":816
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 816, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 816, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x67;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":817
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 817, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 817, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 817, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x66;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":818
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 818, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 818, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 818, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x64;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":819
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 819, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 819, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 819, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x67;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":820
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 820, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 820, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (likely(__pyx_t_6)) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L15;
      }

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":822
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
      /*else*/ {
        __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 822, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 822, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(2, 822, __pyx_L1_error)
      }
      __pyx_L15:;

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":823
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":798
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
      goto __pyx_L13;
    }

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":827
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
    /*else*/ {
      __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(2, 827, __pyx_L1_error)
      __pyx_v_f = __pyx_t_9;
    }
    __pyx_L13:;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":772
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":828
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":763
 *         return ()
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_childname);
  __Pyx_XDECREF(__pyx_v_new_offset);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":943
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_array_base", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":944
 * 
 * cdef inline void set_array_base(ndarray arr, object base):
 *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
 *     PyArray_SetBaseObject(arr, base)
 * 
 */
  Py_INCREF(__pyx_v_base);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":945
 * cdef inline void set_array_base(ndarray arr, object base):
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":943
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":947
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_v_base;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":948
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
 *     if base is NULL:
 *         return None
 */
  __pyx_v_base = PyArray_BASE(__pyx_v_arr);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":949
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
  if (__pyx_t_1) {

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":950
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return <object>base
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":949
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  }

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":951
 *     if base is NULL:
 *         return None
 *     return <object>base             # <<<<<<<<<<<<<<
 * 
 * # Versions of the import_* functions which are more suitable for
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_base));
  __pyx_r = ((PyObject *)__pyx_v_base);
  goto __pyx_L0;

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":947
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":955
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         __pyx_import_array()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_array", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":956
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":957
 * cdef inline int import_array() except -1:
 *     try:
 *         __pyx_import_array()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")
 */
      __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L3_error)

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":956
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":958
 *     try:
 *         __pyx_import_array()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 958, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":959
 *         __pyx_import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 959, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 959, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":956
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":955
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         __pyx_import_array()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":961
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_umath", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":962
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":963
 * cdef inline int import_umath() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 963, __pyx_L3_error)

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":962
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":964
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 964, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":965
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 965, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 965, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":962
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":961
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":967
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_ufunc", 0);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":968
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":969
 * cdef inline int import_ufunc() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 969, __pyx_L3_error)

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":968
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":970
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 970, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":971
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef extern from *:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 971, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 971, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":968
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":967
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "carray.to_py":112
 * 
 * @cname("__Pyx_carray_to_py_float")
 * cdef inline list __Pyx_carray_to_py_float(base_type *v, Py_ssize_t length):             # <<<<<<<<<<<<<<
 *     cdef size_t i
 *     cdef object value
 */

static CYTHON_INLINE PyObject *__Pyx_carray_to_py_float(float *__pyx_v_v, Py_ssize_t __pyx_v_length) {
  size_t __pyx_v_i;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_l = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_carray_to_py_float", 0);

  /* "carray.to_py":115
 *     cdef size_t i
 *     cdef object value
 *     l = PyList_New(length)             # <<<<<<<<<<<<<<
 *     for i in range(<size_t>length):
 *         value = v[i]
 */
  __pyx_t_1 = PyList_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_l = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "carray.to_py":116
 *     cdef object value
 *     l = PyList_New(length)
 *     for i in range(<size_t>length):             # <<<<<<<<<<<<<<
 *         value = v[i]
 *         Py_INCREF(value)
 */
  __pyx_t_2 = ((size_t)__pyx_v_length);
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "carray.to_py":117
 *     l = PyList_New(length)
 *     for i in range(<size_t>length):
 *         value = v[i]             # <<<<<<<<<<<<<<
 *         Py_INCREF(value)
 *         PyList_SET_ITEM(l, i, value)
 */
    __pyx_t_1 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "carray.to_py":118
 *     for i in range(<size_t>length):
 *         value = v[i]
 *         Py_INCREF(value)             # <<<<<<<<<<<<<<
 *         PyList_SET_ITEM(l, i, value)
 *     return l
 */
    Py_INCREF(__pyx_v_value);

    /* "carray.to_py":119
 *         value = v[i]
 *         Py_INCREF(value)
 *         PyList_SET_ITEM(l, i, value)             # <<<<<<<<<<<<<<
 *     return l
 * 
 */
    PyList_SET_ITEM(__pyx_v_l, __pyx_v_i, __pyx_v_value);
  }

  /* "carray.to_py":120
 *         Py_INCREF(value)
 *         PyList_SET_ITEM(l, i, value)
 *     return l             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_l);
  __pyx_r = __pyx_v_l;
  goto __pyx_L0;

  /* "carray.to_py":112
 * 
 * @cname("__Pyx_carray_to_py_float")
 * cdef inline list __Pyx_carray_to_py_float(base_type *v, Py_ssize_t length):             # <<<<<<<<<<<<<<
 *     cdef size_t i
 *     cdef object value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "carray.to_py":124
 * 
 * @cname("__Pyx_carray_to_tuple_float")
 * cdef inline tuple __Pyx_carray_to_tuple_float(base_type *v, Py_ssize_t length):             # <<<<<<<<<<<<<<
 *     cdef size_t i
 *     cdef object value
 */

static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_float(float *__pyx_v_v, Py_ssize_t __pyx_v_length) {
  size_t __pyx_v_i;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_carray_to_tuple_float", 0);

  /* "carray.to_py":127
 *     cdef size_t i
 *     cdef object value
 *     t = PyTuple_New(length)             # <<<<<<<<<<<<<<
 *     for i in range(<size_t>length):
 *         value = v[i]
 */
  __pyx_t_1 = PyTuple_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "carray.to_py":128
 *     cdef object value
 *     t = PyTuple_New(length)
 *     for i in range(<size_t>length):             # <<<<<<<<<<<<<<
 *         value = v[i]
 *         Py_INCREF(value)
 */
  __pyx_t_2 = ((size_t)__pyx_v_length);
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "carray.to_py":129
 *     t = PyTuple_New(length)
 *     for i in range(<size_t>length):
 *         value = v[i]             # <<<<<<<<<<<<<<
 *         Py_INCREF(value)
 *         PyTuple_SET_ITEM(t, i, value)
 */
    __pyx_t_1 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "carray.to_py":130
 *     for i in range(<size_t>length):
 *         value = v[i]
 *         Py_INCREF(value)             # <<<<<<<<<<<<<<
 *         PyTuple_SET_ITEM(t, i, value)
 *     return t
 */
    Py_INCREF(__pyx_v_value);

    /* "carray.to_py":131
 *         value = v[i]
 *         Py_INCREF(value)
 *         PyTuple_SET_ITEM(t, i, value)             # <<<<<<<<<<<<<<
 *     return t
 */
    PyTuple_SET_ITEM(__pyx_v_t, __pyx_v_i, __pyx_v_value);
  }

  /* "carray.to_py":132
 *         Py_INCREF(value)
 *         PyTuple_SET_ITEM(t, i, value)
 *     return t             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_t);
  __pyx_r = __pyx_v_t;
  goto __pyx_L0;

  /* "carray.to_py":124
 * 
 * @cname("__Pyx_carray_to_tuple_float")
 * cdef inline tuple __Pyx_carray_to_tuple_float(base_type *v, Py_ssize_t length):             # <<<<<<<<<<<<<<
 *     cdef size_t i
 *     cdef object value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_tuple_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":122
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

/* Python wrapper */
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_shape = 0;
  Py_ssize_t __pyx_v_itemsize;
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_v_allocate_buffer;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_n_s_c_2);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(3, 122, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(3, 122, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(3, 122, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_shape = ((PyObject*)values[0]);
    __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 122, __pyx_L3_error)
    __pyx_v_format = values[2];
    __pyx_v_mode = values[3];
    if (values[4]) {
      __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 123, __pyx_L3_error)
    } else {

      /* "View.MemoryView":123
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
 *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
 * 
 *         cdef int idx
 */
      __pyx_v_allocate_buffer = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 122, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(3, 122, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(3, 122, __pyx_L1_error)
  }
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);

  /* "View.MemoryView":122
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_dim;
  PyObject **__pyx_v_p;
  char __pyx_v_order;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  char *__pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_format);

  /* "View.MemoryView":129
 *         cdef PyObject **p
 * 
 *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
 *         self.itemsize = itemsize
 * 
 */
  if (unlikely(__pyx_v_shape == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 129, __pyx_L1_error)
  }
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(3, 129, __pyx_L1_error)
  __pyx_v_self->ndim = ((int)__pyx_t_1);

  /* "View.MemoryView":130
 * 
 *         self.ndim = <int> len(shape)
 *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not self.ndim:
 */
  __pyx_v_self->itemsize = __pyx_v_itemsize;

  /* "View.MemoryView":132
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":133
 * 
 *         if not self.ndim:
 *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 133, __pyx_L1_error)

    /* "View.MemoryView":132
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 */
  }

  /* "View.MemoryView":135
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 */
  __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":136
 * 
 *         if itemsize <= 0:
 *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 136, __pyx_L1_error)

    /* "View.MemoryView":135
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 */
  }

  /* "View.MemoryView":138
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_format); 
  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":139
 * 
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":138
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 */
  }

  /* "View.MemoryView":140
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
 *         self.format = self._format
 * 
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(3, 140, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_format;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_format);
  __Pyx_DECREF(__pyx_v_self->_format);
  __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":141
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(__pyx_v_self->_format == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(3, 141, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(3, 141, __pyx_L1_error)
  __pyx_v_self->format = __pyx_t_7;

  /* "View.MemoryView":144
 * 
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
 *         self._strides = self._shape + self.ndim
 * 
 */
  __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));

  /* "View.MemoryView":145
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
 *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
 * 
 *         if not self._shape:
 */
  __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);

  /* "View.MemoryView":147
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError("unable to allocate shape and strides.")
 * 
 */
  __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "View.MemoryView":148
 * 
 *         if not self._shape:
 *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 148, __pyx_L1_error)

    /* "View.MemoryView":147
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError("unable to allocate shape and strides.")
 * 
 */
  }

  /* "View.MemoryView":151
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 */
  __pyx_t_8 = 0;
  __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 151, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 151, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_9;
    __pyx_v_idx = __pyx_t_8;
    __pyx_t_8 = (__pyx_t_8 + 1);

    /* "View.MemoryView":152
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim
 */
    __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":153
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
 *             self._shape[idx] = dim
 * 
 */
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(3, 153, __pyx_L1_error)

      /* "View.MemoryView":152
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim
 */
    }

    /* "View.MemoryView":154
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
 * 
 *         cdef char order
 */
    (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;

    /* "View.MemoryView":151
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":157
 * 
 *         cdef char order
 *         if mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(3, 157, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":158
 *         cdef char order
 *         if mode == 'fortran':
 *             order = b'F'             # <<<<<<<<<<<<<<
 *             self.mode = u'fortran'
 *         elif mode == 'c':
 */
    __pyx_v_order = 'F';

    /* "View.MemoryView":159
 *         if mode == 'fortran':
 *             order = b'F'
 *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
 *         elif mode == 'c':
 *             order = b'C'
 */
    __Pyx_INCREF(__pyx_n_u_fortran);
    __Pyx_GIVEREF(__pyx_n_u_fortran);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_n_u_fortran;

    /* "View.MemoryView":157
 * 
 *         cdef char order
 *         if mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":160
 *             order = b'F'
 *             self.mode = u'fortran'
 *         elif mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c_2, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(3, 160, __pyx_L1_error)
  if (likely(__pyx_t_4)) {

    /* "View.MemoryView":161
 *             self.mode = u'fortran'
 *         elif mode == 'c':
 *             order = b'C'             # <<<<<<<<<<<<<<
 *             self.mode = u'c'
 *         else:
 */
    __pyx_v_order = 'C';

    /* "View.MemoryView":162
 *         elif mode == 'c':
 *             order = b'C'
 *             self.mode = u'c'             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
 */
    __Pyx_INCREF(__pyx_n_u_c_2);
    __Pyx_GIVEREF(__pyx_n_u_c_2);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_n_u_c_2;

    /* "View.MemoryView":160
 *             order = b'F'
 *             self.mode = u'fortran'
 *         elif mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":164
 *             self.mode = u'c'
 *         else:
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides,
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(3, 164, __pyx_L1_error)
  }
  __pyx_L10:;

  /* "View.MemoryView":166
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
 *                                              itemsize, self.ndim, order)
 * 
 */
  __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);

  /* "View.MemoryView":169
 *                                              itemsize, self.ndim, order)
 * 
 *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:
 */
  __pyx_v_self->free_data = __pyx_v_allocate_buffer;

  /* "View.MemoryView":170
 * 
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
 *         if allocate_buffer:
 * 
 */
  __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 170, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 170, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_self->dtype_is_object = __pyx_t_4;

  /* "View.MemoryView":171
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":174
 * 
 * 
 *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")
 */
    __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));

    /* "View.MemoryView":175
 * 
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:             # <<<<<<<<<<<<<<
 *                 raise MemoryError("unable to allocate array data.")
 * 
 */
    __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":176
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
 * 
 *             if self.dtype_is_object:
 */
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(3, 176, __pyx_L1_error)

      /* "View.MemoryView":175
 * 
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:             # <<<<<<<<<<<<<<
 *                 raise MemoryError("unable to allocate array data.")
 * 
 */
    }

    /* "View.MemoryView":178
 *                 raise MemoryError("unable to allocate array data.")
 * 
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 */
    __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":179
 * 
 *             if self.dtype_is_object:
 *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None
 */
      __pyx_v_p = ((PyObject **)__pyx_v_self->data);

      /* "View.MemoryView":180
 *             if self.dtype_is_object:
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
 *                     p[i] = Py_None
 *                     Py_INCREF(Py_None)
 */
      if (unlikely(__pyx_v_itemsize == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        __PYX_ERR(3, 180, __pyx_L1_error)
      }
      else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
        PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
        __PYX_ERR(3, 180, __pyx_L1_error)
      }
      __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
      __pyx_t_9 = __pyx_t_1;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

        /* "View.MemoryView":181
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None             # <<<<<<<<<<<<<<
 *                     Py_INCREF(Py_None)
 * 
 */
        (__pyx_v_p[__pyx_v_i]) = Py_None;

        /* "View.MemoryView":182
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None
 *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
        Py_INCREF(Py_None);
      }

      /* "View.MemoryView":178
 *                 raise MemoryError("unable to allocate array data.")
 * 
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 */
    }

    /* "View.MemoryView":171
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":122
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":185
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_bufmode;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (__pyx_v_info == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "View.MemoryView":186
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 */
  __pyx_v_bufmode = -1;

  /* "View.MemoryView":187
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if self.mode == u"c":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c_2, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 187, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":188
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 */
    __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

    /* "View.MemoryView":187
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if self.mode == u"c":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":189
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 189, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":190
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 */
    __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

    /* "View.MemoryView":189
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":191
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 */
  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":192
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 192, __pyx_L1_error)

    /* "View.MemoryView":191
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 */
  }

  /* "View.MemoryView":193
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data             # <<<<<<<<<<<<<<
 *         info.len = self.len
 *         info.ndim = self.ndim
 */
  __pyx_t_4 = __pyx_v_self->data;
  __pyx_v_info->buf = __pyx_t_4;

  /* "View.MemoryView":194
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 *         info.len = self.len             # <<<<<<<<<<<<<<
 *         info.ndim = self.ndim
 *         info.shape = self._shape
 */
  __pyx_t_5 = __pyx_v_self->len;
  __pyx_v_info->len = __pyx_t_5;

  /* "View.MemoryView":195
 *         info.buf = self.data
 *         info.len = self.len
 *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
 *         info.shape = self._shape
 *         info.strides = self._strides
 */
  __pyx_t_6 = __pyx_v_self->ndim;
  __pyx_v_info->ndim = __pyx_t_6;

  /* "View.MemoryView":196
 *         info.len = self.len
 *         info.ndim = self.ndim
 *         info.shape = self._shape             # <<<<<<<<<<<<<<
 *         info.strides = self._strides
 *         info.suboffsets = NULL
 */
  __pyx_t_7 = __pyx_v_self->_shape;
  __pyx_v_info->shape = __pyx_t_7;

  /* "View.MemoryView":197
 *         info.ndim = self.ndim
 *         info.shape = self._shape
 *         info.strides = self._strides             # <<<<<<<<<<<<<<
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 */
  __pyx_t_7 = __pyx_v_self->_strides;
  __pyx_v_info->strides = __pyx_t_7;

  /* "View.MemoryView":198
 *         info.shape = self._shape
 *         info.strides = self._strides
 *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         info.itemsize = self.itemsize
 *         info.readonly = 0
 */
  __pyx_v_info->suboffsets = NULL;

  /* "View.MemoryView":199
 *         info.strides = self._strides
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
 *         info.readonly = 0
 * 
 */
  __pyx_t_5 = __pyx_v_self->itemsize;
  __pyx_v_info->itemsize = __pyx_t_5;

  /* "View.MemoryView":200
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 *         info.readonly = 0             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
  __pyx_v_info->readonly = 0;

  /* "View.MemoryView":202
 *         info.readonly = 0
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.format
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":203
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
 */
    __pyx_t_4 = __pyx_v_self->format;
    __pyx_v_info->format = __pyx_t_4;

    /* "View.MemoryView":202
 *         info.readonly = 0
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.format
 *         else:
 */
    goto __pyx_L5;
  }

  /* "View.MemoryView":205
 *             info.format = self.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.obj = self
 */
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L5:;

  /* "View.MemoryView":207
 *             info.format = NULL
 * 
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":185
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":211
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 */

/* Python wrapper */
static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":212
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 */
  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":213
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
 *         elif self.free_data:
 *             if self.dtype_is_object:
 */
    __pyx_v_self->callback_free_data(__pyx_v_self->data);

    /* "View.MemoryView":212
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":214
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,
 */
  __pyx_t_1 = (__pyx_v_self->free_data != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":215
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 */
    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":216
 *         elif self.free_data:
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
 *                                           self._strides, self.ndim, False)
 *             free(self.data)
 */
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);

      /* "View.MemoryView":215
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 */
    }

    /* "View.MemoryView":218
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 *             free(self.data)             # <<<<<<<<<<<<<<
 *         PyObject_Free(self._shape)
 * 
 */
    free(__pyx_v_self->data);

    /* "View.MemoryView":214
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":219
 *                                           self._strides, self.ndim, False)
 *             free(self.data)
 *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  PyObject_Free(__pyx_v_self->_shape);

  /* "View.MemoryView":211
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":222
 * 
 *     @property
 *     def memview(self):             # <<<<<<<<<<<<<<
 *         return self.get_memview()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":223
 *     @property
 *     def memview(self):
 *         return self.get_memview()             # <<<<<<<<<<<<<<
 * 
 *     @cname('get_memview')
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":222
 * 
 *     @property
 *     def memview(self):             # <<<<<<<<<<<<<<
 *         return self.get_memview()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":226
 * 
 *     @cname('get_memview')
 *     cdef get_memview(self):             # <<<<<<<<<<<<<<
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)
 */

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_memview", 0);

  /* "View.MemoryView":227
 *     @cname('get_memview')
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 */
  __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);

  /* "View.MemoryView":228
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":226
 * 
 *     @cname('get_memview')
 *     cdef get_memview(self):             # <<<<<<<<<<<<<<
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":230
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "View.MemoryView":231
 * 
 *     def __len__(self):
 *         return self._shape[0]             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self, attr):
 */
  __pyx_r = (__pyx_v_self->_shape[0]);
  goto __pyx_L0;

  /* "View.MemoryView":230
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":233
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "View.MemoryView":234
 * 
 *     def __getattr__(self, attr):
 *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":233
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":236
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":237
 * 
 *     def __getitem__(self, item):
 *         return self.memview[item]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, item, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":236
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":239
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
 */

/* Python wrapper */
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "View.MemoryView":240
 * 
 *     def __setitem__(self, item, value):
 *         self.memview[item] = value             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(3, 240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":239
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(3, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(3, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":244
 * 
 * @cname("__pyx_array_new")
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
 *                           char *mode, char *buf):
 *     cdef array result
 */

static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
  struct __pyx_array_obj *__pyx_v_result = 0;
  struct __pyx_array_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("array_cwrapper", 0);

  /* "View.MemoryView":248
 *     cdef array result
 * 
 *     if buf == NULL:             # <<<<<<<<<<<<<<
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":249
 * 
 *     if buf == NULL:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":248
 *     cdef array result
 * 
 *     if buf == NULL:             # <<<<<<<<<<<<<<
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":251
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
 *                        allocate_buffer=False)
 *         result.data = buf
 */
  /*else*/ {
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;

    /* "View.MemoryView":252
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
 *         result.data = buf
 * 
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(3, 252, __pyx_L1_error)

    /* "View.MemoryView":251
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
 *                        allocate_buffer=False)
 *         result.data = buf
 */
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "View.MemoryView":253
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 *                        allocate_buffer=False)
 *         result.data = buf             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_v_result->data = __pyx_v_buf;
  }
  __pyx_L3:;

  /* "View.MemoryView":255
 *         result.data = buf
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":244
 * 
 * @cname("__pyx_array_new")
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
 *                           char *mode, char *buf):
 *     cdef array result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":281
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
 */

/* Python wrapper */
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(3, 281, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 281, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "View.MemoryView":282
 *     cdef object name
 *     def __init__(self, name):
 *         self.name = name             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return self.name
 */
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_name;

  /* "View.MemoryView":281
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":283
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":284
 *         self.name = name
 *     def __repr__(self):
 *         return self.name             # <<<<<<<<<<<<<<
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* "View.MemoryView":283
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.name,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->name);
  __Pyx_GIVEREF(__pyx_v_self->name);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.name is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_self->name != Py_None);
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.name is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_184977713);
    __Pyx_GIVEREF(__pyx_int_184977713);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_184977713);
    __Pyx_GIVEREF(__pyx_int_184977713);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(3, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":298
 * 
 * @cname('__pyx_align_pointer')
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
 */

static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
  Py_intptr_t __pyx_v_aligned_p;
  size_t __pyx_v_offset;
  void *__pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":300
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
 *     cdef size_t offset
 * 
 */
  __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);

  /* "View.MemoryView":304
 * 
 *     with cython.cdivision(True):
 *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
 * 
 *     if offset > 0:
 */
  __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);

  /* "View.MemoryView":306
 *         offset = aligned_p % alignment
 * 
 *     if offset > 0:             # <<<<<<<<<<<<<<
 *         aligned_p += alignment - offset
 * 
 */
  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":307
 * 
 *     if offset > 0:
 *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
 * 
 *     return <void *> aligned_p
 */
    __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));

    /* "View.MemoryView":306
 *         offset = aligned_p % alignment
 * 
 *     if offset > 0:             # <<<<<<<<<<<<<<
 *         aligned_p += alignment - offset
 * 
 */
  }

  /* "View.MemoryView":309
 *         aligned_p += alignment - offset
 * 
 *     return <void *> aligned_p             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((void *)__pyx_v_aligned_p);
  goto __pyx_L0;

  /* "View.MemoryView":298
 * 
 * @cname('__pyx_align_pointer')
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":345
 *     cdef __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
 */

/* Python wrapper */
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  int __pyx_v_flags;
  int __pyx_v_dtype_is_object;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(3, 345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(3, 345, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obj = values[0];
    __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 345, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 345, __pyx_L3_error)
    } else {
      __pyx_v_dtype_is_object = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 345, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "View.MemoryView":346
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj             # <<<<<<<<<<<<<<
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 */
  __Pyx_INCREF(__pyx_v_obj);
  __Pyx_GIVEREF(__pyx_v_obj);
  __Pyx_GOTREF(__pyx_v_self->obj);
  __Pyx_DECREF(__pyx_v_self->obj);
  __pyx_v_self->obj = __pyx_v_obj;

  /* "View.MemoryView":347
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj
 *         self.flags = flags             # <<<<<<<<<<<<<<
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 */
  __pyx_v_self->flags = __pyx_v_flags;

  /* "View.MemoryView":348
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 */
  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_obj != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "View.MemoryView":349
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 */
    __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 349, __pyx_L1_error)

    /* "View.MemoryView":350
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
 */
    __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":351
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
 *                 Py_INCREF(Py_None)
 * 
 */
      ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;

      /* "View.MemoryView":352
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         global __pyx_memoryview_thread_locks_used
 */
      Py_INCREF(Py_None);

      /* "View.MemoryView":350
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
 */
    }

    /* "View.MemoryView":348
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 */
  }

  /* "View.MemoryView":355
 * 
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 */
  __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":356
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:
 */
    __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);

    /* "View.MemoryView":357
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 */
    __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);

    /* "View.MemoryView":355
 * 
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 */
  }

  /* "View.MemoryView":358
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:             # <<<<<<<<<<<<<<
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 */
  __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":359
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *             if self.lock is NULL:
 *                 raise MemoryError
 */
    __pyx_v_self->lock = PyThread_allocate_lock();

    /* "View.MemoryView":360
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
    __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "View.MemoryView":361
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
      PyErr_NoMemory(); __PYX_ERR(3, 361, __pyx_L1_error)

      /* "View.MemoryView":360
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
    }

    /* "View.MemoryView":358
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:             # <<<<<<<<<<<<<<
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 */
  }

  /* "View.MemoryView":363
 *                 raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":364
 * 
 *         if flags & PyBUF_FORMAT:
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
 *         else:
 *             self.dtype_is_object = dtype_is_object
 */
    __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;
    __pyx_v_self->dtype_is_object = __pyx_t_1;

    /* "View.MemoryView":363
 *                 raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":366
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
 * 
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
 */
  /*else*/ {
    __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  }
  __pyx_L10:;

  /* "View.MemoryView":368
 *             self.dtype_is_object = dtype_is_object
 * 
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
 *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
 *         self.typeinfo = NULL
 */
  __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));

  /* "View.MemoryView":370
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
 *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
 *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(memoryview self):
 */
  __pyx_v_self->typeinfo = NULL;

  /* "View.MemoryView":345
 *     cdef __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":372
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 */

/* Python wrapper */
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
  int __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyThread_type_lock __pyx_t_6;
  PyThread_type_lock __pyx_t_7;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":373
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_ReleaseBuffer(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
 */
  __pyx_t_1 = (__pyx_v_self->obj != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":374
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
 * 
 */
    __Pyx_ReleaseBuffer((&__pyx_v_self->view));

    /* "View.MemoryView":373
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_ReleaseBuffer(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":375
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
 */
  __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":377
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
 *             Py_DECREF(Py_None)
 * 
 */
    ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;

    /* "View.MemoryView":378
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
 *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         cdef int i
 */
    Py_DECREF(Py_None);

    /* "View.MemoryView":375
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":382
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 */
  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":383
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 */
    __pyx_t_3 = __pyx_memoryview_thread_locks_used;
    __pyx_t_4 = __pyx_t_3;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "View.MemoryView":384
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 */
      __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":385
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 */
        __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);

        /* "View.MemoryView":386
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 */
        __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":388
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
          __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
          __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);

          /* "View.MemoryView":387
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break
 */
          (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
          (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;

          /* "View.MemoryView":386
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 */
        }

        /* "View.MemoryView":389
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 PyThread_free_lock(self.lock)
 */
        goto __pyx_L6_break;

        /* "View.MemoryView":384
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 */
      }
    }
    /*else*/ {

      /* "View.MemoryView":391
 *                     break
 *             else:
 *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 */
      PyThread_free_lock(__pyx_v_self->lock);
    }
    __pyx_L6_break:;

    /* "View.MemoryView":382
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 */
  }

  /* "View.MemoryView":372
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":393
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
 */

static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  Py_ssize_t __pyx_v_dim;
  char *__pyx_v_itemp;
  PyObject *__pyx_v_idx = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  char *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_item_pointer", 0);

  /* "View.MemoryView":395
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
 * 
 *         for dim, idx in enumerate(index):
 */
  __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);

  /* "View.MemoryView":397
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 */
  __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
    __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 397, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 397, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(3, 397, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 397, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(3, 397, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 397, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(3, 397, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);

    /* "View.MemoryView":398
 * 
 *         for dim, idx in enumerate(index):
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
 * 
 *         return itemp
 */
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 398, __pyx_L1_error)
    __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(3, 398, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_7;

    /* "View.MemoryView":397
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":400
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 *         return itemp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_itemp;
  goto __pyx_L0;

  /* "View.MemoryView":393
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":403
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_indices = NULL;
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  char *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":404
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
  __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":405
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:
 *             return self             # <<<<<<<<<<<<<<
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;

    /* "View.MemoryView":404
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
  }

  /* "View.MemoryView":407
 *             return self
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         cdef char *itemp
 */
  __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(3, 407, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(3, 407, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_indices = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "View.MemoryView":410
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 410, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "View.MemoryView":411
 *         cdef char *itemp
 *         if have_slices:
 *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
 *         else:
 *             itemp = self.get_item_pointer(indices)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":410
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
 */
  }

  /* "View.MemoryView":413
 *             return memview_slice(self, indices)
 *         else:
 *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
 *             return self.convert_item_to_object(itemp)
 * 
 */
  /*else*/ {
    __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(3, 413, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_6;

    /* "View.MemoryView":414
 *         else:
 *             itemp = self.get_item_pointer(indices)
 *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(memoryview self, object index, object value):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":403
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":416
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         if self.view.readonly:
 *             raise TypeError("Cannot assign to read-only memoryview")
 */

/* Python wrapper */
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_obj = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "View.MemoryView":417
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise TypeError("Cannot assign to read-only memoryview")
 * 
 */
  __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":418
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:
 *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(3, 418, __pyx_L1_error)

    /* "View.MemoryView":417
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise TypeError("Cannot assign to read-only memoryview")
 * 
 */
  }

  /* "View.MemoryView":420
 *             raise TypeError("Cannot assign to read-only memoryview")
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         if have_slices:
 */
  __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None)) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(3, 420, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(3, 420, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":422
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 422, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "View.MemoryView":423
 * 
 *         if have_slices:
 *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
 *             if obj:
 *                 self.setitem_slice_assignment(self[index], obj)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_obj = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "View.MemoryView":424
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 424, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "View.MemoryView":425
 *             obj = self.is_slice(value)
 *             if obj:
 *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":424
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "View.MemoryView":427
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
 *         else:
 *             self.setitem_indexed(index, value)
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(3, 427, __pyx_L1_error)
      __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L5:;

    /* "View.MemoryView":422
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj:
 */
    goto __pyx_L4;
  }

  /* "View.MemoryView":429
 *                 self.setitem_slice_assign_scalar(self[index], value)
 *         else:
 *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef is_slice(self, obj):
 */
  /*else*/ {
    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L4:;

  /* "View.MemoryView":416
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         if self.view.readonly:
 *             raise TypeError("Cannot assign to read-only memoryview")
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":431
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
 */

static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_slice", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "View.MemoryView":432
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":433
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "View.MemoryView":434
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
 */
        __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 434, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);

        /* "View.MemoryView":435
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 return None
 */
        __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 435, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "View.MemoryView":434
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
 */
        __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 434, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_obj);
        __Pyx_GIVEREF(__pyx_v_obj);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
        __pyx_t_6 = 0;
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 434, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "View.MemoryView":433
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "View.MemoryView":436
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
      __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(3, 436, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_6);

        /* "View.MemoryView":437
 *                                  self.dtype_is_object)
 *             except TypeError:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         return obj
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_except_return;
      }
      goto __pyx_L6_except_error;
      __pyx_L6_except_error:;

      /* "View.MemoryView":433
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L7_except_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L0;
      __pyx_L9_try_end:;
    }

    /* "View.MemoryView":432
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 */
  }

  /* "View.MemoryView":439
 *                 return None
 * 
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assignment(self, dst, src):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "View.MemoryView":431
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":441
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 */

static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
  __Pyx_memviewslice __pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_src_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  __Pyx_memviewslice *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);

  /* "View.MemoryView":445
 *         cdef __Pyx_memviewslice src_slice
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 */
  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(3, 445, __pyx_L1_error)
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(3, 445, __pyx_L1_error)

  /* "View.MemoryView":446
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
 *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 */
  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(3, 446, __pyx_L1_error)
  __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(3, 446, __pyx_L1_error)

  /* "View.MemoryView":447
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 447, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 447, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":445
 *         cdef __Pyx_memviewslice src_slice
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 */
  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(3, 445, __pyx_L1_error)

  /* "View.MemoryView":441
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":449
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
 */

static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
  int __pyx_v_array[0x80];
  void *__pyx_v_tmp;
  void *__pyx_v_item;
  __Pyx_memviewslice *__pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_tmp_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);

  /* "View.MemoryView":451
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 *         cdef int array[128]
 *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
 *         cdef void *item
 * 
 */
  __pyx_v_tmp = NULL;

  /* "View.MemoryView":456
 *         cdef __Pyx_memviewslice *dst_slice
 *         cdef __Pyx_memviewslice tmp_slice
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 */
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(3, 456, __pyx_L1_error)
  __pyx_v_dst_slice = __pyx_t_1;

  /* "View.MemoryView":458
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 */
  __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":459
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
 *             if tmp == NULL:
 *                 raise MemoryError
 */
    __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);

    /* "View.MemoryView":460
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
 */
    __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "View.MemoryView":461
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 *             item = tmp
 *         else:
 */
      PyErr_NoMemory(); __PYX_ERR(3, 461, __pyx_L1_error)

      /* "View.MemoryView":460
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
 */
    }

    /* "View.MemoryView":462
 *             if tmp == NULL:
 *                 raise MemoryError
 *             item = tmp             # <<<<<<<<<<<<<<
 *         else:
 *             item = <void *> array
 */
    __pyx_v_item = __pyx_v_tmp;

    /* "View.MemoryView":458
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":464
 *             item = tmp
 *         else:
 *             item = <void *> array             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  /*else*/ {
    __pyx_v_item = ((void *)__pyx_v_array);
  }
  __pyx_L3:;

  /* "View.MemoryView":466
 *             item = <void *> array
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value
 */
  /*try:*/ {

    /* "View.MemoryView":467
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 */
    __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":468
 *         try:
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)
 */
      (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);

      /* "View.MemoryView":467
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 */
      goto __pyx_L8;
    }

    /* "View.MemoryView":470
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 470, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L8:;

    /* "View.MemoryView":474
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 */
    __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":475
 * 
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 *                                 item, self.dtype_is_object)
 */
      __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 475, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "View.MemoryView":474
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 */
    }

    /* "View.MemoryView":476
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
 *                                 item, self.dtype_is_object)
 *         finally:
 */
    __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
  }

  /* "View.MemoryView":479
 *                                 item, self.dtype_is_object)
 *         finally:
 *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_indexed(self, index, value):
 */
  /*finally:*/ {
    /*normal exit:*/{
      PyMem_Free(__pyx_v_tmp);
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        PyMem_Free(__pyx_v_tmp);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "View.MemoryView":449
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":481
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
 */

static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_indexed", 0);

  /* "View.MemoryView":482
 * 
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
 *         self.assign_item_from_object(itemp, value)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(3, 482, __pyx_L1_error)
  __pyx_v_itemp = __pyx_t_1;

  /* "View.MemoryView":483
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":481
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":485
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_v_struct = NULL;
  PyObject *__pyx_v_bytesitem = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":488
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef bytes bytesitem
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":491
 *         cdef bytes bytesitem
 * 
 *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 */
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":492
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "View.MemoryView":493
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 493, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 493, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 493, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 493, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 493, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
        __Pyx_INCREF(__pyx_v_bytesitem);
        __Pyx_GIVEREF(__pyx_v_bytesitem);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 493, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "View.MemoryView":492
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
    }

    /* "View.MemoryView":497
 *             raise ValueError("Unable to convert item to object")
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
 */
    /*else:*/ {
      __pyx_t_10 = strlen(__pyx_v_self->view.format); 
      __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
      if (__pyx_t_11) {

        /* "View.MemoryView":498
 *         else:
 *             if len(self.view.format) == 1:
 *                 return result[0]             # <<<<<<<<<<<<<<
 *             return result
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 498, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L6_except_return;

        /* "View.MemoryView":497
 *             raise ValueError("Unable to convert item to object")
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
 */
      }

      /* "View.MemoryView":499
 *             if len(self.view.format) == 1:
 *                 return result[0]
 *             return result             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "View.MemoryView":494
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:             # <<<<<<<<<<<<<<
 *             raise ValueError("Unable to convert item to object")
 *         else:
 */
    __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 494, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
    __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(3, 494, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_1);

      /* "View.MemoryView":495
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 495, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(3, 495, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "View.MemoryView":492
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "View.MemoryView":485
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesitem);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":501
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_struct = NULL;
  char __pyx_v_c;
  PyObject *__pyx_v_bytesvalue = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  char *__pyx_t_11;
  char *__pyx_t_12;
  char *__pyx_t_13;
  char *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":504
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef char c
 *         cdef bytes bytesvalue
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":509
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "View.MemoryView":510
 * 
 *         if isinstance(value, tuple):
 *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(3, 510, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":509
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":512
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
 * 
 *         for i, c in enumerate(bytesvalue):
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 512, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 512, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
      __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(3, 512, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":514
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
 */
  __pyx_t_9 = 0;
  if (unlikely(__pyx_v_bytesvalue == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(3, 514, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_v_bytesvalue);
  __pyx_t_10 = __pyx_v_bytesvalue;
  __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
  __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
  for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
    __pyx_t_11 = __pyx_t_14;
    __pyx_v_c = (__pyx_t_11[0]);

    /* "View.MemoryView":515
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
    __pyx_v_i = __pyx_t_9;

    /* "View.MemoryView":514
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
 */
    __pyx_t_9 = (__pyx_t_9 + 1);

    /* "View.MemoryView":515
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
    (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "View.MemoryView":501
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":518
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t *__pyx_t_4;
  char *__pyx_t_5;
  void *__pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (__pyx_v_info == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "View.MemoryView":519
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 */
  __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":520
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_ND:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 520, __pyx_L1_error)

    /* "View.MemoryView":519
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 */
  }

  /* "View.MemoryView":522
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":523
 * 
 *         if flags & PyBUF_ND:
 *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
 *         else:
 *             info.shape = NULL
 */
    __pyx_t_4 = __pyx_v_self->view.shape;
    __pyx_v_info->shape = __pyx_t_4;

    /* "View.MemoryView":522
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
 */
    goto __pyx_L6;
  }

  /* "View.MemoryView":525
 *             info.shape = self.view.shape
 *         else:
 *             info.shape = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_STRIDES:
 */
  /*else*/ {
    __pyx_v_info->shape = NULL;
  }
  __pyx_L6:;

  /* "View.MemoryView":527
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":528
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.strides = NULL
 */
    __pyx_t_4 = __pyx_v_self->view.strides;
    __pyx_v_info->strides = __pyx_t_4;

    /* "View.MemoryView":527
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
 */
    goto __pyx_L7;
  }

  /* "View.MemoryView":530
 *             info.strides = self.view.strides
 *         else:
 *             info.strides = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_INDIRECT:
 */
  /*else*/ {
    __pyx_v_info->strides = NULL;
  }
  __pyx_L7:;

  /* "View.MemoryView":532
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":533
 * 
 *         if flags & PyBUF_INDIRECT:
 *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
 *         else:
 *             info.suboffsets = NULL
 */
    __pyx_t_4 = __pyx_v_self->view.suboffsets;
    __pyx_v_info->suboffsets = __pyx_t_4;

    /* "View.MemoryView":532
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
 */
    goto __pyx_L8;
  }

  /* "View.MemoryView":535
 *             info.suboffsets = self.view.suboffsets
 *         else:
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
  /*else*/ {
    __pyx_v_info->suboffsets = NULL;
  }
  __pyx_L8:;

  /* "View.MemoryView":537
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":538
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.view.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
 */
    __pyx_t_5 = __pyx_v_self->view.format;
    __pyx_v_info->format = __pyx_t_5;

    /* "View.MemoryView":537
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
 */
    goto __pyx_L9;
  }

  /* "View.MemoryView":540
 *             info.format = self.view.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.buf = self.view.buf
 */
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L9:;

  /* "View.MemoryView":542
 *             info.format = NULL
 * 
 *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 */
  __pyx_t_6 = __pyx_v_self->view.buf;
  __pyx_v_info->buf = __pyx_t_6;

  /* "View.MemoryView":543
 * 
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 */
  __pyx_t_7 = __pyx_v_self->view.ndim;
  __pyx_v_info->ndim = __pyx_t_7;

  /* "View.MemoryView":544
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly
 */
  __pyx_t_8 = __pyx_v_self->view.itemsize;
  __pyx_v_info->itemsize = __pyx_t_8;

  /* "View.MemoryView":545
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len             # <<<<<<<<<<<<<<
 *         info.readonly = self.view.readonly
 *         info.obj = self
 */
  __pyx_t_8 = __pyx_v_self->view.len;
  __pyx_v_info->len = __pyx_t_8;

  /* "View.MemoryView":546
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
 *         info.obj = self
 * 
 */
  __pyx_t_1 = __pyx_v_self->view.readonly;
  __pyx_v_info->readonly = __pyx_t_1;

  /* "View.MemoryView":547
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":518
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":553
 * 
 *     @property
 *     def T(self):             # <<<<<<<<<<<<<<
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":554
 *     @property
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&result.from_slice)
 *         return result
 */
  __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(3, 554, __pyx_L1_error)
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":555
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(3, 555, __pyx_L1_error)

  /* "View.MemoryView":556
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":553
 * 
 *     @property
 *     def T(self):             # <<<<<<<<<<<<<<
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":559
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":560
 *     @property
 *     def base(self):
 *         return self.obj             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->obj);
  __pyx_r = __pyx_v_self->obj;
  goto __pyx_L0;

  /* "View.MemoryView":559
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":563
 * 
 *     @property
 *     def shape(self):             # <<<<<<<<<<<<<<
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":564
 *     @property
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_length = (__pyx_t_2[0]);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(3, 564, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":563
 * 
 *     @property
 *     def shape(self):             # <<<<<<<<<<<<<<
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":567
 * 
 *     @property
 *     def strides(self):             # <<<<<<<<<<<<<<
 *         if self.view.strides == NULL:
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_stride;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":568
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError("Buffer view does not expose strides")
 */
  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":570
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(3, 570, __pyx_L1_error)

    /* "View.MemoryView":568
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError("Buffer view does not expose strides")
 */
  }

  /* "View.MemoryView":572
 *             raise ValueError("Buffer view does not expose strides")
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
  for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
    __pyx_t_3 = __pyx_t_5;
    __pyx_v_stride = (__pyx_t_3[0]);
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(3, 572, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":567
 * 
 *     @property
 *     def strides(self):             # <<<<<<<<<<<<<<
 *         if self.view.strides == NULL:
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":575
 * 
 *     @property
 *     def suboffsets(self):             # <<<<<<<<<<<<<<
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":576
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":577
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__43, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":576
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
 */
  }

  /* "View.MemoryView":579
 *             return (-1,) * self.view.ndim
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
  for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
    __pyx_t_4 = __pyx_t_6;
    __pyx_v_suboffset = (__pyx_t_4[0]);
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(3, 579, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":575
 * 
 *     @property
 *     def suboffsets(self):             # <<<<<<<<<<<<<<
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":582
 * 
 *     @property
 *     def ndim(self):             # <<<<<<<<<<<<<<
 *         return self.view.ndim
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":583
 *     @property
 *     def ndim(self):
 *         return self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":582
 * 
 *     @property
 *     def ndim(self):             # <<<<<<<<<<<<<<
 *         return self.view.ndim
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":586
 * 
 *     @property
 *     def itemsize(self):             # <<<<<<<<<<<<<<
 *         return self.view.itemsize
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":587
 *     @property
 *     def itemsize(self):
 *         return self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":586
 * 
 *     @property
 *     def itemsize(self):             # <<<<<<<<<<<<<<
 *         return self.view.itemsize
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":590
 * 
 *     @property
 *     def nbytes(self):             # <<<<<<<<<<<<<<
 *         return self.size * self.view.itemsize
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":591
 *     @property
 *     def nbytes(self):
 *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":590
 * 
 *     @property
 *     def nbytes(self):             # <<<<<<<<<<<<<<
 *         return self.size * self.view.itemsize
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":594
 * 
 *     @property
 *     def size(self):             # <<<<<<<<<<<<<<
 *         if self._size is None:
 *             result = 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":595
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_size == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":596
 *     def size(self):
 *         if self._size is None:
 *             result = 1             # <<<<<<<<<<<<<<
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 */
    __Pyx_INCREF(__pyx_int_1);
    __pyx_v_result = __pyx_int_1;

    /* "View.MemoryView":598
 *             result = 1
 * 
 *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
 *                 result *= length
 * 
 */
    __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
    for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "View.MemoryView":599
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 *                 result *= length             # <<<<<<<<<<<<<<
 * 
 *             self._size = result
 */
      __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 599, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
      __pyx_t_6 = 0;
    }

    /* "View.MemoryView":601
 *                 result *= length
 * 
 *             self._size = result             # <<<<<<<<<<<<<<
 * 
 *         return self._size
 */
    __Pyx_INCREF(__pyx_v_result);
    __Pyx_GIVEREF(__pyx_v_result);
    __Pyx_GOTREF(__pyx_v_self->_size);
    __Pyx_DECREF(__pyx_v_self->_size);
    __pyx_v_self->_size = __pyx_v_result;

    /* "View.MemoryView":595
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
 */
  }

  /* "View.MemoryView":603
 *             self._size = result
 * 
 *         return self._size             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_size);
  __pyx_r = __pyx_v_self->_size;
  goto __pyx_L0;

  /* "View.MemoryView":594
 * 
 *     @property
 *     def size(self):             # <<<<<<<<<<<<<<
 *         if self._size is None:
 *             result = 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":605
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
 */

/* Python wrapper */
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "View.MemoryView":606
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":607
 *     def __len__(self):
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_r = (__pyx_v_self->view.shape[0]);
    goto __pyx_L0;

    /* "View.MemoryView":606
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
 */
  }

  /* "View.MemoryView":609
 *             return self.view.shape[0]
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":605
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":611
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":612
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":613
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "View.MemoryView":612
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":611
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":615
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "View.MemoryView":616
 * 
 *     def __str__(self):
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":615
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":619
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_c_contig", 0);

  /* "View.MemoryView":622
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 */
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(3, 622, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":623
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def is_f_contig(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":619
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":625
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_f_contig", 0);

  /* "View.MemoryView":628
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 */
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(3, 628, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":629
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":625
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":631
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_mslice;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "View.MemoryView":633
 *     def copy(self):
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &mslice)
 */
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));

  /* "View.MemoryView":635
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 * 
 *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
 *                                    self.view.itemsize,
 */
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));

  /* "View.MemoryView":636
 * 
 *         slice_copy(self, &mslice)
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                    self.view.itemsize,
 *                                    flags|PyBUF_C_CONTIGUOUS,
 */
  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 636, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":641
 *                                    self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
 * 
 *     def copy_fortran(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":631
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":643
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_fortran", 0);

  /* "View.MemoryView":645
 *     def copy_fortran(self):
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &src)
 */
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));

  /* "View.MemoryView":647
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 * 
 *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
 *                                 self.view.itemsize,
 */
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));

  /* "View.MemoryView":648
 * 
 *         slice_copy(self, &src)
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                 self.view.itemsize,
 *                                 flags|PyBUF_F_CONTIGUOUS,
 */
  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 648, __pyx_L1_error)
  __pyx_v_dst = __pyx_t_1;

  /* "View.MemoryView":653
 *                                 self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":643
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(3, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(3, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":657
 * 
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 */

static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
  struct __pyx_memoryview_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);

  /* "View.MemoryView":658
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
 *     result.typeinfo = typeinfo
 *     return result
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_o);
  __Pyx_GIVEREF(__pyx_v_o);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":659
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_v_result->typeinfo = __pyx_v_typeinfo;

  /* "View.MemoryView":660
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_check')
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":657
 * 
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":663
 * 
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
 *     return isinstance(o, memoryview)
 * 
 */

static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("memoryview_check", 0);

  /* "View.MemoryView":664
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):
 *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _unellipsify(object index, int ndim):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); 
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "View.MemoryView":663
 * 
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
 *     return isinstance(o, memoryview)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":666
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
 */

static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  PyObject *__pyx_v_tup = NULL;
  PyObject *__pyx_v_result = NULL;
  int __pyx_v_have_slices;
  int __pyx_v_seen_ellipsis;
  CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
  PyObject *__pyx_v_item = NULL;
  Py_ssize_t __pyx_v_nslices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unellipsify", 0);

  /* "View.MemoryView":671
 *     full slices.
 *     """
 *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *         tup = (index,)
 *     else:
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":672
 *     """
 *     if not isinstance(index, tuple):
 *         tup = (index,)             # <<<<<<<<<<<<<<
 *     else:
 *         tup = index
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_index);
    __Pyx_GIVEREF(__pyx_v_index);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
    __pyx_v_tup = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "View.MemoryView":671
 *     full slices.
 *     """
 *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *         tup = (index,)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":674
 *         tup = (index,)
 *     else:
 *         tup = index             # <<<<<<<<<<<<<<
 * 
 *     result = []
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_index);
    __pyx_v_tup = __pyx_v_index;
  }
  __pyx_L3:;

  /* "View.MemoryView":676
 *         tup = index
 * 
 *     result = []             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_result = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":677
 * 
 *     result = []
 *     have_slices = False             # <<<<<<<<<<<<<<
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 */
  __pyx_v_have_slices = 0;

  /* "View.MemoryView":678
 *     result = []
 *     have_slices = False
 *     seen_ellipsis = False             # <<<<<<<<<<<<<<
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 */
  __pyx_v_seen_ellipsis = 0;

  /* "View.MemoryView":679
 *     have_slices = False
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_3 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
    __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 679, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(3, 679, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 679, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(3, 679, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 679, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      }
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(3, 679, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
    __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "View.MemoryView":680
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 */
    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":681
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True
 */
      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
      if (__pyx_t_1) {

        /* "View.MemoryView":682
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             else:
 */
        __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(3, 682, __pyx_L1_error)
        __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 682, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        { Py_ssize_t __pyx_temp;
          for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
            __Pyx_INCREF(__pyx_slice__46);
            __Pyx_GIVEREF(__pyx_slice__46);
            PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__46);
          }
        }
        __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 682, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "View.MemoryView":683
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
 *             else:
 *                 result.append(slice(None))
 */
        __pyx_v_seen_ellipsis = 1;

        /* "View.MemoryView":681
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True
 */
        goto __pyx_L7;
      }

      /* "View.MemoryView":685
 *                 seen_ellipsis = True
 *             else:
 *                 result.append(slice(None))             # <<<<<<<<<<<<<<
 *             have_slices = True
 *         else:
 */
      /*else*/ {
        __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__46); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 685, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":686
 *             else:
 *                 result.append(slice(None))
 *             have_slices = True             # <<<<<<<<<<<<<<
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):
 */
      __pyx_v_have_slices = 1;

      /* "View.MemoryView":680
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":688
 *             have_slices = True
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 */
    /*else*/ {
      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
      __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
      if (__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
      __pyx_t_1 = __pyx_t_10;
      __pyx_L9_bool_binop_done:;
      if (unlikely(__pyx_t_1)) {

        /* "View.MemoryView":689
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):
 *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
 * 
 *             have_slices = have_slices or isinstance(item, slice)
 */
        __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 689, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 689, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_Raise(__pyx_t_11, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __PYX_ERR(3, 689, __pyx_L1_error)

        /* "View.MemoryView":688
 *             have_slices = True
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 */
      }

      /* "View.MemoryView":691
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
 *             result.append(item)
 * 
 */
      __pyx_t_10 = (__pyx_v_have_slices != 0);
      if (!__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_10 = PySlice_Check(__pyx_v_item); 
      __pyx_t_2 = (__pyx_t_10 != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L11_bool_binop_done:;
      __pyx_v_have_slices = __pyx_t_1;

      /* "View.MemoryView":692
 * 
 *             have_slices = have_slices or isinstance(item, slice)
 *             result.append(item)             # <<<<<<<<<<<<<<
 * 
 *     nslices = ndim - len(result)
 */
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 692, __pyx_L1_error)
    }
    __pyx_L6:;

    /* "View.MemoryView":679
 *     have_slices = False
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":694
 *             result.append(item)
 * 
 *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
 *     if nslices:
 *         result.extend([slice(None)] * nslices)
 */
  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(3, 694, __pyx_L1_error)
  __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);

  /* "View.MemoryView":695
 * 
 *     nslices = ndim - len(result)
 *     if nslices:             # <<<<<<<<<<<<<<
 *         result.extend([slice(None)] * nslices)
 * 
 */
  __pyx_t_1 = (__pyx_v_nslices != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":696
 *     nslices = ndim - len(result)
 *     if nslices:
 *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
 * 
 *     return have_slices or nslices, tuple(result)
 */
    __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    { Py_ssize_t __pyx_temp;
      for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
        __Pyx_INCREF(__pyx_slice__46);
        __Pyx_GIVEREF(__pyx_slice__46);
        PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__46);
      }
    }
    __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 696, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "View.MemoryView":695
 * 
 *     nslices = ndim - len(result)
 *     if nslices:             # <<<<<<<<<<<<<<
 *         result.extend([slice(None)] * nslices)
 * 
 */
  }

  /* "View.MemoryView":698
 *         result.extend([slice(None)] * nslices)
 * 
 *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 */
  __Pyx_XDECREF(__pyx_r);
  if (!__pyx_v_have_slices) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L14_bool_binop_done:;
  __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":666
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tup);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":700
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 */

static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);

  /* "View.MemoryView":701
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")
 */
  __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
  for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
    __pyx_t_1 = __pyx_t_3;
    __pyx_v_suboffset = (__pyx_t_1[0]);

    /* "View.MemoryView":702
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Indirect dimensions not supported")
 * 
 */
    __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":703
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 703, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(3, 703, __pyx_L1_error)

      /* "View.MemoryView":702
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Indirect dimensions not supported")
 * 
 */
    }
  }

  /* "View.MemoryView":700
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":710
 * 
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
 *     cdef bint negative_step
 */

static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
  int __pyx_v_new_ndim;
  int __pyx_v_suboffset_dim;
  int __pyx_v_dim;
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  __Pyx_memviewslice *__pyx_v_p_src;
  struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
  __Pyx_memviewslice *__pyx_v_p_dst;
  int *__pyx_v_p_suboffset_dim;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  Py_ssize_t __pyx_v_step;
  int __pyx_v_have_start;
  int __pyx_v_have_stop;
  int __pyx_v_have_step;
  PyObject *__pyx_v_index = NULL;
  struct __pyx_memoryview_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_memoryview_obj *__pyx_t_4;
  char *__pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memview_slice", 0);

  /* "View.MemoryView":711
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
 *     cdef bint negative_step
 *     cdef __Pyx_memviewslice src, dst
 */
  __pyx_v_new_ndim = 0;
  __pyx_v_suboffset_dim = -1;

  /* "View.MemoryView":718
 * 
 * 
 *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
 * 
 *     cdef _memoryviewslice memviewsliceobj
 */
  (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));

  /* "View.MemoryView":722
 *     cdef _memoryviewslice memviewsliceobj
 * 
 *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(3, 722, __pyx_L1_error)
    }
  }
  #endif

  /* "View.MemoryView":724
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":725
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 */
    if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(3, 725, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":726
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, &src)
 */
    __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);

    /* "View.MemoryView":724
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":728
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
 *         p_src = &src
 * 
 */
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));

    /* "View.MemoryView":729
 *     else:
 *         slice_copy(memview, &src)
 *         p_src = &src             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_p_src = (&__pyx_v_src);
  }
  __pyx_L3:;

  /* "View.MemoryView":735
 * 
 * 
 *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
 *     dst.data = p_src.data
 * 
 */
  __pyx_t_4 = __pyx_v_p_src->memview;
  __pyx_v_dst.memview = __pyx_t_4;

  /* "View.MemoryView":736
 * 
 *     dst.memview = p_src.memview
 *     dst.data = p_src.data             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __pyx_v_p_src->data;
  __pyx_v_dst.data = __pyx_t_5;

  /* "View.MemoryView":741
 * 
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
 *     cdef int *p_suboffset_dim = &suboffset_dim
 *     cdef Py_ssize_t start, stop, step
 */
  __pyx_v_p_dst = (&__pyx_v_dst);

  /* "View.MemoryView":742
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst
 *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t start, stop, step
 *     cdef bint have_start, have_stop, have_step
 */
  __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);

  /* "View.MemoryView":746
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             slice_memviewslice(
 */
  __pyx_t_6 = 0;
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 746, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(3, 746, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 746, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(3, 746, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 746, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      }
    } else {
      __pyx_t_9 = __pyx_t_8(__pyx_t_3);
      if (unlikely(!__pyx_t_9)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(3, 746, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_9);
    }
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_v_dim = __pyx_t_6;
    __pyx_t_6 = (__pyx_t_6 + 1);

    /* "View.MemoryView":747
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 */
    __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":751
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 */
      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 751, __pyx_L1_error)

      /* "View.MemoryView":748
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 */
      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(3, 748, __pyx_L1_error)

      /* "View.MemoryView":747
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":754
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 */
    __pyx_t_2 = (__pyx_v_index == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":755
 *                 False)
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 */
      (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;

      /* "View.MemoryView":756
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1
 */
      (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;

      /* "View.MemoryView":757
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
 *             new_ndim += 1
 *         else:
 */
      (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;

      /* "View.MemoryView":758
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 *         else:
 *             start = index.start or 0
 */
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);

      /* "View.MemoryView":754
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":760
 *             new_ndim += 1
 *         else:
 *             start = index.start or 0             # <<<<<<<<<<<<<<
 *             stop = index.stop or 0
 *             step = index.step or 0
 */
    /*else*/ {
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 760, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 760, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 760, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L7_bool_binop_done:;
      __pyx_v_start = __pyx_t_10;

      /* "View.MemoryView":761
 *         else:
 *             start = index.start or 0
 *             stop = index.stop or 0             # <<<<<<<<<<<<<<
 *             step = index.step or 0
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 761, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 761, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 761, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L9_bool_binop_done:;
      __pyx_v_stop = __pyx_t_10;

      /* "View.MemoryView":762
 *             start = index.start or 0
 *             stop = index.stop or 0
 *             step = index.step or 0             # <<<<<<<<<<<<<<
 * 
 *             have_start = index.start is not None
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 762, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 762, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L11_bool_binop_done:;
      __pyx_v_step = __pyx_t_10;

      /* "View.MemoryView":764
 *             step = index.step or 0
 * 
 *             have_start = index.start is not None             # <<<<<<<<<<<<<<
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_start = __pyx_t_1;

      /* "View.MemoryView":765
 * 
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
 *             have_step = index.step is not None
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 765, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_stop = __pyx_t_1;

      /* "View.MemoryView":766
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None             # <<<<<<<<<<<<<<
 * 
 *             slice_memviewslice(
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_step = __pyx_t_1;

      /* "View.MemoryView":768
 *             have_step = index.step is not None
 * 
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 */
      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(3, 768, __pyx_L1_error)

      /* "View.MemoryView":774
 *                 have_start, have_stop, have_step,
 *                 True)
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
 */
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
    }
    __pyx_L6:;

    /* "View.MemoryView":746
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             slice_memviewslice(
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":776
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":777
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "View.MemoryView":778
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_dtype_func,
 *                                     memview.dtype_is_object)
 */
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(3, 778, __pyx_L1_error) }

    /* "View.MemoryView":779
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 *     else:
 */
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(3, 779, __pyx_L1_error) }

    /* "View.MemoryView":777
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
 */
    __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(3, 777, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":776
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 */
  }

  /* "View.MemoryView":782
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "View.MemoryView":783
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
 *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 782, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "View.MemoryView":782
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
 */
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(3, 782, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":710
 * 
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
 *     cdef bint negative_step
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":807
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')
 * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
 *         __Pyx_memviewslice *dst,
 *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
 */

static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
  Py_ssize_t __pyx_v_new_shape;
  int __pyx_v_negative_step;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":827
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
 */
  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":829
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
 */
    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":830
 * 
 *         if start < 0:
 *             start += shape             # <<<<<<<<<<<<<<
 *         if not 0 <= start < shape:
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 */
      __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

      /* "View.MemoryView":829
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
 */
    }

    /* "View.MemoryView":831
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
 */
    __pyx_t_1 = (0 <= __pyx_v_start);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
    }
    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":832
 *             start += shape
 *         if not 0 <= start < shape:
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
 *     else:
 * 
 */
      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(3, 832, __pyx_L1_error)

      /* "View.MemoryView":831
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
 */
    }

    /* "View.MemoryView":827
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":835
 *     else:
 * 
 *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
 * 
 *         if have_step and step == 0:
 */
  /*else*/ {
    __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_step < 0) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L6_bool_binop_done:;
    __pyx_v_negative_step = __pyx_t_2;

    /* "View.MemoryView":837
 *         negative_step = have_step != 0 and step < 0
 * 
 *         if have_step and step == 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
 * 
 */
    __pyx_t_1 = (__pyx_v_have_step != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_step == 0) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_2) {

      /* "View.MemoryView":838
 * 
 *         if have_step and step == 0:
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(3, 838, __pyx_L1_error)

      /* "View.MemoryView":837
 *         negative_step = have_step != 0 and step < 0
 * 
 *         if have_step and step == 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
 * 
 */
    }

    /* "View.MemoryView":841
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
 */
    __pyx_t_2 = (__pyx_v_have_start != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":842
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
 */
      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":843
 *         if have_start:
 *             if start < 0:
 *                 start += shape             # <<<<<<<<<<<<<<
 *                 if start < 0:
 *                     start = 0
 */
        __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

        /* "View.MemoryView":844
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
 */
        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":845
 *                 start += shape
 *                 if start < 0:
 *                     start = 0             # <<<<<<<<<<<<<<
 *             elif start >= shape:
 *                 if negative_step:
 */
          __pyx_v_start = 0;

          /* "View.MemoryView":844
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
 */
        }

        /* "View.MemoryView":842
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
 */
        goto __pyx_L12;
      }

      /* "View.MemoryView":846
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
 */
      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":847
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
 */
        __pyx_t_2 = (__pyx_v_negative_step != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":848
 *             elif start >= shape:
 *                 if negative_step:
 *                     start = shape - 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     start = shape
 */
          __pyx_v_start = (__pyx_v_shape - 1);

          /* "View.MemoryView":847
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
 */
          goto __pyx_L14;
        }

        /* "View.MemoryView":850
 *                     start = shape - 1
 *                 else:
 *                     start = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
 */
        /*else*/ {
          __pyx_v_start = __pyx_v_shape;
        }
        __pyx_L14:;

        /* "View.MemoryView":846
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
 */
      }
      __pyx_L12:;

      /* "View.MemoryView":841
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
 */
      goto __pyx_L11;
    }

    /* "View.MemoryView":852
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_negative_step != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":853
 *         else:
 *             if negative_step:
 *                 start = shape - 1             # <<<<<<<<<<<<<<
 *             else:
 *                 start = 0
 */
        __pyx_v_start = (__pyx_v_shape - 1);

        /* "View.MemoryView":852
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
 */
        goto __pyx_L15;
      }

      /* "View.MemoryView":855
 *                 start = shape - 1
 *             else:
 *                 start = 0             # <<<<<<<<<<<<<<
 * 
 *         if have_stop:
 */
      /*else*/ {
        __pyx_v_start = 0;
      }
      __pyx_L15:;
    }
    __pyx_L11:;

    /* "View.MemoryView":857
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
 */
    __pyx_t_2 = (__pyx_v_have_stop != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":858
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
 */
      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":859
 *         if have_stop:
 *             if stop < 0:
 *                 stop += shape             # <<<<<<<<<<<<<<
 *                 if stop < 0:
 *                     stop = 0
 */
        __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);

        /* "View.MemoryView":860
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
 */
        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":861
 *                 stop += shape
 *                 if stop < 0:
 *                     stop = 0             # <<<<<<<<<<<<<<
 *             elif stop > shape:
 *                 stop = shape
 */
          __pyx_v_stop = 0;

          /* "View.MemoryView":860
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
 */
        }

        /* "View.MemoryView":858
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
 */
        goto __pyx_L17;
      }

      /* "View.MemoryView":862
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
 */
      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":863
 *                     stop = 0
 *             elif stop > shape:
 *                 stop = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
 */
        __pyx_v_stop = __pyx_v_shape;

        /* "View.MemoryView":862
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
 */
      }
      __pyx_L17:;

      /* "View.MemoryView":857
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
 */
      goto __pyx_L16;
    }

    /* "View.MemoryView":865
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_negative_step != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":866
 *         else:
 *             if negative_step:
 *                 stop = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 stop = shape
 */
        __pyx_v_stop = -1L;

        /* "View.MemoryView":865
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
 */
        goto __pyx_L19;
      }

      /* "View.MemoryView":868
 *                 stop = -1
 *             else:
 *                 stop = shape             # <<<<<<<<<<<<<<
 * 
 *         if not have_step:
 */
      /*else*/ {
        __pyx_v_stop = __pyx_v_shape;
      }
      __pyx_L19:;
    }
    __pyx_L16:;

    /* "View.MemoryView":870
 *                 stop = shape
 * 
 *         if not have_step:             # <<<<<<<<<<<<<<
 *             step = 1
 * 
 */
    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":871
 * 
 *         if not have_step:
 *             step = 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_step = 1;

      /* "View.MemoryView":870
 *                 stop = shape
 * 
 *         if not have_step:             # <<<<<<<<<<<<<<
 *             step = 1
 * 
 */
    }

    /* "View.MemoryView":875
 * 
 *         with cython.cdivision(True):
 *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
 * 
 *             if (stop - start) - step * new_shape:
 */
    __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);

    /* "View.MemoryView":877
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
 */
    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":878
 * 
 *             if (stop - start) - step * new_shape:
 *                 new_shape += 1             # <<<<<<<<<<<<<<
 * 
 *         if new_shape < 0:
 */
      __pyx_v_new_shape = (__pyx_v_new_shape + 1);

      /* "View.MemoryView":877
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
 */
    }

    /* "View.MemoryView":880
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
 */
    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":881
 * 
 *         if new_shape < 0:
 *             new_shape = 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_new_shape = 0;

      /* "View.MemoryView":880
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
 */
    }

    /* "View.MemoryView":884
 * 
 * 
 *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset
 */
    (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);

    /* "View.MemoryView":885
 * 
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
 *         dst.suboffsets[new_ndim] = suboffset
 * 
 */
    (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;

    /* "View.MemoryView":886
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
  }
  __pyx_L3:;

  /* "View.MemoryView":889
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
 */
  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":890
 * 
 *     if suboffset_dim[0] < 0:
 *         dst.data += start * stride             # <<<<<<<<<<<<<<
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 */
    __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));

    /* "View.MemoryView":889
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
 */
    goto __pyx_L23;
  }

  /* "View.MemoryView":892
 *         dst.data += start * stride
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
 * 
 *     if suboffset >= 0:
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
    (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
  }
  __pyx_L23:;

  /* "View.MemoryView":894
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
 */
  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":895
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 */
    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":896
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 */
      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":897
 *         if not is_slice:
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
 */
        __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);

        /* "View.MemoryView":896
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 */
        goto __pyx_L26;
      }

      /* "View.MemoryView":899
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
 *                                      "must be indexed and not sliced", dim)
 *         else:
 */
      /*else*/ {

        /* "View.MemoryView":900
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
 *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
 *         else:
 *             suboffset_dim[0] = new_ndim
 */
        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(3, 899, __pyx_L1_error)
      }
      __pyx_L26:;

      /* "View.MemoryView":895
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 */
      goto __pyx_L25;
    }

    /* "View.MemoryView":902
 *                                      "must be indexed and not sliced", dim)
 *         else:
 *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
    /*else*/ {
      (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
    }
    __pyx_L25:;

    /* "View.MemoryView":894
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
 */
  }

  /* "View.MemoryView":904
 *             suboffset_dim[0] = new_ndim
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":807
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')
 * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
 *         __Pyx_memviewslice *dst,
 *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":910
 * 
 * @cname('__pyx_pybuffer_index')
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 */

static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_suboffset;
  Py_ssize_t __pyx_v_itemsize;
  char *__pyx_v_resultp;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pybuffer_index", 0);

  /* "View.MemoryView":912
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t itemsize = view.itemsize
 *     cdef char *resultp
 */
  __pyx_v_suboffset = -1L;

  /* "View.MemoryView":913
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
 *     cdef char *resultp
 * 
 */
  __pyx_t_1 = __pyx_v_view->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":916
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len / itemsize
 *         stride = itemsize
 */
  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":917
 * 
 *     if view.ndim == 0:
 *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
 *         stride = itemsize
 *     else:
 */
    if (unlikely(__pyx_v_itemsize == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(3, 917, __pyx_L1_error)
    }
    else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(3, 917, __pyx_L1_error)
    }
    __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);

    /* "View.MemoryView":918
 *     if view.ndim == 0:
 *         shape = view.len / itemsize
 *         stride = itemsize             # <<<<<<<<<<<<<<
 *     else:
 *         shape = view.shape[dim]
 */
    __pyx_v_stride = __pyx_v_itemsize;

    /* "View.MemoryView":916
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len / itemsize
 *         stride = itemsize
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":920
 *         stride = itemsize
 *     else:
 *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 */
  /*else*/ {
    __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);

    /* "View.MemoryView":921
 *     else:
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]
 */
    __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);

    /* "View.MemoryView":922
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
 */
    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":923
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
 * 
 *     if index < 0:
 */
      __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);

      /* "View.MemoryView":922
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
 */
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":925
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
 */
  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":926
 * 
 *     if index < 0:
 *         index += view.shape[dim]             # <<<<<<<<<<<<<<
 *         if index < 0:
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 */
    __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));

    /* "View.MemoryView":927
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "View.MemoryView":928
 *         index += view.shape[dim]
 *         if index < 0:
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
 * 
 *     if index >= shape:
 */
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 928, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 928, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 928, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(3, 928, __pyx_L1_error)

      /* "View.MemoryView":927
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
    }

    /* "View.MemoryView":925
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
 */
  }

  /* "View.MemoryView":930
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":931
 * 
 *     if index >= shape:
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
 * 
 *     resultp = bufp + index * stride
 */
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 931, __pyx_L1_error)

    /* "View.MemoryView":930
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
  }

  /* "View.MemoryView":933
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset
 */
  __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));

  /* "View.MemoryView":934
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 */
  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":935
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
 * 
 *     return resultp
 */
    __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);

    /* "View.MemoryView":934
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 */
  }

  /* "View.MemoryView":937
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 *     return resultp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_resultp;
  goto __pyx_L0;

  /* "View.MemoryView":910
 * 
 * @cname('__pyx_pybuffer_index')
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":943
 * 
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 */

static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  int __pyx_v_ndim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  long __pyx_t_3;
  long __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":944
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
 *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 */
  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
  __pyx_v_ndim = __pyx_t_1;

  /* "View.MemoryView":946
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t *strides = memslice.strides
 * 
 */
  __pyx_t_2 = __pyx_v_memslice->shape;
  __pyx_v_shape = __pyx_t_2;

  /* "View.MemoryView":947
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_v_memslice->strides;
  __pyx_v_strides = __pyx_t_2;

  /* "View.MemoryView":951
 * 
 *     cdef int i, j
 *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 */
  __pyx_t_3 = (__pyx_v_ndim / 2);
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":952
 *     cdef int i, j
 *     for i in range(ndim / 2):
 *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]
 */
    __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);

    /* "View.MemoryView":953
 *     for i in range(ndim / 2):
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 */
    __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
    __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;

    /* "View.MemoryView":954
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 */
    __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
    __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;

    /* "View.MemoryView":956
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 */
    __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_7) {

      /* "View.MemoryView":957
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
 * 
 *     return 1
 */
      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 957, __pyx_L1_error)

      /* "View.MemoryView":956
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 */
    }
  }

  /* "View.MemoryView":959
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "View.MemoryView":943
 * 
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":976
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 */

/* Python wrapper */
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":977
 * 
 *     def __dealloc__(self):
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 */
  __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);

  /* "View.MemoryView":976
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":979
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
 */

static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":980
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":981
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":980
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
 */
  }

  /* "View.MemoryView":983
 *             return self.to_object_func(itemp)
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 983, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":979
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":985
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
 */

static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":986
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":987
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)
 */
    __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(3, 987, __pyx_L1_error)

    /* "View.MemoryView":986
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":989
 *             self.to_dtype_func(itemp, value)
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  /*else*/ {
    __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":985
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":992
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":993
 *     @property
 *     def base(self):
 *         return self.from_object             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->from_object);
  __pyx_r = __pyx_v_self->from_object;
  goto __pyx_L0;

  /* "View.MemoryView":992
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(3, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(3, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":999
 * 
 * @cname('__pyx_memoryview_fromslice')
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
 *                           int ndim,
 *                           object (*to_object_func)(char *),
 */

static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_TypeInfo *__pyx_t_4;
  Py_buffer __pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  Py_ssize_t *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);

  /* "View.MemoryView":1007
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1008
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "View.MemoryView":1007
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "View.MemoryView":1013
 * 
 * 
 *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     result.from_slice = memviewslice
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":1015
 *     result = _memoryviewslice(None, 0, dtype_is_object)
 * 
 *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 */
  __pyx_v_result->from_slice = __pyx_v_memviewslice;

  /* "View.MemoryView":1016
 * 
 *     result.from_slice = memviewslice
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base
 */
  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);

  /* "View.MemoryView":1018
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_result->from_object);
  __Pyx_DECREF(__pyx_v_result->from_object);
  __pyx_v_result->from_object = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "View.MemoryView":1019
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base
 *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
 * 
 *     result.view = memviewslice.memview.view
 */
  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;

  /* "View.MemoryView":1021
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 */
  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
  __pyx_v_result->__pyx_base.view = __pyx_t_5;

  /* "View.MemoryView":1022
 * 
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 */
  __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);

  /* "View.MemoryView":1023
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)
 */
  __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;

  /* "View.MemoryView":1024
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
 *     Py_INCREF(Py_None)
 * 
 */
  ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;

  /* "View.MemoryView":1025
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
 */
  Py_INCREF(Py_None);

  /* "View.MemoryView":1027
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
 */
  __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1028
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
 *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
 *     else:
 *         result.flags = PyBUF_RECORDS_RO
 */
    __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;

    /* "View.MemoryView":1027
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
 */
    goto __pyx_L4;
  }

  /* "View.MemoryView":1030
 *         result.flags = PyBUF_RECORDS
 *     else:
 *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 */
  /*else*/ {
    __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
  }
  __pyx_L4:;

  /* "View.MemoryView":1032
 *         result.flags = PyBUF_RECORDS_RO
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
 * 
 */
  __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);

  /* "View.MemoryView":1033
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);

  /* "View.MemoryView":1036
 * 
 * 
 *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 */
  __pyx_v_result->__pyx_base.view.suboffsets = NULL;

  /* "View.MemoryView":1037
 * 
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 */
  __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_v_suboffset = (__pyx_t_6[0]);

    /* "View.MemoryView":1038
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
 */
    __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":1039
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);

      /* "View.MemoryView":1040
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break             # <<<<<<<<<<<<<<
 * 
 *     result.view.len = result.view.itemsize
 */
      goto __pyx_L6_break;

      /* "View.MemoryView":1038
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
 */
    }
  }
  __pyx_L6_break:;

  /* "View.MemoryView":1042
 *             break
 * 
 *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length
 */
  __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;

  /* "View.MemoryView":1043
 * 
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         result.view.len *= length
 * 
 */
  __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":1044
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length             # <<<<<<<<<<<<<<
 * 
 *     result.to_object_func = to_object_func
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 1044, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  }

  /* "View.MemoryView":1046
 *         result.view.len *= length
 * 
 *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
 *     result.to_dtype_func = to_dtype_func
 * 
 */
  __pyx_v_result->to_object_func = __pyx_v_to_object_func;

  /* "View.MemoryView":1047
 * 
 *     result.to_object_func = to_object_func
 *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;

  /* "View.MemoryView":1049
 *     result.to_dtype_func = to_dtype_func
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":999
 * 
 * @cname('__pyx_memoryview_fromslice')
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
 *                           int ndim,
 *                           object (*to_object_func)(char *),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1052
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 */

static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
  struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
  __Pyx_memviewslice *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);

  /* "View.MemoryView":1055
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1056
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview             # <<<<<<<<<<<<<<
 *         return &obj.from_slice
 *     else:
 */
    if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(3, 1056, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":1057
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview
 *         return &obj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, mslice)
 */
    __pyx_r = (&__pyx_v_obj->from_slice);
    goto __pyx_L0;

    /* "View.MemoryView":1055
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
 */
  }

  /* "View.MemoryView":1059
 *         return &obj.from_slice
 *     else:
 *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
 *         return mslice
 * 
 */
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);

    /* "View.MemoryView":1060
 *     else:
 *         slice_copy(memview, mslice)
 *         return mslice             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_slice_copy')
 */
    __pyx_r = __pyx_v_mslice;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1052
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1063
 * 
 * @cname('__pyx_memoryview_slice_copy')
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
 *     cdef int dim
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 */

static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
  int __pyx_v_dim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  Py_ssize_t *__pyx_v_suboffsets;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  __Pyx_RefNannySetupContext("slice_copy", 0);

  /* "View.MemoryView":1067
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 * 
 *     shape = memview.view.shape             # <<<<<<<<<<<<<<
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets
 */
  __pyx_t_1 = __pyx_v_memview->view.shape;
  __pyx_v_shape = __pyx_t_1;

  /* "View.MemoryView":1068
 * 
 *     shape = memview.view.shape
 *     strides = memview.view.strides             # <<<<<<<<<<<<<<
 *     suboffsets = memview.view.suboffsets
 * 
 */
  __pyx_t_1 = __pyx_v_memview->view.strides;
  __pyx_v_strides = __pyx_t_1;

  /* "View.MemoryView":1069
 *     shape = memview.view.shape
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 */
  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
  __pyx_v_suboffsets = __pyx_t_1;

  /* "View.MemoryView":1071
 *     suboffsets = memview.view.suboffsets
 * 
 *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
 *     dst.data = <char *> memview.view.buf
 * 
 */
  __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);

  /* "View.MemoryView":1072
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
 * 
 *     for dim in range(memview.view.ndim):
 */
  __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);

  /* "View.MemoryView":1074
 *     dst.data = <char *> memview.view.buf
 * 
 *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 */
  __pyx_t_2 = __pyx_v_memview->view.ndim;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_dim = __pyx_t_4;

    /* "View.MemoryView":1075
 * 
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 */
    (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);

    /* "View.MemoryView":1076
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 */
    (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);

    /* "View.MemoryView":1077
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object')
 */
    if ((__pyx_v_suboffsets != 0)) {
      __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
    } else {
      __pyx_t_5 = -1L;
    }
    (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
  }

  /* "View.MemoryView":1063
 * 
 * @cname('__pyx_memoryview_slice_copy')
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
 *     cdef int dim
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":1080
 * 
 * @cname('__pyx_memoryview_copy_object')
 * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 */

static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
  __Pyx_memviewslice __pyx_v_memviewslice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_copy", 0);

  /* "View.MemoryView":1083
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 */
  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));

  /* "View.MemoryView":1084
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)
 *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1080
 * 
 * @cname('__pyx_memoryview_copy_object')
 * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1087
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new memoryview object from a given memoryview object and slice.
 */

static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
  PyObject *(*__pyx_v_to_object_func)(char *);
  int (*__pyx_v_to_dtype_func)(char *, PyObject *);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *(*__pyx_t_3)(char *);
  int (*__pyx_t_4)(char *, PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);

  /* "View.MemoryView":1094
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1095
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 */
    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
    __pyx_v_to_object_func = __pyx_t_3;

    /* "View.MemoryView":1096
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
 *     else:
 *         to_object_func = NULL
 */
    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
    __pyx_v_to_dtype_func = __pyx_t_4;

    /* "View.MemoryView":1094
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1098
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 *         to_object_func = NULL             # <<<<<<<<<<<<<<
 *         to_dtype_func = NULL
 * 
 */
  /*else*/ {
    __pyx_v_to_object_func = NULL;

    /* "View.MemoryView":1099
 *     else:
 *         to_object_func = NULL
 *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 */
    __pyx_v_to_dtype_func = NULL;
  }
  __pyx_L3:;

  /* "View.MemoryView":1101
 *         to_dtype_func = NULL
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "View.MemoryView":1103
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1087
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new memoryview object from a given memoryview object and slice.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1109
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
 *     if arg < 0:
 *         return -arg
 */

static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  Py_ssize_t __pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":1110
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:             # <<<<<<<<<<<<<<
 *         return -arg
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1111
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:
 *         return -arg             # <<<<<<<<<<<<<<
 *     else:
 *         return arg
 */
    __pyx_r = (-__pyx_v_arg);
    goto __pyx_L0;

    /* "View.MemoryView":1110
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:             # <<<<<<<<<<<<<<
 *         return -arg
 *     else:
 */
  }

  /* "View.MemoryView":1113
 *         return -arg
 *     else:
 *         return arg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_get_best_slice_order')
 */
  /*else*/ {
    __pyx_r = __pyx_v_arg;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1109
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
 *     if arg < 0:
 *         return -arg
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1116
 * 
 * @cname('__pyx_get_best_slice_order')
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Figure out the best memory access order for a given slice.
 */

static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_c_stride;
  Py_ssize_t __pyx_v_f_stride;
  char __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1121
 *     """
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t f_stride = 0
 * 
 */
  __pyx_v_c_stride = 0;

  /* "View.MemoryView":1122
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0
 *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
 */
  __pyx_v_f_stride = 0;

  /* "View.MemoryView":1124
 *     cdef Py_ssize_t f_stride = 0
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 */
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1125
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
 */
    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1126
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1127
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
      goto __pyx_L4_break;

      /* "View.MemoryView":1125
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
 */
    }
  }
  __pyx_L4_break:;

  /* "View.MemoryView":1129
 *             break
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 */
  __pyx_t_1 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_1;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1130
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
 */
    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1131
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1132
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 */
      goto __pyx_L7_break;

      /* "View.MemoryView":1130
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
 */
    }
  }
  __pyx_L7_break:;

  /* "View.MemoryView":1134
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
 */
  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1135
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 *         return 'C'             # <<<<<<<<<<<<<<
 *     else:
 *         return 'F'
 */
    __pyx_r = 'C';
    goto __pyx_L0;

    /* "View.MemoryView":1134
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
 */
  }

  /* "View.MemoryView":1137
 *         return 'C'
 *     else:
 *         return 'F'             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
  /*else*/ {
    __pyx_r = 'F';
    goto __pyx_L0;
  }

  /* "View.MemoryView":1116
 * 
 * @cname('__pyx_get_best_slice_order')
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Figure out the best memory access order for a given slice.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1140
 * 
 * @cython.cdivision(True)
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
 *                                    char *dst_data, Py_ssize_t *dst_strides,
 *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
 */

static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
  Py_ssize_t __pyx_v_dst_extent;
  Py_ssize_t __pyx_v_src_stride;
  Py_ssize_t __pyx_v_dst_stride;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;

  /* "View.MemoryView":1147
 * 
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 */
  __pyx_v_src_extent = (__pyx_v_src_shape[0]);

  /* "View.MemoryView":1148
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 */
  __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);

  /* "View.MemoryView":1149
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 */
  __pyx_v_src_stride = (__pyx_v_src_strides[0]);

  /* "View.MemoryView":1150
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
 */
  __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);

  /* "View.MemoryView":1152
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 */
  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1153
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
    __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "View.MemoryView":1154
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 *        else:
 */
    __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
    if (__pyx_t_2) {
      __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
    }
    __pyx_t_3 = (__pyx_t_2 != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;

    /* "View.MemoryView":1153
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
    if (__pyx_t_1) {

      /* "View.MemoryView":1155
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
 *        else:
 *            for i in range(dst_extent):
 */
      (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));

      /* "View.MemoryView":1153
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
      goto __pyx_L4;
    }

    /* "View.MemoryView":1157
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 *        else:
 *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride
 */
    /*else*/ {
      __pyx_t_4 = __pyx_v_dst_extent;
      __pyx_t_5 = __pyx_t_4;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "View.MemoryView":1158
 *        else:
 *            for i in range(dst_extent):
 *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
 *                src_data += src_stride
 *                dst_data += dst_stride
 */
        (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));

        /* "View.MemoryView":1159
 *            for i in range(dst_extent):
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride             # <<<<<<<<<<<<<<
 *                dst_data += dst_stride
 *     else:
 */
        __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

        /* "View.MemoryView":1160
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride
 *                dst_data += dst_stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(dst_extent):
 */
        __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
      }
    }
    __pyx_L4:;

    /* "View.MemoryView":1152
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1162
 *                dst_data += dst_stride
 *     else:
 *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *             _copy_strided_to_strided(src_data, src_strides + 1,
 *                                      dst_data, dst_strides + 1,
 */
  /*else*/ {
    __pyx_t_4 = __pyx_v_dst_extent;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "View.MemoryView":1163
 *     else:
 *         for i in range(dst_extent):
 *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
 *                                      dst_data, dst_strides + 1,
 *                                      src_shape + 1, dst_shape + 1,
 */
      _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);

      /* "View.MemoryView":1167
 *                                      src_shape + 1, dst_shape + 1,
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride             # <<<<<<<<<<<<<<
 *             dst_data += dst_stride
 * 
 */
      __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

      /* "View.MemoryView":1168
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride
 *             dst_data += dst_stride             # <<<<<<<<<<<<<<
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
 */
      __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1140
 * 
 * @cython.cdivision(True)
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
 *                                    char *dst_data, Py_ssize_t *dst_strides,
 *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
 */

  /* function exit code */
}

/* "View.MemoryView":1170
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 */

static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {

  /* "View.MemoryView":1173
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 */
  _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1170
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1177
 * 
 * @cname('__pyx_memoryview_slice_get_size')
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
 */

static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_size;
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;

  /* "View.MemoryView":1179
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     for shape in src.shape[:ndim]:
 */
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_size = __pyx_t_1;

  /* "View.MemoryView":1181
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
 * 
 *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         size *= shape
 * 
 */
  __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
  for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_shape = (__pyx_t_2[0]);

    /* "View.MemoryView":1182
 * 
 *     for shape in src.shape[:ndim]:
 *         size *= shape             # <<<<<<<<<<<<<<
 * 
 *     return size
 */
    __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
  }

  /* "View.MemoryView":1184
 *         size *= shape
 * 
 *     return size             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_fill_contig_strides_array')
 */
  __pyx_r = __pyx_v_size;
  goto __pyx_L0;

  /* "View.MemoryView":1177
 * 
 * @cname('__pyx_memoryview_slice_get_size')
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1187
 * 
 * @cname('__pyx_fill_contig_strides_array')
 * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
 *                 int ndim, char order) nogil:
 */

static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1196
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
 */
  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1197
 * 
 *     if order == 'F':
 *         for idx in range(ndim):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride *= shape[idx]
 */
    __pyx_t_2 = __pyx_v_ndim;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_idx = __pyx_t_4;

      /* "View.MemoryView":1198
 *     if order == 'F':
 *         for idx in range(ndim):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride *= shape[idx]
 *     else:
 */
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1199
 *         for idx in range(ndim):
 *             strides[idx] = stride
 *             stride *= shape[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 */
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }

    /* "View.MemoryView":1196
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1201
 *             stride *= shape[idx]
 *     else:
 *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride *= shape[idx]
 */
  /*else*/ {
    for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
      __pyx_v_idx = __pyx_t_2;

      /* "View.MemoryView":1202
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride *= shape[idx]
 * 
 */
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1203
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride
 *             stride *= shape[idx]             # <<<<<<<<<<<<<<
 * 
 *     return stride
 */
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1205
 *             stride *= shape[idx]
 * 
 *     return stride             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 */
  __pyx_r = __pyx_v_stride;
  goto __pyx_L0;

  /* "View.MemoryView":1187
 * 
 * @cname('__pyx_fill_contig_strides_array')
 * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
 *                 int ndim, char order) nogil:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1208
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                              __Pyx_memviewslice *tmpslice,
 *                              char order,
 */

static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
  int __pyx_v_i;
  void *__pyx_v_result;
  size_t __pyx_v_itemsize;
  size_t __pyx_v_size;
  void *__pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  struct __pyx_memoryview_obj *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":1219
 *     cdef void *result
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 */
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1220
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
 * 
 *     result = malloc(size)
 */
  __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);

  /* "View.MemoryView":1222
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 *     result = malloc(size)             # <<<<<<<<<<<<<<
 *     if not result:
 *         _err(MemoryError, NULL)
 */
  __pyx_v_result = malloc(__pyx_v_size);

  /* "View.MemoryView":1223
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err(MemoryError, NULL)
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1224
 *     result = malloc(size)
 *     if not result:
 *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(3, 1224, __pyx_L1_error)

    /* "View.MemoryView":1223
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err(MemoryError, NULL)
 * 
 */
  }

  /* "View.MemoryView":1227
 * 
 * 
 *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 */
  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);

  /* "View.MemoryView":1228
 * 
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 */
  __pyx_t_4 = __pyx_v_src->memview;
  __pyx_v_tmpslice->memview = __pyx_t_4;

  /* "View.MemoryView":1229
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1
 */
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "View.MemoryView":1230
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
 *         tmpslice.suboffsets[i] = -1
 * 
 */
    (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);

    /* "View.MemoryView":1231
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
 */
    (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1233
 *         tmpslice.suboffsets[i] = -1
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
 *                               ndim, order)
 * 
 */
  (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));

  /* "View.MemoryView":1237
 * 
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0
 */
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "View.MemoryView":1238
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
 */
    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1239
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
 * 
 *     if slice_is_contig(src[0], order, ndim):
 */
      (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;

      /* "View.MemoryView":1238
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
 */
    }
  }

  /* "View.MemoryView":1241
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
 */
  __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1242
 * 
 *     if slice_is_contig(src[0], order, ndim):
 *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 */
    (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));

    /* "View.MemoryView":1241
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
 */
    goto __pyx_L9;
  }

  /* "View.MemoryView":1244
 *         memcpy(result, src.data, size)
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  /*else*/ {
    copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
  }
  __pyx_L9:;

  /* "View.MemoryView":1246
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":1208
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                              __Pyx_memviewslice *tmpslice,
 *                              char order,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1251
 * 
 * @cname('__pyx_memoryview_err_extents')
 * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 */

static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err_extents", 0);

  /* "View.MemoryView":1254
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_dim')
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;

  /* "View.MemoryView":1253
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
 *                                                         (i, extent1, extent2))
 * 
 */
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __PYX_ERR(3, 1253, __pyx_L1_error)

  /* "View.MemoryView":1251
 * 
 * @cname('__pyx_memoryview_err_extents')
 * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1257
 * 
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
 *     raise error(msg.decode('ascii') % dim)
 * 
 */

static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err_dim", 0);
  __Pyx_INCREF(__pyx_v_error);

  /* "View.MemoryView":1258
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
 *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err')
 */
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_v_error);
  __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(3, 1258, __pyx_L1_error)

  /* "View.MemoryView":1257
 * 
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
 *     raise error(msg.decode('ascii') % dim)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1261
 * 
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))
 */

static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err", 0);
  __Pyx_INCREF(__pyx_v_error);

  /* "View.MemoryView":1262
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:             # <<<<<<<<<<<<<<
 *         raise error(msg.decode('ascii'))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":1263
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
 *     else:
 *         raise error
 */
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_error);
    __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(3, 1263, __pyx_L1_error)

    /* "View.MemoryView":1262
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:             # <<<<<<<<<<<<<<
 *         raise error(msg.decode('ascii'))
 *     else:
 */
  }

  /* "View.MemoryView":1265
 *         raise error(msg.decode('ascii'))
 *     else:
 *         raise error             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_contents')
 */
  /*else*/ {
    __Pyx_Raise(__pyx_v_error, 0, 0, 0);
    __PYX_ERR(3, 1265, __pyx_L1_error)
  }

  /* "View.MemoryView":1261
 * 
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1268
 * 
 * @cname('__pyx_memoryview_copy_contents')
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice dst,
 *                                   int src_ndim, int dst_ndim,
 */

static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
  void *__pyx_v_tmpdata;
  size_t __pyx_v_itemsize;
  int __pyx_v_i;
  char __pyx_v_order;
  int __pyx_v_broadcasting;
  int __pyx_v_direct_copy;
  __Pyx_memviewslice __pyx_v_tmp;
  int __pyx_v_ndim;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  void *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":1276
 *     Check for overlapping memory and verify the shapes.
 *     """
 *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 */
  __pyx_v_tmpdata = NULL;

  /* "View.MemoryView":1277
 *     """
 *     cdef void *tmpdata = NULL
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 */
  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1279
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False
 */
  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);

  /* "View.MemoryView":1280
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
 *     cdef bint direct_copy = False
 *     cdef __Pyx_memviewslice tmp
 */
  __pyx_v_broadcasting = 0;

  /* "View.MemoryView":1281
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
 *     cdef __Pyx_memviewslice tmp
 * 
 */
  __pyx_v_direct_copy = 0;

  /* "View.MemoryView":1284
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 */
  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1285
 * 
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 */
    __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);

    /* "View.MemoryView":1284
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1286
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 */
  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1287
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)
 */
    __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);

    /* "View.MemoryView":1286
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":1289
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
  __pyx_t_3 = __pyx_v_dst_ndim;
  __pyx_t_4 = __pyx_v_src_ndim;
  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
    __pyx_t_5 = __pyx_t_3;
  } else {
    __pyx_t_5 = __pyx_t_4;
  }
  __pyx_v_ndim = __pyx_t_5;

  /* "View.MemoryView":1291
 *     cdef int ndim = max(src_ndim, dst_ndim)
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 */
  __pyx_t_5 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_5;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1292
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 */
    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1293
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
 */
      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":1294
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 *                 broadcasting = True             # <<<<<<<<<<<<<<
 *                 src.strides[i] = 0
 *             else:
 */
        __pyx_v_broadcasting = 1;

        /* "View.MemoryView":1295
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 */
        (__pyx_v_src.strides[__pyx_v_i]) = 0;

        /* "View.MemoryView":1293
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
 */
        goto __pyx_L7;
      }

      /* "View.MemoryView":1297
 *                 src.strides[i] = 0
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
 * 
 *         if src.suboffsets[i] >= 0:
 */
      /*else*/ {
        __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(3, 1297, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":1292
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 */
    }

    /* "View.MemoryView":1299
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 */
    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1300
 * 
 *         if src.suboffsets[i] >= 0:
 *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 */
      __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(3, 1300, __pyx_L1_error)

      /* "View.MemoryView":1299
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 */
    }
  }

  /* "View.MemoryView":1302
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
 */
  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1304
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
 */
    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1305
 * 
 *         if not slice_is_contig(src, order, ndim):
 *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 */
      __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);

      /* "View.MemoryView":1304
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
 */
    }

    /* "View.MemoryView":1307
 *             order = get_best_order(&dst, ndim)
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
 *         src = tmp
 * 
 */
    __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(3, 1307, __pyx_L1_error)
    __pyx_v_tmpdata = __pyx_t_7;

    /* "View.MemoryView":1308
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 *         src = tmp             # <<<<<<<<<<<<<<
 * 
 *     if not broadcasting:
 */
    __pyx_v_src = __pyx_v_tmp;

    /* "View.MemoryView":1302
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
 */
  }

  /* "View.MemoryView":1310
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1313
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 */
    __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1314
 * 
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 */
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);

      /* "View.MemoryView":1313
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 */
      goto __pyx_L12;
    }

    /* "View.MemoryView":1315
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 */
    __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1316
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
 * 
 *         if direct_copy:
 */
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);

      /* "View.MemoryView":1315
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 */
    }
    __pyx_L12:;

    /* "View.MemoryView":1318
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    __pyx_t_2 = (__pyx_v_direct_copy != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1320
 *         if direct_copy:
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 */
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

      /* "View.MemoryView":1321
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)
 */
      (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));

      /* "View.MemoryView":1322
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 *             free(tmpdata)
 *             return 0
 */
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

      /* "View.MemoryView":1323
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
      free(__pyx_v_tmpdata);

      /* "View.MemoryView":1324
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "View.MemoryView":1318
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    }

    /* "View.MemoryView":1310
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":1326
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = (__pyx_v_order == 'F');
  if (__pyx_t_2) {
    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
  }
  __pyx_t_8 = (__pyx_t_2 != 0);
  if (__pyx_t_8) {

    /* "View.MemoryView":1329
 * 
 * 
 *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&dst)
 * 
 */
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(3, 1329, __pyx_L1_error)

    /* "View.MemoryView":1330
 * 
 *         transpose_memslice(&src)
 *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(3, 1330, __pyx_L1_error)

    /* "View.MemoryView":1326
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":1332
 *         transpose_memslice(&dst)
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 */
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1333
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 * 
 */
  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1334
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 * 
 *     free(tmpdata)
 */
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1336
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 * 
 *     free(tmpdata)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  free(__pyx_v_tmpdata);

  /* "View.MemoryView":1337
 * 
 *     free(tmpdata)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1268
 * 
 * @cname('__pyx_memoryview_copy_contents')
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice dst,
 *                                   int src_ndim, int dst_ndim,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1340
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
 *                             int ndim,
 *                             int ndim_other) nogil:
 */

static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
  int __pyx_v_i;
  int __pyx_v_offset;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1344
 *                             int ndim_other) nogil:
 *     cdef int i
 *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
 */
  __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);

  /* "View.MemoryView":1346
 *     cdef int offset = ndim_other - ndim
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 */
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1347
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 */
    (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);

    /* "View.MemoryView":1348
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 */
    (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);

    /* "View.MemoryView":1349
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
 * 
 *     for i in range(offset):
 */
    (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
  }

  /* "View.MemoryView":1351
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 *     for i in range(offset):             # <<<<<<<<<<<<<<
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 */
  __pyx_t_1 = __pyx_v_offset;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1352
 * 
 *     for i in range(offset):
 *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1
 */
    (__pyx_v_mslice->shape[__pyx_v_i]) = 1;

    /* "View.MemoryView":1353
 *     for i in range(offset):
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i] = -1
 * 
 */
    (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);

    /* "View.MemoryView":1354
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1340
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
 *                             int ndim,
 *                             int ndim_other) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1362
 * 
 * @cname('__pyx_memoryview_refcount_copying')
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
 *                            int ndim, bint inc) nogil:
 * 
 */

static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
  int __pyx_t_1;

  /* "View.MemoryView":1366
 * 
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
 *                                            dst.strides, ndim, inc)
 */
  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1367
 * 
 *     if dtype_is_object:
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
 *                                            dst.strides, ndim, inc)
 * 
 */
    __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);

    /* "View.MemoryView":1366
 * 
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
 *                                            dst.strides, ndim, inc)
 */
  }

  /* "View.MemoryView":1362
 * 
 * @cname('__pyx_memoryview_refcount_copying')
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
 *                            int ndim, bint inc) nogil:
 * 
 */

  /* function exit code */
}

/* "View.MemoryView":1371
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 */

static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  __Pyx_RefNannyDeclarations
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);

  /* "View.MemoryView":1374
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 */
  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);

  /* "View.MemoryView":1371
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "View.MemoryView":1377
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                     Py_ssize_t *strides, int ndim, bint inc):
 *     cdef Py_ssize_t i
 */

static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);

  /* "View.MemoryView":1381
 *     cdef Py_ssize_t i
 * 
 *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *         if ndim == 1:
 *             if inc:
 */
  __pyx_t_1 = (__pyx_v_shape[0]);
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1382
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
 */
    __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":1383
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 */
      __pyx_t_4 = (__pyx_v_inc != 0);
      if (__pyx_t_4) {

        /* "View.MemoryView":1384
 *         if ndim == 1:
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])
 */
        Py_INCREF((((PyObject **)__pyx_v_data)[0]));

        /* "View.MemoryView":1383
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 */
        goto __pyx_L6;
      }

      /* "View.MemoryView":1386
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,
 */
      /*else*/ {
        Py_DECREF((((PyObject **)__pyx_v_data)[0]));
      }
      __pyx_L6:;

      /* "View.MemoryView":1382
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
 */
      goto __pyx_L5;
    }

    /* "View.MemoryView":1388
 *                 Py_DECREF((<PyObject **> data)[0])
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
 *                                       ndim - 1, inc)
 * 
 */
    /*else*/ {

      /* "View.MemoryView":1389
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,
 *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
 * 
 *         data += strides[0]
 */
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
    }
    __pyx_L5:;

    /* "View.MemoryView":1391
 *                                       ndim - 1, inc)
 * 
 *         data += strides[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
  }

  /* "View.MemoryView":1377
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                     Py_ssize_t *strides, int ndim, bint inc):
 *     cdef Py_ssize_t i
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":1397
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 */

static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {

  /* "View.MemoryView":1400
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
 *                          itemsize, item)
 */
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1401
 *                               bint dtype_is_object) nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
 *                          itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, True)
 */
  __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);

  /* "View.MemoryView":1403
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
 *                          itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1397
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1407
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_extent;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;

  /* "View.MemoryView":1411
 *                               size_t itemsize, void *item) nogil:
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t extent = shape[0]
 * 
 */
  __pyx_v_stride = (__pyx_v_strides[0]);

  /* "View.MemoryView":1412
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]
 *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
 */
  __pyx_v_extent = (__pyx_v_shape[0]);

  /* "View.MemoryView":1414
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 */
  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1415
 * 
 *     if ndim == 1:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             memcpy(data, item, itemsize)
 *             data += stride
 */
    __pyx_t_2 = __pyx_v_extent;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":1416
 *     if ndim == 1:
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
 *             data += stride
 *     else:
 */
      (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));

      /* "View.MemoryView":1417
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 *             data += stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(extent):
 */
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }

    /* "View.MemoryView":1414
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1419
 *             data += stride
 *     else:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             _slice_assign_scalar(data, shape + 1, strides + 1,
 *                                 ndim - 1, itemsize, item)
 */
  /*else*/ {
    __pyx_t_2 = __pyx_v_extent;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":1420
 *     else:
 *         for i in range(extent):
 *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
 *                                 ndim - 1, itemsize, item)
 *             data += stride
 */
      __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);

      /* "View.MemoryView":1422
 *             _slice_assign_scalar(data, shape + 1, strides + 1,
 *                                 ndim - 1, itemsize, item)
 *             data += stride             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1407
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

  /* function exit code */
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(3, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(3, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(3, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xb068931:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xb068931:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(3, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->name);
  __Pyx_DECREF(__pyx_v___pyx_result->name);
  __pyx_v___pyx_result->name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(3, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(3, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "BufferFormatFromTypeInfo":1463
 * 
 * @cname('__pyx_format_from_typeinfo')
 * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type):             # <<<<<<<<<<<<<<
 *     cdef __Pyx_StructField *field
 *     cdef __pyx_typeinfo_string fmt
 */

static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) {
  __Pyx_StructField *__pyx_v_field;
  struct __pyx_typeinfo_string __pyx_v_fmt;
  PyObject *__pyx_v_part = 0;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_v_alignment = NULL;
  PyObject *__pyx_v_parts = NULL;
  PyObject *__pyx_v_extents = NULL;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_StructField *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("format_from_typeinfo", 0);

  /* "BufferFormatFromTypeInfo":1468
 *     cdef bytes part, result
 * 
 *     if type.typegroup == 'S':             # <<<<<<<<<<<<<<
 *         assert type.fields != NULL and type.fields.type != NULL
 * 
 */
  __pyx_t_1 = ((__pyx_v_type->typegroup == 'S') != 0);
  if (__pyx_t_1) {

    /* "BufferFormatFromTypeInfo":1469
 * 
 *     if type.typegroup == 'S':
 *         assert type.fields != NULL and type.fields.type != NULL             # <<<<<<<<<<<<<<
 * 
 *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_2 = ((__pyx_v_type->fields != NULL) != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_2 = ((__pyx_v_type->fields->type != NULL) != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L4_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(3, 1469, __pyx_L1_error)
      }
    }
    #endif

    /* "BufferFormatFromTypeInfo":1471
 *         assert type.fields != NULL and type.fields.type != NULL
 * 
 *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:             # <<<<<<<<<<<<<<
 *             alignment = b'^'
 *         else:
 */
    __pyx_t_1 = ((__pyx_v_type->flags & __PYX_BUF_FLAGS_PACKED_STRUCT) != 0);
    if (__pyx_t_1) {

      /* "BufferFormatFromTypeInfo":1472
 * 
 *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
 *             alignment = b'^'             # <<<<<<<<<<<<<<
 *         else:
 *             alignment = b''
 */
      __Pyx_INCREF(__pyx_kp_b__50);
      __pyx_v_alignment = __pyx_kp_b__50;

      /* "BufferFormatFromTypeInfo":1471
 *         assert type.fields != NULL and type.fields.type != NULL
 * 
 *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:             # <<<<<<<<<<<<<<
 *             alignment = b'^'
 *         else:
 */
      goto __pyx_L6;
    }

    /* "BufferFormatFromTypeInfo":1474
 *             alignment = b'^'
 *         else:
 *             alignment = b''             # <<<<<<<<<<<<<<
 * 
 *         parts = [b"T{"]
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_kp_b__51);
      __pyx_v_alignment = __pyx_kp_b__51;
    }
    __pyx_L6:;

    /* "BufferFormatFromTypeInfo":1476
 *             alignment = b''
 * 
 *         parts = [b"T{"]             # <<<<<<<<<<<<<<
 *         field = type.fields
 * 
 */
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1476, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_kp_b_T);
    __Pyx_GIVEREF(__pyx_kp_b_T);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_b_T);
    __pyx_v_parts = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "BufferFormatFromTypeInfo":1477
 * 
 *         parts = [b"T{"]
 *         field = type.fields             # <<<<<<<<<<<<<<
 * 
 *         while field.type:
 */
    __pyx_t_4 = __pyx_v_type->fields;
    __pyx_v_field = __pyx_t_4;

    /* "BufferFormatFromTypeInfo":1479
 *         field = type.fields
 * 
 *         while field.type:             # <<<<<<<<<<<<<<
 *             part = format_from_typeinfo(field.type)
 *             parts.append(part + b':' + field.name + b':')
 */
    while (1) {
      __pyx_t_1 = (__pyx_v_field->type != 0);
      if (!__pyx_t_1) break;

      /* "BufferFormatFromTypeInfo":1480
 * 
 *         while field.type:
 *             part = format_from_typeinfo(field.type)             # <<<<<<<<<<<<<<
 *             parts.append(part + b':' + field.name + b':')
 *             field += 1
 */
      __pyx_t_3 = __pyx_format_from_typeinfo(__pyx_v_field->type); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "BufferFormatFromTypeInfo":1481
 *         while field.type:
 *             part = format_from_typeinfo(field.type)
 *             parts.append(part + b':' + field.name + b':')             # <<<<<<<<<<<<<<
 *             field += 1
 * 
 */
      __pyx_t_3 = PyNumber_Add(__pyx_v_part, __pyx_kp_b__52); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_field->name); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_kp_b__52); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(3, 1481, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "BufferFormatFromTypeInfo":1482
 *             part = format_from_typeinfo(field.type)
 *             parts.append(part + b':' + field.name + b':')
 *             field += 1             # <<<<<<<<<<<<<<
 * 
 *         result = alignment.join(parts) + b'}'
 */
      __pyx_v_field = (__pyx_v_field + 1);
    }

    /* "BufferFormatFromTypeInfo":1484
 *             field += 1
 * 
 *         result = alignment.join(parts) + b'}'             # <<<<<<<<<<<<<<
 *     else:
 *         fmt = __Pyx_TypeInfoToFormat(type)
 */
    __pyx_t_5 = __Pyx_PyBytes_Join(__pyx_v_alignment, __pyx_v_parts); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_kp_b__53); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(3, 1484, __pyx_L1_error)
    __pyx_v_result = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "BufferFormatFromTypeInfo":1468
 *     cdef bytes part, result
 * 
 *     if type.typegroup == 'S':             # <<<<<<<<<<<<<<
 *         assert type.fields != NULL and type.fields.type != NULL
 * 
 */
    goto __pyx_L3;
  }

  /* "BufferFormatFromTypeInfo":1486
 *         result = alignment.join(parts) + b'}'
 *     else:
 *         fmt = __Pyx_TypeInfoToFormat(type)             # <<<<<<<<<<<<<<
 *         if type.arraysize[0]:
 *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
 */
  /*else*/ {
    __pyx_v_fmt = __Pyx_TypeInfoToFormat(__pyx_v_type);

    /* "BufferFormatFromTypeInfo":1487
 *     else:
 *         fmt = __Pyx_TypeInfoToFormat(type)
 *         if type.arraysize[0]:             # <<<<<<<<<<<<<<
 *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
 *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
 */
    __pyx_t_1 = ((__pyx_v_type->arraysize[0]) != 0);
    if (__pyx_t_1) {

      /* "BufferFormatFromTypeInfo":1488
 *         fmt = __Pyx_TypeInfoToFormat(type)
 *         if type.arraysize[0]:
 *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]             # <<<<<<<<<<<<<<
 *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
 *         else:
 */
      __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __pyx_v_type->ndim;
      __pyx_t_9 = __pyx_t_8;
      for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
        __pyx_v_i = __pyx_t_10;
        __pyx_t_5 = __Pyx_PyInt_FromSize_t((__pyx_v_type->arraysize[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1488, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1488, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(3, 1488, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_v_extents = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "BufferFormatFromTypeInfo":1489
 *         if type.arraysize[0]:
 *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
 *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string             # <<<<<<<<<<<<<<
 *         else:
 *             result = fmt.string
 */
      __pyx_t_6 = PyUnicode_Join(__pyx_kp_u__54, __pyx_v_extents); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_s, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyUnicode_AsASCIIString(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(PyBytes_CheckExact(__pyx_t_5))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(3, 1489, __pyx_L1_error)
      __pyx_v_result = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "BufferFormatFromTypeInfo":1487
 *     else:
 *         fmt = __Pyx_TypeInfoToFormat(type)
 *         if type.arraysize[0]:             # <<<<<<<<<<<<<<
 *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
 *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
 */
      goto __pyx_L9;
    }

    /* "BufferFormatFromTypeInfo":1491
 *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
 *         else:
 *             result = fmt.string             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_result = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;
    }
    __pyx_L9:;
  }
  __pyx_L3:;

  /* "BufferFormatFromTypeInfo":1493
 *             result = fmt.string
 * 
 *     return result             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "BufferFormatFromTypeInfo":1463
 * 
 * @cname('__pyx_format_from_typeinfo')
 * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type):             # <<<<<<<<<<<<<<
 *     cdef __Pyx_StructField *field
 *     cdef __pyx_typeinfo_string fmt
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("BufferFormatFromTypeInfo.format_from_typeinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_part);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_alignment);
  __Pyx_XDECREF(__pyx_v_parts);
  __Pyx_XDECREF(__pyx_v_extents);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_array __pyx_vtable_array;

static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_array_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_array_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_array;
  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_array(PyObject *o) {
  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_array___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->mode);
  Py_CLEAR(p->_format);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_array___setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_array___getattr__(o, n);
  }
  return v;
}

static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
}

static PyMethodDef __pyx_methods_array[] = {
  {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_array[] = {
  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_array = {
  __pyx_array___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_array, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_array = {
  __pyx_array___len__, /*mp_length*/
  __pyx_array___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_array = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_array = {
  PyVarObject_HEAD_INIT(0, 0)
  "PygameShader.shader.array", /*tp_name*/
  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_array, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_array, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_array, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_array, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_array, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_MemviewEnum_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_MemviewEnum_obj *)o);
  p->name = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_Enum(PyObject *o) {
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_Enum(PyObject *o) {
  PyObject* tmp;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_Enum[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  PyVarObject_HEAD_INIT(0, 0)
  "PygameShader.shader.Enum", /*tp_name*/
  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_MemviewEnum___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_Enum, /*tp_traverse*/
  __pyx_tp_clear_Enum, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_Enum, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_MemviewEnum___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_Enum, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};
static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;

static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryview_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryview_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_memoryview;
  p->obj = Py_None; Py_INCREF(Py_None);
  p->_size = Py_None; Py_INCREF(Py_None);
  p->_array_interface = Py_None; Py_INCREF(Py_None);
  p->view.obj = NULL;
  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_memoryview(PyObject *o) {
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_memoryview___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->obj);
  Py_CLEAR(p->_size);
  Py_CLEAR(p->_array_interface);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  if (p->obj) {
    e = (*v)(p->obj, a); if (e) return e;
  }
  if (p->_size) {
    e = (*v)(p->_size, a); if (e) return e;
  }
  if (p->_array_interface) {
    e = (*v)(p->_array_interface, a); if (e) return e;
  }
  if (p->view.obj) {
    e = (*v)(p->view.obj, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_memoryview(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  tmp = ((PyObject*)p->obj);
  p->obj = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_size);
  p->_size = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_array_interface);
  p->_array_interface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  Py_CLEAR(p->view.obj);
  return 0;
}
static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_memoryview___setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
}

static PyMethodDef __pyx_methods_memoryview[] = {
  {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
  {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
  {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
  {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
  __pyx_memoryview___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_memoryview, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
  __pyx_memoryview___len__, /*mp_length*/
  __pyx_memoryview___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_memoryview = {
  PyVarObject_HEAD_INIT(0, 0)
  "PygameShader.shader.memoryview", /*tp_name*/
  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_memoryview___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_memoryview___str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_memoryview, /*tp_traverse*/
  __pyx_tp_clear_memoryview, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_memoryview, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_memoryview, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_memoryview, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};
static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;

static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryviewslice_obj *p;
  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryviewslice_obj *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
  p->from_object = Py_None; Py_INCREF(Py_None);
  p->from_slice.memview = NULL;
  return o;
}

static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_memoryviewslice___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->from_object);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_memoryview(o);
}

static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
  if (p->from_object) {
    e = (*v)(p->from_object, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  __pyx_tp_clear_memoryview(o);
  tmp = ((PyObject*)p->from_object);
  p->from_object = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
  return 0;
}

static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
}

static PyMethodDef __pyx_methods__memoryviewslice[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  PyVarObject_HEAD_INIT(0, 0)
  "PygameShader.shader._memoryviewslice", /*tp_name*/
  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_memoryview___repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_memoryview___str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Internal class for passing memoryview slices to Python", /*tp_doc*/
  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods__memoryviewslice, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets__memoryviewslice, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new__memoryviewslice, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {"rgb_to_bgr", (PyCFunction)__pyx_pw_12PygameShader_6shader_1rgb_to_bgr, METH_O, __pyx_doc_12PygameShader_6shader_rgb_to_bgr},
  {"rgb_to_brg", (PyCFunction)__pyx_pw_12PygameShader_6shader_3rgb_to_brg, METH_O, __pyx_doc_12PygameShader_6shader_2rgb_to_brg},
  {"greyscale", (PyCFunction)__pyx_pw_12PygameShader_6shader_5greyscale, METH_O, __pyx_doc_12PygameShader_6shader_4greyscale},
  {"sepia", (PyCFunction)__pyx_pw_12PygameShader_6shader_7sepia, METH_O, __pyx_doc_12PygameShader_6shader_6sepia},
  {"median", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_9median, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_8median},
  {"median_grayscale", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_11median_grayscale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_10median_grayscale},
  {"median_avg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_13median_avg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_12median_avg},
  {"color_reduction", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_15color_reduction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_14color_reduction},
  {"sobel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_17sobel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_16sobel},
  {"sobel_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_19sobel_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_18sobel_fast},
  {"invert", (PyCFunction)__pyx_pw_12PygameShader_6shader_21invert, METH_O, __pyx_doc_12PygameShader_6shader_20invert},
  {"hsl_effect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_23hsl_effect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_22hsl_effect},
  {"hsl_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_25hsl_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_24hsl_fast},
  {"blur", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_27blur, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_26blur},
  {"wave", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_29wave, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_28wave},
  {"swirl", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_31swirl, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_30swirl},
  {"swirl2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_33swirl2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_32swirl2},
  {"plasma_config", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_35plasma_config, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_34plasma_config},
  {"plasma", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_37plasma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_36plasma},
  {"rgb_to_hsl_model", (PyCFunction)__pyx_pw_12PygameShader_6shader_39rgb_to_hsl_model, METH_NOARGS, __pyx_doc_12PygameShader_6shader_38rgb_to_hsl_model},
  {"hsl_to_rgb_model", (PyCFunction)__pyx_pw_12PygameShader_6shader_41hsl_to_rgb_model, METH_NOARGS, __pyx_doc_12PygameShader_6shader_40hsl_to_rgb_model},
  {"brightness", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_43brightness, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_42brightness},
  {"brightness_exclude", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_45brightness_exclude, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_44brightness_exclude},
  {"brightness_bpf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_47brightness_bpf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_46brightness_bpf},
  {"brightness_model", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_49brightness_model, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_48brightness_model},
  {"saturation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_51saturation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_50saturation},
  {"heatwave_vertical", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_53heatwave_vertical, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_52heatwave_vertical},
  {"horizontal_glitch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_55horizontal_glitch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_54horizontal_glitch},
  {"bpf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_57bpf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_56bpf},
  {"bloom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_59bloom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_58bloom},
  {"fisheye_footprint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_61fisheye_footprint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_60fisheye_footprint},
  {"fisheye", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_63fisheye, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_62fisheye},
  {"rain_footprint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_65rain_footprint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_64rain_footprint},
  {"rain_fisheye", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_67rain_fisheye, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_66rain_fisheye},
  {"tv_scan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_69tv_scan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_68tv_scan},
  {"rgb_split", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_71rgb_split, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_70rgb_split},
  {"rgb_split_clean", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_73rgb_split_clean, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_72rgb_split_clean},
  {"ripple", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_75ripple, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_74ripple},
  {"heatmap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_77heatmap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_76heatmap},
  {"predator_vision", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_79predator_vision, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_78predator_vision},
  {"blood", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_81blood, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_80blood},
  {"make_palette", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_83make_palette, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_82make_palette},
  {"fire_sub", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_85fire_sub, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_84fire_sub},
  {"fire_effect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_87fire_effect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_86fire_effect},
  {"cloud_effect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_89cloud_effect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_88cloud_effect},
  {"mirroring_array", (PyCFunction)__pyx_pw_12PygameShader_6shader_91mirroring_array, METH_O, __pyx_doc_12PygameShader_6shader_90mirroring_array},
  {"mirroring", (PyCFunction)__pyx_pw_12PygameShader_6shader_93mirroring, METH_O, __pyx_doc_12PygameShader_6shader_92mirroring},
  {"sharpen", (PyCFunction)__pyx_pw_12PygameShader_6shader_95sharpen, METH_O, __pyx_doc_12PygameShader_6shader_94sharpen},
  {"dirt_lens", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_97dirt_lens, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_96dirt_lens},
  {"end_game", (PyCFunction)__pyx_pw_12PygameShader_6shader_99end_game, METH_O, __pyx_doc_12PygameShader_6shader_98end_game},
  {"level_clear", (PyCFunction)__pyx_pw_12PygameShader_6shader_101level_clear, METH_O, __pyx_doc_12PygameShader_6shader_100level_clear},
  {"dithering", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_103dithering, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_102dithering},
  {"dithering_int", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_105dithering_int, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_104dithering_int},
  {"pixelation", (PyCFunction)__pyx_pw_12PygameShader_6shader_107pixelation, METH_O, __pyx_doc_12PygameShader_6shader_106pixelation},
  {"zoom_in", (PyCFunction)__pyx_pw_12PygameShader_6shader_109zoom_in, METH_O, __pyx_doc_12PygameShader_6shader_108zoom_in},
  {"electric", (PyCFunction)__pyx_pw_12PygameShader_6shader_111electric, METH_O, __pyx_doc_12PygameShader_6shader_110electric},
  {"filmstrips", (PyCFunction)__pyx_pw_12PygameShader_6shader_113filmstrips, METH_O, __pyx_doc_12PygameShader_6shader_112filmstrips},
  {"cubism", (PyCFunction)__pyx_pw_12PygameShader_6shader_115cubism, METH_O, __pyx_doc_12PygameShader_6shader_114cubism},
  {"code_listing", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_117code_listing, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_116code_listing},
  {"ascii_char", (PyCFunction)__pyx_pw_12PygameShader_6shader_119ascii_char, METH_O, __pyx_doc_12PygameShader_6shader_118ascii_char},
  {"blend", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_121blend, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_120blend},
  {"cartoon", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_123cartoon, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_122cartoon},
  {"explode", (PyCFunction)__pyx_pw_12PygameShader_6shader_125explode, METH_O, __pyx_doc_12PygameShader_6shader_124explode},
  {"spectrum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_127spectrum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_126spectrum},
  {"convert_27colors", (PyCFunction)__pyx_pw_12PygameShader_6shader_129convert_27colors, METH_O, __pyx_doc_12PygameShader_6shader_128convert_27colors},
  {"bilateral", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_131bilateral, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_130bilateral},
  {"emboss", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_133emboss, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_132emboss},
  {"palette_change", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_135palette_change, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_134palette_change},
  {"putmask_c", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_137putmask_c, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_136putmask_c},
  {"tunnel_modeling32", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_139tunnel_modeling32, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_138tunnel_modeling32},
  {"tunnel_render32", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_141tunnel_render32, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_140tunnel_render32},
  {"heat_map", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_143heat_map, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_142heat_map},
  {"custom_map", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_145custom_map, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_144custom_map},
  {"heatmap_convert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_147heatmap_convert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_146heatmap_convert},
  {"blue_map", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_149blue_map, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_148blue_map},
  {"bluescale", (PyCFunction)__pyx_pw_12PygameShader_6shader_151bluescale, METH_O, __pyx_doc_12PygameShader_6shader_150bluescale},
  {"red_map", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_153red_map, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_152red_map},
  {"redscale", (PyCFunction)__pyx_pw_12PygameShader_6shader_155redscale, METH_O, __pyx_doc_12PygameShader_6shader_154redscale},
  {"rgb_to_int", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_157rgb_to_int, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_156rgb_to_int},
  {"int_to_rgb", (PyCFunction)__pyx_pw_12PygameShader_6shader_159int_to_rgb, METH_O, __pyx_doc_12PygameShader_6shader_158int_to_rgb},
  {"dampening", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_161dampening, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_160dampening},
  {"lateral_dampening", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12PygameShader_6shader_163lateral_dampening, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12PygameShader_6shader_162lateral_dampening},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_shader(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_shader},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "shader",
    __pyx_k_GNU_GENERAL_PUBLIC_LICENSE_Vers, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1_0_3, __pyx_k_1_0_3, sizeof(__pyx_k_1_0_3), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
  {&__pyx_kp_s_Argument_array_must_be_a_numpy, __pyx_k_Argument_array_must_be_a_numpy, sizeof(__pyx_k_Argument_array_must_be_a_numpy), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_bpf_threshold__must_be, __pyx_k_Argument_bpf_threshold__must_be, sizeof(__pyx_k_Argument_bpf_threshold__must_be), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_brightness_intensity_mu, __pyx_k_Argument_brightness_intensity_mu, sizeof(__pyx_k_Argument_brightness_intensity_mu), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_color_number_must_be_0, __pyx_k_Argument_color_number_must_be_0, sizeof(__pyx_k_Argument_color_number_must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_current_must_be_a_nump, __pyx_k_Argument_current_must_be_a_nump, sizeof(__pyx_k_Argument_current_must_be_a_nump), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_destination__must_be_a, __pyx_k_Argument_destination__must_be_a, sizeof(__pyx_k_Argument_destination__must_be_a), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_duration__must_be_0, __pyx_k_Argument_duration__must_be_0, sizeof(__pyx_k_Argument_duration__must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_factor__cannot_be_null, __pyx_k_Argument_factor__cannot_be_null, sizeof(__pyx_k_Argument_factor__cannot_be_null), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_factor__must_be_1, __pyx_k_Argument_factor__must_be_1, sizeof(__pyx_k_Argument_factor__must_be_1), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_factor__must_be_an_int, __pyx_k_Argument_factor__must_be_an_int, sizeof(__pyx_k_Argument_factor__must_be_an_int), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_factor__must_be_in_ran, __pyx_k_Argument_factor__must_be_in_ran, sizeof(__pyx_k_Argument_factor__must_be_in_ran), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_fire_intensity__must_be, __pyx_k_Argument_fire_intensity__must_be, sizeof(__pyx_k_Argument_fire_intensity__must_be), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_fisheye_model_must_be, __pyx_k_Argument_fisheye_model_must_be, sizeof(__pyx_k_Argument_fisheye_model_must_be), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_flag__must_be_a_int_ty, __pyx_k_Argument_flag__must_be_a_int_ty, sizeof(__pyx_k_Argument_flag__must_be_a_int_ty), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_freq__must_be_0, __pyx_k_Argument_freq__must_be_0, sizeof(__pyx_k_Argument_freq__must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_h2_cannot_be_0, __pyx_k_Argument_h2_cannot_be_0, sizeof(__pyx_k_Argument_h2_cannot_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_h_must_be_0, __pyx_k_Argument_h_must_be_0, sizeof(__pyx_k_Argument_h_must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_high_must_be_width, __pyx_k_Argument_high_must_be_width, sizeof(__pyx_k_Argument_high_must_be_width), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_hsl_model__must_be_a_n, __pyx_k_Argument_hsl_model__must_be_a_n, sizeof(__pyx_k_Argument_hsl_model__must_be_a_n), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_image_must_be_a_valid_S, __pyx_k_Argument_image_must_be_a_valid_S, sizeof(__pyx_k_Argument_image_must_be_a_valid_S), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_kernel_size__cannot_be, __pyx_k_Argument_kernel_size__cannot_be, sizeof(__pyx_k_Argument_kernel_size__cannot_be), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_lens_model__must_be_a, __pyx_k_Argument_lens_model__must_be_a, sizeof(__pyx_k_Argument_lens_model__must_be_a), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_light__must_be_a_float, __pyx_k_Argument_light__must_be_a_float, sizeof(__pyx_k_Argument_light__must_be_a_float), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_low__must_be_high, __pyx_k_Argument_low__must_be_high, sizeof(__pyx_k_Argument_low__must_be_high), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_mask__must_be_a_numpy, __pyx_k_Argument_mask__must_be_a_numpy, sizeof(__pyx_k_Argument_mask__must_be_a_numpy), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_mask_must_be_a_numpy_a, __pyx_k_Argument_mask_must_be_a_numpy_a, sizeof(__pyx_k_Argument_mask_must_be_a_numpy_a), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_offset__must_be_an_int, __pyx_k_Argument_offset__must_be_an_int, sizeof(__pyx_k_Argument_offset__must_be_an_int), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_previous_must_be_a_num, __pyx_k_Argument_previous_must_be_a_num, sizeof(__pyx_k_Argument_previous_must_be_a_num), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_rain_fisheye_model_mus, __pyx_k_Argument_rain_fisheye_model_mus, sizeof(__pyx_k_Argument_rain_fisheye_model_mus), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_reduce_factor__must_be, __pyx_k_Argument_reduce_factor__must_be, sizeof(__pyx_k_Argument_reduce_factor__must_be), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_reduce_factor_must_be_i, __pyx_k_Argument_reduce_factor_must_be_i, sizeof(__pyx_k_Argument_reduce_factor_must_be_i), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_rgb_model__must_be_a_n, __pyx_k_Argument_rgb_model__must_be_a_n, sizeof(__pyx_k_Argument_rgb_model__must_be_a_n), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_screen_h2_must_be_0, __pyx_k_Argument_screen_h2_must_be_0, sizeof(__pyx_k_Argument_screen_h2_must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_screen_height_must_be_0, __pyx_k_Argument_screen_height_must_be_0, sizeof(__pyx_k_Argument_screen_height_must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_screen_w2_must_be_0, __pyx_k_Argument_screen_w2_must_be_0, sizeof(__pyx_k_Argument_screen_w2_must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_screen_width_must_be_0, __pyx_k_Argument_screen_width_must_be_0, sizeof(__pyx_k_Argument_screen_width_must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_shift__must_be_in_rang, __pyx_k_Argument_shift__must_be_in_rang, sizeof(__pyx_k_Argument_shift__must_be_in_rang), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_shift__must_be_in_range, __pyx_k_Argument_shift__must_be_in_range, sizeof(__pyx_k_Argument_shift__must_be_in_range), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_shift_must_be_in_range, __pyx_k_Argument_shift_must_be_in_range, sizeof(__pyx_k_Argument_shift_must_be_in_range), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_sigma_i_must_be_a_valid, __pyx_k_Argument_sigma_i_must_be_a_valid, sizeof(__pyx_k_Argument_sigma_i_must_be_a_valid), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_sigma_s_must_be_a_valid, __pyx_k_Argument_sigma_s_must_be_a_valid, sizeof(__pyx_k_Argument_sigma_s_must_be_a_valid), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_size_must_be_0, __pyx_k_Argument_size_must_be_0, sizeof(__pyx_k_Argument_size_must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_source__must_be_a_pygam, __pyx_k_Argument_source__must_be_a_pygam, sizeof(__pyx_k_Argument_source__must_be_a_pygam), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_space_cannot_be_0, __pyx_k_Argument_space_cannot_be_0, sizeof(__pyx_k_Argument_space_cannot_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_surface__must_be_a_Surf, __pyx_k_Argument_surface__must_be_a_Surf, sizeof(__pyx_k_Argument_surface__must_be_a_Surf), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_surface__must_be_a_pyg, __pyx_k_Argument_surface__must_be_a_pyg, sizeof(__pyx_k_Argument_surface__must_be_a_pyg), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_surface__must_be_a_pyga, __pyx_k_Argument_surface__must_be_a_pyga, sizeof(__pyx_k_Argument_surface__must_be_a_pyga), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_surface__must_be_a_vali, __pyx_k_Argument_surface__must_be_a_vali, sizeof(__pyx_k_Argument_surface__must_be_a_vali), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_t__must_be_0_got_s, __pyx_k_Argument_t__must_be_0_got_s, sizeof(__pyx_k_Argument_t__must_be_0_got_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_threshold_must_be_an_i, __pyx_k_Argument_threshold_must_be_an_i, sizeof(__pyx_k_Argument_threshold_must_be_an_i), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_threshold_must_be_in_ra, __pyx_k_Argument_threshold_must_be_in_ra, sizeof(__pyx_k_Argument_threshold_must_be_in_ra), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_w2_cannot_be_0, __pyx_k_Argument_w2_cannot_be_0, sizeof(__pyx_k_Argument_w2_cannot_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_w_must_be_0, __pyx_k_Argument_w_must_be_0, sizeof(__pyx_k_Argument_w_must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_width_or_height_cannot, __pyx_k_Argument_width_or_height_cannot, sizeof(__pyx_k_Argument_width_or_height_cannot), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_width_should_be_0_got_s, __pyx_k_Argument_width_should_be_0_got_s, sizeof(__pyx_k_Argument_width_should_be_0_got_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Array_sizes_mismatch_previous_w, __pyx_k_Array_sizes_mismatch_previous_w, sizeof(__pyx_k_Array_sizes_mismatch_previous_w), 0, 0, 1, 0},
  {&__pyx_kp_s_Assets_space1_jpg, __pyx_k_Assets_space1_jpg, sizeof(__pyx_k_Assets_space1_jpg), 0, 0, 1, 0},
  {&__pyx_n_s_BLEND_RGB_ADD, __pyx_k_BLEND_RGB_ADD, sizeof(__pyx_k_BLEND_RGB_ADD), 0, 0, 1, 1},
  {&__pyx_n_s_BLEND_RGB_MAX, __pyx_k_BLEND_RGB_MAX, sizeof(__pyx_k_BLEND_RGB_MAX), 0, 0, 1, 1},
  {&__pyx_n_s_BLEND_RGB_MIN, __pyx_k_BLEND_RGB_MIN, sizeof(__pyx_k_BLEND_RGB_MIN), 0, 0, 1, 1},
  {&__pyx_n_s_BLUEMAP, __pyx_k_BLUEMAP, sizeof(__pyx_k_BLUEMAP), 0, 0, 1, 1},
  {&__pyx_n_s_BufferProxy, __pyx_k_BufferProxy, sizeof(__pyx_k_BufferProxy), 0, 0, 1, 1},
  {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
  {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  {&__pyx_n_s_COLORS_CPC64, __pyx_k_COLORS_CPC64, sizeof(__pyx_k_COLORS_CPC64), 0, 0, 1, 1},
  {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_reference_destination_pi, __pyx_k_Cannot_reference_destination_pi, sizeof(__pyx_k_Cannot_reference_destination_pi), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_reference_source_pixels, __pyx_k_Cannot_reference_source_pixels, sizeof(__pyx_k_Cannot_reference_source_pixels), 0, 0, 1, 0},
  {&__pyx_kp_s_Cloud_array_size_mismatch_the_te, __pyx_k_Cloud_array_size_mismatch_the_te, sizeof(__pyx_k_Cloud_array_size_mismatch_the_te), 0, 0, 1, 0},
  {&__pyx_n_s_Color, __pyx_k_Color, sizeof(__pyx_k_Color), 0, 0, 1, 1},
  {&__pyx_n_s_DEG_TO_RAD, __pyx_k_DEG_TO_RAD, sizeof(__pyx_k_DEG_TO_RAD), 0, 0, 1, 1},
  {&__pyx_kp_s_Deprecated_version_use_shader_br, __pyx_k_Deprecated_version_use_shader_br, sizeof(__pyx_k_Deprecated_version_use_shader_br), 0, 0, 1, 0},
  {&__pyx_n_s_DeprecationWarning, __pyx_k_DeprecationWarning, sizeof(__pyx_k_DeprecationWarning), 0, 0, 1, 1},
  {&__pyx_n_s_EMBOSS_KERNEL, __pyx_k_EMBOSS_KERNEL, sizeof(__pyx_k_EMBOSS_KERNEL), 0, 0, 1, 1},
  {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
  {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
  {&__pyx_kp_s_Fire_array_size_mismatch_the_tex, __pyx_k_Fire_array_size_mismatch_the_tex, sizeof(__pyx_k_Fire_array_size_mismatch_the_tex), 0, 0, 1, 0},
  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
  {&__pyx_n_s_FutureWarning, __pyx_k_FutureWarning, sizeof(__pyx_k_FutureWarning), 0, 0, 1, 1},
  {&__pyx_n_s_HEATMAP, __pyx_k_HEATMAP, sizeof(__pyx_k_HEATMAP), 0, 0, 1, 1},
  {&__pyx_n_s_HWACCEL, __pyx_k_HWACCEL, sizeof(__pyx_k_HWACCEL), 0, 0, 1, 1},
  {&__pyx_n_s_HWSURFACE, __pyx_k_HWSURFACE, sizeof(__pyx_k_HWSURFACE), 0, 0, 1, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_n_s_ImportWarning, __pyx_k_ImportWarning, sizeof(__pyx_k_ImportWarning), 0, 0, 1, 1},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
  {&__pyx_kp_s_Incorrect_value_for_argument_pe, __pyx_k_Incorrect_value_for_argument_pe, sizeof(__pyx_k_Incorrect_value_for_argument_pe), 0, 0, 1, 0},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
  {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
  {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
  {&__pyx_n_s_K_SPACE, __pyx_k_K_SPACE, sizeof(__pyx_k_K_SPACE), 0, 0, 1, 1},
  {&__pyx_n_s_M_2PI, __pyx_k_M_2PI, sizeof(__pyx_k_M_2PI), 0, 0, 1, 1},
  {&__pyx_n_s_M_PI, __pyx_k_M_PI, sizeof(__pyx_k_M_PI), 0, 0, 1, 1},
  {&__pyx_n_s_M_PI2, __pyx_k_M_PI2, sizeof(__pyx_k_M_PI2), 0, 0, 1, 1},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
  {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
  {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_PygameShader_gaussianBlur5x5, __pyx_k_PygameShader_gaussianBlur5x5, sizeof(__pyx_k_PygameShader_gaussianBlur5x5), 0, 0, 1, 1},
  {&__pyx_kp_s_Pygame_library_is_missing_on_yo, __pyx_k_Pygame_library_is_missing_on_yo, sizeof(__pyx_k_Pygame_library_is_missing_on_yo), 0, 0, 1, 0},
  {&__pyx_n_s_QUIT, __pyx_k_QUIT, sizeof(__pyx_k_QUIT), 0, 0, 1, 1},
  {&__pyx_n_s_RAD_TO_DEG, __pyx_k_RAD_TO_DEG, sizeof(__pyx_k_RAD_TO_DEG), 0, 0, 1, 1},
  {&__pyx_n_s_REDMAP, __pyx_k_REDMAP, sizeof(__pyx_k_REDMAP), 0, 0, 1, 1},
  {&__pyx_n_s_RGB, __pyx_k_RGB, sizeof(__pyx_k_RGB), 0, 0, 1, 1},
  {&__pyx_n_s_RGBA, __pyx_k_RGBA, sizeof(__pyx_k_RGBA), 0, 0, 1, 1},
  {&__pyx_n_s_RLEACCEL, __pyx_k_RLEACCEL, sizeof(__pyx_k_RLEACCEL), 0, 0, 1, 1},
  {&__pyx_n_s_Rect, __pyx_k_Rect, sizeof(__pyx_k_Rect), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeWarning, __pyx_k_RuntimeWarning, sizeof(__pyx_k_RuntimeWarning), 0, 0, 1, 1},
  {&__pyx_n_s_SRCALPHA, __pyx_k_SRCALPHA, sizeof(__pyx_k_SRCALPHA), 0, 0, 1, 1},
  {&__pyx_n_s_STYLE_NORMAL, __pyx_k_STYLE_NORMAL, sizeof(__pyx_k_STYLE_NORMAL), 0, 0, 1, 1},
  {&__pyx_n_s_STYLE_STRONG, __pyx_k_STYLE_STRONG, sizeof(__pyx_k_STYLE_STRONG), 0, 0, 1, 1},
  {&__pyx_kp_s_Source_and_Destination_surfaces, __pyx_k_Source_and_Destination_surfaces, sizeof(__pyx_k_Source_and_Destination_surfaces), 0, 0, 1, 0},
  {&__pyx_n_s_Surface, __pyx_k_Surface, sizeof(__pyx_k_Surface), 0, 0, 1, 1},
  {&__pyx_kp_s_Surface_argument_has_incorrect_d, __pyx_k_Surface_argument_has_incorrect_d, sizeof(__pyx_k_Surface_argument_has_incorrect_d), 0, 0, 1, 0},
  {&__pyx_kp_s_Surface_size_and_mask_size_mism, __pyx_k_Surface_size_and_mask_size_mism, sizeof(__pyx_k_Surface_size_and_mask_size_mism), 0, 0, 1, 0},
  {&__pyx_kp_b_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 0, 0},
  {&__pyx_n_s_THREADS, __pyx_k_THREADS, sizeof(__pyx_k_THREADS), 0, 0, 1, 1},
  {&__pyx_kp_s_Texture_image_is_not_compatible, __pyx_k_Texture_image_is_not_compatible, sizeof(__pyx_k_Texture_image_is_not_compatible), 0, 0, 1, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
  {&__pyx_n_s_VERSION, __pyx_k_VERSION, sizeof(__pyx_k_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_Vector2, __pyx_k_Vector2, sizeof(__pyx_k_Vector2), 0, 0, 1, 1},
  {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
  {&__pyx_kp_b__50, __pyx_k__50, sizeof(__pyx_k__50), 0, 0, 0, 0},
  {&__pyx_kp_b__51, __pyx_k__51, sizeof(__pyx_k__51), 0, 0, 0, 0},
  {&__pyx_kp_b__52, __pyx_k__52, sizeof(__pyx_k__52), 0, 0, 0, 0},
  {&__pyx_kp_b__53, __pyx_k__53, sizeof(__pyx_k__53), 0, 0, 0, 0},
  {&__pyx_kp_u__54, __pyx_k__54, sizeof(__pyx_k__54), 0, 1, 0, 0},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_n_s_adjust_palette, __pyx_k_adjust_palette, sizeof(__pyx_k_adjust_palette), 0, 0, 1, 1},
  {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
  {&__pyx_n_s_amplitude, __pyx_k_amplitude, sizeof(__pyx_k_amplitude), 0, 0, 1, 1},
  {&__pyx_n_s_angles, __pyx_k_angles, sizeof(__pyx_k_angles), 0, 0, 1, 1},
  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  {&__pyx_n_s_array3d, __pyx_k_array3d, sizeof(__pyx_k_array3d), 0, 0, 1, 1},
  {&__pyx_n_s_array_2, __pyx_k_array_2, sizeof(__pyx_k_array_2), 0, 0, 1, 1},
  {&__pyx_n_s_array_alpha, __pyx_k_array_alpha, sizeof(__pyx_k_array_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_array_to_surface, __pyx_k_array_to_surface, sizeof(__pyx_k_array_to_surface), 0, 0, 1, 1},
  {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1},
  {&__pyx_n_s_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 0, 0, 1, 1},
  {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_b_2, __pyx_k_b_2, sizeof(__pyx_k_b_2), 0, 0, 1, 1},
  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  {&__pyx_n_s_blend, __pyx_k_blend, sizeof(__pyx_k_blend), 0, 0, 1, 1},
  {&__pyx_n_s_blit, __pyx_k_blit, sizeof(__pyx_k_blit), 0, 0, 1, 1},
  {&__pyx_n_s_blit_array, __pyx_k_blit_array, sizeof(__pyx_k_blit_array), 0, 0, 1, 1},
  {&__pyx_n_s_bloom, __pyx_k_bloom, sizeof(__pyx_k_bloom), 0, 0, 1, 1},
  {&__pyx_n_s_bloom_threshold, __pyx_k_bloom_threshold, sizeof(__pyx_k_bloom_threshold), 0, 0, 1, 1},
  {&__pyx_n_s_blue, __pyx_k_blue, sizeof(__pyx_k_blue), 0, 0, 1, 1},
  {&__pyx_n_s_blur, __pyx_k_blur, sizeof(__pyx_k_blur), 0, 0, 1, 1},
  {&__pyx_n_s_border, __pyx_k_border, sizeof(__pyx_k_border), 0, 0, 1, 1},
  {&__pyx_n_s_bpf_threshold, __pyx_k_bpf_threshold, sizeof(__pyx_k_bpf_threshold), 0, 0, 1, 1},
  {&__pyx_n_s_bpf_threshold_2, __pyx_k_bpf_threshold_2, sizeof(__pyx_k_bpf_threshold_2), 0, 0, 1, 1},
  {&__pyx_n_s_brightness, __pyx_k_brightness, sizeof(__pyx_k_brightness), 0, 0, 1, 1},
  {&__pyx_n_s_brightness_intensity, __pyx_k_brightness_intensity, sizeof(__pyx_k_brightness_intensity), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_s_c_2, __pyx_k_c_2, sizeof(__pyx_k_c_2), 0, 0, 1, 1},
  {&__pyx_n_u_c_2, __pyx_k_c_2, sizeof(__pyx_k_c_2), 0, 1, 0, 1},
  {&__pyx_n_s_canny_blur5x5_surface24_c, __pyx_k_canny_blur5x5_surface24_c, sizeof(__pyx_k_canny_blur5x5_surface24_c), 0, 0, 1, 1},
  {&__pyx_n_s_category, __pyx_k_category, sizeof(__pyx_k_category), 0, 0, 1, 1},
  {&__pyx_n_s_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_cloud, __pyx_k_cloud, sizeof(__pyx_k_cloud), 0, 0, 1, 1},
  {&__pyx_n_s_cloud_intensity, __pyx_k_cloud_intensity, sizeof(__pyx_k_cloud_intensity), 0, 0, 1, 1},
  {&__pyx_n_s_color, __pyx_k_color, sizeof(__pyx_k_color), 0, 0, 1, 1},
  {&__pyx_n_s_color_array, __pyx_k_color_array, sizeof(__pyx_k_color_array), 0, 0, 1, 1},
  {&__pyx_n_s_cols, __pyx_k_cols, sizeof(__pyx_k_cols), 0, 0, 1, 1},
  {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
  {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
  {&__pyx_n_s_convert, __pyx_k_convert, sizeof(__pyx_k_convert), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_current, __pyx_k_current, sizeof(__pyx_k_current), 0, 0, 1, 1},
  {&__pyx_n_s_degrees, __pyx_k_degrees, sizeof(__pyx_k_degrees), 0, 0, 1, 1},
  {&__pyx_n_s_dest_array, __pyx_k_dest_array, sizeof(__pyx_k_dest_array), 0, 0, 1, 1},
  {&__pyx_n_s_destination, __pyx_k_destination, sizeof(__pyx_k_destination), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_display_height, __pyx_k_display_height, sizeof(__pyx_k_display_height), 0, 0, 1, 1},
  {&__pyx_n_s_display_width, __pyx_k_display_width, sizeof(__pyx_k_display_width), 0, 0, 1, 1},
  {&__pyx_n_s_distances, __pyx_k_distances, sizeof(__pyx_k_distances), 0, 0, 1, 1},
  {&__pyx_n_s_divide, __pyx_k_divide, sizeof(__pyx_k_divide), 0, 0, 1, 1},
  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
  {&__pyx_n_s_duration, __pyx_k_duration, sizeof(__pyx_k_duration), 0, 0, 1, 1},
  {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_factor, __pyx_k_factor, sizeof(__pyx_k_factor), 0, 0, 1, 1},
  {&__pyx_n_s_factor_2, __pyx_k_factor_2, sizeof(__pyx_k_factor_2), 0, 0, 1, 1},
  {&__pyx_n_s_fast, __pyx_k_fast, sizeof(__pyx_k_fast), 0, 0, 1, 1},
  {&__pyx_n_s_fast_2, __pyx_k_fast_2, sizeof(__pyx_k_fast_2), 0, 0, 1, 1},
  {&__pyx_n_s_fast_bloom, __pyx_k_fast_bloom, sizeof(__pyx_k_fast_bloom), 0, 0, 1, 1},
  {&__pyx_n_s_fh, __pyx_k_fh, sizeof(__pyx_k_fh), 0, 0, 1, 1},
  {&__pyx_n_s_filterwarnings, __pyx_k_filterwarnings, sizeof(__pyx_k_filterwarnings), 0, 0, 1, 1},
  {&__pyx_n_s_fire, __pyx_k_fire, sizeof(__pyx_k_fire), 0, 0, 1, 1},
  {&__pyx_n_s_fire_2, __pyx_k_fire_2, sizeof(__pyx_k_fire_2), 0, 0, 1, 1},
  {&__pyx_n_s_fire_intensity, __pyx_k_fire_intensity, sizeof(__pyx_k_fire_intensity), 0, 0, 1, 1},
  {&__pyx_n_s_fisheye_model, __pyx_k_fisheye_model, sizeof(__pyx_k_fisheye_model), 0, 0, 1, 1},
  {&__pyx_n_s_fl, __pyx_k_fl, sizeof(__pyx_k_fl), 0, 0, 1, 1},
  {&__pyx_n_s_flag, __pyx_k_flag, sizeof(__pyx_k_flag), 0, 0, 1, 1},
  {&__pyx_n_s_flag_2, __pyx_k_flag_2, sizeof(__pyx_k_flag_2), 0, 0, 1, 1},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
  {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
  {&__pyx_n_s_frame, __pyx_k_frame, sizeof(__pyx_k_frame), 0, 0, 1, 1},
  {&__pyx_n_s_frame_2, __pyx_k_frame_2, sizeof(__pyx_k_frame_2), 0, 0, 1, 1},
  {&__pyx_n_s_freetype, __pyx_k_freetype, sizeof(__pyx_k_freetype), 0, 0, 1, 1},
  {&__pyx_n_s_freq, __pyx_k_freq, sizeof(__pyx_k_freq), 0, 0, 1, 1},
  {&__pyx_n_s_frequency, __pyx_k_frequency, sizeof(__pyx_k_frequency), 0, 0, 1, 1},
  {&__pyx_n_s_frombuffer, __pyx_k_frombuffer, sizeof(__pyx_k_frombuffer), 0, 0, 1, 1},
  {&__pyx_n_s_fromstring, __pyx_k_fromstring, sizeof(__pyx_k_fromstring), 0, 0, 1, 1},
  {&__pyx_n_s_fs, __pyx_k_fs, sizeof(__pyx_k_fs), 0, 0, 1, 1},
  {&__pyx_n_s_g, __pyx_k_g, sizeof(__pyx_k_g), 0, 0, 1, 1},
  {&__pyx_n_s_gamma, __pyx_k_gamma, sizeof(__pyx_k_gamma), 0, 0, 1, 1},
  {&__pyx_n_s_get_bitsize, __pyx_k_get_bitsize, sizeof(__pyx_k_get_bitsize), 0, 0, 1, 1},
  {&__pyx_n_s_get_buffer, __pyx_k_get_buffer, sizeof(__pyx_k_get_buffer), 0, 0, 1, 1},
  {&__pyx_n_s_get_bytesize, __pyx_k_get_bytesize, sizeof(__pyx_k_get_bytesize), 0, 0, 1, 1},
  {&__pyx_n_s_get_height, __pyx_k_get_height, sizeof(__pyx_k_get_height), 0, 0, 1, 1},
  {&__pyx_n_s_get_size, __pyx_k_get_size, sizeof(__pyx_k_get_size), 0, 0, 1, 1},
  {&__pyx_n_s_get_view, __pyx_k_get_view, sizeof(__pyx_k_get_view), 0, 0, 1, 1},
  {&__pyx_n_s_get_width, __pyx_k_get_width, sizeof(__pyx_k_get_width), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
  {&__pyx_n_s_green, __pyx_k_green, sizeof(__pyx_k_green), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_n_s_height, __pyx_k_height, sizeof(__pyx_k_height), 0, 0, 1, 1},
  {&__pyx_n_s_height_2, __pyx_k_height_2, sizeof(__pyx_k_height_2), 0, 0, 1, 1},
  {&__pyx_n_s_high, __pyx_k_high, sizeof(__pyx_k_high), 0, 0, 1, 1},
  {&__pyx_n_s_hsl, __pyx_k_hsl, sizeof(__pyx_k_hsl), 0, 0, 1, 1},
  {&__pyx_n_s_hsl_model, __pyx_k_hsl_model, sizeof(__pyx_k_hsl_model), 0, 0, 1, 1},
  {&__pyx_n_s_hue, __pyx_k_hue, sizeof(__pyx_k_hue), 0, 0, 1, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_s_ignore, __pyx_k_ignore, sizeof(__pyx_k_ignore), 0, 0, 1, 1},
  {&__pyx_n_s_image, __pyx_k_image, sizeof(__pyx_k_image), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_int16, __pyx_k_int16, sizeof(__pyx_k_int16), 0, 0, 1, 1},
  {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
  {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1},
  {&__pyx_n_s_inv_colormap, __pyx_k_inv_colormap, sizeof(__pyx_k_inv_colormap), 0, 0, 1, 1},
  {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_kernel_size, __pyx_k_kernel_size, sizeof(__pyx_k_kernel_size), 0, 0, 1, 1},
  {&__pyx_n_s_lens_model, __pyx_k_lens_model, sizeof(__pyx_k_lens_model), 0, 0, 1, 1},
  {&__pyx_n_s_light, __pyx_k_light, sizeof(__pyx_k_light), 0, 0, 1, 1},
  {&__pyx_n_s_linspace, __pyx_k_linspace, sizeof(__pyx_k_linspace), 0, 0, 1, 1},
  {&__pyx_n_s_load, __pyx_k_load, sizeof(__pyx_k_load), 0, 0, 1, 1},
  {&__pyx_n_s_low, __pyx_k_low, sizeof(__pyx_k_low), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_make_surface, __pyx_k_make_surface, sizeof(__pyx_k_make_surface), 0, 0, 1, 1},
  {&__pyx_n_s_mask, __pyx_k_mask, sizeof(__pyx_k_mask), 0, 0, 1, 1},
  {&__pyx_n_s_mask_2, __pyx_k_mask_2, sizeof(__pyx_k_mask_2), 0, 0, 1, 1},
  {&__pyx_n_s_median_kernel, __pyx_k_median_kernel, sizeof(__pyx_k_median_kernel), 0, 0, 1, 1},
  {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_mu, __pyx_k_mu, sizeof(__pyx_k_mu), 0, 0, 1, 1},
  {&__pyx_n_s_multiply, __pyx_k_multiply, sizeof(__pyx_k_multiply), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_ndarray, __pyx_k_ndarray, sizeof(__pyx_k_ndarray), 0, 0, 1, 1},
  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
  {&__pyx_kp_s_numpy_library_is_missing_on_you, __pyx_k_numpy_library_is_missing_on_you, sizeof(__pyx_k_numpy_library_is_missing_on_you), 0, 0, 1, 0},
  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
  {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
  {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
  {&__pyx_n_s_palette, __pyx_k_palette, sizeof(__pyx_k_palette), 0, 0, 1, 1},
  {&__pyx_n_s_palette_2, __pyx_k_palette_2, sizeof(__pyx_k_palette_2), 0, 0, 1, 1},
  {&__pyx_n_s_perc, __pyx_k_perc, sizeof(__pyx_k_perc), 0, 0, 1, 1},
  {&__pyx_kp_s_perc__variable_must_be_in_range, __pyx_k_perc__variable_must_be_in_range, sizeof(__pyx_k_perc__variable_must_be_in_range), 0, 0, 1, 0},
  {&__pyx_n_s_percentage, __pyx_k_percentage, sizeof(__pyx_k_percentage), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_pixels3d, __pyx_k_pixels3d, sizeof(__pyx_k_pixels3d), 0, 0, 1, 1},
  {&__pyx_n_s_pixels_alpha, __pyx_k_pixels_alpha, sizeof(__pyx_k_pixels_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_pixels_blue, __pyx_k_pixels_blue, sizeof(__pyx_k_pixels_blue), 0, 0, 1, 1},
  {&__pyx_n_s_pixels_green, __pyx_k_pixels_green, sizeof(__pyx_k_pixels_green), 0, 0, 1, 1},
  {&__pyx_n_s_pixels_red, __pyx_k_pixels_red, sizeof(__pyx_k_pixels_red), 0, 0, 1, 1},
  {&__pyx_n_s_previous, __pyx_k_previous, sizeof(__pyx_k_previous), 0, 0, 1, 1},
  {&__pyx_n_s_pygame, __pyx_k_pygame, sizeof(__pyx_k_pygame), 0, 0, 1, 1},
  {&__pyx_n_s_pygame__freetype, __pyx_k_pygame__freetype, sizeof(__pyx_k_pygame__freetype), 0, 0, 1, 1},
  {&__pyx_n_s_pygame_image, __pyx_k_pygame_image, sizeof(__pyx_k_pygame_image), 0, 0, 1, 1},
  {&__pyx_n_s_pygame_math, __pyx_k_pygame_math, sizeof(__pyx_k_pygame_math), 0, 0, 1, 1},
  {&__pyx_n_s_pygame_pixelcopy, __pyx_k_pygame_pixelcopy, sizeof(__pyx_k_pygame_pixelcopy), 0, 0, 1, 1},
  {&__pyx_n_s_pygame_surfarray, __pyx_k_pygame_surfarray, sizeof(__pyx_k_pygame_surfarray), 0, 0, 1, 1},
  {&__pyx_n_s_pygame_transform, __pyx_k_pygame_transform, sizeof(__pyx_k_pygame_transform), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_capi, __pyx_k_pyx_capi, sizeof(__pyx_k_pyx_capi), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_n_s_rad, __pyx_k_rad, sizeof(__pyx_k_rad), 0, 0, 1, 1},
  {&__pyx_n_s_rad1, __pyx_k_rad1, sizeof(__pyx_k_rad1), 0, 0, 1, 1},
  {&__pyx_n_s_rain_fisheye_model, __pyx_k_rain_fisheye_model, sizeof(__pyx_k_rain_fisheye_model), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_red, __pyx_k_red, sizeof(__pyx_k_red), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_factor, __pyx_k_reduce_factor, sizeof(__pyx_k_reduce_factor), 0, 0, 1, 1},
  {&__pyx_n_s_rgb, __pyx_k_rgb, sizeof(__pyx_k_rgb), 0, 0, 1, 1},
  {&__pyx_n_s_rgb_model, __pyx_k_rgb_model, sizeof(__pyx_k_rgb_model), 0, 0, 1, 1},
  {&__pyx_n_s_rgb_to_hsl_model, __pyx_k_rgb_to_hsl_model, sizeof(__pyx_k_rgb_to_hsl_model), 0, 0, 1, 1},
  {&__pyx_n_s_rotate, __pyx_k_rotate, sizeof(__pyx_k_rotate), 0, 0, 1, 1},
  {&__pyx_n_s_rows, __pyx_k_rows, sizeof(__pyx_k_rows), 0, 0, 1, 1},
  {&__pyx_kp_u_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 1, 0, 0},
  {&__pyx_n_s_sat, __pyx_k_sat, sizeof(__pyx_k_sat), 0, 0, 1, 1},
  {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1},
  {&__pyx_n_s_scale2x, __pyx_k_scale2x, sizeof(__pyx_k_scale2x), 0, 0, 1, 1},
  {&__pyx_n_s_scr_data, __pyx_k_scr_data, sizeof(__pyx_k_scr_data), 0, 0, 1, 1},
  {&__pyx_n_s_screen_h2, __pyx_k_screen_h2, sizeof(__pyx_k_screen_h2), 0, 0, 1, 1},
  {&__pyx_n_s_screen_height, __pyx_k_screen_height, sizeof(__pyx_k_screen_height), 0, 0, 1, 1},
  {&__pyx_n_s_screen_w2, __pyx_k_screen_w2, sizeof(__pyx_k_screen_w2), 0, 0, 1, 1},
  {&__pyx_n_s_screen_width, __pyx_k_screen_width, sizeof(__pyx_k_screen_width), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_shades, __pyx_k_shades, sizeof(__pyx_k_shades), 0, 0, 1, 1},
  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  {&__pyx_n_s_shift, __pyx_k_shift, sizeof(__pyx_k_shift), 0, 0, 1, 1},
  {&__pyx_n_s_sigma, __pyx_k_sigma, sizeof(__pyx_k_sigma), 0, 0, 1, 1},
  {&__pyx_n_s_sigma_i, __pyx_k_sigma_i, sizeof(__pyx_k_sigma_i), 0, 0, 1, 1},
  {&__pyx_n_s_sigma_s, __pyx_k_sigma_s, sizeof(__pyx_k_sigma_s), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_size_2, __pyx_k_size_2, sizeof(__pyx_k_size_2), 0, 0, 1, 1},
  {&__pyx_n_s_smooth, __pyx_k_smooth, sizeof(__pyx_k_smooth), 0, 0, 1, 1},
  {&__pyx_n_s_smoothscale, __pyx_k_smoothscale, sizeof(__pyx_k_smoothscale), 0, 0, 1, 1},
  {&__pyx_n_s_sobel_threshold, __pyx_k_sobel_threshold, sizeof(__pyx_k_sobel_threshold), 0, 0, 1, 1},
  {&__pyx_n_s_sobel_threshold_2, __pyx_k_sobel_threshold_2, sizeof(__pyx_k_sobel_threshold_2), 0, 0, 1, 1},
  {&__pyx_n_s_source, __pyx_k_source, sizeof(__pyx_k_source), 0, 0, 1, 1},
  {&__pyx_n_s_space, __pyx_k_space, sizeof(__pyx_k_space), 0, 0, 1, 1},
  {&__pyx_n_s_special_flags, __pyx_k_special_flags, sizeof(__pyx_k_special_flags), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
  {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
  {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_surface, __pyx_k_surface, sizeof(__pyx_k_surface), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_t_2, __pyx_k_t_2, sizeof(__pyx_k_t_2), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_threshold, __pyx_k_threshold, sizeof(__pyx_k_threshold), 0, 0, 1, 1},
  {&__pyx_n_s_threshold_2, __pyx_k_threshold_2, sizeof(__pyx_k_threshold_2), 0, 0, 1, 1},
  {&__pyx_n_s_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 0, 0, 1, 1},
  {&__pyx_n_s_transpose, __pyx_k_transpose, sizeof(__pyx_k_transpose), 0, 0, 1, 1},
  {&__pyx_n_s_transpose_2, __pyx_k_transpose_2, sizeof(__pyx_k_transpose_2), 0, 0, 1, 1},
  {&__pyx_n_s_uint, __pyx_k_uint, sizeof(__pyx_k_uint), 0, 0, 1, 1},
  {&__pyx_n_s_uint16, __pyx_k_uint16, sizeof(__pyx_k_uint16), 0, 0, 1, 1},
  {&__pyx_n_s_uint32, __pyx_k_uint32, sizeof(__pyx_k_uint32), 0, 0, 1, 1},
  {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1},
  {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
  {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
  {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
  {&__pyx_n_s_wavelength, __pyx_k_wavelength, sizeof(__pyx_k_wavelength), 0, 0, 1, 1},
  {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1},
  {&__pyx_n_s_width_2, __pyx_k_width_2, sizeof(__pyx_k_width_2), 0, 0, 1, 1},
  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_FutureWarning = __Pyx_GetBuiltinName(__pyx_n_s_FutureWarning); if (!__pyx_builtin_FutureWarning) __PYX_ERR(0, 37, __pyx_L1_error)
  __pyx_builtin_RuntimeWarning = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeWarning); if (!__pyx_builtin_RuntimeWarning) __PYX_ERR(0, 38, __pyx_L1_error)
  __pyx_builtin_ImportWarning = __Pyx_GetBuiltinName(__pyx_n_s_ImportWarning); if (!__pyx_builtin_ImportWarning) __PYX_ERR(0, 39, __pyx_L1_error)
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 84, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 177, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 393, __pyx_L1_error)
  __pyx_builtin_DeprecationWarning = __Pyx_GetBuiltinName(__pyx_n_s_DeprecationWarning); if (!__pyx_builtin_DeprecationWarning) __PYX_ERR(1, 963, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(1, 2094, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(2, 777, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(3, 148, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(3, 151, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(3, 2, __pyx_L1_error)
  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(3, 404, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(3, 613, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(3, 832, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "PygameShader/shader.pyx":393
 * 
 *     if kernel_size_ <= 0:
 *         raise ValueError('\nArgument kernel_size_ cannot be <= 0')             # <<<<<<<<<<<<<<
 *     if not 0 < reduce_factor_ < 9:
 *         raise ValueError('\nArgument reduce_factor_ must be in range [1 ... 8] ')
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Argument_kernel_size__cannot_be); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "PygameShader/shader.pyx":395
 *         raise ValueError('\nArgument kernel_size_ cannot be <= 0')
 *     if not 0 < reduce_factor_ < 9:
 *         raise ValueError('\nArgument reduce_factor_ must be in range [1 ... 8] ')             # <<<<<<<<<<<<<<
 * 
 *     if fast_:
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Argument_reduce_factor__must_be); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "PygameShader/shader.pyx":873
 *         object surface_,
 *         float shift_,
 *         color_=(0, 0, 0)             # <<<<<<<<<<<<<<
 * ):
 *     """
 */
  __pyx_tuple__9 = PyTuple_Pack(3, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "PygameShader/shader.pyx":962
 *         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)
 * 
 *     warnings.warn("Deprecated version, use shader_brightness_24_inplace (fastest version)",             # <<<<<<<<<<<<<<
 *                   DeprecationWarning)
 *     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"
 */
  __pyx_tuple__10 = PyTuple_Pack(2, __pyx_kp_s_Deprecated_version_use_shader_br, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "PygameShader/shader.pyx":1402
 *     shader_bloom_effect_array24_c(surface_, bloom_threshold, fast_=True)
 *     heatmap_convert(surface_, inv_colormap)
 *     surface_.blit(surface_copy, (0, 0), special_flags=blend)             # <<<<<<<<<<<<<<
 * 
 *     return surface_.convert()
 */
  __pyx_tuple__12 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 1402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "PygameShader/shader.pyx":1509
 *         object surface_                   = None,
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),             # <<<<<<<<<<<<<<
 *         bint transpose_                   = False,
 *         bint border_                      = False,
 */
  __pyx_tuple__13 = PyTuple_Pack(3, __pyx_int_10, __pyx_int_80, __pyx_float_1_8); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 1509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);
  __pyx_tuple__14 = PyTuple_Pack(3, __pyx_int_10, __pyx_int_80, __pyx_float_1_8); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 1509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "PygameShader/shader.pyx":2203
 *     # todo percentage of pixelation
 *     w, h = surface_.get_size()
 *     cdef object small = smoothscale(surface_, (32, 32))             # <<<<<<<<<<<<<<
 *     return scale(small, (w, h))
 * 
 */
  __pyx_tuple__16 = PyTuple_Pack(2, __pyx_int_32, __pyx_int_32); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 2203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "PygameShader/shader.pyx":2440
 * 
 *     except (pygame.error, ValueError):
 *         raise ValueError('\nTexture/image is not compatible.')             # <<<<<<<<<<<<<<
 * 
 *     convert_27colors_c(array_)
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Texture_image_is_not_compatible); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 2440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "PygameShader/shader.pyx":4176
 *     :return: Numpy.ndarray shape (r, g, b, 3) type float
 *     """
 *     cdef float [:, :, :, ::1] rgb_to_hsl = numpy.empty((256, 256, 256, 3), float32)             # <<<<<<<<<<<<<<
 *     cdef hsl hsl_
 *     cdef int r, g, b
 */
  __pyx_tuple__22 = PyTuple_Pack(4, __pyx_int_256, __pyx_int_256, __pyx_int_256, __pyx_int_3); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 4176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "PygameShader/shader.pyx":6691
 *         object surface_                   = None,
 *         bint adjust_palette_              = False,
 *         tuple hsl_                        = (10, 80, 1.8),             # <<<<<<<<<<<<<<
 *         bint transpose_                   = False,
 *         bint border_                      = False,
 */
  __pyx_tuple__23 = PyTuple_Pack(3, __pyx_int_10, __pyx_int_80, __pyx_float_1_8); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 6691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "PygameShader/shader.pyx":6914
 * 
 *     cdef int f_height, f_width
 *     f_height, f_width = (<object>fire_).shape[:2]             # <<<<<<<<<<<<<<
 * 
 *     assert f_width >= w4 or f_height >= h4,\
 */
  __pyx_slice__24 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__24)) __PYX_ERR(1, 6914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__24);
  __Pyx_GIVEREF(__pyx_slice__24);

  /* "PygameShader/shader.pyx":6958
 * 
 *     if transpose_:
 *         rgb_array_ = rgb_array_.transpose(1, 0, 2)             # <<<<<<<<<<<<<<
 *         fire_surface_smallest = rotate(fire_surface_smallest, 90)
 * 
 */
  __pyx_tuple__25 = PyTuple_Pack(3, __pyx_int_1, __pyx_int_0, __pyx_int_2); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 6958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "PygameShader/shader.pyx":8089
 *         rgb_color_int rgb_c
 *         unsigned char [:, :, :] spectrum_array =\
 *             numpy.empty((370, 1, 3), numpy.uint8)             # <<<<<<<<<<<<<<
 *         object surface
 * 
 */
  __pyx_tuple__26 = PyTuple_Pack(3, __pyx_int_370, __pyx_int_1, __pyx_int_3); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 8089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":777
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":781
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":801
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":959
 *         __pyx_import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "../../AppData/Local/Programs/Python/Python36/lib/site-packages/numpy/__init__.pxd":965
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "View.MemoryView":133
 * 
 *         if not self.ndim:
 *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(3, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "View.MemoryView":136
 * 
 *         if itemsize <= 0:
 *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(3, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "View.MemoryView":148
 * 
 *         if not self._shape:
 *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(3, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "View.MemoryView":176
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
 * 
 *             if self.dtype_is_object:
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(3, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "View.MemoryView":192
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(3, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(3, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "View.MemoryView":418
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:
 *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(3, 418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "View.MemoryView":495
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(3, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "View.MemoryView":520
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_ND:
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(3, 520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "View.MemoryView":570
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(3, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "View.MemoryView":577
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 */
  __pyx_tuple__43 = PyTuple_New(1); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(3, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_tuple__43, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(3, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "View.MemoryView":682
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             else:
 */
  __pyx_slice__46 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__46)) __PYX_ERR(3, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__46);
  __Pyx_GIVEREF(__pyx_slice__46);

  /* "View.MemoryView":703
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(3, 703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(3, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "PygameShader/shader.pyx":76
 * import warnings
 * 
 * warnings.filterwarnings("ignore", category=FutureWarning)             # <<<<<<<<<<<<<<
 * warnings.filterwarnings("ignore", category=RuntimeWarning)
 * warnings.filterwarnings("ignore", category=ImportWarning)
 */
  __pyx_tuple__55 = PyTuple_Pack(1, __pyx_n_s_ignore); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);

  /* "PygameShader/shader.pyx":85
 *         ascontiguousarray, zeros, uint16, uint32, int32, int8
 * except ImportError:
 *     raise ImportError("\n<numpy> library is missing on your system."             # <<<<<<<<<<<<<<
 *           "\nTry: \n   C:\\pip install numpy on a window command prompt.")
 * 
 */
  __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_numpy_library_is_missing_on_you); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(1, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "PygameShader/shader.pyx":114
 * 
 * except ImportError:
 *     raise ImportError("\n<Pygame> library is missing on your system."             # <<<<<<<<<<<<<<
 *           "\nTry: \n   C:\\pip install pygame on a window command prompt.")
 * 
 */
  __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_Pygame_library_is_missing_on_yo); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "PygameShader/shader.pyx":5019
 * 
 * 
 * cdef unsigned int [:, :, ::1] IMAGE_FISHEYE_MODEL = numpy.zeros((800, 1024, 2), uint32)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_tuple__58 = PyTuple_Pack(3, __pyx_int_800, __pyx_int_1024, __pyx_int_2); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(1, 5019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "PygameShader/shader.pyx":5945
 * cdef float f_map = (<float>750.0 - <float>380.0 -<float>1.0) / (<float>255.0 * <float>3.0)
 * 
 * cdef unsigned char[:, ::1] heatmap_array = numpy.zeros((750 - 380, 3), numpy.uint8)             # <<<<<<<<<<<<<<
 * cdef tuple t
 * i = 0
 */
  __pyx_tuple__59 = PyTuple_Pack(2, __pyx_int_370, __pyx_int_3); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 5945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "PygameShader/shader.pyx":6046
 * cdef float f_bluemap = (<float>495.0 - <float>450.0 - <float>1.0) / (<float>255.0 * <float>3.0)
 * 
 * cdef unsigned char[:, ::1] bluemap_array = numpy.zeros((495 - 450, 3), numpy.uint8)             # <<<<<<<<<<<<<<
 * 
 * i = 0
 */
  __pyx_tuple__60 = PyTuple_Pack(2, __pyx_int_45, __pyx_int_3); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(1, 6046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "PygameShader/shader.pyx":6131
 * cdef float f_redmap = (<float>750.0 - <float>620.0 - <float>1.0) / (<float>255.0 * <float>3.0)
 * 
 * cdef unsigned char[:, ::1] redmap_array = numpy.zeros((750 - 620, 3), numpy.uint8)             # <<<<<<<<<<<<<<
 * 
 * i = 0
 */
  __pyx_tuple__61 = PyTuple_Pack(2, __pyx_int_130, __pyx_int_3); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(1, 6131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "View.MemoryView":286
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
 */
  __pyx_tuple__62 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(3, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "View.MemoryView":287
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
 */
  __pyx_tuple__63 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(3, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);

  /* "View.MemoryView":288
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__64 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(3, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);

  /* "View.MemoryView":291
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
 */
  __pyx_tuple__65 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(3, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);

  /* "View.MemoryView":292
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__66 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(3, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__67 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  /* InitThreads.init */
  #ifdef WITH_THREAD
PyEval_InitThreads();
#endif

if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L1_error)

  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
  __pyx_float_1_8 = PyFloat_FromDouble(1.8); if (unlikely(!__pyx_float_1_8)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_float_255_0 = PyFloat_FromDouble(255.0); if (unlikely(!__pyx_float_255_0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_45 = PyInt_FromLong(45); if (unlikely(!__pyx_int_45)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_80 = PyInt_FromLong(80); if (unlikely(!__pyx_int_80)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_90 = PyInt_FromLong(90); if (unlikely(!__pyx_int_90)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_130 = PyInt_FromLong(130); if (unlikely(!__pyx_int_130)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_256 = PyInt_FromLong(256); if (unlikely(!__pyx_int_256)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_370 = PyInt_FromLong(370); if (unlikely(!__pyx_int_370)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_800 = PyInt_FromLong(800); if (unlikely(!__pyx_int_800)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_neg_4 = PyInt_FromLong(-4); if (unlikely(!__pyx_int_neg_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __pyx_v_12PygameShader_6shader_t = ((PyObject*)Py_None); Py_INCREF(Py_None);
  generic = Py_None; Py_INCREF(Py_None);
  strided = Py_None; Py_INCREF(Py_None);
  indirect = Py_None; Py_INCREF(Py_None);
  contiguous = Py_None; Py_INCREF(Py_None);
  indirect_contiguous = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  if (__Pyx_ExportVoidPtr(__pyx_n_s_M_PI, (void *)&__pyx_v_12PygameShader_6shader_M_PI, "float") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportVoidPtr(__pyx_n_s_M_PI2, (void *)&__pyx_v_12PygameShader_6shader_M_PI2, "float") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportVoidPtr(__pyx_n_s_M_2PI, (void *)&__pyx_v_12PygameShader_6shader_M_2PI, "float") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportVoidPtr(__pyx_n_s_RAD_TO_DEG, (void *)&__pyx_v_12PygameShader_6shader_RAD_TO_DEG, "float") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportVoidPtr(__pyx_n_s_DEG_TO_RAD, (void *)&__pyx_v_12PygameShader_6shader_DEG_TO_RAD, "float") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportVoidPtr(__pyx_n_s_THREADS, (void *)&__pyx_v_12PygameShader_6shader_THREADS, "int") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("rgb_to_bgr", (void (*)(void))__pyx_f_12PygameShader_6shader_rgb_to_bgr, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("rgb_to_brg", (void (*)(void))__pyx_f_12PygameShader_6shader_rgb_to_brg, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("greyscale", (void (*)(void))__pyx_f_12PygameShader_6shader_greyscale, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("sepia", (void (*)(void))__pyx_f_12PygameShader_6shader_sepia, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("median_fast", (void (*)(void))__pyx_f_12PygameShader_6shader_median_fast, "void (PyObject *, struct __pyx_opt_args_12PygameShader_6shader_median_fast *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("median", (void (*)(void))__pyx_f_12PygameShader_6shader_median, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("median_grayscale", (void (*)(void))__pyx_f_12PygameShader_6shader_median_grayscale, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median_grayscale *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("median_avg", (void (*)(void))__pyx_f_12PygameShader_6shader_median_avg, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median_avg *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("color_reduction", (void (*)(void))__pyx_f_12PygameShader_6shader_color_reduction, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_color_reduction *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("sobel", (void (*)(void))__pyx_f_12PygameShader_6shader_sobel, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_sobel *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("sobel_fast", (void (*)(void))__pyx_f_12PygameShader_6shader_sobel_fast, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_sobel_fast *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("invert", (void (*)(void))__pyx_f_12PygameShader_6shader_invert, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("hsl_effect", (void (*)(void))__pyx_f_12PygameShader_6shader_hsl_effect, "void (PyObject *, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("hsl_fast", (void (*)(void))__pyx_f_12PygameShader_6shader_hsl_fast, "void (PyObject *, float, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("blur", (void (*)(void))__pyx_f_12PygameShader_6shader_blur, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_blur *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("wave", (void (*)(void))__pyx_f_12PygameShader_6shader_wave, "void (PyObject *, float, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("swirl", (void (*)(void))__pyx_f_12PygameShader_6shader_swirl, "void (PyObject *, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("swirl2", (void (*)(void))__pyx_f_12PygameShader_6shader_swirl2, "void (PyObject *, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("plasma_config", (void (*)(void))__pyx_f_12PygameShader_6shader_plasma_config, "void (PyObject *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_plasma_config *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("plasma", (void (*)(void))__pyx_f_12PygameShader_6shader_plasma, "void (PyObject *, float, __Pyx_memviewslice, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("rgb_to_hsl_model", (void (*)(void))__pyx_f_12PygameShader_6shader_rgb_to_hsl_model, "__Pyx_memviewslice (int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("hsl_to_rgb_model", (void (*)(void))__pyx_f_12PygameShader_6shader_hsl_to_rgb_model, "__Pyx_memviewslice (int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("brightness", (void (*)(void))__pyx_f_12PygameShader_6shader_brightness, "void (PyObject *, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("brightness_exclude", (void (*)(void))__pyx_f_12PygameShader_6shader_brightness_exclude, "void (PyObject *, float, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_brightness_exclude *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("brightness_bpf", (void (*)(void))__pyx_f_12PygameShader_6shader_brightness_bpf, "void (PyObject *, float, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_brightness_bpf *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("brightness_model", (void (*)(void))__pyx_f_12PygameShader_6shader_brightness_model, "void (PyObject *, float, __Pyx_memviewslice, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("saturation", (void (*)(void))__pyx_f_12PygameShader_6shader_saturation, "void (PyObject *, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("heatwave_vertical", (void (*)(void))__pyx_f_12PygameShader_6shader_heatwave_vertical, "void (PyObject *, __Pyx_memviewslice, float, float, float, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("horizontal_glitch", (void (*)(void))__pyx_f_12PygameShader_6shader_horizontal_glitch, "void (PyObject *, float, float, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("bpf", (void (*)(void))__pyx_f_12PygameShader_6shader_bpf, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_bpf *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("bloom", (void (*)(void))__pyx_f_12PygameShader_6shader_bloom, "void (PyObject *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_bloom *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("fisheye_footprint", (void (*)(void))__pyx_f_12PygameShader_6shader_fisheye_footprint, "PyObject *(int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("fisheye", (void (*)(void))__pyx_f_12PygameShader_6shader_fisheye, "void (PyObject *, __Pyx_memviewslice, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("rain_footprint", (void (*)(void))__pyx_f_12PygameShader_6shader_rain_footprint, "PyObject *(int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("rain_fisheye", (void (*)(void))__pyx_f_12PygameShader_6shader_rain_fisheye, "void (PyObject *, __Pyx_memviewslice, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("tv_scan", (void (*)(void))__pyx_f_12PygameShader_6shader_tv_scan, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_tv_scan *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("rgb_split", (void (*)(void))__pyx_f_12PygameShader_6shader_rgb_split, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_rgb_split *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("rgb_split_clean", (void (*)(void))__pyx_f_12PygameShader_6shader_rgb_split_clean, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_rgb_split_clean *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("ripple", (void (*)(void))__pyx_f_12PygameShader_6shader_ripple, "PyObject *(int, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("tunnel_modeling32", (void (*)(void))__pyx_f_12PygameShader_6shader_tunnel_modeling32, "PyObject *(Py_ssize_t, Py_ssize_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("tunnel_render32", (void (*)(void))__pyx_f_12PygameShader_6shader_tunnel_render32, "PyObject *(int, Py_ssize_t, Py_ssize_t, int, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("heatmap", (void (*)(void))__pyx_f_12PygameShader_6shader_heatmap, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_heatmap *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("predator_vision", (void (*)(void))__pyx_f_12PygameShader_6shader_predator_vision, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_predator_vision *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("blood", (void (*)(void))__pyx_f_12PygameShader_6shader_blood, "PyObject *(PyObject *, __Pyx_memviewslice, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("make_palette", (void (*)(void))__pyx_f_12PygameShader_6shader_make_palette, "PyObject *(int, float, float, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("bluescale", (void (*)(void))__pyx_f_12PygameShader_6shader_bluescale, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("redscale", (void (*)(void))__pyx_f_12PygameShader_6shader_redscale, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("fire_sub", (void (*)(void))__pyx_f_12PygameShader_6shader_fire_sub, "PyObject *(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("fire_effect", (void (*)(void))__pyx_f_12PygameShader_6shader_fire_effect, "PyObject *(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_fire_effect *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("cloud_effect", (void (*)(void))__pyx_f_12PygameShader_6shader_cloud_effect, "PyObject *(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_cloud_effect *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("mirroring_array", (void (*)(void))__pyx_f_12PygameShader_6shader_mirroring_array, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("mirroring", (void (*)(void))__pyx_f_12PygameShader_6shader_mirroring, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("lateral_dampening", (void (*)(void))__pyx_f_12PygameShader_6shader_lateral_dampening, "float (int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_lateral_dampening *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("dampening", (void (*)(void))__pyx_f_12PygameShader_6shader_dampening, "PyObject *(PyObject *, int, int, int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dampening *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("blend", (void (*)(void))__pyx_f_12PygameShader_6shader_blend, "PyObject *(PyObject *, PyObject *, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("cartoon", (void (*)(void))__pyx_f_12PygameShader_6shader_cartoon, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_cartoon *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("dirt_lens", (void (*)(void))__pyx_f_12PygameShader_6shader_dirt_lens, "void (PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dirt_lens *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("dithering", (void (*)(void))__pyx_f_12PygameShader_6shader_dithering, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dithering *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("dithering_int", (void (*)(void))__pyx_f_12PygameShader_6shader_dithering_int, "void (PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dithering_int *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("spectrum", (void (*)(void))__pyx_f_12PygameShader_6shader_spectrum, "PyObject *(int, int, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_spectrum *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("convert_27colors", (void (*)(void))__pyx_f_12PygameShader_6shader_convert_27colors, "void (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("palette_change", (void (*)(void))__pyx_f_12PygameShader_6shader_palette_change, "void (PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("bilateral", (void (*)(void))__pyx_f_12PygameShader_6shader_bilateral, "PyObject *(PyObject *, float, float, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("emboss", (void (*)(void))__pyx_f_12PygameShader_6shader_emboss, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_emboss *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("pixelation", (void (*)(void))__pyx_f_12PygameShader_6shader_pixelation, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_array = &__pyx_vtable_array;
  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(3, 105, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_array.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(3, 105, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(3, 105, __pyx_L1_error)
  __pyx_array_type = &__pyx_type___pyx_array;
  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(3, 279, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_MemviewEnum.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(3, 279, __pyx_L1_error)
  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
  if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(3, 330, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_memoryview.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(3, 330, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(3, 330, __pyx_L1_error)
  __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
  __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
  __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
  __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
  __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
  if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(3, 965, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_memoryviewslice.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(3, 965, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(3, 965, __pyx_L1_error)
  __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(4, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(5, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(6, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 207, __pyx_L1_error)
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 230, __pyx_L1_error)
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 234, __pyx_L1_error)
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 246, __pyx_L1_error)
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 839, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = PyImport_ImportModule("PygameShader.misc"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportFunction(__pyx_t_1, "color_diff_hsv", (void (**)(void))&__pyx_f_12PygameShader_4misc_color_diff_hsv, "struct rgb (struct rgb, __Pyx_memviewslice, Py_ssize_t)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "color_diff_hsl", (void (**)(void))&__pyx_f_12PygameShader_4misc_color_diff_hsl, "struct rgb (struct rgb, __Pyx_memviewslice, Py_ssize_t)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "close_color", (void (**)(void))&__pyx_f_12PygameShader_4misc_close_color, "struct rgb (struct rgb, __Pyx_memviewslice, Py_ssize_t)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initshader(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initshader(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_shader(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_shader(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_shader(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  PyObject *__pyx_t_27 = NULL;
  PyObject *__pyx_t_28 = NULL;
  PyObject *__pyx_t_29 = NULL;
  PyObject *__pyx_t_30 = NULL;
  PyObject *__pyx_t_31 = NULL;
  PyObject *__pyx_t_32 = NULL;
  PyObject *__pyx_t_33 = NULL;
  __Pyx_memviewslice __pyx_t_34 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_35 = { 0, 0, { 0 }, { 0 }, { 0 } };
  static float __pyx_t_36[5];
  __Pyx_memviewslice __pyx_t_37 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_12PygameShader_6shader_heat_map __pyx_t_38;
  __Pyx_memviewslice __pyx_t_39 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_40;
  PyObject *(*__pyx_t_41)(PyObject *);
  unsigned char __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  struct __pyx_opt_args_12PygameShader_6shader_blue_map __pyx_t_45;
  struct __pyx_opt_args_12PygameShader_6shader_red_map __pyx_t_46;
  size_t __pyx_t_47;
  static PyThread_type_lock __pyx_t_48[8];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'shader' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_shader(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("shader", __pyx_methods, __pyx_k_GNU_GENERAL_PUBLIC_LICENSE_Vers, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_PygameShader__shader) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "PygameShader.shader")) {
      if (unlikely(PyDict_SetItemString(modules, "PygameShader.shader", __pyx_m) < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  if (unlikely(__Pyx_modinit_variable_export_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif

  /* "PygameShader/shader.pyx":72
 * 
 * 
 * __VERSION__ = "1.0.3"             # <<<<<<<<<<<<<<
 * 
 * import warnings
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION, __pyx_kp_s_1_0_3) < 0) __PYX_ERR(1, 72, __pyx_L1_error)

  /* "PygameShader/shader.pyx":74
 * __VERSION__ = "1.0.3"
 * 
 * import warnings             # <<<<<<<<<<<<<<
 * 
 * warnings.filterwarnings("ignore", category=FutureWarning)
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(1, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":76
 * import warnings
 * 
 * warnings.filterwarnings("ignore", category=FutureWarning)             # <<<<<<<<<<<<<<
 * warnings.filterwarnings("ignore", category=RuntimeWarning)
 * warnings.filterwarnings("ignore", category=ImportWarning)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_warnings); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_filterwarnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_category, __pyx_builtin_FutureWarning) < 0) __PYX_ERR(1, 76, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__55, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PygameShader/shader.pyx":77
 * 
 * warnings.filterwarnings("ignore", category=FutureWarning)
 * warnings.filterwarnings("ignore", category=RuntimeWarning)             # <<<<<<<<<<<<<<
 * warnings.filterwarnings("ignore", category=ImportWarning)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_warnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_filterwarnings); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_category, __pyx_builtin_RuntimeWarning) < 0) __PYX_ERR(1, 77, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__55, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":78
 * warnings.filterwarnings("ignore", category=FutureWarning)
 * warnings.filterwarnings("ignore", category=RuntimeWarning)
 * warnings.filterwarnings("ignore", category=ImportWarning)             # <<<<<<<<<<<<<<
 * 
 * try:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_warnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_filterwarnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_category, __pyx_builtin_ImportWarning) < 0) __PYX_ERR(1, 78, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__55, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":80
 * warnings.filterwarnings("ignore", category=ImportWarning)
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import numpy
 *     from numpy import empty, uint8, int16, float32, asarray, linspace, \
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "PygameShader/shader.pyx":81
 * 
 * try:
 *     import numpy             # <<<<<<<<<<<<<<
 *     from numpy import empty, uint8, int16, float32, asarray, linspace, \
 *         ascontiguousarray, zeros, uint16, uint32, int32, int8
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 81, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(1, 81, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PygameShader/shader.pyx":82
 * try:
 *     import numpy
 *     from numpy import empty, uint8, int16, float32, asarray, linspace, \             # <<<<<<<<<<<<<<
 *         ascontiguousarray, zeros, uint16, uint32, int32, int8
 * except ImportError:
 */
      __pyx_t_1 = PyList_New(12); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_empty);
      __Pyx_GIVEREF(__pyx_n_s_empty);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_empty);
      __Pyx_INCREF(__pyx_n_s_uint8);
      __Pyx_GIVEREF(__pyx_n_s_uint8);
      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_uint8);
      __Pyx_INCREF(__pyx_n_s_int16);
      __Pyx_GIVEREF(__pyx_n_s_int16);
      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_int16);
      __Pyx_INCREF(__pyx_n_s_float32);
      __Pyx_GIVEREF(__pyx_n_s_float32);
      PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_float32);
      __Pyx_INCREF(__pyx_n_s_asarray);
      __Pyx_GIVEREF(__pyx_n_s_asarray);
      PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_asarray);
      __Pyx_INCREF(__pyx_n_s_linspace);
      __Pyx_GIVEREF(__pyx_n_s_linspace);
      PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_linspace);
      __Pyx_INCREF(__pyx_n_s_ascontiguousarray);
      __Pyx_GIVEREF(__pyx_n_s_ascontiguousarray);
      PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_s_ascontiguousarray);
      __Pyx_INCREF(__pyx_n_s_zeros);
      __Pyx_GIVEREF(__pyx_n_s_zeros);
      PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_s_zeros);
      __Pyx_INCREF(__pyx_n_s_uint16);
      __Pyx_GIVEREF(__pyx_n_s_uint16);
      PyList_SET_ITEM(__pyx_t_1, 8, __pyx_n_s_uint16);
      __Pyx_INCREF(__pyx_n_s_uint32);
      __Pyx_GIVEREF(__pyx_n_s_uint32);
      PyList_SET_ITEM(__pyx_t_1, 9, __pyx_n_s_uint32);
      __Pyx_INCREF(__pyx_n_s_int32);
      __Pyx_GIVEREF(__pyx_n_s_int32);
      PyList_SET_ITEM(__pyx_t_1, 10, __pyx_n_s_int32);
      __Pyx_INCREF(__pyx_n_s_int8);
      __Pyx_GIVEREF(__pyx_n_s_int8);
      PyList_SET_ITEM(__pyx_t_1, 11, __pyx_n_s_int8);
      __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_empty, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint8, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_int16); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_int16, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_float32, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_asarray, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_linspace, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_ascontiguousarray, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_zeros, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_uint16); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint16, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_uint32); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint32, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_int32, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_int8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_int8, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "PygameShader/shader.pyx":80
 * warnings.filterwarnings("ignore", category=ImportWarning)
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import numpy
 *     from numpy import empty, uint8, int16, float32, asarray, linspace, \
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PygameShader/shader.pyx":84
 *     from numpy import empty, uint8, int16, float32, asarray, linspace, \
 *         ascontiguousarray, zeros, uint16, uint32, int32, int8
 * except ImportError:             # <<<<<<<<<<<<<<
 *     raise ImportError("\n<numpy> library is missing on your system."
 *           "\nTry: \n   C:\\pip install numpy on a window command prompt.")
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("PygameShader.shader", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(1, 84, __pyx_L4_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);

      /* "PygameShader/shader.pyx":85
 *         ascontiguousarray, zeros, uint16, uint32, int32, int8
 * except ImportError:
 *     raise ImportError("\n<numpy> library is missing on your system."             # <<<<<<<<<<<<<<
 *           "\nTry: \n   C:\\pip install numpy on a window command prompt.")
 * 
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 85, __pyx_L4_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 85, __pyx_L4_except_error)
    }
    goto __pyx_L4_except_error;
    __pyx_L4_except_error:;

    /* "PygameShader/shader.pyx":80
 * warnings.filterwarnings("ignore", category=ImportWarning)
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import numpy
 *     from numpy import empty, uint8, int16, float32, asarray, linspace, \
 */
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L7_try_end:;
  }

  /* "PygameShader/shader.pyx":90
 * cimport numpy as np
 * 
 * try:             # <<<<<<<<<<<<<<
 *     cimport cython
 *     from cython.parallel cimport prange
 */
  {
    (void)__pyx_t_6; (void)__pyx_t_5; (void)__pyx_t_4; /* mark used */
    /*try:*/ {

      /* "PygameShader/shader.pyx":92
 * try:
 *     cimport cython
 *     from cython.parallel cimport prange             # <<<<<<<<<<<<<<
 * 
 * except ImportError:
 */
    }
  }

  /* "PygameShader/shader.pyx":99
 * 
 * # PYGAME IS REQUIRED
 * try:             # <<<<<<<<<<<<<<
 *     import pygame
 *     from pygame import Color, Surface, SRCALPHA, RLEACCEL, BufferProxy, HWACCEL, HWSURFACE, \
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "PygameShader/shader.pyx":100
 * # PYGAME IS REQUIRED
 * try:
 *     import pygame             # <<<<<<<<<<<<<<
 *     from pygame import Color, Surface, SRCALPHA, RLEACCEL, BufferProxy, HWACCEL, HWSURFACE, \
 *     QUIT, K_SPACE, BLEND_RGB_ADD, Rect, BLEND_RGB_MAX, BLEND_RGB_MIN
 */
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 100, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pygame, __pyx_t_3) < 0) __PYX_ERR(1, 100, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "PygameShader/shader.pyx":101
 * try:
 *     import pygame
 *     from pygame import Color, Surface, SRCALPHA, RLEACCEL, BufferProxy, HWACCEL, HWSURFACE, \             # <<<<<<<<<<<<<<
 *     QUIT, K_SPACE, BLEND_RGB_ADD, Rect, BLEND_RGB_MAX, BLEND_RGB_MIN
 *     from pygame.surfarray import pixels3d, array_alpha, pixels_alpha, array3d, \
 */
      __pyx_t_3 = PyList_New(13); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_s_Color);
      __Pyx_GIVEREF(__pyx_n_s_Color);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Color);
      __Pyx_INCREF(__pyx_n_s_Surface);
      __Pyx_GIVEREF(__pyx_n_s_Surface);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_Surface);
      __Pyx_INCREF(__pyx_n_s_SRCALPHA);
      __Pyx_GIVEREF(__pyx_n_s_SRCALPHA);
      PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_SRCALPHA);
      __Pyx_INCREF(__pyx_n_s_RLEACCEL);
      __Pyx_GIVEREF(__pyx_n_s_RLEACCEL);
      PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_RLEACCEL);
      __Pyx_INCREF(__pyx_n_s_BufferProxy);
      __Pyx_GIVEREF(__pyx_n_s_BufferProxy);
      PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_s_BufferProxy);
      __Pyx_INCREF(__pyx_n_s_HWACCEL);
      __Pyx_GIVEREF(__pyx_n_s_HWACCEL);
      PyList_SET_ITEM(__pyx_t_3, 5, __pyx_n_s_HWACCEL);
      __Pyx_INCREF(__pyx_n_s_HWSURFACE);
      __Pyx_GIVEREF(__pyx_n_s_HWSURFACE);
      PyList_SET_ITEM(__pyx_t_3, 6, __pyx_n_s_HWSURFACE);
      __Pyx_INCREF(__pyx_n_s_QUIT);
      __Pyx_GIVEREF(__pyx_n_s_QUIT);
      PyList_SET_ITEM(__pyx_t_3, 7, __pyx_n_s_QUIT);
      __Pyx_INCREF(__pyx_n_s_K_SPACE);
      __Pyx_GIVEREF(__pyx_n_s_K_SPACE);
      PyList_SET_ITEM(__pyx_t_3, 8, __pyx_n_s_K_SPACE);
      __Pyx_INCREF(__pyx_n_s_BLEND_RGB_ADD);
      __Pyx_GIVEREF(__pyx_n_s_BLEND_RGB_ADD);
      PyList_SET_ITEM(__pyx_t_3, 9, __pyx_n_s_BLEND_RGB_ADD);
      __Pyx_INCREF(__pyx_n_s_Rect);
      __Pyx_GIVEREF(__pyx_n_s_Rect);
      PyList_SET_ITEM(__pyx_t_3, 10, __pyx_n_s_Rect);
      __Pyx_INCREF(__pyx_n_s_BLEND_RGB_MAX);
      __Pyx_GIVEREF(__pyx_n_s_BLEND_RGB_MAX);
      PyList_SET_ITEM(__pyx_t_3, 11, __pyx_n_s_BLEND_RGB_MAX);
      __Pyx_INCREF(__pyx_n_s_BLEND_RGB_MIN);
      __Pyx_GIVEREF(__pyx_n_s_BLEND_RGB_MIN);
      PyList_SET_ITEM(__pyx_t_3, 12, __pyx_n_s_BLEND_RGB_MIN);
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_pygame, __pyx_t_3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Color); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Color, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Surface, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SRCALPHA); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_SRCALPHA, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_RLEACCEL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_RLEACCEL, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BufferProxy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_BufferProxy, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_HWACCEL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_HWACCEL, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_HWSURFACE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_HWSURFACE, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_QUIT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_QUIT, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_K_SPACE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_K_SPACE, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLEND_RGB_ADD, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Rect); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Rect, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BLEND_RGB_MAX); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLEND_RGB_MAX, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BLEND_RGB_MIN); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLEND_RGB_MIN, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PygameShader/shader.pyx":103
 *     from pygame import Color, Surface, SRCALPHA, RLEACCEL, BufferProxy, HWACCEL, HWSURFACE, \
 *     QUIT, K_SPACE, BLEND_RGB_ADD, Rect, BLEND_RGB_MAX, BLEND_RGB_MIN
 *     from pygame.surfarray import pixels3d, array_alpha, pixels_alpha, array3d, \             # <<<<<<<<<<<<<<
 *         make_surface, blit_array, pixels_red, \
 *     pixels_green, pixels_blue
 */
      __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_pixels3d);
      __Pyx_GIVEREF(__pyx_n_s_pixels3d);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_pixels3d);
      __Pyx_INCREF(__pyx_n_s_array_alpha);
      __Pyx_GIVEREF(__pyx_n_s_array_alpha);
      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_array_alpha);
      __Pyx_INCREF(__pyx_n_s_pixels_alpha);
      __Pyx_GIVEREF(__pyx_n_s_pixels_alpha);
      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_pixels_alpha);
      __Pyx_INCREF(__pyx_n_s_array3d);
      __Pyx_GIVEREF(__pyx_n_s_array3d);
      PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_array3d);
      __Pyx_INCREF(__pyx_n_s_make_surface);
      __Pyx_GIVEREF(__pyx_n_s_make_surface);
      PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_make_surface);
      __Pyx_INCREF(__pyx_n_s_blit_array);
      __Pyx_GIVEREF(__pyx_n_s_blit_array);
      PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_blit_array);
      __Pyx_INCREF(__pyx_n_s_pixels_red);
      __Pyx_GIVEREF(__pyx_n_s_pixels_red);
      PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_s_pixels_red);
      __Pyx_INCREF(__pyx_n_s_pixels_green);
      __Pyx_GIVEREF(__pyx_n_s_pixels_green);
      PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_s_pixels_green);
      __Pyx_INCREF(__pyx_n_s_pixels_blue);
      __Pyx_GIVEREF(__pyx_n_s_pixels_blue);
      PyList_SET_ITEM(__pyx_t_1, 8, __pyx_n_s_pixels_blue);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame_surfarray, __pyx_t_1, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pixels3d, __pyx_t_1) < 0) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_array_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_array_alpha, __pyx_t_1) < 0) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pixels_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pixels_alpha, __pyx_t_1) < 0) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_array3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_array3d, __pyx_t_1) < 0) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_surface, __pyx_t_1) < 0) __PYX_ERR(1, 104, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_blit_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_blit_array, __pyx_t_1) < 0) __PYX_ERR(1, 104, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pixels_red); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pixels_red, __pyx_t_1) < 0) __PYX_ERR(1, 104, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pixels_green); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pixels_green, __pyx_t_1) < 0) __PYX_ERR(1, 105, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pixels_blue); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pixels_blue, __pyx_t_1) < 0) __PYX_ERR(1, 105, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "PygameShader/shader.pyx":106
 *         make_surface, blit_array, pixels_red, \
 *     pixels_green, pixels_blue
 *     from pygame.image import frombuffer, fromstring, tostring             # <<<<<<<<<<<<<<
 *     from pygame.math import Vector2
 *     from pygame import _freetype
 */
      __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 106, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_s_frombuffer);
      __Pyx_GIVEREF(__pyx_n_s_frombuffer);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_frombuffer);
      __Pyx_INCREF(__pyx_n_s_fromstring);
      __Pyx_GIVEREF(__pyx_n_s_fromstring);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_fromstring);
      __Pyx_INCREF(__pyx_n_s_tostring);
      __Pyx_GIVEREF(__pyx_n_s_tostring);
      PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_tostring);
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_pygame_image, __pyx_t_3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 106, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 106, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_frombuffer, __pyx_t_3) < 0) __PYX_ERR(1, 106, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 106, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_fromstring, __pyx_t_3) < 0) __PYX_ERR(1, 106, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_tostring); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 106, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_tostring, __pyx_t_3) < 0) __PYX_ERR(1, 106, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PygameShader/shader.pyx":107
 *     pixels_green, pixels_blue
 *     from pygame.image import frombuffer, fromstring, tostring
 *     from pygame.math import Vector2             # <<<<<<<<<<<<<<
 *     from pygame import _freetype
 *     from pygame._freetype import STYLE_STRONG, STYLE_NORMAL
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 107, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_Vector2);
      __Pyx_GIVEREF(__pyx_n_s_Vector2);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Vector2);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame_math, __pyx_t_1, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 107, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Vector2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 107, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Vector2, __pyx_t_1) < 0) __PYX_ERR(1, 107, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "PygameShader/shader.pyx":108
 *     from pygame.image import frombuffer, fromstring, tostring
 *     from pygame.math import Vector2
 *     from pygame import _freetype             # <<<<<<<<<<<<<<
 *     from pygame._freetype import STYLE_STRONG, STYLE_NORMAL
 *     from pygame.transform import scale, smoothscale, rotate, scale2x
 */
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 108, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_s_freetype);
      __Pyx_GIVEREF(__pyx_n_s_freetype);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_freetype);
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_pygame, __pyx_t_3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 108, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_freetype); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 108, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_freetype, __pyx_t_3) < 0) __PYX_ERR(1, 108, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PygameShader/shader.pyx":109
 *     from pygame.math import Vector2
 *     from pygame import _freetype
 *     from pygame._freetype import STYLE_STRONG, STYLE_NORMAL             # <<<<<<<<<<<<<<
 *     from pygame.transform import scale, smoothscale, rotate, scale2x
 *     from pygame.pixelcopy import array_to_surface
 */
      __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 109, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_STYLE_STRONG);
      __Pyx_GIVEREF(__pyx_n_s_STYLE_STRONG);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_STYLE_STRONG);
      __Pyx_INCREF(__pyx_n_s_STYLE_NORMAL);
      __Pyx_GIVEREF(__pyx_n_s_STYLE_NORMAL);
      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_STYLE_NORMAL);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame__freetype, __pyx_t_1, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 109, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_STYLE_STRONG); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 109, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_STYLE_STRONG, __pyx_t_1) < 0) __PYX_ERR(1, 109, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_STYLE_NORMAL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 109, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_STYLE_NORMAL, __pyx_t_1) < 0) __PYX_ERR(1, 109, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "PygameShader/shader.pyx":110
 *     from pygame import _freetype
 *     from pygame._freetype import STYLE_STRONG, STYLE_NORMAL
 *     from pygame.transform import scale, smoothscale, rotate, scale2x             # <<<<<<<<<<<<<<
 *     from pygame.pixelcopy import array_to_surface
 * 
 */
      __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_s_scale);
      __Pyx_GIVEREF(__pyx_n_s_scale);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_scale);
      __Pyx_INCREF(__pyx_n_s_smoothscale);
      __Pyx_GIVEREF(__pyx_n_s_smoothscale);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_smoothscale);
      __Pyx_INCREF(__pyx_n_s_rotate);
      __Pyx_GIVEREF(__pyx_n_s_rotate);
      PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_rotate);
      __Pyx_INCREF(__pyx_n_s_scale2x);
      __Pyx_GIVEREF(__pyx_n_s_scale2x);
      PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_scale2x);
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_pygame_transform, __pyx_t_3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 110, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_scale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_scale, __pyx_t_3) < 0) __PYX_ERR(1, 110, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_smoothscale, __pyx_t_3) < 0) __PYX_ERR(1, 110, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_rotate); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotate, __pyx_t_3) < 0) __PYX_ERR(1, 110, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_scale2x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_scale2x, __pyx_t_3) < 0) __PYX_ERR(1, 110, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PygameShader/shader.pyx":111
 *     from pygame._freetype import STYLE_STRONG, STYLE_NORMAL
 *     from pygame.transform import scale, smoothscale, rotate, scale2x
 *     from pygame.pixelcopy import array_to_surface             # <<<<<<<<<<<<<<
 * 
 * except ImportError:
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 111, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_array_to_surface);
      __Pyx_GIVEREF(__pyx_n_s_array_to_surface);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_array_to_surface);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame_pixelcopy, __pyx_t_1, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 111, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_array_to_surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 111, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_array_to_surface, __pyx_t_1) < 0) __PYX_ERR(1, 111, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "PygameShader/shader.pyx":99
 * 
 * # PYGAME IS REQUIRED
 * try:             # <<<<<<<<<<<<<<
 *     import pygame
 *     from pygame import Color, Surface, SRCALPHA, RLEACCEL, BufferProxy, HWACCEL, HWSURFACE, \
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L21_try_end;
    __pyx_L16_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PygameShader/shader.pyx":113
 *     from pygame.pixelcopy import array_to_surface
 * 
 * except ImportError:             # <<<<<<<<<<<<<<
 *     raise ImportError("\n<Pygame> library is missing on your system."
 *           "\nTry: \n   C:\\pip install pygame on a window command prompt.")
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("PygameShader.shader", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(1, 113, __pyx_L18_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);

      /* "PygameShader/shader.pyx":114
 * 
 * except ImportError:
 *     raise ImportError("\n<Pygame> library is missing on your system."             # <<<<<<<<<<<<<<
 *           "\nTry: \n   C:\\pip install pygame on a window command prompt.")
 * 
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 114, __pyx_L18_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 114, __pyx_L18_except_error)
    }
    goto __pyx_L18_except_error;
    __pyx_L18_except_error:;

    /* "PygameShader/shader.pyx":99
 * 
 * # PYGAME IS REQUIRED
 * try:             # <<<<<<<<<<<<<<
 *     import pygame
 *     from pygame import Color, Surface, SRCALPHA, RLEACCEL, BufferProxy, HWACCEL, HWSURFACE, \
 */
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L21_try_end:;
  }

  /* "PygameShader/shader.pyx":117
 *           "\nTry: \n   C:\\pip install pygame on a window command prompt.")
 * 
 * try:             # <<<<<<<<<<<<<<
 *     cimport cython
 *     from cython.parallel cimport prange
 */
  {
    (void)__pyx_t_6; (void)__pyx_t_5; (void)__pyx_t_4; /* mark used */
    /*try:*/ {

      /* "PygameShader/shader.pyx":126
 *         PyDict_Values, PyDict_Keys, PyDict_Items
 *     from cpython.list cimport PyList_Append, PyList_GetItem, PyList_Size, PyList_SetItem
 *     from cpython.object cimport PyObject_SetAttr             # <<<<<<<<<<<<<<
 * 
 * except ImportError:
 */
    }
  }

  /* "PygameShader/shader.pyx":132
 *           "\nTry: \n   C:\\pip install cython on a window command prompt.")
 * 
 * from PygameShader.gaussianBlur5x5 import canny_blur5x5_surface24_c             # <<<<<<<<<<<<<<
 * from PygameShader.misc cimport color_diff_hsv, color_diff_hsl, close_color
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_canny_blur5x5_surface24_c);
  __Pyx_GIVEREF(__pyx_n_s_canny_blur5x5_surface24_c);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_canny_blur5x5_surface24_c);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_PygameShader_gaussianBlur5x5, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_canny_blur5x5_surface24_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_canny_blur5x5_surface24_c, __pyx_t_2) < 0) __PYX_ERR(1, 132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":142
 * from libc.stdio cimport printf
 * 
 * cdef float M_PI = 3.14159265358979323846             # <<<<<<<<<<<<<<
 * cdef float M_PI2 =3.14159265358979323846/2.0
 * cdef float M_2PI =2 * 3.14159265358979323846
 */
  __pyx_v_12PygameShader_6shader_M_PI = 3.14159265358979323846;

  /* "PygameShader/shader.pyx":143
 * 
 * cdef float M_PI = 3.14159265358979323846
 * cdef float M_PI2 =3.14159265358979323846/2.0             # <<<<<<<<<<<<<<
 * cdef float M_2PI =2 * 3.14159265358979323846
 * 
 */
  __pyx_v_12PygameShader_6shader_M_PI2 = (3.14159265358979323846 / 2.0);

  /* "PygameShader/shader.pyx":144
 * cdef float M_PI = 3.14159265358979323846
 * cdef float M_PI2 =3.14159265358979323846/2.0
 * cdef float M_2PI =2 * 3.14159265358979323846             # <<<<<<<<<<<<<<
 * 
 * cdef float RAD_TO_DEG=<float>(180.0/M_PI)
 */
  __pyx_v_12PygameShader_6shader_M_2PI = (2.0 * 3.14159265358979323846);

  /* "PygameShader/shader.pyx":146
 * cdef float M_2PI =2 * 3.14159265358979323846
 * 
 * cdef float RAD_TO_DEG=<float>(180.0/M_PI)             # <<<<<<<<<<<<<<
 * cdef float DEG_TO_RAD=<float>(M_PI/180.0)
 * 
 */
  __pyx_v_12PygameShader_6shader_RAD_TO_DEG = ((float)(180.0 / __pyx_v_12PygameShader_6shader_M_PI));

  /* "PygameShader/shader.pyx":147
 * 
 * cdef float RAD_TO_DEG=<float>(180.0/M_PI)
 * cdef float DEG_TO_RAD=<float>(M_PI/180.0)             # <<<<<<<<<<<<<<
 * 
 * cdef float C1 = <float>7.0/<float>16.0
 */
  __pyx_v_12PygameShader_6shader_DEG_TO_RAD = ((float)(__pyx_v_12PygameShader_6shader_M_PI / 180.0));

  /* "PygameShader/shader.pyx":149
 * cdef float DEG_TO_RAD=<float>(M_PI/180.0)
 * 
 * cdef float C1 = <float>7.0/<float>16.0             # <<<<<<<<<<<<<<
 * cdef float C2 = <float>3.0/<float>16.0
 * cdef float C3 = <float>5.0/<float>16.0
 */
  __pyx_v_12PygameShader_6shader_C1 = (((float)7.0) / ((float)16.0));

  /* "PygameShader/shader.pyx":150
 * 
 * cdef float C1 = <float>7.0/<float>16.0
 * cdef float C2 = <float>3.0/<float>16.0             # <<<<<<<<<<<<<<
 * cdef float C3 = <float>5.0/<float>16.0
 * cdef float C4 = <float>1.0/<float>16.0
 */
  __pyx_v_12PygameShader_6shader_C2 = (((float)3.0) / ((float)16.0));

  /* "PygameShader/shader.pyx":151
 * cdef float C1 = <float>7.0/<float>16.0
 * cdef float C2 = <float>3.0/<float>16.0
 * cdef float C3 = <float>5.0/<float>16.0             # <<<<<<<<<<<<<<
 * cdef float C4 = <float>1.0/<float>16.0
 * 
 */
  __pyx_v_12PygameShader_6shader_C3 = (((float)5.0) / ((float)16.0));

  /* "PygameShader/shader.pyx":152
 * cdef float C2 = <float>3.0/<float>16.0
 * cdef float C3 = <float>5.0/<float>16.0
 * cdef float C4 = <float>1.0/<float>16.0             # <<<<<<<<<<<<<<
 * 
 * cdef int THREADS = 4
 */
  __pyx_v_12PygameShader_6shader_C4 = (((float)1.0) / ((float)16.0));

  /* "PygameShader/shader.pyx":154
 * cdef float C4 = <float>1.0/<float>16.0
 * 
 * cdef int THREADS = 4             # <<<<<<<<<<<<<<
 * 
 * DEF HALF         = 1.0/2.0
 */
  __pyx_v_12PygameShader_6shader_THREADS = 4;

  /* "PygameShader/shader.pyx":177
 * cdef float[360] SIN_TABLE
 * cdef int ANGLE
 * for ANGLE in range(0, 360):             # <<<<<<<<<<<<<<
 *     COS_TABLE[ANGLE] = <float>cos(<float>(ANGLE * DEG_TO_RAD))
 *     SIN_TABLE[ANGLE] = <float>sin(<float>(ANGLE * DEG_TO_RAD))
 */
  for (__pyx_t_7 = 0; __pyx_t_7 < 0x168; __pyx_t_7+=1) {
    __pyx_v_12PygameShader_6shader_ANGLE = __pyx_t_7;

    /* "PygameShader/shader.pyx":178
 * cdef int ANGLE
 * for ANGLE in range(0, 360):
 *     COS_TABLE[ANGLE] = <float>cos(<float>(ANGLE * DEG_TO_RAD))             # <<<<<<<<<<<<<<
 *     SIN_TABLE[ANGLE] = <float>sin(<float>(ANGLE * DEG_TO_RAD))
 * 
 */
    (__pyx_v_12PygameShader_6shader_COS_TABLE[__pyx_v_12PygameShader_6shader_ANGLE]) = ((float)cos(((float)(__pyx_v_12PygameShader_6shader_ANGLE * __pyx_v_12PygameShader_6shader_DEG_TO_RAD))));

    /* "PygameShader/shader.pyx":179
 * for ANGLE in range(0, 360):
 *     COS_TABLE[ANGLE] = <float>cos(<float>(ANGLE * DEG_TO_RAD))
 *     SIN_TABLE[ANGLE] = <float>sin(<float>(ANGLE * DEG_TO_RAD))             # <<<<<<<<<<<<<<
 * 
 * COLORS_CPC64 = numpy.array(
 */
    (__pyx_v_12PygameShader_6shader_SIN_TABLE[__pyx_v_12PygameShader_6shader_ANGLE]) = ((float)sin(((float)(__pyx_v_12PygameShader_6shader_ANGLE * __pyx_v_12PygameShader_6shader_DEG_TO_RAD))));
  }

  /* "PygameShader/shader.pyx":181
 *     SIN_TABLE[ANGLE] = <float>sin(<float>(ANGLE * DEG_TO_RAD))
 * 
 * COLORS_CPC64 = numpy.array(             # <<<<<<<<<<<<<<
 *     [[0, 0, 0],
 *     [0, 0, 128],
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PygameShader/shader.pyx":182
 * 
 * COLORS_CPC64 = numpy.array(
 *     [[0, 0, 0],             # <<<<<<<<<<<<<<
 *     [0, 0, 128],
 *     [0, 0, 255],
 */
  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":183
 * COLORS_CPC64 = numpy.array(
 *     [[0, 0, 0],
 *     [0, 0, 128],             # <<<<<<<<<<<<<<
 *     [0, 0, 255],
 *     [128, 0, 0],
 */
  __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_3, 2, __pyx_int_128);

  /* "PygameShader/shader.pyx":184
 *     [[0, 0, 0],
 *     [0, 0, 128],
 *     [0, 0, 255],             # <<<<<<<<<<<<<<
 *     [128, 0, 0],
 *     [128, 0, 128],
 */
  __pyx_t_8 = PyList_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_8, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_8, 2, __pyx_int_255);

  /* "PygameShader/shader.pyx":185
 *     [0, 0, 128],
 *     [0, 0, 255],
 *     [128, 0, 0],             # <<<<<<<<<<<<<<
 *     [128, 0, 128],
 *     [128, 0, 255],
 */
  __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_9, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_9, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":186
 *     [0, 0, 255],
 *     [128, 0, 0],
 *     [128, 0, 128],             # <<<<<<<<<<<<<<
 *     [128, 0, 255],
 *     [255, 0, 0],
 */
  __pyx_t_10 = PyList_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_10, 0, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_10, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_10, 2, __pyx_int_128);

  /* "PygameShader/shader.pyx":187
 *     [128, 0, 0],
 *     [128, 0, 128],
 *     [128, 0, 255],             # <<<<<<<<<<<<<<
 *     [255, 0, 0],
 *     [255, 0, 128],
 */
  __pyx_t_11 = PyList_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_11, 0, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_11, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_11, 2, __pyx_int_255);

  /* "PygameShader/shader.pyx":188
 *     [128, 0, 128],
 *     [128, 0, 255],
 *     [255, 0, 0],             # <<<<<<<<<<<<<<
 *     [255, 0, 128],
 *     [255, 0, 255],
 */
  __pyx_t_12 = PyList_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_12, 0, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_12, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_12, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":189
 *     [128, 0, 255],
 *     [255, 0, 0],
 *     [255, 0, 128],             # <<<<<<<<<<<<<<
 *     [255, 0, 255],
 *     [0, 128, 0],
 */
  __pyx_t_13 = PyList_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_13, 0, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_13, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_13, 2, __pyx_int_128);

  /* "PygameShader/shader.pyx":190
 *     [255, 0, 0],
 *     [255, 0, 128],
 *     [255, 0, 255],             # <<<<<<<<<<<<<<
 *     [0, 128, 0],
 *     [0, 128, 128],
 */
  __pyx_t_14 = PyList_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_14, 0, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_14, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_14, 2, __pyx_int_255);

  /* "PygameShader/shader.pyx":191
 *     [255, 0, 128],
 *     [255, 0, 255],
 *     [0, 128, 0],             # <<<<<<<<<<<<<<
 *     [0, 128, 128],
 *     [0, 128, 255],
 */
  __pyx_t_15 = PyList_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_15, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_15, 1, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_15, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":192
 *     [255, 0, 255],
 *     [0, 128, 0],
 *     [0, 128, 128],             # <<<<<<<<<<<<<<
 *     [0, 128, 255],
 *     [128, 128, 0],
 */
  __pyx_t_16 = PyList_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_16, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_16, 1, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_16, 2, __pyx_int_128);

  /* "PygameShader/shader.pyx":193
 *     [0, 128, 0],
 *     [0, 128, 128],
 *     [0, 128, 255],             # <<<<<<<<<<<<<<
 *     [128, 128, 0],
 *     [128, 128, 128],
 */
  __pyx_t_17 = PyList_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_17, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_17, 1, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_17, 2, __pyx_int_255);

  /* "PygameShader/shader.pyx":194
 *     [0, 128, 128],
 *     [0, 128, 255],
 *     [128, 128, 0],             # <<<<<<<<<<<<<<
 *     [128, 128, 128],
 *     [128, 128, 255],
 */
  __pyx_t_18 = PyList_New(3); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_18, 0, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_18, 1, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_18, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":195
 *     [0, 128, 255],
 *     [128, 128, 0],
 *     [128, 128, 128],             # <<<<<<<<<<<<<<
 *     [128, 128, 255],
 *     [255, 128, 0],
 */
  __pyx_t_19 = PyList_New(3); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_19, 0, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_19, 1, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_19, 2, __pyx_int_128);

  /* "PygameShader/shader.pyx":196
 *     [128, 128, 0],
 *     [128, 128, 128],
 *     [128, 128, 255],             # <<<<<<<<<<<<<<
 *     [255, 128, 0],
 *     [255, 128, 128],
 */
  __pyx_t_20 = PyList_New(3); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_20, 0, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_20, 1, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_20, 2, __pyx_int_255);

  /* "PygameShader/shader.pyx":197
 *     [128, 128, 128],
 *     [128, 128, 255],
 *     [255, 128, 0],             # <<<<<<<<<<<<<<
 *     [255, 128, 128],
 *     [255, 128, 255],
 */
  __pyx_t_21 = PyList_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_21, 0, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_21, 1, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_21, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":198
 *     [128, 128, 255],
 *     [255, 128, 0],
 *     [255, 128, 128],             # <<<<<<<<<<<<<<
 *     [255, 128, 255],
 *     [0, 255, 0],
 */
  __pyx_t_22 = PyList_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_22, 0, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_22, 1, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_22, 2, __pyx_int_128);

  /* "PygameShader/shader.pyx":199
 *     [255, 128, 0],
 *     [255, 128, 128],
 *     [255, 128, 255],             # <<<<<<<<<<<<<<
 *     [0, 255, 0],
 *     [0, 255, 128],
 */
  __pyx_t_23 = PyList_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_23);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_23, 0, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_23, 1, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_23, 2, __pyx_int_255);

  /* "PygameShader/shader.pyx":200
 *     [255, 128, 128],
 *     [255, 128, 255],
 *     [0, 255, 0],             # <<<<<<<<<<<<<<
 *     [0, 255, 128],
 *     [0, 255, 255],
 */
  __pyx_t_24 = PyList_New(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_24, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_24, 1, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_24, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":201
 *     [255, 128, 255],
 *     [0, 255, 0],
 *     [0, 255, 128],             # <<<<<<<<<<<<<<
 *     [0, 255, 255],
 *     [128, 255, 0],
 */
  __pyx_t_25 = PyList_New(3); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_25);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_25, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_25, 1, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_25, 2, __pyx_int_128);

  /* "PygameShader/shader.pyx":202
 *     [0, 255, 0],
 *     [0, 255, 128],
 *     [0, 255, 255],             # <<<<<<<<<<<<<<
 *     [128, 255, 0],
 *     [128, 255, 128],
 */
  __pyx_t_26 = PyList_New(3); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_26);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_26, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_26, 1, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_26, 2, __pyx_int_255);

  /* "PygameShader/shader.pyx":203
 *     [0, 255, 128],
 *     [0, 255, 255],
 *     [128, 255, 0],             # <<<<<<<<<<<<<<
 *     [128, 255, 128],
 *     [128, 255, 255],
 */
  __pyx_t_27 = PyList_New(3); if (unlikely(!__pyx_t_27)) __PYX_ERR(1, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_27);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_27, 0, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_27, 1, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_27, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":204
 *     [0, 255, 255],
 *     [128, 255, 0],
 *     [128, 255, 128],             # <<<<<<<<<<<<<<
 *     [128, 255, 255],
 *     [255, 255, 0],
 */
  __pyx_t_28 = PyList_New(3); if (unlikely(!__pyx_t_28)) __PYX_ERR(1, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_28);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_28, 0, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_28, 1, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_28, 2, __pyx_int_128);

  /* "PygameShader/shader.pyx":205
 *     [128, 255, 0],
 *     [128, 255, 128],
 *     [128, 255, 255],             # <<<<<<<<<<<<<<
 *     [255, 255, 0],
 *     [255, 255, 128],
 */
  __pyx_t_29 = PyList_New(3); if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_29);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_29, 0, __pyx_int_128);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_29, 1, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_29, 2, __pyx_int_255);

  /* "PygameShader/shader.pyx":206
 *     [128, 255, 128],
 *     [128, 255, 255],
 *     [255, 255, 0],             # <<<<<<<<<<<<<<
 *     [255, 255, 128],
 *     [255, 255, 255]], dtype=numpy.uint8)
 */
  __pyx_t_30 = PyList_New(3); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_30, 0, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_30, 1, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_30, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":207
 *     [128, 255, 255],
 *     [255, 255, 0],
 *     [255, 255, 128],             # <<<<<<<<<<<<<<
 *     [255, 255, 255]], dtype=numpy.uint8)
 * 
 */
  __pyx_t_31 = PyList_New(3); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_31, 0, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_31, 1, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_128);
  __Pyx_GIVEREF(__pyx_int_128);
  PyList_SET_ITEM(__pyx_t_31, 2, __pyx_int_128);

  /* "PygameShader/shader.pyx":208
 *     [255, 255, 0],
 *     [255, 255, 128],
 *     [255, 255, 255]], dtype=numpy.uint8)             # <<<<<<<<<<<<<<
 * 
 * cdef:
 */
  __pyx_t_32 = PyList_New(3); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_32, 0, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_32, 1, __pyx_int_255);
  __Pyx_INCREF(__pyx_int_255);
  __Pyx_GIVEREF(__pyx_int_255);
  PyList_SET_ITEM(__pyx_t_32, 2, __pyx_int_255);

  /* "PygameShader/shader.pyx":182
 * 
 * COLORS_CPC64 = numpy.array(
 *     [[0, 0, 0],             # <<<<<<<<<<<<<<
 *     [0, 0, 128],
 *     [0, 0, 255],
 */
  __pyx_t_33 = PyList_New(27); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_33, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_33, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_33, 2, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyList_SET_ITEM(__pyx_t_33, 3, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_10);
  PyList_SET_ITEM(__pyx_t_33, 4, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_11);
  PyList_SET_ITEM(__pyx_t_33, 5, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_12);
  PyList_SET_ITEM(__pyx_t_33, 6, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_13);
  PyList_SET_ITEM(__pyx_t_33, 7, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_14);
  PyList_SET_ITEM(__pyx_t_33, 8, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_15);
  PyList_SET_ITEM(__pyx_t_33, 9, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_16);
  PyList_SET_ITEM(__pyx_t_33, 10, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_17);
  PyList_SET_ITEM(__pyx_t_33, 11, __pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_18);
  PyList_SET_ITEM(__pyx_t_33, 12, __pyx_t_18);
  __Pyx_GIVEREF(__pyx_t_19);
  PyList_SET_ITEM(__pyx_t_33, 13, __pyx_t_19);
  __Pyx_GIVEREF(__pyx_t_20);
  PyList_SET_ITEM(__pyx_t_33, 14, __pyx_t_20);
  __Pyx_GIVEREF(__pyx_t_21);
  PyList_SET_ITEM(__pyx_t_33, 15, __pyx_t_21);
  __Pyx_GIVEREF(__pyx_t_22);
  PyList_SET_ITEM(__pyx_t_33, 16, __pyx_t_22);
  __Pyx_GIVEREF(__pyx_t_23);
  PyList_SET_ITEM(__pyx_t_33, 17, __pyx_t_23);
  __Pyx_GIVEREF(__pyx_t_24);
  PyList_SET_ITEM(__pyx_t_33, 18, __pyx_t_24);
  __Pyx_GIVEREF(__pyx_t_25);
  PyList_SET_ITEM(__pyx_t_33, 19, __pyx_t_25);
  __Pyx_GIVEREF(__pyx_t_26);
  PyList_SET_ITEM(__pyx_t_33, 20, __pyx_t_26);
  __Pyx_GIVEREF(__pyx_t_27);
  PyList_SET_ITEM(__pyx_t_33, 21, __pyx_t_27);
  __Pyx_GIVEREF(__pyx_t_28);
  PyList_SET_ITEM(__pyx_t_33, 22, __pyx_t_28);
  __Pyx_GIVEREF(__pyx_t_29);
  PyList_SET_ITEM(__pyx_t_33, 23, __pyx_t_29);
  __Pyx_GIVEREF(__pyx_t_30);
  PyList_SET_ITEM(__pyx_t_33, 24, __pyx_t_30);
  __Pyx_GIVEREF(__pyx_t_31);
  PyList_SET_ITEM(__pyx_t_33, 25, __pyx_t_31);
  __Pyx_GIVEREF(__pyx_t_32);
  PyList_SET_ITEM(__pyx_t_33, 26, __pyx_t_32);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_11 = 0;
  __pyx_t_12 = 0;
  __pyx_t_13 = 0;
  __pyx_t_14 = 0;
  __pyx_t_15 = 0;
  __pyx_t_16 = 0;
  __pyx_t_17 = 0;
  __pyx_t_18 = 0;
  __pyx_t_19 = 0;
  __pyx_t_20 = 0;
  __pyx_t_21 = 0;
  __pyx_t_22 = 0;
  __pyx_t_23 = 0;
  __pyx_t_24 = 0;
  __pyx_t_25 = 0;
  __pyx_t_26 = 0;
  __pyx_t_27 = 0;
  __pyx_t_28 = 0;
  __pyx_t_29 = 0;
  __pyx_t_30 = 0;
  __pyx_t_31 = 0;
  __pyx_t_32 = 0;

  /* "PygameShader/shader.pyx":181
 *     SIN_TABLE[ANGLE] = <float>sin(<float>(ANGLE * DEG_TO_RAD))
 * 
 * COLORS_CPC64 = numpy.array(             # <<<<<<<<<<<<<<
 *     [[0, 0, 0],
 *     [0, 0, 128],
 */
  __pyx_t_32 = PyTuple_New(1); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_GIVEREF(__pyx_t_33);
  PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_33);
  __pyx_t_33 = 0;

  /* "PygameShader/shader.pyx":208
 *     [255, 255, 0],
 *     [255, 255, 128],
 *     [255, 255, 255]], dtype=numpy.uint8)             # <<<<<<<<<<<<<<
 * 
 * cdef:
 */
  __pyx_t_33 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_GetModuleGlobalName(__pyx_t_31, __pyx_n_s_numpy); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_31, __pyx_n_s_uint8); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
  if (PyDict_SetItem(__pyx_t_33, __pyx_n_s_dtype, __pyx_t_30) < 0) __PYX_ERR(1, 208, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;

  /* "PygameShader/shader.pyx":181
 *     SIN_TABLE[ANGLE] = <float>sin(<float>(ANGLE * DEG_TO_RAD))
 * 
 * COLORS_CPC64 = numpy.array(             # <<<<<<<<<<<<<<
 *     [[0, 0, 0],
 *     [0, 0, 128],
 */
  __pyx_t_30 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_32, __pyx_t_33); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_COLORS_CPC64, __pyx_t_30) < 0) __PYX_ERR(1, 181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;

  /* "PygameShader/shader.pyx":211
 * 
 * cdef:
 *     float [:, :] COLORS_CPC64_C = numpy.divide(COLORS_CPC64, 255.0).astype(dtype=float32)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_n_s_numpy); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_30, __pyx_n_s_divide); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_n_s_COLORS_CPC64); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __pyx_t_32 = PyTuple_New(2); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_GIVEREF(__pyx_t_30);
  PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_30);
  __Pyx_INCREF(__pyx_float_255_0);
  __Pyx_GIVEREF(__pyx_float_255_0);
  PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_float_255_0);
  __pyx_t_30 = 0;
  __pyx_t_30 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_t_32, NULL); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_30, __pyx_n_s_astype); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  __pyx_t_30 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_float32); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  if (PyDict_SetItem(__pyx_t_30, __pyx_n_s_dtype, __pyx_t_33) < 0) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __pyx_t_33 = __Pyx_PyObject_Call(__pyx_t_32, __pyx_empty_tuple, __pyx_t_30); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  __pyx_t_34 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_33, PyBUF_WRITABLE); if (unlikely(!__pyx_t_34.memview)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_COLORS_CPC64_C, 1);
  __pyx_v_12PygameShader_6shader_COLORS_CPC64_C = __pyx_t_34;
  __pyx_t_34.memview = NULL;
  __pyx_t_34.data = NULL;

  /* "PygameShader/shader.pyx":765
 *         object surface_,
 *         int frame,
 *         float hue_=1.0/6.0,             # <<<<<<<<<<<<<<
 *         float sat_=1.0/6.0,
 *         float value_=1.0/8.0,
 */
  __pyx_k__3 = (1.0 / 6.0);

  /* "PygameShader/shader.pyx":766
 *         int frame,
 *         float hue_=1.0/6.0,
 *         float sat_=1.0/6.0,             # <<<<<<<<<<<<<<
 *         float value_=1.0/8.0,
 *         float a_=1.0/255.0,
 */
  __pyx_k__4 = (1.0 / 6.0);

  /* "PygameShader/shader.pyx":767
 *         float hue_=1.0/6.0,
 *         float sat_=1.0/6.0,
 *         float value_=1.0/8.0,             # <<<<<<<<<<<<<<
 *         float a_=1.0/255.0,
 *         float b_=1.0/12.0,
 */
  __pyx_k__5 = (1.0 / 8.0);

  /* "PygameShader/shader.pyx":768
 *         float sat_=1.0/6.0,
 *         float value_=1.0/8.0,
 *         float a_=1.0/255.0,             # <<<<<<<<<<<<<<
 *         float b_=1.0/12.0,
 *         float c_=1.0/12.0
 */
  __pyx_k__6 = (1.0 / 255.0);

  /* "PygameShader/shader.pyx":769
 *         float value_=1.0/8.0,
 *         float a_=1.0/255.0,
 *         float b_=1.0/12.0,             # <<<<<<<<<<<<<<
 *         float c_=1.0/12.0
 * ):
 */
  __pyx_k__7 = (1.0 / 12.0);

  /* "PygameShader/shader.pyx":770
 *         float a_=1.0/255.0,
 *         float b_=1.0/12.0,
 *         float c_=1.0/12.0             # <<<<<<<<<<<<<<
 * ):
 *     """
 */
  __pyx_k__8 = (1.0 / 12.0);

  /* "PygameShader/shader.pyx":765
 *         object surface_,
 *         int frame,
 *         float hue_=1.0/6.0,             # <<<<<<<<<<<<<<
 *         float sat_=1.0/6.0,
 *         float value_=1.0/8.0,
 */
  __pyx_k__3 = (1.0 / 6.0);

  /* "PygameShader/shader.pyx":766
 *         int frame,
 *         float hue_=1.0/6.0,
 *         float sat_=1.0/6.0,             # <<<<<<<<<<<<<<
 *         float value_=1.0/8.0,
 *         float a_=1.0/255.0,
 */
  __pyx_k__4 = (1.0 / 6.0);

  /* "PygameShader/shader.pyx":767
 *         float hue_=1.0/6.0,
 *         float sat_=1.0/6.0,
 *         float value_=1.0/8.0,             # <<<<<<<<<<<<<<
 *         float a_=1.0/255.0,
 *         float b_=1.0/12.0,
 */
  __pyx_k__5 = (1.0 / 8.0);

  /* "PygameShader/shader.pyx":768
 *         float sat_=1.0/6.0,
 *         float value_=1.0/8.0,
 *         float a_=1.0/255.0,             # <<<<<<<<<<<<<<
 *         float b_=1.0/12.0,
 *         float c_=1.0/12.0
 */
  __pyx_k__6 = (1.0 / 255.0);

  /* "PygameShader/shader.pyx":769
 *         float value_=1.0/8.0,
 *         float a_=1.0/255.0,
 *         float b_=1.0/12.0,             # <<<<<<<<<<<<<<
 *         float c_=1.0/12.0
 * ):
 */
  __pyx_k__7 = (1.0 / 12.0);

  /* "PygameShader/shader.pyx":770
 *         float a_=1.0/255.0,
 *         float b_=1.0/12.0,
 *         float c_=1.0/12.0             # <<<<<<<<<<<<<<
 * ):
 *     """
 */
  __pyx_k__8 = (1.0 / 12.0);

  /* "PygameShader/shader.pyx":1376
 *         bint inv_colormap=False,
 *         bint fast=False,
 *         int blend=pygame.BLEND_RGB_ADD             # <<<<<<<<<<<<<<
 * ):
 *     """
 */
  __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_pygame); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_33, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_30); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1376, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  __pyx_k__11 = __pyx_t_7;

  /* "PygameShader/shader.pyx":1369
 * 
 * 
 * cpdef inline predator_vision(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         unsigned int sobel_threshold=12,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_n_s_pygame); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);

  /* "PygameShader/shader.pyx":1376
 *         bint inv_colormap=False,
 *         bint fast=False,
 *         int blend=pygame.BLEND_RGB_ADD             # <<<<<<<<<<<<<<
 * ):
 *     """
 */
  __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_30, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_33); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1376, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __pyx_k__11 = __pyx_t_7;

  /* "PygameShader/shader.pyx":2004
 *         object surface_,
 *         object lens_model_,
 *         int flag_=BLEND_RGB_ADD,             # <<<<<<<<<<<<<<
 *         float light_ = 0.0
 * ):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 2004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_33); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2004, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __pyx_k__15 = __pyx_t_7;

  /* "PygameShader/shader.pyx":2001
 * 
 * 
 * cpdef inline void dirt_lens(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         object lens_model_,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 2004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);

  /* "PygameShader/shader.pyx":2004
 *         object surface_,
 *         object lens_model_,
 *         int flag_=BLEND_RGB_ADD,             # <<<<<<<<<<<<<<
 *         float light_ = 0.0
 * ):
 */
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_33); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2004, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __pyx_k__15 = __pyx_t_7;

  /* "PygameShader/shader.pyx":2357
 *         int median_kernel_   = 2,
 *         color_               = 8,
 *         flag_                = BLEND_RGB_ADD             # <<<<<<<<<<<<<<
 * ):
 *     """
 */
  __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 2357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __pyx_k__17 = __pyx_t_33;
  __Pyx_GIVEREF(__pyx_t_33);
  __pyx_t_33 = 0;

  /* "PygameShader/shader.pyx":2352
 * @cython.nonecheck(False)
 * @cython.cdivision(True)
 * cpdef cartoon(             # <<<<<<<<<<<<<<
 *         object surface_,
 *         int sobel_threshold_ = 128,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 2357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __pyx_k__17 = __pyx_t_33;
  __Pyx_GIVEREF(__pyx_t_33);
  __pyx_t_33 = 0;

  /* "PygameShader/shader.pyx":2584
 * 
 * 
 * cdef float C1_ = <float>1.0 / <float>sqrt(M_2PI)             # <<<<<<<<<<<<<<
 * 
 * cdef inline float gauss(float x, float c, float sigma=1.0, float mu=0.0)nogil:
 */
  __pyx_v_12PygameShader_6shader_C1_ = (((float)1.0) / ((float)sqrt(__pyx_v_12PygameShader_6shader_M_2PI)));

  /* "PygameShader/shader.pyx":3307
 * 
 * 
 * cdef float ONE_255 = <float>1.0 / <float>255.0             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_v_12PygameShader_6shader_ONE_255 = (((float)1.0) / ((float)255.0));

  /* "PygameShader/shader.pyx":3364
 * 
 * cdef:
 *     short [:, ::1] GY = numpy.array(             # <<<<<<<<<<<<<<
 *         ([-1, 0, 1],
 *          [-2, 0, 2],
 */
  __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_numpy); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 3364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_33, __pyx_n_s_array_2); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 3364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;

  /* "PygameShader/shader.pyx":3365
 * cdef:
 *     short [:, ::1] GY = numpy.array(
 *         ([-1, 0, 1],             # <<<<<<<<<<<<<<
 *          [-2, 0, 2],
 *          [-1, 0, 1])).astype(dtype=int16, order='C')
 */
  __pyx_t_33 = PyList_New(3); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 3365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_33, 0, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_33, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_33, 2, __pyx_int_1);

  /* "PygameShader/shader.pyx":3366
 *     short [:, ::1] GY = numpy.array(
 *         ([-1, 0, 1],
 *          [-2, 0, 2],             # <<<<<<<<<<<<<<
 *          [-1, 0, 1])).astype(dtype=int16, order='C')
 * 
 */
  __pyx_t_32 = PyList_New(3); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 3366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_INCREF(__pyx_int_neg_2);
  __Pyx_GIVEREF(__pyx_int_neg_2);
  PyList_SET_ITEM(__pyx_t_32, 0, __pyx_int_neg_2);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_32, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyList_SET_ITEM(__pyx_t_32, 2, __pyx_int_2);

  /* "PygameShader/shader.pyx":3367
 *         ([-1, 0, 1],
 *          [-2, 0, 2],
 *          [-1, 0, 1])).astype(dtype=int16, order='C')             # <<<<<<<<<<<<<<
 * 
 *     short [:, ::1] GX = numpy.array(
 */
  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_1);

  /* "PygameShader/shader.pyx":3365
 * cdef:
 *     short [:, ::1] GY = numpy.array(
 *         ([-1, 0, 1],             # <<<<<<<<<<<<<<
 *          [-2, 0, 2],
 *          [-1, 0, 1])).astype(dtype=int16, order='C')
 */
  __pyx_t_31 = PyTuple_New(3); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 3365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __Pyx_GIVEREF(__pyx_t_33);
  PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_33);
  __Pyx_GIVEREF(__pyx_t_32);
  PyTuple_SET_ITEM(__pyx_t_31, 1, __pyx_t_32);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_31, 2, __pyx_t_2);
  __pyx_t_33 = 0;
  __pyx_t_32 = 0;
  __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":3364
 * 
 * cdef:
 *     short [:, ::1] GY = numpy.array(             # <<<<<<<<<<<<<<
 *         ([-1, 0, 1],
 *          [-2, 0, 2],
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_30, __pyx_t_31); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;

  /* "PygameShader/shader.pyx":3367
 *         ([-1, 0, 1],
 *          [-2, 0, 2],
 *          [-1, 0, 1])).astype(dtype=int16, order='C')             # <<<<<<<<<<<<<<
 * 
 *     short [:, ::1] GX = numpy.array(
 */
  __pyx_t_31 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 3367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_n_s_int16); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 3367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_30) < 0) __PYX_ERR(1, 3367, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 3367, __pyx_L1_error)
  __pyx_t_30 = __Pyx_PyObject_Call(__pyx_t_31, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 3367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_35 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(__pyx_t_30, PyBUF_WRITABLE); if (unlikely(!__pyx_t_35.memview)) __PYX_ERR(1, 3367, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_GY, 1);
  __pyx_v_12PygameShader_6shader_GY = __pyx_t_35;
  __pyx_t_35.memview = NULL;
  __pyx_t_35.data = NULL;

  /* "PygameShader/shader.pyx":3369
 *          [-1, 0, 1])).astype(dtype=int16, order='C')
 * 
 *     short [:, ::1] GX = numpy.array(             # <<<<<<<<<<<<<<
 *         ([-1, -2, -1],
 *          [0,   0,  0],
 */
  __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_n_s_numpy); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 3369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_30, __pyx_n_s_array_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;

  /* "PygameShader/shader.pyx":3370
 * 
 *     short [:, ::1] GX = numpy.array(
 *         ([-1, -2, -1],             # <<<<<<<<<<<<<<
 *          [0,   0,  0],
 *          [1,   2,  1])).astype(dtype=int16, order='c')
 */
  __pyx_t_30 = PyList_New(3); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 3370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_30, 0, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_2);
  __Pyx_GIVEREF(__pyx_int_neg_2);
  PyList_SET_ITEM(__pyx_t_30, 1, __pyx_int_neg_2);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_30, 2, __pyx_int_neg_1);

  /* "PygameShader/shader.pyx":3371
 *     short [:, ::1] GX = numpy.array(
 *         ([-1, -2, -1],
 *          [0,   0,  0],             # <<<<<<<<<<<<<<
 *          [1,   2,  1])).astype(dtype=int16, order='c')
 * 
 */
  __pyx_t_31 = PyList_New(3); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 3371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_31, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_31, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_31, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":3372
 *         ([-1, -2, -1],
 *          [0,   0,  0],
 *          [1,   2,  1])).astype(dtype=int16, order='c')             # <<<<<<<<<<<<<<
 * 
 *     unsigned short int KERNEL_HALF = 1
 */
  __pyx_t_32 = PyList_New(3); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 3372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_32, 0, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyList_SET_ITEM(__pyx_t_32, 1, __pyx_int_2);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_32, 2, __pyx_int_1);

  /* "PygameShader/shader.pyx":3370
 * 
 *     short [:, ::1] GX = numpy.array(
 *         ([-1, -2, -1],             # <<<<<<<<<<<<<<
 *          [0,   0,  0],
 *          [1,   2,  1])).astype(dtype=int16, order='c')
 */
  __pyx_t_33 = PyTuple_New(3); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 3370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_GIVEREF(__pyx_t_30);
  PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_t_30);
  __Pyx_GIVEREF(__pyx_t_31);
  PyTuple_SET_ITEM(__pyx_t_33, 1, __pyx_t_31);
  __Pyx_GIVEREF(__pyx_t_32);
  PyTuple_SET_ITEM(__pyx_t_33, 2, __pyx_t_32);
  __pyx_t_30 = 0;
  __pyx_t_31 = 0;
  __pyx_t_32 = 0;

  /* "PygameShader/shader.pyx":3369
 *          [-1, 0, 1])).astype(dtype=int16, order='C')
 * 
 *     short [:, ::1] GX = numpy.array(             # <<<<<<<<<<<<<<
 *         ([-1, -2, -1],
 *          [0,   0,  0],
 */
  __pyx_t_32 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_33); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 3369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;

  /* "PygameShader/shader.pyx":3372
 *         ([-1, -2, -1],
 *          [0,   0,  0],
 *          [1,   2,  1])).astype(dtype=int16, order='c')             # <<<<<<<<<<<<<<
 * 
 *     unsigned short int KERNEL_HALF = 1
 */
  __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_32, __pyx_n_s_astype); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 3372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __pyx_t_32 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 3372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_int16); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_32, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 3372, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_32, __pyx_n_s_order, __pyx_n_s_c_2) < 0) __PYX_ERR(1, 3372, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_empty_tuple, __pyx_t_32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __pyx_t_35 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_35.memview)) __PYX_ERR(1, 3372, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_GX, 1);
  __pyx_v_12PygameShader_6shader_GX = __pyx_t_35;
  __pyx_t_35.memview = NULL;
  __pyx_t_35.data = NULL;

  /* "PygameShader/shader.pyx":3374
 *          [1,   2,  1])).astype(dtype=int16, order='c')
 * 
 *     unsigned short int KERNEL_HALF = 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_12PygameShader_6shader_KERNEL_HALF = 1;

  /* "PygameShader/shader.pyx":3686
 * 
 * 
 * cdef float[5] GAUSS_KERNEL = [1.0/16.0, 4.0/16.0, 6.0/16.0, 4.0/16.0, 1.0/16.0]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_t_36[0] = (1.0 / 16.0);
  __pyx_t_36[1] = (4.0 / 16.0);
  __pyx_t_36[2] = (6.0 / 16.0);
  __pyx_t_36[3] = (4.0 / 16.0);
  __pyx_t_36[4] = (1.0 / 16.0);
  memcpy(&(__pyx_v_12PygameShader_6shader_GAUSS_KERNEL[0]), __pyx_t_36, sizeof(__pyx_v_12PygameShader_6shader_GAUSS_KERNEL[0]) * (5));

  /* "PygameShader/shader.pyx":4014
 *         unsigned char [:, :, :] rgb_array_,
 *         int frame,
 *         float hue_=1.0/6.0,             # <<<<<<<<<<<<<<
 *         float sat_=1.0/6.0,
 *         float value_=1.0/8.0,
 */
  if (unlikely(6.0 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(1, 4014, __pyx_L1_error)
  }
  __pyx_k__19 = (1.0 / 6.0);

  /* "PygameShader/shader.pyx":4015
 *         int frame,
 *         float hue_=1.0/6.0,
 *         float sat_=1.0/6.0,             # <<<<<<<<<<<<<<
 *         float value_=1.0/8.0,
 *         float a_=ONE_255,
 */
  if (unlikely(6.0 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(1, 4015, __pyx_L1_error)
  }
  __pyx_k__20 = (1.0 / 6.0);

  /* "PygameShader/shader.pyx":4016
 *         float hue_=1.0/6.0,
 *         float sat_=1.0/6.0,
 *         float value_=1.0/8.0,             # <<<<<<<<<<<<<<
 *         float a_=ONE_255,
 *         float b_=ONE_TWELVE,
 */
  if (unlikely(8.0 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(1, 4016, __pyx_L1_error)
  }
  __pyx_k__21 = (1.0 / 8.0);

  /* "PygameShader/shader.pyx":5019
 * 
 * 
 * cdef unsigned int [:, :, ::1] IMAGE_FISHEYE_MODEL = numpy.zeros((800, 1024, 2), uint32)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_33 = PyTuple_New(2); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 5019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_INCREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);
  PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_33, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_32, __pyx_t_33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __pyx_t_37 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_int(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_37.memview)) __PYX_ERR(1, 5019, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_IMAGE_FISHEYE_MODEL, 1);
  __pyx_v_12PygameShader_6shader_IMAGE_FISHEYE_MODEL = __pyx_t_37;
  __pyx_t_37.memview = NULL;
  __pyx_t_37.data = NULL;

  /* "PygameShader/shader.pyx":5940
 * 
 * 
 * cdef int i = 0             # <<<<<<<<<<<<<<
 * HEATMAP = [heat_map(i, 1.0) for i in range(380, 750)]
 * 
 */
  __pyx_v_12PygameShader_6shader_i = 0;

  /* "PygameShader/shader.pyx":5941
 * 
 * cdef int i = 0
 * HEATMAP = [heat_map(i, 1.0) for i in range(380, 750)]             # <<<<<<<<<<<<<<
 * 
 * cdef float f_map = (<float>750.0 - <float>380.0 -<float>1.0) / (<float>255.0 * <float>3.0)
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  for (__pyx_t_7 = 0x17C; __pyx_t_7 < 0x2EE; __pyx_t_7+=1) {
    __pyx_v_12PygameShader_6shader_i = __pyx_t_7;
    __pyx_t_38.__pyx_n = 1;
    __pyx_t_38.gamma = 1.0;
    __pyx_t_33 = __pyx_f_12PygameShader_6shader_heat_map(__pyx_v_12PygameShader_6shader_i, 0, &__pyx_t_38); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 5941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_33);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_33))) __PYX_ERR(1, 5941, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  }
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HEATMAP, __pyx_t_2) < 0) __PYX_ERR(1, 5941, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":5943
 * HEATMAP = [heat_map(i, 1.0) for i in range(380, 750)]
 * 
 * cdef float f_map = (<float>750.0 - <float>380.0 -<float>1.0) / (<float>255.0 * <float>3.0)             # <<<<<<<<<<<<<<
 * 
 * cdef unsigned char[:, ::1] heatmap_array = numpy.zeros((750 - 380, 3), numpy.uint8)
 */
  __pyx_v_12PygameShader_6shader_f_map = (((((float)750.0) - ((float)380.0)) - ((float)1.0)) / (((float)255.0) * ((float)3.0)));

  /* "PygameShader/shader.pyx":5945
 * cdef float f_map = (<float>750.0 - <float>380.0 -<float>1.0) / (<float>255.0 * <float>3.0)
 * 
 * cdef unsigned char[:, ::1] heatmap_array = numpy.zeros((750 - 380, 3), numpy.uint8)             # <<<<<<<<<<<<<<
 * cdef tuple t
 * i = 0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 5945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_t_32);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_32);
  __pyx_t_32 = 0;
  __pyx_t_32 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_t_2, NULL); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_39 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_char(__pyx_t_32, PyBUF_WRITABLE); if (unlikely(!__pyx_t_39.memview)) __PYX_ERR(1, 5945, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_heatmap_array, 1);
  __pyx_v_12PygameShader_6shader_heatmap_array = __pyx_t_39;
  __pyx_t_39.memview = NULL;
  __pyx_t_39.data = NULL;

  /* "PygameShader/shader.pyx":5947
 * cdef unsigned char[:, ::1] heatmap_array = numpy.zeros((750 - 380, 3), numpy.uint8)
 * cdef tuple t
 * i = 0             # <<<<<<<<<<<<<<
 * for t in HEATMAP:
 *     heatmap_array[i, 0] = t[0]
 */
  __pyx_v_12PygameShader_6shader_i = 0;

  /* "PygameShader/shader.pyx":5948
 * cdef tuple t
 * i = 0
 * for t in HEATMAP:             # <<<<<<<<<<<<<<
 *     heatmap_array[i, 0] = t[0]
 *     heatmap_array[i, 1] = t[1]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_32, __pyx_n_s_HEATMAP); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  if (likely(PyList_CheckExact(__pyx_t_32)) || PyTuple_CheckExact(__pyx_t_32)) {
    __pyx_t_2 = __pyx_t_32; __Pyx_INCREF(__pyx_t_2); __pyx_t_40 = 0;
    __pyx_t_41 = NULL;
  } else {
    __pyx_t_40 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_41 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_41)) __PYX_ERR(1, 5948, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  for (;;) {
    if (likely(!__pyx_t_41)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_40 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_32 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_32); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 5948, __pyx_L1_error)
        #else
        __pyx_t_32 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5948, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_32);
        #endif
      } else {
        if (__pyx_t_40 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_32 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_32); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 5948, __pyx_L1_error)
        #else
        __pyx_t_32 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5948, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_32);
        #endif
      }
    } else {
      __pyx_t_32 = __pyx_t_41(__pyx_t_2);
      if (unlikely(!__pyx_t_32)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 5948, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_32);
    }
    if (!(likely(PyTuple_CheckExact(__pyx_t_32))||((__pyx_t_32) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_32)->tp_name), 0))) __PYX_ERR(1, 5948, __pyx_L1_error)
    __Pyx_XGOTREF(__pyx_v_12PygameShader_6shader_t);
    __Pyx_DECREF_SET(__pyx_v_12PygameShader_6shader_t, ((PyObject*)__pyx_t_32));
    __Pyx_GIVEREF(__pyx_t_32);
    __pyx_t_32 = 0;

    /* "PygameShader/shader.pyx":5949
 * i = 0
 * for t in HEATMAP:
 *     heatmap_array[i, 0] = t[0]             # <<<<<<<<<<<<<<
 *     heatmap_array[i, 1] = t[1]
 *     heatmap_array[i, 2] = t[2]
 */
    if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 5949, __pyx_L1_error)
    }
    __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 0)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 5949, __pyx_L1_error)
    if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundLocalError("heatmap_array"); __PYX_ERR(1, 5949, __pyx_L1_error) }
    __pyx_t_43 = __pyx_v_12PygameShader_6shader_i;
    __pyx_t_44 = 0;
    *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_43 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_44)) )) = __pyx_t_42;

    /* "PygameShader/shader.pyx":5950
 * for t in HEATMAP:
 *     heatmap_array[i, 0] = t[0]
 *     heatmap_array[i, 1] = t[1]             # <<<<<<<<<<<<<<
 *     heatmap_array[i, 2] = t[2]
 *     i += 1
 */
    if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 5950, __pyx_L1_error)
    }
    __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 1)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 5950, __pyx_L1_error)
    if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundLocalError("heatmap_array"); __PYX_ERR(1, 5950, __pyx_L1_error) }
    __pyx_t_44 = __pyx_v_12PygameShader_6shader_i;
    __pyx_t_43 = 1;
    *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_44 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_43)) )) = __pyx_t_42;

    /* "PygameShader/shader.pyx":5951
 *     heatmap_array[i, 0] = t[0]
 *     heatmap_array[i, 1] = t[1]
 *     heatmap_array[i, 2] = t[2]             # <<<<<<<<<<<<<<
 *     i += 1
 * 
 */
    if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 5951, __pyx_L1_error)
    }
    __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 2)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 5951, __pyx_L1_error)
    if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundLocalError("heatmap_array"); __PYX_ERR(1, 5951, __pyx_L1_error) }
    __pyx_t_43 = __pyx_v_12PygameShader_6shader_i;
    __pyx_t_44 = 2;
    *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_43 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_44)) )) = __pyx_t_42;

    /* "PygameShader/shader.pyx":5952
 *     heatmap_array[i, 1] = t[1]
 *     heatmap_array[i, 2] = t[2]
 *     i += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_12PygameShader_6shader_i = (__pyx_v_12PygameShader_6shader_i + 1);

    /* "PygameShader/shader.pyx":5948
 * cdef tuple t
 * i = 0
 * for t in HEATMAP:             # <<<<<<<<<<<<<<
 *     heatmap_array[i, 0] = t[0]
 *     heatmap_array[i, 1] = t[1]
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":6041
 *     return rgb_c.r, rgb_c.g, rgb_c.b
 * 
 * i = 0             # <<<<<<<<<<<<<<
 * BLUEMAP = [ blue_map(i, 1.0) for i in range(450, 495) ]
 * 
 */
  __pyx_v_12PygameShader_6shader_i = 0;

  /* "PygameShader/shader.pyx":6042
 * 
 * i = 0
 * BLUEMAP = [ blue_map(i, 1.0) for i in range(450, 495) ]             # <<<<<<<<<<<<<<
 * 
 * cdef float f_bluemap = (<float>495.0 - <float>450.0 - <float>1.0) / (<float>255.0 * <float>3.0)
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  for (__pyx_t_7 = 0x1C2; __pyx_t_7 < 0x1EF; __pyx_t_7+=1) {
    __pyx_v_12PygameShader_6shader_i = __pyx_t_7;
    __pyx_t_45.__pyx_n = 1;
    __pyx_t_45.gamma = 1.0;
    __pyx_t_32 = __pyx_f_12PygameShader_6shader_blue_map(__pyx_v_12PygameShader_6shader_i, 0, &__pyx_t_45); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_32);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_32))) __PYX_ERR(1, 6042, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  }
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLUEMAP, __pyx_t_2) < 0) __PYX_ERR(1, 6042, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":6044
 * BLUEMAP = [ blue_map(i, 1.0) for i in range(450, 495) ]
 * 
 * cdef float f_bluemap = (<float>495.0 - <float>450.0 - <float>1.0) / (<float>255.0 * <float>3.0)             # <<<<<<<<<<<<<<
 * 
 * cdef unsigned char[:, ::1] bluemap_array = numpy.zeros((495 - 450, 3), numpy.uint8)
 */
  __pyx_v_12PygameShader_6shader_f_bluemap = (((((float)495.0) - ((float)450.0)) - ((float)1.0)) / (((float)255.0) * ((float)3.0)));

  /* "PygameShader/shader.pyx":6046
 * cdef float f_bluemap = (<float>495.0 - <float>450.0 - <float>1.0) / (<float>255.0 * <float>3.0)
 * 
 * cdef unsigned char[:, ::1] bluemap_array = numpy.zeros((495 - 450, 3), numpy.uint8)             # <<<<<<<<<<<<<<
 * 
 * i = 0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_t_33);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_33);
  __pyx_t_33 = 0;
  __pyx_t_33 = __Pyx_PyObject_Call(__pyx_t_32, __pyx_t_2, NULL); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_39 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_char(__pyx_t_33, PyBUF_WRITABLE); if (unlikely(!__pyx_t_39.memview)) __PYX_ERR(1, 6046, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_bluemap_array, 1);
  __pyx_v_12PygameShader_6shader_bluemap_array = __pyx_t_39;
  __pyx_t_39.memview = NULL;
  __pyx_t_39.data = NULL;

  /* "PygameShader/shader.pyx":6048
 * cdef unsigned char[:, ::1] bluemap_array = numpy.zeros((495 - 450, 3), numpy.uint8)
 * 
 * i = 0             # <<<<<<<<<<<<<<
 * for t in BLUEMAP:
 *     bluemap_array[i, 0] = t[0]
 */
  __pyx_v_12PygameShader_6shader_i = 0;

  /* "PygameShader/shader.pyx":6049
 * 
 * i = 0
 * for t in BLUEMAP:             # <<<<<<<<<<<<<<
 *     bluemap_array[i, 0] = t[0]
 *     bluemap_array[i, 1] = t[1]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_BLUEMAP); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  if (likely(PyList_CheckExact(__pyx_t_33)) || PyTuple_CheckExact(__pyx_t_33)) {
    __pyx_t_2 = __pyx_t_33; __Pyx_INCREF(__pyx_t_2); __pyx_t_40 = 0;
    __pyx_t_41 = NULL;
  } else {
    __pyx_t_40 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_33); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_41 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_41)) __PYX_ERR(1, 6049, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  for (;;) {
    if (likely(!__pyx_t_41)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_40 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_33 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_33); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 6049, __pyx_L1_error)
        #else
        __pyx_t_33 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6049, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        #endif
      } else {
        if (__pyx_t_40 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_33 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_33); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 6049, __pyx_L1_error)
        #else
        __pyx_t_33 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6049, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        #endif
      }
    } else {
      __pyx_t_33 = __pyx_t_41(__pyx_t_2);
      if (unlikely(!__pyx_t_33)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 6049, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_33);
    }
    if (!(likely(PyTuple_CheckExact(__pyx_t_33))||((__pyx_t_33) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_33)->tp_name), 0))) __PYX_ERR(1, 6049, __pyx_L1_error)
    __Pyx_XGOTREF(__pyx_v_12PygameShader_6shader_t);
    __Pyx_DECREF_SET(__pyx_v_12PygameShader_6shader_t, ((PyObject*)__pyx_t_33));
    __Pyx_GIVEREF(__pyx_t_33);
    __pyx_t_33 = 0;

    /* "PygameShader/shader.pyx":6050
 * i = 0
 * for t in BLUEMAP:
 *     bluemap_array[i, 0] = t[0]             # <<<<<<<<<<<<<<
 *     bluemap_array[i, 1] = t[1]
 *     bluemap_array[i, 2] = t[2]
 */
    if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 6050, __pyx_L1_error)
    }
    __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 0)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6050, __pyx_L1_error)
    if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundLocalError("bluemap_array"); __PYX_ERR(1, 6050, __pyx_L1_error) }
    __pyx_t_44 = __pyx_v_12PygameShader_6shader_i;
    __pyx_t_43 = 0;
    *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_44 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_43)) )) = __pyx_t_42;

    /* "PygameShader/shader.pyx":6051
 * for t in BLUEMAP:
 *     bluemap_array[i, 0] = t[0]
 *     bluemap_array[i, 1] = t[1]             # <<<<<<<<<<<<<<
 *     bluemap_array[i, 2] = t[2]
 *     i += 1
 */
    if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 6051, __pyx_L1_error)
    }
    __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 1)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6051, __pyx_L1_error)
    if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundLocalError("bluemap_array"); __PYX_ERR(1, 6051, __pyx_L1_error) }
    __pyx_t_43 = __pyx_v_12PygameShader_6shader_i;
    __pyx_t_44 = 1;
    *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_43 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_44)) )) = __pyx_t_42;

    /* "PygameShader/shader.pyx":6052
 *     bluemap_array[i, 0] = t[0]
 *     bluemap_array[i, 1] = t[1]
 *     bluemap_array[i, 2] = t[2]             # <<<<<<<<<<<<<<
 *     i += 1
 * 
 */
    if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 6052, __pyx_L1_error)
    }
    __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 2)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6052, __pyx_L1_error)
    if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundLocalError("bluemap_array"); __PYX_ERR(1, 6052, __pyx_L1_error) }
    __pyx_t_44 = __pyx_v_12PygameShader_6shader_i;
    __pyx_t_43 = 2;
    *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_44 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_43)) )) = __pyx_t_42;

    /* "PygameShader/shader.pyx":6053
 *     bluemap_array[i, 1] = t[1]
 *     bluemap_array[i, 2] = t[2]
 *     i += 1             # <<<<<<<<<<<<<<
 * 
 * @cython.binding(False)
 */
    __pyx_v_12PygameShader_6shader_i = (__pyx_v_12PygameShader_6shader_i + 1);

    /* "PygameShader/shader.pyx":6049
 * 
 * i = 0
 * for t in BLUEMAP:             # <<<<<<<<<<<<<<
 *     bluemap_array[i, 0] = t[0]
 *     bluemap_array[i, 1] = t[1]
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":6126
 *     return rgb_c.r, rgb_c.g, rgb_c.b
 * 
 * i = 0             # <<<<<<<<<<<<<<
 * REDMAP = [ red_map(i, 1.0) for i in range(620, 750) ]
 * 
 */
  __pyx_v_12PygameShader_6shader_i = 0;

  /* "PygameShader/shader.pyx":6127
 * 
 * i = 0
 * REDMAP = [ red_map(i, 1.0) for i in range(620, 750) ]             # <<<<<<<<<<<<<<
 * 
 * cdef float f_redmap = (<float>750.0 - <float>620.0 - <float>1.0) / (<float>255.0 * <float>3.0)
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  for (__pyx_t_7 = 0x26C; __pyx_t_7 < 0x2EE; __pyx_t_7+=1) {
    __pyx_v_12PygameShader_6shader_i = __pyx_t_7;
    __pyx_t_46.__pyx_n = 1;
    __pyx_t_46.gamma = 1.0;
    __pyx_t_33 = __pyx_f_12PygameShader_6shader_red_map(__pyx_v_12PygameShader_6shader_i, 0, &__pyx_t_46); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_33);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_33))) __PYX_ERR(1, 6127, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  }
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_REDMAP, __pyx_t_2) < 0) __PYX_ERR(1, 6127, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":6129
 * REDMAP = [ red_map(i, 1.0) for i in range(620, 750) ]
 * 
 * cdef float f_redmap = (<float>750.0 - <float>620.0 - <float>1.0) / (<float>255.0 * <float>3.0)             # <<<<<<<<<<<<<<
 * 
 * cdef unsigned char[:, ::1] redmap_array = numpy.zeros((750 - 620, 3), numpy.uint8)
 */
  __pyx_v_12PygameShader_6shader_f_redmap = (((((float)750.0) - ((float)620.0)) - ((float)1.0)) / (((float)255.0) * ((float)3.0)));

  /* "PygameShader/shader.pyx":6131
 * cdef float f_redmap = (<float>750.0 - <float>620.0 - <float>1.0) / (<float>255.0 * <float>3.0)
 * 
 * cdef unsigned char[:, ::1] redmap_array = numpy.zeros((750 - 620, 3), numpy.uint8)             # <<<<<<<<<<<<<<
 * 
 * i = 0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_t_32);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_32);
  __pyx_t_32 = 0;
  __pyx_t_32 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_t_2, NULL); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_39 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_char(__pyx_t_32, PyBUF_WRITABLE); if (unlikely(!__pyx_t_39.memview)) __PYX_ERR(1, 6131, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_redmap_array, 1);
  __pyx_v_12PygameShader_6shader_redmap_array = __pyx_t_39;
  __pyx_t_39.memview = NULL;
  __pyx_t_39.data = NULL;

  /* "PygameShader/shader.pyx":6133
 * cdef unsigned char[:, ::1] redmap_array = numpy.zeros((750 - 620, 3), numpy.uint8)
 * 
 * i = 0             # <<<<<<<<<<<<<<
 * for t in REDMAP:
 *     redmap_array[i, 0] = t[0]
 */
  __pyx_v_12PygameShader_6shader_i = 0;

  /* "PygameShader/shader.pyx":6134
 * 
 * i = 0
 * for t in REDMAP:             # <<<<<<<<<<<<<<
 *     redmap_array[i, 0] = t[0]
 *     redmap_array[i, 1] = t[1]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_32, __pyx_n_s_REDMAP); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  if (likely(PyList_CheckExact(__pyx_t_32)) || PyTuple_CheckExact(__pyx_t_32)) {
    __pyx_t_2 = __pyx_t_32; __Pyx_INCREF(__pyx_t_2); __pyx_t_40 = 0;
    __pyx_t_41 = NULL;
  } else {
    __pyx_t_40 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_41 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_41)) __PYX_ERR(1, 6134, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  for (;;) {
    if (likely(!__pyx_t_41)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_40 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_32 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_32); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 6134, __pyx_L1_error)
        #else
        __pyx_t_32 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_32);
        #endif
      } else {
        if (__pyx_t_40 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_32 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_32); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 6134, __pyx_L1_error)
        #else
        __pyx_t_32 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_32);
        #endif
      }
    } else {
      __pyx_t_32 = __pyx_t_41(__pyx_t_2);
      if (unlikely(!__pyx_t_32)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 6134, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_32);
    }
    if (!(likely(PyTuple_CheckExact(__pyx_t_32))||((__pyx_t_32) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_32)->tp_name), 0))) __PYX_ERR(1, 6134, __pyx_L1_error)
    __Pyx_XGOTREF(__pyx_v_12PygameShader_6shader_t);
    __Pyx_DECREF_SET(__pyx_v_12PygameShader_6shader_t, ((PyObject*)__pyx_t_32));
    __Pyx_GIVEREF(__pyx_t_32);
    __pyx_t_32 = 0;

    /* "PygameShader/shader.pyx":6135
 * i = 0
 * for t in REDMAP:
 *     redmap_array[i, 0] = t[0]             # <<<<<<<<<<<<<<
 *     redmap_array[i, 1] = t[1]
 *     redmap_array[i, 2] = t[2]
 */
    if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 6135, __pyx_L1_error)
    }
    __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 0)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6135, __pyx_L1_error)
    if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundLocalError("redmap_array"); __PYX_ERR(1, 6135, __pyx_L1_error) }
    __pyx_t_43 = __pyx_v_12PygameShader_6shader_i;
    __pyx_t_44 = 0;
    *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_43 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_44)) )) = __pyx_t_42;

    /* "PygameShader/shader.pyx":6136
 * for t in REDMAP:
 *     redmap_array[i, 0] = t[0]
 *     redmap_array[i, 1] = t[1]             # <<<<<<<<<<<<<<
 *     redmap_array[i, 2] = t[2]
 *     i += 1
 */
    if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 6136, __pyx_L1_error)
    }
    __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 1)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6136, __pyx_L1_error)
    if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundLocalError("redmap_array"); __PYX_ERR(1, 6136, __pyx_L1_error) }
    __pyx_t_44 = __pyx_v_12PygameShader_6shader_i;
    __pyx_t_43 = 1;
    *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_44 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_43)) )) = __pyx_t_42;

    /* "PygameShader/shader.pyx":6137
 *     redmap_array[i, 0] = t[0]
 *     redmap_array[i, 1] = t[1]
 *     redmap_array[i, 2] = t[2]             # <<<<<<<<<<<<<<
 *     i += 1
 * 
 */
    if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 6137, __pyx_L1_error)
    }
    __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 2)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6137, __pyx_L1_error)
    if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundLocalError("redmap_array"); __PYX_ERR(1, 6137, __pyx_L1_error) }
    __pyx_t_43 = __pyx_v_12PygameShader_6shader_i;
    __pyx_t_44 = 2;
    *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_43 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_44)) )) = __pyx_t_42;

    /* "PygameShader/shader.pyx":6138
 *     redmap_array[i, 1] = t[1]
 *     redmap_array[i, 2] = t[2]
 *     i += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_12PygameShader_6shader_i = (__pyx_v_12PygameShader_6shader_i + 1);

    /* "PygameShader/shader.pyx":6134
 * 
 * i = 0
 * for t in REDMAP:             # <<<<<<<<<<<<<<
 *     redmap_array[i, 0] = t[0]
 *     redmap_array[i, 1] = t[1]
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":7605
 * # --------------------------------------------------------------------------------------------------------
 * # KERNEL DEFINITION FOR SHARPEN ALGORITHM
 * cdef float [:, :] SHARPEN_KERNEL = numpy.array(([0, -1, 0],             # <<<<<<<<<<<<<<
 *                       [-1, 5, -1],
 *                       [0, -1, 0])).astype(dtype=float32)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array_2); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 7605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":7606
 * # KERNEL DEFINITION FOR SHARPEN ALGORITHM
 * cdef float [:, :] SHARPEN_KERNEL = numpy.array(([0, -1, 0],
 *                       [-1, 5, -1],             # <<<<<<<<<<<<<<
 *                       [0, -1, 0])).astype(dtype=float32)
 * cdef int HALF_KERNEL = len(SHARPEN_KERNEL) >> 1
 */
  __pyx_t_33 = PyList_New(3); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 7606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_33, 0, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_5);
  __Pyx_GIVEREF(__pyx_int_5);
  PyList_SET_ITEM(__pyx_t_33, 1, __pyx_int_5);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_33, 2, __pyx_int_neg_1);

  /* "PygameShader/shader.pyx":7607
 * cdef float [:, :] SHARPEN_KERNEL = numpy.array(([0, -1, 0],
 *                       [-1, 5, -1],
 *                       [0, -1, 0])).astype(dtype=float32)             # <<<<<<<<<<<<<<
 * cdef int HALF_KERNEL = len(SHARPEN_KERNEL) >> 1
 * 
 */
  __pyx_t_31 = PyList_New(3); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 7607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_31, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_31, 1, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_31, 2, __pyx_int_0);

  /* "PygameShader/shader.pyx":7605
 * # --------------------------------------------------------------------------------------------------------
 * # KERNEL DEFINITION FOR SHARPEN ALGORITHM
 * cdef float [:, :] SHARPEN_KERNEL = numpy.array(([0, -1, 0],             # <<<<<<<<<<<<<<
 *                       [-1, 5, -1],
 *                       [0, -1, 0])).astype(dtype=float32)
 */
  __pyx_t_30 = PyTuple_New(3); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 7605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_30, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_33);
  PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_33);
  __Pyx_GIVEREF(__pyx_t_31);
  PyTuple_SET_ITEM(__pyx_t_30, 2, __pyx_t_31);
  __pyx_t_2 = 0;
  __pyx_t_33 = 0;
  __pyx_t_31 = 0;
  __pyx_t_31 = __Pyx_PyObject_CallOneArg(__pyx_t_32, __pyx_t_30); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 7605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;

  /* "PygameShader/shader.pyx":7607
 * cdef float [:, :] SHARPEN_KERNEL = numpy.array(([0, -1, 0],
 *                       [-1, 5, -1],
 *                       [0, -1, 0])).astype(dtype=float32)             # <<<<<<<<<<<<<<
 * cdef int HALF_KERNEL = len(SHARPEN_KERNEL) >> 1
 * 
 */
  __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_31, __pyx_n_s_astype); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 7607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
  __pyx_t_31 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 7607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __Pyx_GetModuleGlobalName(__pyx_t_32, __pyx_n_s_float32); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 7607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  if (PyDict_SetItem(__pyx_t_31, __pyx_n_s_dtype, __pyx_t_32) < 0) __PYX_ERR(1, 7607, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __pyx_t_32 = __Pyx_PyObject_Call(__pyx_t_30, __pyx_empty_tuple, __pyx_t_31); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 7607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
  __pyx_t_34 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_32, PyBUF_WRITABLE); if (unlikely(!__pyx_t_34.memview)) __PYX_ERR(1, 7607, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_SHARPEN_KERNEL, 1);
  __pyx_v_12PygameShader_6shader_SHARPEN_KERNEL = __pyx_t_34;
  __pyx_t_34.memview = NULL;
  __pyx_t_34.data = NULL;

  /* "PygameShader/shader.pyx":7608
 *                       [-1, 5, -1],
 *                       [0, -1, 0])).astype(dtype=float32)
 * cdef int HALF_KERNEL = len(SHARPEN_KERNEL) >> 1             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  if (unlikely(!__pyx_v_12PygameShader_6shader_SHARPEN_KERNEL.memview)) { __Pyx_RaiseUnboundLocalError("SHARPEN_KERNEL"); __PYX_ERR(1, 7608, __pyx_L1_error) }
  __pyx_t_47 = __Pyx_MemoryView_Len(__pyx_v_12PygameShader_6shader_SHARPEN_KERNEL); 
  __pyx_v_12PygameShader_6shader_HALF_KERNEL = (__pyx_t_47 >> 1);

  /* "PygameShader/shader.pyx":8271
 * 
 * EMBOSS_KERNEL = \
 *     numpy.array((             # <<<<<<<<<<<<<<
 *         [-1, -1, -1, -1, 0],
 *         [-1, -1, -1, 0,  1],
 */
  __Pyx_GetModuleGlobalName(__pyx_t_32, __pyx_n_s_numpy); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 8271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __pyx_t_31 = __Pyx_PyObject_GetAttrStr(__pyx_t_32, __pyx_n_s_array_2); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 8271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;

  /* "PygameShader/shader.pyx":8272
 * EMBOSS_KERNEL = \
 *     numpy.array((
 *         [-1, -1, -1, -1, 0],             # <<<<<<<<<<<<<<
 *         [-1, -1, -1, 0,  1],
 *         [-1, -1,  0, 1,  1],
 */
  __pyx_t_32 = PyList_New(5); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 8272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_32);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_32, 0, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_32, 1, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_32, 2, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_32, 3, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_32, 4, __pyx_int_0);

  /* "PygameShader/shader.pyx":8273
 *     numpy.array((
 *         [-1, -1, -1, -1, 0],
 *         [-1, -1, -1, 0,  1],             # <<<<<<<<<<<<<<
 *         [-1, -1,  0, 1,  1],
 *         [-1,  0,  1, 1,  1],
 */
  __pyx_t_30 = PyList_New(5); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 8273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_30);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_30, 0, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_30, 1, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_30, 2, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_30, 3, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_30, 4, __pyx_int_1);

  /* "PygameShader/shader.pyx":8274
 *         [-1, -1, -1, -1, 0],
 *         [-1, -1, -1, 0,  1],
 *         [-1, -1,  0, 1,  1],             # <<<<<<<<<<<<<<
 *         [-1,  0,  1, 1,  1],
 *         [ 0,  1,  1, 1,  1])).astype(dtype=numpy.float32, order='C')
 */
  __pyx_t_33 = PyList_New(5); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 8274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_33);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_33, 0, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_33, 1, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_33, 2, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_33, 3, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_33, 4, __pyx_int_1);

  /* "PygameShader/shader.pyx":8275
 *         [-1, -1, -1, 0,  1],
 *         [-1, -1,  0, 1,  1],
 *         [-1,  0,  1, 1,  1],             # <<<<<<<<<<<<<<
 *         [ 0,  1,  1, 1,  1])).astype(dtype=numpy.float32, order='C')
 * 
 */
  __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_int_1);

  /* "PygameShader/shader.pyx":8276
 *         [-1, -1,  0, 1,  1],
 *         [-1,  0,  1, 1,  1],
 *         [ 0,  1,  1, 1,  1])).astype(dtype=numpy.float32, order='C')             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_t_29 = PyList_New(5); if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 8276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_29);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_29, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_29, 1, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_29, 2, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_29, 3, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_29, 4, __pyx_int_1);

  /* "PygameShader/shader.pyx":8272
 * EMBOSS_KERNEL = \
 *     numpy.array((
 *         [-1, -1, -1, -1, 0],             # <<<<<<<<<<<<<<
 *         [-1, -1, -1, 0,  1],
 *         [-1, -1,  0, 1,  1],
 */
  __pyx_t_28 = PyTuple_New(5); if (unlikely(!__pyx_t_28)) __PYX_ERR(1, 8272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_28);
  __Pyx_GIVEREF(__pyx_t_32);
  PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_32);
  __Pyx_GIVEREF(__pyx_t_30);
  PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_30);
  __Pyx_GIVEREF(__pyx_t_33);
  PyTuple_SET_ITEM(__pyx_t_28, 2, __pyx_t_33);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_28, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_29);
  PyTuple_SET_ITEM(__pyx_t_28, 4, __pyx_t_29);
  __pyx_t_32 = 0;
  __pyx_t_30 = 0;
  __pyx_t_33 = 0;
  __pyx_t_2 = 0;
  __pyx_t_29 = 0;

  /* "PygameShader/shader.pyx":8271
 * 
 * EMBOSS_KERNEL = \
 *     numpy.array((             # <<<<<<<<<<<<<<
 *         [-1, -1, -1, -1, 0],
 *         [-1, -1, -1, 0,  1],
 */
  __pyx_t_29 = __Pyx_PyObject_CallOneArg(__pyx_t_31, __pyx_t_28); if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 8271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_29);
  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;

  /* "PygameShader/shader.pyx":8276
 *         [-1, -1,  0, 1,  1],
 *         [-1,  0,  1, 1,  1],
 *         [ 0,  1,  1, 1,  1])).astype(dtype=numpy.float32, order='C')             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_t_28 = __Pyx_PyObject_GetAttrStr(__pyx_t_29, __pyx_n_s_astype); if (unlikely(!__pyx_t_28)) __PYX_ERR(1, 8276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_28);
  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
  __pyx_t_29 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 8276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_29);
  __Pyx_GetModuleGlobalName(__pyx_t_31, __pyx_n_s_numpy); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 8276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_31, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
  if (PyDict_SetItem(__pyx_t_29, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 8276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_29, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 8276, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_28, __pyx_empty_tuple, __pyx_t_29); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EMBOSS_KERNEL, __pyx_t_2) < 0) __PYX_ERR(1, 8270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PygameShader/shader.pyx":1
 * # cython: binding=False, boundscheck=False, wraparound=False, nonecheck=False, cdivision=True,             # <<<<<<<<<<<<<<
 * # cython: optimize.use_switch=True
 * # encoding: utf-8
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":209
 *         info.obj = self
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(array self):
 */
  __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(3, 209, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_array_type);

  /* "View.MemoryView":286
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__62, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(generic);
  __Pyx_DECREF_SET(generic, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":287
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__63, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(strided);
  __Pyx_DECREF_SET(strided, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":288
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__64, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(indirect);
  __Pyx_DECREF_SET(indirect, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":291
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__65, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(contiguous);
  __Pyx_DECREF_SET(contiguous, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":292
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__66, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(indirect_contiguous);
  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":316
 * 
 * DEF THREAD_LOCKS_PREALLOCATED = 8
 * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
 *     PyThread_allocate_lock(),
 */
  __pyx_memoryview_thread_locks_used = 0;

  /* "View.MemoryView":317
 * DEF THREAD_LOCKS_PREALLOCATED = 8
 * cdef int __pyx_memoryview_thread_locks_used = 0
 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
 *     PyThread_allocate_lock(),
 *     PyThread_allocate_lock(),
 */
  __pyx_t_48[0] = PyThread_allocate_lock();
  __pyx_t_48[1] = PyThread_allocate_lock();
  __pyx_t_48[2] = PyThread_allocate_lock();
  __pyx_t_48[3] = PyThread_allocate_lock();
  __pyx_t_48[4] = PyThread_allocate_lock();
  __pyx_t_48[5] = PyThread_allocate_lock();
  __pyx_t_48[6] = PyThread_allocate_lock();
  __pyx_t_48[7] = PyThread_allocate_lock();
  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_48, sizeof(__pyx_memoryview_thread_locks[0]) * (8));

  /* "View.MemoryView":549
 *         info.obj = self
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(3, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_memoryview_type);

  /* "View.MemoryView":995
 *         return self.from_object
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(3, 995, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_memoryviewslice_type);

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "BufferFormatFromTypeInfo":1463
 * 
 * @cname('__pyx_format_from_typeinfo')
 * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type):             # <<<<<<<<<<<<<<
 *     cdef __Pyx_StructField *field
 *     cdef __pyx_typeinfo_string fmt
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_XDECREF(__pyx_t_23);
  __Pyx_XDECREF(__pyx_t_24);
  __Pyx_XDECREF(__pyx_t_25);
  __Pyx_XDECREF(__pyx_t_26);
  __Pyx_XDECREF(__pyx_t_27);
  __Pyx_XDECREF(__pyx_t_28);
  __Pyx_XDECREF(__pyx_t_29);
  __Pyx_XDECREF(__pyx_t_30);
  __Pyx_XDECREF(__pyx_t_31);
  __Pyx_XDECREF(__pyx_t_32);
  __Pyx_XDECREF(__pyx_t_33);
  __PYX_XDEC_MEMVIEW(&__pyx_t_34, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_35, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_37, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_39, 1);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init PygameShader.shader", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init PygameShader.shader");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* MemviewSliceInit */
static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                        int ndim,
                        __Pyx_memviewslice *memviewslice,
                        int memview_is_new_reference)
{
    __Pyx_RefNannyDeclarations
    int i, retval=-1;
    Py_buffer *buf = &memview->view;
    __Pyx_RefNannySetupContext("init_memviewslice", 0);
    if (unlikely(memviewslice->memview || memviewslice->data)) {
        PyErr_SetString(PyExc_ValueError,
            "memviewslice is already initialized!");
        goto fail;
    }
    if (buf->strides) {
        for (i = 0; i < ndim; i++) {
            memviewslice->strides[i] = buf->strides[i];
        }
    } else {
        Py_ssize_t stride = buf->itemsize;
        for (i = ndim - 1; i >= 0; i--) {
            memviewslice->strides[i] = stride;
            stride *= buf->shape[i];
        }
    }
    for (i = 0; i < ndim; i++) {
        memviewslice->shape[i]   = buf->shape[i];
        if (buf->suboffsets) {
            memviewslice->suboffsets[i] = buf->suboffsets[i];
        } else {
            memviewslice->suboffsets[i] = -1;
        }
    }
    memviewslice->memview = memview;
    memviewslice->data = (char *)buf->buf;
    if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
        Py_INCREF(memview);
    }
    retval = 0;
    goto no_fail;
fail:
    memviewslice->memview = 0;
    memviewslice->data = 0;
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}
#ifndef Py_NO_RETURN
#define Py_NO_RETURN
#endif
static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
    va_list vargs;
    char msg[200];
#ifdef HAVE_STDARG_PROTOTYPES
    va_start(vargs, fmt);
#else
    va_start(vargs);
#endif
    vsnprintf(msg, 200, fmt, vargs);
    va_end(vargs);
    Py_FatalError(msg);
}
static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)++;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)--;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
{
    int first_time;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (unlikely(!memview || (PyObject *) memview == Py_None))
        return;
    if (unlikely(__pyx_get_slice_count(memview) < 0))
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         __pyx_get_slice_count(memview), lineno);
    first_time = __pyx_add_acquisition_count(memview) == 0;
    if (unlikely(first_time)) {
        if (have_gil) {
            Py_INCREF((PyObject *) memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_INCREF((PyObject *) memview);
            PyGILState_Release(_gilstate);
        }
    }
}
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
                                             int have_gil, int lineno) {
    int last_time;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (unlikely(!memview || (PyObject *) memview == Py_None)) {
        memslice->memview = NULL;
        return;
    }
    if (unlikely(__pyx_get_slice_count(memview) <= 0))
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         __pyx_get_slice_count(memview), lineno);
    last_time = __pyx_sub_acquisition_count(memview) == 1;
    memslice->data = NULL;
    if (unlikely(last_time)) {
        if (have_gil) {
            Py_CLEAR(memslice->memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_CLEAR(memslice->memview);
            PyGILState_Release(_gilstate);
        }
    } else {
        memslice->memview = NULL;
    }
}

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* None */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* None */
static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname) {
    #ifdef WITH_THREAD
    PyGILState_STATE gilstate = PyGILState_Ensure();
    #endif
    __Pyx_RaiseUnboundLocalError(varname);
    #ifdef WITH_THREAD
    PyGILState_Release(gilstate);
    #endif
}

/* None */
static CYTHON_INLINE float __Pyx_mod_float(float a, float b) {
    float r = fmodf(a, b);
    r += ((r != 0) & ((r < 0) ^ (b < 0))) * b;
    return r;
}

/* None */
static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
    long r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* None */
static CYTHON_INLINE int __Pyx_mod_int(int a, int b) {
    int r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* None */
static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* decode_c_string */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* GetAttr3 */
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* HasAttr */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* StringJoin */
#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetVTable */
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* PyObjectGetAttrStrNoError */
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
}

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
            if (likely(reduce_cython)) {
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
    PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
    return -1;
}
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
    PyObject *obj = view->obj;
    if (!obj) return;
    if (PyObject_CheckBuffer(obj)) {
        PyBuffer_Release(view);
        return;
    }
    if ((0)) {}
    view->obj = NULL;
    Py_DECREF(obj);
}
#endif


/* MemviewSliceIsContig */
static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
{
    int i, index, step, start;
    Py_ssize_t itemsize = mvs.memview->view.itemsize;
    if (order == 'F') {
        step = 1;
        start = 0;
    } else {
        step = -1;
        start = ndim - 1;
    }
    for (i = 0; i < ndim; i++) {
        index = start + step * i;
        if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
            return 0;
        itemsize *= mvs.shape[index];
    }
    return 1;
}

/* OverlappingSlices */
static void
__pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
                               void **out_start, void **out_end,
                               int ndim, size_t itemsize)
{
    char *start, *end;
    int i;
    start = end = slice->data;
    for (i = 0; i < ndim; i++) {
        Py_ssize_t stride = slice->strides[i];
        Py_ssize_t extent = slice->shape[i];
        if (extent == 0) {
            *out_start = *out_end = start;
            return;
        } else {
            if (stride > 0)
                end += stride * (extent - 1);
            else
                start += stride * (extent - 1);
        }
    }
    *out_start = start;
    *out_end = end + itemsize;
}
static int
__pyx_slices_overlap(__Pyx_memviewslice *slice1,
                     __Pyx_memviewslice *slice2,
                     int ndim, size_t itemsize)
{
    void *start1, *end1, *start2, *end2;
    __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
    __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
    return (start1 < end2) && (start2 < end1);
}

/* Capsule */
static CYTHON_INLINE PyObject *
__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
{
    PyObject *cobj;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(p, sig, NULL);
#else
    cobj = PyCObject_FromVoidPtr(p, NULL);
#endif
    return cobj;
}

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* IsLittleEndian */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
{
  union {
    uint32_t u32;
    uint8_t u8[4];
  } S;
  S.u32 = 0x01020304;
  return S.u8[0] == 4;
}

/* BufferFormatCheck */
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t <= '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1)
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case '?': return "'bool'";
    case 'c': return "'char'";
    case 'b': return "'signed char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 's': case 'p': return "a string";
    case 0: return "end";
    default: return "unparseable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count;
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break;
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue;
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}
static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number, ndim;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    ndim = ctx->head->field->type->ndim;
    while (*ts && *ts != ')') {
        switch (*ts) {
            case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
            default:  break;
        }
        number = __Pyx_BufFmt_ExpectNumber(&ts);
        if (number == -1) return NULL;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
            return PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
        if (*ts != ',' && *ts != ')')
            return PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim)
        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return NULL;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return Py_None;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case '\r':
      case '\n':
        ++ts;
        break;
      case '<':
        if (!__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T':
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          size_t struct_alignment = ctx->struct_alignment;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          ctx->enc_count = 0;
          ctx->struct_alignment = 0;
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
          if (struct_alignment) ctx->struct_alignment = struct_alignment;
        }
        break;
      case '}':
        {
          size_t alignment = ctx->struct_alignment;
          ++ts;
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          if (alignment && ctx->fmt_offset % alignment) {
            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
          }
        }
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }
        CYTHON_FALLTHROUGH;
      case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O': case 'p':
        if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
            (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
          ctx->enc_count += ctx->new_count;
          ctx->new_count = 1;
          got_Z = 0;
          ++ts;
          break;
        }
        CYTHON_FALLTHROUGH;
      case 's':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->enc_count = ctx->new_count;
        ctx->enc_packmode = ctx->new_packmode;
        ctx->enc_type = *ts;
        ctx->is_complex = got_Z;
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      case '(':
        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return NULL;
          ctx->new_count = (size_t)number;
        }
    }
  }
}

/* TypeInfoCompare */
  static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
{
    int i;
    if (!a || !b)
        return 0;
    if (a == b)
        return 1;
    if (a->size != b->size || a->typegroup != b->typegroup ||
            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
        if (a->typegroup == 'H' || b->typegroup == 'H') {
            return a->size == b->size;
        } else {
            return 0;
        }
    }
    if (a->ndim) {
        for (i = 0; i < a->ndim; i++)
            if (a->arraysize[i] != b->arraysize[i])
                return 0;
    }
    if (a->typegroup == 'S') {
        if (a->flags != b->flags)
            return 0;
        if (a->fields || b->fields) {
            if (!(a->fields && b->fields))
                return 0;
            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
                __Pyx_StructField *field_a = a->fields + i;
                __Pyx_StructField *field_b = b->fields + i;
                if (field_a->offset != field_b->offset ||
                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
                    return 0;
            }
            return !a->fields[i].type && !b->fields[i].type;
        }
    }
    return 1;
}

/* MemviewSliceValidateAndInit */
  static int
__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
{
    if (buf->shape[dim] <= 1)
        return 1;
    if (buf->strides) {
        if (spec & __Pyx_MEMVIEW_CONTIG) {
            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
                if (unlikely(buf->strides[dim] != sizeof(void *))) {
                    PyErr_Format(PyExc_ValueError,
                                 "Buffer is not indirectly contiguous "
                                 "in dimension %d.", dim);
                    goto fail;
                }
            } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer and memoryview are not contiguous "
                                "in the same dimension.");
                goto fail;
            }
        }
        if (spec & __Pyx_MEMVIEW_FOLLOW) {
            Py_ssize_t stride = buf->strides[dim];
            if (stride < 0)
                stride = -stride;
            if (unlikely(stride < buf->itemsize)) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer and memoryview are not contiguous "
                                "in the same dimension.");
                goto fail;
            }
        }
    } else {
        if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
            PyErr_Format(PyExc_ValueError,
                         "C-contiguous buffer is not contiguous in "
                         "dimension %d", dim);
            goto fail;
        } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
            PyErr_Format(PyExc_ValueError,
                         "C-contiguous buffer is not indirect in "
                         "dimension %d", dim);
            goto fail;
        } else if (unlikely(buf->suboffsets)) {
            PyErr_SetString(PyExc_ValueError,
                            "Buffer exposes suboffsets but no strides");
            goto fail;
        }
    }
    return 1;
fail:
    return 0;
}
static int
__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
{
    if (spec & __Pyx_MEMVIEW_DIRECT) {
        if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
            PyErr_Format(PyExc_ValueError,
                         "Buffer not compatible with direct access "
                         "in dimension %d.", dim);
            goto fail;
        }
    }
    if (spec & __Pyx_MEMVIEW_PTR) {
        if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
            PyErr_Format(PyExc_ValueError,
                         "Buffer is not indirectly accessible "
                         "in dimension %d.", dim);
            goto fail;
        }
    }
    return 1;
fail:
    return 0;
}
static int
__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
{
    int i;
    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
        Py_ssize_t stride = 1;
        for (i = 0; i < ndim; i++) {
            if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
                PyErr_SetString(PyExc_ValueError,
                    "Buffer not fortran contiguous.");
                goto fail;
            }
            stride = stride * buf->shape[i];
        }
    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
        Py_ssize_t stride = 1;
        for (i = ndim - 1; i >- 1; i--) {
            if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
                PyErr_SetString(PyExc_ValueError,
                    "Buffer not C contiguous.");
                goto fail;
            }
            stride = stride * buf->shape[i];
        }
    }
    return 1;
fail:
    return 0;
}
static int __Pyx_ValidateAndInit_memviewslice(
                int *axes_specs,
                int c_or_f_flag,
                int buf_flags,
                int ndim,
                __Pyx_TypeInfo *dtype,
                __Pyx_BufFmt_StackElem stack[],
                __Pyx_memviewslice *memviewslice,
                PyObject *original_obj)
{
    struct __pyx_memoryview_obj *memview, *new_memview;
    __Pyx_RefNannyDeclarations
    Py_buffer *buf;
    int i, spec = 0, retval = -1;
    __Pyx_BufFmt_Context ctx;
    int from_memoryview = __pyx_memoryview_check(original_obj);
    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
                                                            original_obj)->typeinfo)) {
        memview = (struct __pyx_memoryview_obj *) original_obj;
        new_memview = NULL;
    } else {
        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                            original_obj, buf_flags, 0, dtype);
        new_memview = memview;
        if (unlikely(!memview))
            goto fail;
    }
    buf = &memview->view;
    if (unlikely(buf->ndim != ndim)) {
        PyErr_Format(PyExc_ValueError,
                "Buffer has wrong number of dimensions (expected %d, got %d)",
                ndim, buf->ndim);
        goto fail;
    }
    if (new_memview) {
        __Pyx_BufFmt_Init(&ctx, stack, dtype);
        if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
    }
    if (unlikely((unsigned) buf->itemsize != dtype->size)) {
        PyErr_Format(PyExc_ValueError,
                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
                     buf->itemsize,
                     (buf->itemsize > 1) ? "s" : "",
                     dtype->name,
                     dtype->size,
                     (dtype->size > 1) ? "s" : "");
        goto fail;
    }
    if (buf->len > 0) {
        for (i = 0; i < ndim; i++) {
            spec = axes_specs[i];
            if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
                goto fail;
            if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
                goto fail;
        }
        if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
            goto fail;
    }
    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
                                         new_memview != NULL) == -1)) {
        goto fail;
    }
    retval = 0;
    goto no_fail;
fail:
    Py_XDECREF(new_memview);
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_float(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 4,
                                                 &__Pyx_TypeInfo_float, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_unsigned_char(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 4,
                                                 &__Pyx_TypeInfo_unsigned_char, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
                                                 &__Pyx_TypeInfo_unsigned_int, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_float(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 4,
                                                 &__Pyx_TypeInfo_float, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_unsigned_char(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 2,
                                                 &__Pyx_TypeInfo_unsigned_char, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_int(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 3,
                                                 &__Pyx_TypeInfo_unsigned_int, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_int(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 3,
                                                 &__Pyx_TypeInfo_unsigned_int, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
                                                 &__Pyx_TypeInfo_float, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 3,
                                                 &__Pyx_TypeInfo_unsigned_char, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 2,
                                                 &__Pyx_TypeInfo_float, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_int(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 3,
                                                 &__Pyx_TypeInfo_int, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_int(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
                                                 &__Pyx_TypeInfo_int, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
                                                 &__Pyx_TypeInfo_unsigned_char, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 1,
                                                 &__Pyx_TypeInfo_int, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* MemviewDtypeToObject */
  static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp) {
    return (PyObject *) PyFloat_FromDouble(*(float *) itemp);
}
static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *obj) {
    float value = __pyx_PyFloat_AsFloat(obj);
    if ((value == (float)-1) && PyErr_Occurred())
        return 0;
    *(float *) itemp = value;
    return 1;
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) {
    const unsigned char neg_one = (unsigned char) ((unsigned char) 0 - (unsigned char) 1), const_zero = (unsigned char) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned char) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned char),
                                     little, !is_unsigned);
    }
}

/* MemviewDtypeToObject */
  static CYTHON_INLINE PyObject *__pyx_memview_get_unsigned_char(const char *itemp) {
    return (PyObject *) __Pyx_PyInt_From_unsigned_char(*(unsigned char *) itemp);
}
static CYTHON_INLINE int __pyx_memview_set_unsigned_char(const char *itemp, PyObject *obj) {
    unsigned char value = __Pyx_PyInt_As_unsigned_char(obj);
    if ((value == (unsigned char)-1) && PyErr_Occurred())
        return 0;
    *(unsigned char *) itemp = value;
    return 1;
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
    const unsigned int neg_one = (unsigned int) ((unsigned int) 0 - (unsigned int) 1), const_zero = (unsigned int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
                                     little, !is_unsigned);
    }
}

/* MemviewDtypeToObject */
  static CYTHON_INLINE PyObject *__pyx_memview_get_unsigned_int(const char *itemp) {
    return (PyObject *) __Pyx_PyInt_From_unsigned_int(*(unsigned int *) itemp);
}
static CYTHON_INLINE int __pyx_memview_set_unsigned_int(const char *itemp, PyObject *obj) {
    unsigned int value = __Pyx_PyInt_As_unsigned_int(obj);
    if ((value == (unsigned int)-1) && PyErr_Occurred())
        return 0;
    *(unsigned int *) itemp = value;
    return 1;
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_short(unsigned short value) {
    const unsigned short neg_one = (unsigned short) ((unsigned short) 0 - (unsigned short) 1), const_zero = (unsigned short) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned short) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned short) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned short) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned short) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned short) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned short),
                                     little, !is_unsigned);
    }
}

/* MemviewDtypeToObject */
  static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp) {
    return (PyObject *) __Pyx_PyInt_From_int(*(int *) itemp);
}
static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) {
    int value = __Pyx_PyInt_As_int(obj);
    if ((value == (int)-1) && PyErr_Occurred())
        return 0;
    *(int *) itemp = value;
    return 1;
}

static PyObject* __pyx_convert__to_py_struct__rgb(struct rgb s) {
    PyObject* res;
    PyObject* member;
    res = __Pyx_PyDict_NewPresized(3); if (unlikely(!res)) return NULL;
    member = PyFloat_FromDouble(s.r); if (unlikely(!member)) goto bad;
    if (unlikely(PyDict_SetItem(res, __pyx_n_s_r, member) < 0)) goto bad;
    Py_DECREF(member);
    member = PyFloat_FromDouble(s.g); if (unlikely(!member)) goto bad;
    if (unlikely(PyDict_SetItem(res, __pyx_n_s_g, member) < 0)) goto bad;
    Py_DECREF(member);
    member = PyFloat_FromDouble(s.b); if (unlikely(!member)) goto bad;
    if (unlikely(PyDict_SetItem(res, __pyx_n_s_b_2, member) < 0)) goto bad;
    Py_DECREF(member);
    return res;
    bad:
    Py_XDECREF(member);
    Py_DECREF(res);
    return NULL;
  }
  /* None */
  static CYTHON_INLINE long __Pyx_pow_long(long b, long e) {
    long t = b;
    switch (e) {
        case 3:
            t *= b;
        CYTHON_FALLTHROUGH;
        case 2:
            t *= b;
        CYTHON_FALLTHROUGH;
        case 1:
            return t;
        case 0:
            return 1;
    }
    #if 1
    if (unlikely(e<0)) return 0;
    #endif
    t = 1;
    while (likely(e)) {
        t *= (b * (e&1)) | ((~e)&1);
        b *= b;
        e >>= 1;
    }
    return t;
}

/* Declarations */
  #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
  #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabsf(b.real) >= fabsf(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                float r = b.imag / b.real;
                float s = (float)(1.0) / (b.real + b.imag * r);
                return __pyx_t_float_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            float r = b.real / b.imag;
            float s = (float)(1.0) / (b.imag + b.real * r);
            return __pyx_t_float_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            float denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_float_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        return __Pyx_c_prod_float(a, a);
                    case 3:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, a);
                    case 4:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = powf(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2f(0.0, -1.0);
                }
            } else {
                r = __Pyx_c_abs_float(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

/* Declarations */
  #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
  #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabs(b.real) >= fabs(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                double r = b.imag / b.real;
                double s = (double)(1.0) / (b.real + b.imag * r);
                return __pyx_t_double_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            double r = b.real / b.imag;
            double s = (double)(1.0) / (b.imag + b.real * r);
            return __pyx_t_double_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            double denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_double_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        return __Pyx_c_prod_double(a, a);
                    case 3:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, a);
                    case 4:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = pow(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2(0.0, -1.0);
                }
            } else {
                r = __Pyx_c_abs_double(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
    const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum NPY_TYPES) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
                                     little, !is_unsigned);
    }
}

/* MemviewSliceCopyTemplate */
  static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                 const char *mode, int ndim,
                                 size_t sizeof_dtype, int contig_flag,
                                 int dtype_is_object)
{
    __Pyx_RefNannyDeclarations
    int i;
    __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
    struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
    Py_buffer *buf = &from_memview->view;
    PyObject *shape_tuple = NULL;
    PyObject *temp_int = NULL;
    struct __pyx_array_obj *array_obj = NULL;
    struct __pyx_memoryview_obj *memview_obj = NULL;
    __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
    for (i = 0; i < ndim; i++) {
        if (unlikely(from_mvs->suboffsets[i] >= 0)) {
            PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
                                           "indirect dimensions (axis %d)", i);
            goto fail;
        }
    }
    shape_tuple = PyTuple_New(ndim);
    if (unlikely(!shape_tuple)) {
        goto fail;
    }
    __Pyx_GOTREF(shape_tuple);
    for(i = 0; i < ndim; i++) {
        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
        if(unlikely(!temp_int)) {
            goto fail;
        } else {
            PyTuple_SET_ITEM(shape_tuple, i, temp_int);
            temp_int = NULL;
        }
    }
    array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
    if (unlikely(!array_obj)) {
        goto fail;
    }
    __Pyx_GOTREF(array_obj);
    memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                    (PyObject *) array_obj, contig_flag,
                                    dtype_is_object,
                                    from_mvs->memview->typeinfo);
    if (unlikely(!memview_obj))
        goto fail;
    if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
        goto fail;
    if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
                                                dtype_is_object) < 0))
        goto fail;
    goto no_fail;
fail:
    __Pyx_XDECREF(new_mvs.memview);
    new_mvs.memview = NULL;
    new_mvs.data = NULL;
no_fail:
    __Pyx_XDECREF(shape_tuple);
    __Pyx_XDECREF(temp_int);
    __Pyx_XDECREF(array_obj);
    __Pyx_RefNannyFinishContext();
    return new_mvs;
}

/* CIntFromPy */
  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE unsigned short __Pyx_PyInt_As_unsigned_short(PyObject *x) {
    const unsigned short neg_one = (unsigned short) ((unsigned short) 0 - (unsigned short) 1), const_zero = (unsigned short) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned short) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned short, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned short) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned short) 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned short, digit, digits[0])
                case 2:
                    if (8 * sizeof(unsigned short) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned short) >= 2 * PyLong_SHIFT) {
                            return (unsigned short) (((((unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned short) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned short) >= 3 * PyLong_SHIFT) {
                            return (unsigned short) (((((((unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned short) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned short) >= 4 * PyLong_SHIFT) {
                            return (unsigned short) (((((((((unsigned short)digits[3]) << PyLong_SHIFT) | (unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (unsigned short) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(unsigned short) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned short) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned short) 0;
                case -1: __PYX_VERIFY_RETURN_INT(unsigned short, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(unsigned short,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(unsigned short) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned short) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned short) (((unsigned short)-1)*(((((unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(unsigned short) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned short) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned short) ((((((unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(unsigned short) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned short) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned short) (((unsigned short)-1)*(((((((unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned short) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned short) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned short) ((((((((unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(unsigned short) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned short, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned short) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned short) (((unsigned short)-1)*(((((((((unsigned short)digits[3]) << PyLong_SHIFT) | (unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned short) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned short) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned short) ((((((((((unsigned short)digits[3]) << PyLong_SHIFT) | (unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(unsigned short) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned short) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned short val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (unsigned short) -1;
        }
    } else {
        unsigned short val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned short) -1;
        val = __Pyx_PyInt_As_unsigned_short(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned short");
    return (unsigned short) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned short");
    return (unsigned short) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *x) {
    const unsigned char neg_one = (unsigned char) ((unsigned char) 0 - (unsigned char) 1), const_zero = (unsigned char) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned char) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned char, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned char) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned char) 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned char, digit, digits[0])
                case 2:
                    if (8 * sizeof(unsigned char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned char) >= 2 * PyLong_SHIFT) {
                            return (unsigned char) (((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned char) >= 3 * PyLong_SHIFT) {
                            return (unsigned char) (((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned char) >= 4 * PyLong_SHIFT) {
                            return (unsigned char) (((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (unsigned char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(unsigned char) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned char) 0;
                case -1: __PYX_VERIFY_RETURN_INT(unsigned char, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(unsigned char,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(unsigned char) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned char) (((unsigned char)-1)*(((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(unsigned char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned char) ((((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned char) (((unsigned char)-1)*(((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned char) ((((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned char) (((unsigned char)-1)*(((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned char) ((((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(unsigned char) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned char, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned char, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned char val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (unsigned char) -1;
        }
    } else {
        unsigned char val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned char) -1;
        val = __Pyx_PyInt_As_unsigned_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned char");
    return (unsigned char) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned char");
    return (unsigned char) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
    const unsigned int neg_one = (unsigned int) ((unsigned int) 0 - (unsigned int) 1), const_zero = (unsigned int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0])
                case 2:
                    if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) {
                            return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) {
                            return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) {
                            return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (unsigned int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(unsigned int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(unsigned int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (unsigned int) -1;
        }
    } else {
        unsigned int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned int) -1;
        val = __Pyx_PyInt_As_unsigned_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned int");
    return (unsigned int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned int");
    return (unsigned int) -1;
}

/* TypeInfoToFormat */
  static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type) {
    struct __pyx_typeinfo_string result = { {0} };
    char *buf = (char *) result.string;
    size_t size = type->size;
    switch (type->typegroup) {
        case 'H':
            *buf = 'c';
            break;
        case 'I':
        case 'U':
            if (size == 1)
                *buf = (type->is_unsigned) ? 'B' : 'b';
            else if (size == 2)
                *buf = (type->is_unsigned) ? 'H' : 'h';
            else if (size == 4)
                *buf = (type->is_unsigned) ? 'I' : 'i';
            else if (size == 8)
                *buf = (type->is_unsigned) ? 'Q' : 'q';
            break;
        case 'P':
            *buf = 'P';
            break;
        case 'C':
         {
            __Pyx_TypeInfo complex_type = *type;
            complex_type.typegroup = 'R';
            complex_type.size /= 2;
            *buf++ = 'Z';
            *buf = __Pyx_TypeInfoToFormat(&complex_type).string[0];
            break;
         }
        case 'R':
            if (size == 4)
                *buf = 'f';
            else if (size == 8)
                *buf = 'd';
            else
                *buf = 'g';
            break;
    }
    return result;
}

/* CIntFromPy */
  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
    const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(char) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (char) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (char) 0;
                case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
                            return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
                            return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
                            return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(char) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (char) 0;
                case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(char) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            char val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (char) -1;
        }
    } else {
        char val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (char) -1;
        val = __Pyx_PyInt_As_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to char");
    return (char) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to char");
    return (char) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) {
    const short neg_one = (short) ((short) 0 - (short) 1), const_zero = (short) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(short) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(short, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (short) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (short) 0;
                case  1: __PYX_VERIFY_RETURN_INT(short, digit, digits[0])
                case 2:
                    if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 2 * PyLong_SHIFT) {
                            return (short) (((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 3 * PyLong_SHIFT) {
                            return (short) (((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 4 * PyLong_SHIFT) {
                            return (short) (((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (short) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(short) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (short) 0;
                case -1: __PYX_VERIFY_RETURN_INT(short, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(short,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(short) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                            return (short) ((((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                            return (short) ((((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 4 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 4 * PyLong_SHIFT) {
                            return (short) ((((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(short) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            short val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (short) -1;
        }
    } else {
        short val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (short) -1;
        val = __Pyx_PyInt_As_short(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to short");
    return (short) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to short");
    return (short) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) ((size_t) 0 - (size_t) 1), const_zero = (size_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 3,
                                                 &__Pyx_TypeInfo_unsigned_char, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_float(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 3,
                                                 &__Pyx_TypeInfo_float, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_float(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
                                                 &__Pyx_TypeInfo_float, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 1,
                                                 &__Pyx_TypeInfo_unsigned_char, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* CheckBinaryVersion */
  static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* PyObjectSetAttrStr */
  #if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* VoidPtrExport */
  static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) {
    PyObject *d;
    PyObject *cobj = 0;
    d = PyDict_GetItem(__pyx_d, __pyx_n_s_pyx_capi);
    Py_XINCREF(d);
    if (!d) {
        d = PyDict_New();
        if (!d)
            goto bad;
        if (__Pyx_PyObject_SetAttrStr(__pyx_m, __pyx_n_s_pyx_capi, d) < 0)
            goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItem(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* FunctionExport */
  static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* FunctionImport */
  #ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
                                                 &__Pyx_TypeInfo_short, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_char(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
                                                 &__Pyx_TypeInfo_unsigned_char, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* InitStrings */
  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
