/* Generated by Cython 3.2.4 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [],
        "extra_compile_args": [
            "-O3",
            "-fno-strict-overflow",
            "-Wsign-compare",
            "-DNDEBUG",
            "-g",
            "-O3",
            "-Wall",
            "-march=x86-64",
            "-mtune=generic",
            "-O3",
            "-pipe",
            "-fno-plt",
            "-fexceptions",
            "-Wp,-D_FORTIFY_SOURCE=3",
            "-Wformat",
            "-Werror=format-security",
            "-fstack-clash-protection",
            "-fcf-protection",
            "-fno-omit-frame-pointer",
            "-mno-omit-leaf-frame-pointer",
            "-g",
            "-ffile-prefix-map=/build/python/src=/usr/src/debug/python",
            "-flto=auto",
            "-ffat-lto-objects",
            "-march=x86-64",
            "-mtune=generic",
            "-O3",
            "-pipe",
            "-fno-plt",
            "-fexceptions",
            "-Wp,-D_FORTIFY_SOURCE=3",
            "-Wformat",
            "-Werror=format-security",
            "-fstack-clash-protection",
            "-fcf-protection",
            "-fno-omit-frame-pointer",
            "-mno-omit-leaf-frame-pointer",
            "-g",
            "-ffile-prefix-map=/build/python/src=/usr/src/debug/python",
            "-flto=auto",
            "-march=x86-64",
            "-mtune=generic",
            "-O3",
            "-pipe",
            "-fno-plt",
            "-fexceptions",
            "-Wp,-D_FORTIFY_SOURCE=3",
            "-Wformat",
            "-Werror=format-security",
            "-fstack-clash-protection",
            "-fcf-protection",
            "-fno-omit-frame-pointer",
            "-mno-omit-leaf-frame-pointer",
            "-g",
            "-ffile-prefix-map=/build/python/src=/usr/src/debug/python",
            "-flto=auto",
            "-Wall",
            "-Wno-deprecated-declarations",
            "-fPIC",
            "-march=x86-64",
            "-mtune=generic",
            "-O2",
            "-pipe",
            "-fno-plt",
            "-fexceptions",
            "-Wp,-D_FORTIFY_SOURCE=3",
            "-Wformat",
            "-Werror=format-security",
            "-fstack-clash-protection",
            "-fcf-protection",
            "-fno-omit-frame-pointer",
            "-mno-omit-leaf-frame-pointer",
            "-g",
            "-ffile-prefix-map=/build/xpra/src=/usr/src/debug/xpra",
            "-flto=auto"
        ],
        "extra_link_args": [
            "-Wall",
            "-Wl,-O1",
            "-Wl,--sort-common",
            "-Wl,--as-needed",
            "-Wl,-z,relro",
            "-Wl,-z,now",
            "-Wl,-z,pack-relative-relocs",
            "-flto=auto"
        ],
        "name": "xpra.codecs.csc_cython.converter",
        "sources": [
            "xpra/codecs/csc_cython/converter.pyx"
        ]
    },
    "module_name": "xpra.codecs.csc_cython.converter"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
/* InitLimitedAPI */
#if defined(Py_LIMITED_API)
  #if !defined(CYTHON_LIMITED_API)
  #define CYTHON_LIMITED_API 1
  #endif
#elif defined(CYTHON_LIMITED_API)
  #ifdef _MSC_VER
  #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.")
  #else
  #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.
  #endif
#endif

#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 < 0x03080000
    #error Cython requires Python 3.8+.
#else
#define __PYX_ABI_VERSION "3_2_4"
#define CYTHON_HEX_VERSION 0x030204F0
#define CYTHON_FUTURE_DIVISION 1
/* CModulePreamble */
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(_WIN32) && !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 PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
#if defined(GRAALVM_PYTHON)
  /* For very preliminary testing purposes. Most variables are set the same as PyPy.
     The existence of this section does not imply that anything works or is even tested */
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 1
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #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_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 1
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(PYPY_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 1
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #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_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #if PY_VERSION_HEX < 0x03090000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
  #endif
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 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
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(CYTHON_LIMITED_API)
  #ifdef Py_LIMITED_API
    #undef __PYX_LIMITED_VERSION_HEX
    #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  #endif
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 1
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 1
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #endif
  #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_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #ifndef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 1
  #endif
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #ifdef Py_GIL_DISABLED
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
  #else
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #endif
  #if PY_VERSION_HEX < 0x030A0000
    #undef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #elif !defined(CYTHON_USE_TYPE_SLOTS)
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #ifndef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
    #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
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_FAST_GIL
    #define CYTHON_FAST_GIL 0
  #elif !defined(CYTHON_FAST_GIL)
    #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
  #endif
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #ifndef CYTHON_USE_SYS_MONITORING
    #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS 0
  #elif !defined(CYTHON_USE_DICT_VERSIONS)
    #define CYTHON_USE_DICT_VERSIONS  (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 1
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
  #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000
    #undef CYTHON_IMMORTAL_CONSTANTS
    #define CYTHON_IMMORTAL_CONSTANTS 0  // definitely won't work
  #elif !defined(CYTHON_IMMORTAL_CONSTANTS)
    #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
#endif
#ifndef CYTHON_COMPRESS_STRINGS
  #define CYTHON_COMPRESS_STRINGS 1
#endif
#ifndef CYTHON_FAST_PYCCALL
#define CYTHON_FAST_PYCCALL  CYTHON_FAST_PYCALL
#endif
#ifndef CYTHON_VECTORCALL
#if CYTHON_COMPILING_IN_LIMITED_API
#define CYTHON_VECTORCALL  (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
#else
#define CYTHON_VECTORCALL  (CYTHON_FAST_PYCCALL)
#endif
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #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(__cplusplus)
    /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(maybe_unused)
        #define CYTHON_UNUSED [[maybe_unused]]
      #endif
    #endif
  #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_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
  #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_USE_CPP_STD_MOVE
  #if defined(__cplusplus) && (\
    __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
    #define CYTHON_USE_CPP_STD_MOVE 1
  #else
    #define CYTHON_USE_CPP_STD_MOVE 0
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#include <stdint.h>
typedef uintptr_t  __pyx_uintptr_t;
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(fallthrough)
        #define CYTHON_FALLTHROUGH [[fallthrough]]
      #endif
    #endif
    #ifndef CYTHON_FALLTHROUGH
      #if __has_cpp_attribute(clang::fallthrough)
        #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
      #elif __has_cpp_attribute(gnu::fallthrough)
        #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
      #endif
    #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 Py_UNREACHABLE
  #define Py_UNREACHABLE()  assert(0); abort()
#endif
#ifdef __cplusplus
  template <typename T>
  struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
#else
  #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
#endif
#if CYTHON_COMPILING_IN_PYPY == 1
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x030A0000)
#else
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x03090000)
#endif
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))

/* CInitCode */
#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

/* PythonCompatibility */
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_DefaultClassType PyType_Type
#if CYTHON_COMPILING_IN_LIMITED_API
    #ifndef CO_OPTIMIZED
    static int CO_OPTIMIZED;
    #endif
    #ifndef CO_NEWLOCALS
    static int CO_NEWLOCALS;
    #endif
    #ifndef CO_VARARGS
    static int CO_VARARGS;
    #endif
    #ifndef CO_VARKEYWORDS
    static int CO_VARKEYWORDS;
    #endif
    #ifndef CO_ASYNC_GENERATOR
    static int CO_ASYNC_GENERATOR;
    #endif
    #ifndef CO_GENERATOR
    static int CO_GENERATOR;
    #endif
    #ifndef CO_COROUTINE
    static int CO_COROUTINE;
    #endif
#else
    #ifndef CO_COROUTINE
      #define CO_COROUTINE 0x80
    #endif
    #ifndef CO_ASYNC_GENERATOR
      #define CO_ASYNC_GENERATOR 0x200
    #endif
#endif
static int __Pyx_init_co_variables(void);
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
#else
  #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  #define __Pyx_Py_Is(x, y)  Py_Is(x, y)
#else
  #define __Pyx_Py_Is(x, y) ((x) == (y))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
#else
  #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
#else
  #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
#else
  #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
#endif
#define __Pyx_NoneAsNull(obj)  (__Pyx_Py_IsNone(obj) ? NULL : (obj))
#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
#else
  #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
#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 Py_TPFLAGS_SEQUENCE
  #define Py_TPFLAGS_SEQUENCE 0
#endif
#ifndef Py_TPFLAGS_MAPPING
  #define Py_TPFLAGS_MAPPING 0
#endif
#ifndef Py_TPFLAGS_IMMUTABLETYPE
  #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
#endif
#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION
  #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#ifndef 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
  #if PY_VERSION_HEX >= 0x030d00A4
  #  define __Pyx_PyCFunctionFast PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  #else
  #  define __Pyx_PyCFunctionFast _PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  #endif
#endif
#if CYTHON_METH_FASTCALL
  #define __Pyx_METH_FASTCALL METH_FASTCALL
  #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
#else
  #define __Pyx_METH_FASTCALL METH_VARARGS
  #define __Pyx_PyCFunction_FastCall PyCFunction
  #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
#endif
#if CYTHON_VECTORCALL
  #define __pyx_vectorcallfunc vectorcallfunc
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  PY_VECTORCALL_ARGUMENTS_OFFSET
  #define __Pyx_PyVectorcall_NARGS(n)  PyVectorcall_NARGS((size_t)(n))
#else
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  0
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(n))
#endif
#if PY_VERSION_HEX >= 0x030900B1
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_CheckExact(func)
#else
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_Check(func)
#endif
#define __Pyx_CyOrPyCFunction_Check(func)  PyCFunction_Check(func)
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  (((PyCFunctionObject*)(func))->m_ml->ml_meth)
#elif !CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  PyCFunction_GET_FUNCTION(func)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FLAGS(func)  (((PyCFunctionObject*)(func))->m_ml->ml_flags)
static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
    return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
}
#endif
static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
#else
    return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
#endif
}
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCFunction(func, cfunc)
#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  ((void)m, PyType_FromSpecWithBases(s, b))
  typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
#else
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  PyType_FromModuleAndSpec(m, s, b)
  #define __Pyx_PyCMethod  PyCMethod
#endif
#ifndef METH_METHOD
  #define METH_METHOD 0x200
#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_LIMITED_API
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno))
#elif CYTHON_COMPILING_IN_GRAAL
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #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_COMPILING_IN_LIMITED_API
  #define __Pyx_PyThreadState_Current PyThreadState_Get()
#elif !CYTHON_FAST_THREAD_STATE
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x030d00A1
  #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#endif
#if CYTHON_USE_MODULE_STATE
static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
{
    void *result;
    result = PyModule_GetState(op);
    if (!result)
        Py_FatalError("Couldn't find the module state");
    return result;
}
#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
#else
#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
#endif
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype)  __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((type)->name)
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
  #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
  #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
#else
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((func_ctype) PyType_GetSlot((type), Py_##name))
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
    ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
     (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
     __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
  #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
  #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
#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
#define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStrWithError(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
    PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
    if (res == NULL) PyErr_Clear();
    return res;
}
#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
#define __Pyx_PyDict_GetItemStrWithError  PyDict_GetItemWithError
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#else
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
#if CYTHON_COMPILING_IN_PYPY
    return PyDict_GetItem(dict, name);
#else
    PyDictEntry *ep;
    PyDictObject *mp = (PyDictObject*) dict;
    long hash = ((PyStringObject *) name)->ob_shash;
    assert(hash != -1);
    ep = (mp->ma_lookup)(mp, name, hash);
    if (ep == NULL) {
        return NULL;
    }
    return ep->me_value;
#endif
}
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#endif
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetFlags(tp)   (((PyTypeObject *)tp)->tp_flags)
  #define __Pyx_PyType_HasFeature(type, feature)  ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
#else
  #define __Pyx_PyType_GetFlags(tp)   (PyType_GetFlags((PyTypeObject *)tp))
  #define __Pyx_PyType_HasFeature(type, feature)  PyType_HasFeature(type, feature)
#endif
#define __Pyx_PyObject_GetIterNextFunc(iterator)  __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
#if CYTHON_USE_TYPE_SPECS
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  {\
    PyTypeObject *type = Py_TYPE((PyObject*)obj);\
    assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
    PyObject_GC_Del(obj);\
    Py_DECREF(type);\
}
#else
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  PyObject_GC_Del(obj)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((void)u, 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((void)u, (0))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)u)
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GetLength(u))
#else
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #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)         ((int)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, (Py_UCS4) ch)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#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
  #if !defined(PyUnicode_DecodeUnicodeEscape)
    #define PyUnicode_DecodeUnicodeEscape(s, size, errors)  PyUnicode_Decode(s, size, "unicode_escape", errors)
  #endif
  #if !defined(PyUnicode_Contains)
    #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  #endif
  #if !defined(PyByteArray_Check)
    #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
  #endif
  #if !defined(PyObject_Format)
    #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
  #endif
#endif
#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 CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#elif CYTHON_COMPILING_IN_CPYTHON
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#else
  #define __Pyx_PySequence_ListKeepNew(obj)  PySequence_List(obj)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        __Pyx_IS_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
enum __Pyx_ReferenceSharing {
  __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check
  __Pyx_ReferenceSharing_OwnStrongReference,
  __Pyx_ReferenceSharing_FunctionArgument,
  __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar
};
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\
    (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\
      (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\
      (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0)))
#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1)
#else
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0)
#endif
#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  #else
    #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i)
  #endif
#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #else
    #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i))
  #endif
#else
  #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
#endif
#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
    __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i))
#else
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i)
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyObject_GetItem(dict, key);
  if (*result == NULL) {
    if (PyErr_ExceptionMatches(PyExc_KeyError)) {
      PyErr_Clear();
      return 0;
    }
    return -1;
  }
  return 1;
}
#else
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyDict_GetItemWithError(dict, key);
  if (*result == NULL) {
    return PyErr_Occurred() ? -1 : 0;
  }
  Py_INCREF(*result);
  return 1;
}
#endif
#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
  #define __Pyx_VISIT_CONST(obj)  Py_VISIT(obj)
#else
  #define __Pyx_VISIT_CONST(obj)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
#else
  #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
#endif
#if CYTHON_ASSUME_SAFE_SIZE
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
#else
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
#endif
#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
#define __Pyx_PyLong_AsHash_t   __Pyx_PyIndex_AsSsize_t
#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
    #define __Pyx_PySendResult PySendResult
#else
    typedef enum {
        PYGEN_RETURN = 0,
        PYGEN_ERROR = -1,
        PYGEN_NEXT = 1,
    } __Pyx_PySendResult;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
  typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
#else
  #define __Pyx_pyiter_sendfunc sendfunc
#endif
#if !CYTHON_USE_AM_SEND
#define __PYX_HAS_PY_AM_SEND 0
#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
#define __PYX_HAS_PY_AM_SEND 1
#else
#define __PYX_HAS_PY_AM_SEND 2  // our own backported implementation
#endif
#if __PYX_HAS_PY_AM_SEND < 2
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
        __Pyx_pyiter_sendfunc am_send;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
#endif
#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
#else
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
#endif
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
#else
#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
#ifdef __cplusplus
extern "C"
#endif
PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
    int value;
    PyObject *py_value = PyObject_GetAttrString(inspect, name);
    if (!py_value) return 0;
    value = (int) PyLong_AsLong(py_value);
    Py_DECREF(py_value);
    *write_to = value;
    return value != -1 || !PyErr_Occurred();
}
static int __Pyx_init_co_variables(void) {
    PyObject *inspect;
    int result;
    inspect = PyImport_ImportModule("inspect");
    result =
#if !defined(CO_OPTIMIZED)
        __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
#endif
#if !defined(CO_NEWLOCALS)
        __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
#endif
#if !defined(CO_VARARGS)
        __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
#endif
#if !defined(CO_VARKEYWORDS)
        __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
#endif
#if !defined(CO_ASYNC_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
#endif
#if !defined(CO_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
#endif
#if !defined(CO_COROUTINE)
        __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
#endif
        1;
    Py_DECREF(inspect);
    return result ? 0 : -1;
}
#else
static int __Pyx_init_co_variables(void) {
    return 0;  // It's a limited API-only feature
}
#endif

/* MathInitCode */
#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #ifndef _USE_MATH_DEFINES
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
#endif
#ifndef CYTHON_CLINE_IN_TRACEBACK
#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#endif
#if CYTHON_CLINE_IN_TRACEBACK
#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; }
#else
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
#endif
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifdef CYTHON_EXTERN_C
    #undef __PYX_EXTERN_C
    #define __PYX_EXTERN_C CYTHON_EXTERN_C
#elif defined(__PYX_EXTERN_C)
    #ifdef _MSC_VER
    #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
    #else
    #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
    #endif
#else
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__xpra__codecs__csc_cython__converter
#define __PYX_HAVE_API__xpra__codecs__csc_cython__converter
/* Early includes */
#include <stdint.h>
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

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

#ifdef CYTHON_FREETHREADING_COMPATIBLE
#if CYTHON_FREETHREADING_COMPATIBLE
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#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 Py_ssize_t __Pyx_ssize_strlen(const char *s);
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
#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 CYTHON_ASSUME_SAFE_MACROS
    #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_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
#else
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
#endif
#define __Pyx_PyObject_AsWritableString(s)    ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*)(__pyx_uintptr_t) __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_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#define __Pyx_PyUnicode_FromOrdinal(o)       PyUnicode_FromOrdinal((int)o)
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
    return Py_NewRef(obj);
#else
    Py_INCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
    return Py_XNewRef(obj);
#else
    Py_XINCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
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_Long(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_PyLong_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
#else
#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
#endif
#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_VERSION_HEX >= 0x030C00A7
  #ifndef _PyLong_SIGN_MASK
    #define _PyLong_SIGN_MASK 3
  #endif
  #ifndef _PyLong_NON_SIZE_BITS
    #define _PyLong_NON_SIZE_BITS 3
  #endif
  #define __Pyx_PyLong_Sign(x)  (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  #define __Pyx_PyLong_IsNeg(x)  ((__Pyx_PyLong_Sign(x) & 2) != 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (!__Pyx_PyLong_IsNeg(x))
  #define __Pyx_PyLong_IsZero(x)  (__Pyx_PyLong_Sign(x) & 1)
  #define __Pyx_PyLong_IsPos(x)  (__Pyx_PyLong_Sign(x) == 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  (__Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  #define __Pyx_PyLong_SignedDigitCount(x)\
        ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
    #define __Pyx_PyLong_IsCompact(x)     PyUnstable_Long_IsCompact((PyLongObject*) x)
    #define __Pyx_PyLong_CompactValue(x)  PyUnstable_Long_CompactValue((PyLongObject*) x)
  #else
    #define __Pyx_PyLong_IsCompact(x)     (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
    #define __Pyx_PyLong_CompactValue(x)  ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  #endif
  typedef Py_ssize_t  __Pyx_compact_pylong;
  typedef size_t  __Pyx_compact_upylong;
  #else
  #define __Pyx_PyLong_IsNeg(x)  (Py_SIZE(x) < 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (Py_SIZE(x) >= 0)
  #define __Pyx_PyLong_IsZero(x)  (Py_SIZE(x) == 0)
  #define __Pyx_PyLong_IsPos(x)  (Py_SIZE(x) > 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  __Pyx_sst_abs(Py_SIZE(x))
  #define __Pyx_PyLong_SignedDigitCount(x)  Py_SIZE(x)
  #define __Pyx_PyLong_IsCompact(x)  (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  #define __Pyx_PyLong_CompactValue(x)\
        ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  typedef sdigit  __Pyx_compact_pylong;
  typedef digit  __Pyx_compact_upylong;
  #endif
  #if PY_VERSION_HEX >= 0x030C00A5
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->long_value.ob_digit)
  #else
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->ob_digit)
  #endif
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
#else
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#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__ */
/* PretendToInitialize */
#ifdef __cplusplus
#if __cplusplus > 201103L
#include <type_traits>
#endif
template <typename T>
static void __Pyx_pretend_to_initialize(T* ptr) {
#if __cplusplus > 201103L
    if ((std::is_trivially_default_constructible<T>::value))
#endif
        *ptr = T();
    (void)ptr;
}
#else
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
#endif


#if !CYTHON_USE_MODULE_STATE
static PyObject *__pyx_m = NULL;
#endif
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * const __pyx_cfilenm = __FILE__;
static const char *__pyx_filename;

/* #### Code section: filename_table ### */

static const char* const __pyx_f[] = {
  "xpra/codecs/csc_cython/converter.pyx",
  "xpra/buffers/membuf.pxd",
};
/* #### Code section: utility_code_proto_before_types ### */
/* IncludeStructmemberH.proto (used by FixUpExtensionType) */
#include <structmember.h>

/* Atomics.proto (used by UnpackUnboundCMethod) */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __pyx_atomic_int_type int
#define __pyx_nonatomic_int_type int
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__))
    #include <stdatomic.h>
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)))
    #include <atomic>
#endif
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__) &&\
                       ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type atomic_int
    #define __pyx_atomic_ptr_type atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) atomic_load(value)
    #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C atomics"
    #endif
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
                    ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type std::atomic_int
    #define __pyx_atomic_ptr_type std::atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) std::atomic_load(value)
    #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C++ atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C++ atomics"
    #endif
#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
                    (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
    #define __pyx_atomic_ptr_type void*
    #define __pyx_nonatomic_ptr_type void*
    #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
    #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER)
    #include <intrin.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type long
    #define __pyx_atomic_ptr_type void*
    #undef __pyx_nonatomic_int_type
    #define __pyx_nonatomic_int_type long
    #define __pyx_nonatomic_ptr_type void*
    #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
    #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
    #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
    #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
    #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif

/* CriticalSectionsDefinition.proto (used by CriticalSections) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection void*
#define __Pyx_PyCriticalSection2 void*
#define __Pyx_PyCriticalSection_End(cs)
#define __Pyx_PyCriticalSection2_End(cs)
#else
#define __Pyx_PyCriticalSection PyCriticalSection
#define __Pyx_PyCriticalSection2 PyCriticalSection2
#define __Pyx_PyCriticalSection_End PyCriticalSection_End
#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
#endif

/* CriticalSections.proto (used by CythonFunctionShared) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
#else
#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
#endif
#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_BEGIN_CRITICAL_SECTION(o) {
#define __Pyx_END_CRITICAL_SECTION() }
#else
#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
#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

/* #### Code section: numeric_typedefs ### */
/* #### Code section: complex_type_declarations ### */
/* #### Code section: type_declarations ### */

/*--- Type declarations ---*/
struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf;
struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter;
struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context;
struct __pyx_opt_args_4xpra_7buffers_6membuf_getbuf;
struct __pyx_opt_args_4xpra_7buffers_6membuf_padbuf;
struct __pyx_opt_args_4xpra_7buffers_6membuf_makebuf;
struct __pyx_opt_args_4xpra_7buffers_6membuf_wrapbuf;

/* "xpra/buffers/membuf.pxd":6
 * # later version. See the file COPYING for details.
 * 
 * cdef MemBuf getbuf(size_t l, int readonly=*)             # <<<<<<<<<<<<<<
 * cdef MemBuf padbuf(size_t l, size_t padding, int readonly=*)
 * cdef MemBuf makebuf(void *p, size_t l, int readonly=*)
*/
struct __pyx_opt_args_4xpra_7buffers_6membuf_getbuf {
  int __pyx_n;
  int readonly;
};

/* "xpra/buffers/membuf.pxd":7
 * 
 * cdef MemBuf getbuf(size_t l, int readonly=*)
 * cdef MemBuf padbuf(size_t l, size_t padding, int readonly=*)             # <<<<<<<<<<<<<<
 * cdef MemBuf makebuf(void *p, size_t l, int readonly=*)
 * cdef MemBuf wrapbuf(void *p, size_t l, int readonly=*)
*/
struct __pyx_opt_args_4xpra_7buffers_6membuf_padbuf {
  int __pyx_n;
  int readonly;
};

/* "xpra/buffers/membuf.pxd":8
 * cdef MemBuf getbuf(size_t l, int readonly=*)
 * cdef MemBuf padbuf(size_t l, size_t padding, int readonly=*)
 * cdef MemBuf makebuf(void *p, size_t l, int readonly=*)             # <<<<<<<<<<<<<<
 * cdef MemBuf wrapbuf(void *p, size_t l, int readonly=*)
 * 
*/
struct __pyx_opt_args_4xpra_7buffers_6membuf_makebuf {
  int __pyx_n;
  int readonly;
};

/* "xpra/buffers/membuf.pxd":9
 * cdef MemBuf padbuf(size_t l, size_t padding, int readonly=*)
 * cdef MemBuf makebuf(void *p, size_t l, int readonly=*)
 * cdef MemBuf wrapbuf(void *p, size_t l, int readonly=*)             # <<<<<<<<<<<<<<
 * 
 * cdef object buffer_context(object obj)
*/
struct __pyx_opt_args_4xpra_7buffers_6membuf_wrapbuf {
  int __pyx_n;
  int readonly;
};

/* "xpra/buffers/membuf.pxd":13
 * cdef object buffer_context(object obj)
 * 
 * ctypedef void dealloc_callback(const void *p, size_t l, void *arg)             # <<<<<<<<<<<<<<
 * 
 * 
*/
typedef void __pyx_t_4xpra_7buffers_6membuf_dealloc_callback(void const *, size_t, void *);
struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_planar3_image_wrapper;
struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper;

/* "xpra/codecs/csc_cython/converter.pyx":873
 *         return self.planar3_image_wrapper(<void *> output_image)
 * 
 *     cdef object planar3_image_wrapper(self, void *buf, unsigned char bpp=24):             # <<<<<<<<<<<<<<
 *         #create python buffer from each plane:
 *         planes = []
*/
struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_planar3_image_wrapper {
  int __pyx_n;
  unsigned char bpp;
};

/* "xpra/codecs/csc_cython/converter.pyx":1053
 *         return self.packed_image_wrapper(<char *> bgr48, 48)
 * 
 *     cdef object packed_image_wrapper(self, char *buf, unsigned char bpp=24):             # <<<<<<<<<<<<<<
 *         pybuf = PyMemoryView_FromMemory(buf, self.dst_sizes[0], PyBUF_WRITE)
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height, pybuf, self.dst_format, bpp, self.dst_strides[0], planes=ImageWrapper.PACKED)
*/
struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper {
  int __pyx_n;
  unsigned char bpp;
};

/* "xpra/buffers/membuf.pxd":22
 * 
 * 
 * cdef class MemBuf:             # <<<<<<<<<<<<<<
 *     cdef int readonly
 *     cdef const void *p
*/
struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf {
  PyObject_HEAD
  struct __pyx_vtabstruct_4xpra_7buffers_6membuf_MemBuf *__pyx_vtab;
  int readonly;
  void const *p;
  size_t l;
  __pyx_t_4xpra_7buffers_6membuf_dealloc_callback *dealloc_cb_p;
  void *dealloc_cb_arg;
};


/* "xpra/codecs/csc_cython/converter.pyx":444
 * 
 * 
 * cdef class Converter:             # <<<<<<<<<<<<<<
 *     cdef unsigned int src_width
 *     cdef unsigned int src_height
*/
struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter {
  PyObject_HEAD
  struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_vtab;
  unsigned int src_width;
  unsigned int src_height;
  PyObject *src_format;
  unsigned int dst_width;
  unsigned int dst_height;
  PyObject *dst_format;
  unsigned long dst_strides[3];
  unsigned long dst_sizes[3];
  unsigned long offsets[3];
  unsigned char full_range;
  PyObject *convert_image_function;
  unsigned long frames;
  double time;
  unsigned long buffer_size;
  PyObject *__weakref__;
};


/* "xpra/codecs/csc_cython/converter.pyx":464
 *     cdef object __weakref__
 * 
 *     def init_context(self, int src_width, int src_height, src_format: str,             # <<<<<<<<<<<<<<
 *                            int dst_width, int dst_height, dst_format: str, options: typedict) -> None:
 *         cdef int i
*/
struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context {
  PyObject_HEAD
  PyObject *__pyx_v_dst_format;
  int __pyx_v_dst_height;
  int __pyx_v_dst_width;
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self;
  PyObject *__pyx_v_src_format;
  int __pyx_v_src_height;
  int __pyx_v_src_width;
};



/* "xpra/buffers/membuf.pxd":22
 * 
 * 
 * cdef class MemBuf:             # <<<<<<<<<<<<<<
 *     cdef int readonly
 *     cdef const void *p
*/

struct __pyx_vtabstruct_4xpra_7buffers_6membuf_MemBuf {
  void const *(*get_mem)(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *);
};
static struct __pyx_vtabstruct_4xpra_7buffers_6membuf_MemBuf *__pyx_vtabptr_4xpra_7buffers_6membuf_MemBuf;


/* "xpra/codecs/csc_cython/converter.pyx":444
 * 
 * 
 * cdef class Converter:             # <<<<<<<<<<<<<<
 *     cdef unsigned int src_width
 *     cdef unsigned int src_height
*/

struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter {
  PyObject *(*do_RGB_to_YUV420P)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, PyObject *, uint8_t const , uint8_t const , uint8_t const , uint8_t const );
  PyObject *(*do_RGB_to_YUV444P)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, PyObject *, uint8_t const , uint8_t const , uint8_t const , uint8_t const );
  PyObject *(*planar3_image_wrapper)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, void *, struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_planar3_image_wrapper *__pyx_optional_args);
  PyObject *(*packed_image_wrapper)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, char *, struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper *__pyx_optional_args);
  PyObject *(*do_YUV420P_to_RGB)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, PyObject *, uint8_t const , uint8_t const , uint8_t const , uint8_t const , uint8_t const );
  PyObject *(*do_RGBP_to_RGB)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, PyObject *, uint8_t const , uint8_t const , uint8_t const , uint8_t const , uint8_t const , uint8_t const , uint8_t const );
};
static struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_vtabptr_4xpra_6codecs_10csc_cython_9converter_Converter;
/* #### Code section: utility_code_proto ### */

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, Py_ssize_t);
    void (*DECREF)(void*, PyObject*, Py_ssize_t);
    void (*GOTREF)(void*, PyObject*, Py_ssize_t);
    void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
    void* (*SetupContext)(const char*, Py_ssize_t, 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;
  #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__));\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #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); else {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContextNogil()
  #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_Py_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; Py_XDECREF(tmp);\
    } while (0)
#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)

/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
#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

/* PyThreadStateGet.proto (used by PyErrFetchRestore) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#if PY_VERSION_HEX >= 0x030C00A6
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->current_exception != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
#else
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->curexc_type != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->curexc_type)
#endif
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  (PyErr_Occurred() != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
#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 && PY_VERSION_HEX < 0x030C00A6
#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

/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
#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

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

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

/* TupleAndListFromArray.proto (used by fastcall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
#endif
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
#endif

/* IncludeStringH.proto (used by BytesEquals) */
#include <string.h>

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

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

/* fastcall.proto */
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
#elif CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
#else
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
#endif
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
#define __Pyx_KwValues_VARARGS(args, nargs) NULL
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
#if CYTHON_METH_FASTCALL
    #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
    #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
    #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
    static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  #else
    #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  #endif
#else
    #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
    #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
    #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
    #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
    #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
#endif
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
#else
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
#endif

/* ParseKeywordsImpl */
static int(*__Pyx_ParseKeywordsTuple)(PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs); /*proto*/
static int(*__Pyx_ParseKeywordDictToDict)(PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
static int(*__Pyx_ParseKeywordDict)(PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs); /*proto*/

/* ParseKeywords.proto */
static CYTHON_INLINE int __Pyx_ParseKeywords(
    PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
    PyObject *kwds2, PyObject *values[],
    Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* 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);

/* PyDictVersioning.proto (used by GetModuleGlobalName) */
#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_XNewRef(__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)  do {\
    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_mstate_global->__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);\
} while(0)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  do {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
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

/* PyObjectCall.proto (used by PyObjectFastCall) */
#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

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

/* PyObjectFastCall.proto (used by PyObjectFastCallMethod) */
#define __Pyx_PyObject_FastCall(func, args, nargs)  __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);

/* PyObjectFastCallMethod.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL)
#else
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf);
#endif

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* 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);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __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

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

/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);

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

/* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
#endif

/* PyObjectCallMethod0.proto (used by dict_iter) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

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

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

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

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

/* UnpackTupleError.proto (used by UnpackTuple2) */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
    PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple);
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* PyObjectVectorCallKwBuilder.proto */
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#if CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
#endif
#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
#endif

/* PyObjectDelAttr.proto (used by PyObjectSetAttrStr) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
#define __Pyx_PyObject_DelAttr(o, n) PyObject_SetAttr(o, n, NULL)
#else
#define __Pyx_PyObject_DelAttr(o, n) PyObject_DelAttr(o, n)
#endif

/* 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)   __Pyx_PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* ArgTypeTestFunc */
static int(*__Pyx__ArgTypeTest)(PyObject *obj, PyTypeObject *type, const char *name, int exact); /*proto*/

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))

/* AssertionsEnabled.proto */
#if CYTHON_COMPILING_IN_LIMITED_API  ||  PY_VERSION_HEX >= 0x030C0000
  static int __pyx_assertions_enabled_flag;
  #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  #if __clang__ || __GNUC__
  __attribute__((no_sanitize("thread")))
  #endif
  static int __Pyx_init_assertions_enabled(void) {
    PyObject *builtins, *debug, *debug_str;
    int flag;
    builtins = PyEval_GetBuiltins();
    if (!builtins) goto bad;
    debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
    if (!debug_str) goto bad;
    debug = PyObject_GetItem(builtins, debug_str);
    Py_DECREF(debug_str);
    if (!debug) goto bad;
    flag = PyObject_IsTrue(debug);
    Py_DECREF(debug);
    if (flag == -1) goto bad;
    __pyx_assertions_enabled_flag = flag;
    return 0;
  bad:
    __pyx_assertions_enabled_flag = 1;
    return -1;
  }
#else
  #define __Pyx_init_assertions_enabled()  (0)
  #define __pyx_assertions_enabled()  (!Py_OptimizeFlag)
#endif

/* PyAssertionError_Check.proto */
#define __Pyx_PyExc_AssertionError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_AssertionError)

/* PyUnicode_Unicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj);

/* RaiseClosureNameError.proto */
static void __Pyx_RaiseClosureNameError(const char *varname);

/* JoinPyUnicode */
static PyObject*(*__Pyx_PyUnicode_Join)(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char); /*proto*/

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

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

/* PyObjectFormatAndDecref.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);

/* DictGetItem.proto */
#if !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

/* dict_setdefault.proto (used by FetchCommonType) */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);

/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
#endif

/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)

/* FixUpExtensionType.proto (used by FetchCommonType) */
static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);

/* AddModuleRef.proto (used by FetchSharedCythonModule) */
#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
     __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
#else
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#endif

/* FetchSharedCythonModule.proto (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void);

/* FetchCommonType.proto (used by CommonTypesMetaclass) */
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);

/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */
static int __pyx_CommonTypesMetaclass_init(PyObject *module);
#define __Pyx_CommonTypesMetaclass_USED

/* CallTypeTraverse.proto (used by CythonFunctionShared) */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
#endif

/* PyMethodNew.proto (used by CythonFunctionShared) */
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);

/* py_dict_items.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

/* CallCFunction.proto (used by CallUnboundCMethod0) */
#define __Pyx_CallCFunction(cfunc, self, args)\
    ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
    ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
    ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
    ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)

/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
typedef struct {
    PyObject *type;
    PyObject **method_name;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
    __pyx_atomic_int_type initialized;
#endif
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
#if !CYTHON_ATOMICS
    return 1;
#else
    __pyx_nonatomic_int_type expected = 0;
    if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
        return 0;
    }
    return expected;
#endif
}
static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
#if CYTHON_ATOMICS
    __pyx_atomic_store(&cfunc->initialized, 2);
#endif
}
#else
#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
#endif

/* CallUnboundCMethod0.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* py_dict_values.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);

/* OwnedDictNext.proto (used by PyVectorcallFastCallDict) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
#else
CYTHON_INLINE
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
#endif

/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
#endif

/* CythonFunctionShared.proto (used by CythonFunction) */
#define __Pyx_CyFunction_USED
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CYFUNCTION_COROUTINE     0x08
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_CyFunction_GetClassObj(f)\
      (((__pyx_CyFunctionObject *) (f))->func_classobj)
#else
  #define __Pyx_CyFunction_GetClassObj(f)\
      ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
#endif
#define __Pyx_CyFunction_SetClassObj(f, classobj)\
    __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject_HEAD
    PyObject *func;
#elif PY_VERSION_HEX < 0x030900B1
    PyCFunctionObject func;
#else
    PyCMethodObject func;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
    __pyx_vectorcallfunc func_vectorcall;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_weakreflist;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_dict;
#endif
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_classobj;
#endif
    PyObject *defaults;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
    PyObject *func_is_coroutine;
} __pyx_CyFunctionObject;
#undef __Pyx_CyOrPyCFunction_Check
#define __Pyx_CyFunction_Check(obj)  __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
#define __Pyx_CyOrPyCFunction_Check(obj)  __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
#define __Pyx_CyFunction_CheckExact(obj)  __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
#undef __Pyx_IsSameCFunction
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCyOrCFunction(func, cfunc)
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
                                                         PyTypeObject *defaults_type);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(PyObject *module);
#if CYTHON_METH_FASTCALL
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
#else
#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
#endif
#endif

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* PyValueError_Check.proto */
#define __Pyx_PyExc_ValueError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ValueError)

/* BuildPyUnicode.proto (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char);

/* COrdinalToPyUnicode.proto (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value);
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char);

/* GCCDiagnostics.proto (used by CIntToPyUnicode) */
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* IncludeStdlibH.proto (used by CIntToPyUnicode) */
#include <stdlib.h>

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_unsigned_int(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_unsigned_int(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_unsigned_int(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_unsigned_int(unsigned int value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_unsigned_int(unsigned int value, Py_ssize_t width, char padding_char, char format_char);

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

/* pyint_simplify.proto */
static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none);

/* RaiseUnexpectedTypeError.proto */
static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);

/* PyObjectLookupSpecial.proto */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 0)
#define __Pyx_PyObject_LookupSpecial(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 1)
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error);
#else
#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n)
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* GetTopmostException.proto (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
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

/* 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

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\
    (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, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (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, int unsafe_shared);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (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, int unsafe_shared);
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, int unsafe_shared);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char);

/* SetStringIndexingError.proto (used by GetItemIntUnicode) */
static void __Pyx_SetStringIndexingError(const char* message, int has_gil);

/* GetItemIntUnicode.proto */
#define __Pyx_GetItemInt_Unicode(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Unicode_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, has_gil) :\
    (__Pyx_SetStringIndexingError("string index out of range", has_gil), (Py_UCS4)-1))
static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i,
                                                           int wraparound, int boundscheck, int has_gil);

/* ImportImpl */
static PyObject *(*__Pyx__Import)(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); /*proto*/

/* Import.proto */
static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);

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

/* AllocateExtensionType.proto */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);

/* CheckTypeForFreelists.proto */
#if CYTHON_USE_FREELISTS
#if CYTHON_USE_TYPE_SPECS
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  Py_TPFLAGS_IS_ABSTRACT
#else
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
#endif
#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
    (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
     (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
#endif

/* ValidateBasesTuple.proto (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
#endif

/* PyType_Ready.proto */
CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable);

/* GetVTable.proto (used by MergeVTables) */
static void* __Pyx_GetVtable(PyTypeObject *type);

/* MergeVTables.proto */
static int __Pyx_MergeVtables(PyTypeObject *type);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_4
#define __PYX_HAVE_RT_ImportType_proto_3_2_4
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#endif
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_4(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_4(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_2_4 {
   __Pyx_ImportType_CheckSize_Error_3_2_4 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_2_4 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_2_4 = 2
};
static PyTypeObject *__Pyx_ImportType_3_2_4(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_4 check_size);
#endif

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

/* ListPack.proto */
static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...);

/* Py3UpdateBases.proto */
static PyObject* __Pyx_PEP560_update_bases(PyObject *bases);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* PyObjectCall2Args.proto (used by Py3ClassCreate) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CyFunctionClassCell.proto */
static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj);

/* CLineInTraceback.proto (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#else
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#endif

/* CodeObjectCache.proto (used by AddTraceback) */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject __Pyx_CachedCodeObjectType;
#else
typedef PyCodeObject __Pyx_CachedCodeObjectType;
#endif
typedef struct {
    __Pyx_CachedCodeObjectType* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_int_type accessor_count;
  #endif
};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint8_t(uint8_t value);

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

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

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

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

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

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

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

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

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

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

/* FormatTypeName.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%U"
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
#else
static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
#endif
#else  // !LIMITED_API
typedef const char *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%.200s"
#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
#define __Pyx_DECREF_TypeName(obj)
#endif

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

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, 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_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
    return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
}
#endif
#define __Pyx_PyErr_ExceptionMatches2(err1, err2)  __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#ifdef PyExceptionInstance_Check
  #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
#else
  #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
#endif

/* GetRuntimeVersion.proto */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
static unsigned long __Pyx_cached_runtime_version = 0;
static void __Pyx_init_runtime_version(void);
#else
#define __Pyx_init_runtime_version()
#endif
static unsigned long __Pyx_get_runtime_version(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);

/* DecompressString.proto */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);

/* MultiPhaseInitModuleState.proto */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
static PyObject *__Pyx_State_FindModule(void*);
static int __Pyx_State_AddModule(PyObject* module, void*);
static int __Pyx_State_RemoveModule(void*);
#elif CYTHON_USE_MODULE_STATE
#define __Pyx_State_FindModule PyState_FindModule
#define __Pyx_State_AddModule PyState_AddModule
#define __Pyx_State_RemoveModule PyState_RemoveModule
#endif

/* #### Code section: module_declarations ### */
/* CythonABIVersion.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
    #if CYTHON_METH_FASTCALL
        #define __PYX_FASTCALL_ABI_SUFFIX  "_fastcall"
    #else
        #define __PYX_FASTCALL_ABI_SUFFIX
    #endif
    #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#else
    #define __PYX_LIMITED_ABI_SUFFIX
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    #define __PYX_AM_SEND_ABI_SUFFIX
#elif __PYX_HAS_PY_AM_SEND == 2
    #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
#else
    #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
#endif
#ifndef __PYX_MONITORING_ABI_SUFFIX
    #define __PYX_MONITORING_ABI_SUFFIX
#endif
#if CYTHON_USE_TP_FINALIZE
    #define __PYX_TP_FINALIZE_ABI_SUFFIX
#else
    #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
#endif
#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
    #define __PYX_FREELISTS_ABI_SUFFIX
#else
    #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
#endif
#define CYTHON_ABI  __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."

static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_RGB_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image, uint8_t const __pyx_v_Bpp, uint8_t const __pyx_v_Rindex, uint8_t const __pyx_v_Gindex, uint8_t const __pyx_v_Bindex); /* proto*/
static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_RGB_to_YUV444P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image, uint8_t const __pyx_v_Bpp, uint8_t const __pyx_v_Rindex, uint8_t const __pyx_v_Gindex, uint8_t const __pyx_v_Bindex); /* proto*/
static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_planar3_image_wrapper(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, void *__pyx_v_buf, struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_planar3_image_wrapper *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, char *__pyx_v_buf, struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_YUV420P_to_RGB(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image, uint8_t const __pyx_v_Bpp, uint8_t const __pyx_v_Rindex, uint8_t const __pyx_v_Gindex, uint8_t const __pyx_v_Bindex, uint8_t const __pyx_v_Xindex); /* proto*/
static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_RGBP_to_RGB(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image, uint8_t const __pyx_v_Rsrc, uint8_t const __pyx_v_Gsrc, uint8_t const __pyx_v_Bsrc, uint8_t const __pyx_v_Rdst, uint8_t const __pyx_v_Gdst, uint8_t const __pyx_v_Bdst, uint8_t const __pyx_v_Xdst); /* proto*/

/* Module declarations from "libc.stdint" */

/* Module declarations from "xpra.buffers.membuf" */
static PyObject *(*__pyx_f_4xpra_7buffers_6membuf_buffer_context)(PyObject *); /*proto*/
static void *(*__pyx_f_4xpra_7buffers_6membuf_memalign)(size_t); /*proto*/
static void (*__pyx_f_4xpra_7buffers_6membuf_memfree)(void *); /*proto*/

/* Module declarations from "xpra.codecs.csc_cython.converter" */
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_R;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_G;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_B;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_X;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_R;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_G;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_B;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_X;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_R;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_G;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_B;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_R;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_G;
static uint8_t __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_B;
static CYTHON_INLINE int __pyx_f_4xpra_6codecs_10csc_cython_9converter_roundup(int, int); /*proto*/
static CYTHON_INLINE unsigned char __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp(long const ); /*proto*/
static CYTHON_INLINE unsigned short __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp10(long const ); /*proto*/
static CYTHON_INLINE unsigned char __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp_studio_UV(long const ); /*proto*/
static CYTHON_INLINE unsigned char __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp_studio_Y(long const ); /*proto*/
static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_r210_to_BGR48_copy(unsigned short *, unsigned int const *, unsigned int, unsigned int, unsigned int, unsigned int); /*proto*/
static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_gbrp10_to_r210_copy(uintptr_t, uintptr_t *, unsigned int, unsigned int, unsigned int, unsigned int); /*proto*/
static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_r210_to_YUV444P10_copy(unsigned short *, unsigned short *, unsigned short *, uintptr_t, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); /*proto*/
static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P10_to_r210_copy(uintptr_t, unsigned short const *, unsigned short const *, unsigned short const *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); /*proto*/
static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P_to_BGRX_copy(uintptr_t, unsigned char const *, unsigned char const *, unsigned char const *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char); /*proto*/
static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P_to_RGBX_copy(uintptr_t, unsigned char const *, unsigned char const *, unsigned char const *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char); /*proto*/
/* #### Code section: typeinfo ### */
/* #### Code section: before_global_var ### */
#define __Pyx_MODULE_NAME "xpra.codecs.csc_cython.converter"
extern int __pyx_module_is_main_xpra__codecs__csc_cython__converter;
int __pyx_module_is_main_xpra__codecs__csc_cython__converter = 0;

/* Implementation of "xpra.codecs.csc_cython.converter" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_enumerate;
/* #### Code section: string_decls ### */
/* #### Code section: decls ### */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_get_CS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_cs, PyObject *__pyx_v_valid_options); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_2get_type(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_4get_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_6get_info(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_8get_specs(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_free(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_2_cn(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_assert_no_scaling(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_2allocate_yuv(PyObject *__pyx_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_Bpp); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_4allocate_rgb(PyObject *__pyx_self, PyObject *__pyx_v_Bpp); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_init_context(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, int __pyx_v_src_width, int __pyx_v_src_height, PyObject *__pyx_v_src_format, int __pyx_v_dst_width, int __pyx_v_dst_height, PyObject *__pyx_v_dst_format, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_2clean(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_4is_closed(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_6get_info(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_8__repr__(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static void __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_10__dealloc__(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12get_src_width(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_14get_src_height(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_16get_src_format(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_18get_dst_width(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_20get_dst_height(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_22get_dst_format(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_24get_type(CYTHON_UNUSED struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_26convert_image(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_28r210_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_30BGR_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_32RGB_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_34BGRX_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_36RGBX_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_38BGR_to_YUV444P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_40RGB_to_YUV444P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_42BGRX_to_YUV444P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_44RGBX_to_YUV444P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_46validate_rgb_image(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_48r210_to_YUV444P10(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_50YUV444P10_to_r210(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_52YUV444P_to_RGB(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_54r210_to_BGR48(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_56validate_planar3_image(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_58GBRP10_to_r210(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_60YUV420P_to_RGBX(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_62YUV420P_to_RGB(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_64YUV420P_to_BGRX(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_66YUV420P_to_BGR(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_68GBRP_to_RGBX(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_70GBRP_to_BGRX(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image); /* proto */
static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_10selftest(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_full); /* proto */
static PyObject *__pyx_tp_new_4xpra_6codecs_10csc_cython_9converter_Converter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
/* #### Code section: late_includes ### */
/* #### Code section: module_state ### */
/* SmallCodeConfig */
#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

typedef struct {
  PyObject *__pyx_d;
  PyObject *__pyx_b;
  PyObject *__pyx_cython_runtime;
  PyObject *__pyx_empty_tuple;
  PyObject *__pyx_empty_bytes;
  PyObject *__pyx_empty_unicode;
  PyTypeObject *__pyx_ptype_4xpra_7buffers_6membuf_MemBuf;
  PyObject *__pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter;
  PyObject *__pyx_type_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context;
  PyTypeObject *__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter;
  PyTypeObject *__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  PyObject *__pyx_tuple[7];
  PyObject *__pyx_codeobj_tab[45];
  PyObject *__pyx_string_tab[342];
  PyObject *__pyx_number_tab[8];
/* #### Code section: module_state_contents ### */
/* CommonTypesMetaclass.module_state_decls */
PyTypeObject *__pyx_CommonTypesMetaclassType;

/* CachedMethodType.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API
PyObject *__Pyx_CachedMethodType;
#endif

/* CythonFunctionShared.module_state_decls */
PyTypeObject *__pyx_CyFunctionType;


#if CYTHON_USE_FREELISTS
struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *__pyx_freelist_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context[8];
int __pyx_freecount_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context;
#endif
/* CodeObjectCache.module_state_decls */
struct __Pyx_CodeObjectCache __pyx_code_cache;

/* #### Code section: module_state_end ### */
} __pyx_mstatetype;

#if CYTHON_USE_MODULE_STATE
#ifdef __cplusplus
namespace {
extern struct PyModuleDef __pyx_moduledef;
} /* anonymous namespace */
#else
static struct PyModuleDef __pyx_moduledef;
#endif

#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))

#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
#else
static __pyx_mstatetype __pyx_mstate_global_static =
#ifdef __cplusplus
    {};
#else
    {0};
#endif
static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
#endif
/* #### Code section: constant_name_defines ### */
#define __pyx_kp_u_ __pyx_string_tab[0]
#define __pyx_kp_u_BUG_src_format_s_dst_format_s __pyx_string_tab[1]
#define __pyx_kp_u_CythonImageWrapper_free_cython_b __pyx_string_tab[2]
#define __pyx_kp_u_Dict_str_Any __pyx_string_tab[3]
#define __pyx_kp_u_None __pyx_string_tab[4]
#define __pyx_kp_u_Sequence_CSCSpec __pyx_string_tab[5]
#define __pyx_kp_u_Sequence_str __pyx_string_tab[6]
#define __pyx_kp_u_Tuple_int_int __pyx_string_tab[7]
#define __pyx_kp_u_XPRA_CSC_CYTHON__s_COLORSPACES __pyx_string_tab[8]
#define __pyx_kp_u_YUV444P10_to_r210_s_strides_s __pyx_string_tab[9]
#define __pyx_kp_u_YUV444P_to_RGB_s_strides_s __pyx_string_tab[10]
#define __pyx_kp_u__2 __pyx_string_tab[11]
#define __pyx_kp_u__3 __pyx_string_tab[12]
#define __pyx_kp_u__4 __pyx_string_tab[13]
#define __pyx_kp_u__5 __pyx_string_tab[14]
#define __pyx_kp_u__6 __pyx_string_tab[15]
#define __pyx_kp_u__7 __pyx_string_tab[16]
#define __pyx_kp_u_allocate_rgb_i_buffer_size_s_dst __pyx_string_tab[17]
#define __pyx_kp_u_allocate_yuv_s_i_buffer_size_s_s __pyx_string_tab[18]
#define __pyx_kp_u_buffer_for_G_plane_is_too_small __pyx_string_tab[19]
#define __pyx_kp_u_buffer_for_Y_plane_is_too_small __pyx_string_tab[20]
#define __pyx_kp_u_bytes_expected_at_least __pyx_string_tab[21]
#define __pyx_kp_u_csc_cython __pyx_string_tab[22]
#define __pyx_kp_u_csc_cython_Converter_init_contex __pyx_string_tab[23]
#define __pyx_kp_u_csc_cython_byteorder_BGRX_s __pyx_string_tab[24]
#define __pyx_kp_u_csc_cython_byteorder_BGR_s __pyx_string_tab[25]
#define __pyx_kp_u_csc_cython_byteorder_RGBX_s __pyx_string_tab[26]
#define __pyx_kp_u_csc_cython_byteorder_RGB_s __pyx_string_tab[27]
#define __pyx_kp_u_csc_cython_s_endian __pyx_string_tab[28]
#define __pyx_kp_u_disable __pyx_string_tab[29]
#define __pyx_kp_u_do_RGBP_to_RGB_s_strides_s __pyx_string_tab[30]
#define __pyx_kp_u_do_RGB_to_YUV420P_s_i_i_i_i_inpu __pyx_string_tab[31]
#define __pyx_kp_u_do_RGB_to_YUV444P_s_i_i_i_i_inpu __pyx_string_tab[32]
#define __pyx_kp_u_do_YUV420P_to_RGB_s_strides_s __pyx_string_tab[33]
#define __pyx_kp_u_enable __pyx_string_tab[34]
#define __pyx_kp_u_environment_override_for_s_s __pyx_string_tab[35]
#define __pyx_kp_u_failed_to_get_pixels_from_s __pyx_string_tab[36]
#define __pyx_kp_u_failed_to_read_pixel_data_from_s __pyx_string_tab[37]
#define __pyx_kp_u_for __pyx_string_tab[38]
#define __pyx_kp_u_full_range __pyx_string_tab[39]
#define __pyx_kp_u_gc __pyx_string_tab[40]
#define __pyx_kp_u_input_plane_s_is_too_small_i_byt __pyx_string_tab[41]
#define __pyx_kp_u_invalid_colorspace_override_for __pyx_string_tab[42]
#define __pyx_kp_u_invalid_image_height __pyx_string_tab[43]
#define __pyx_kp_u_invalid_image_width __pyx_string_tab[44]
#define __pyx_kp_u_invalid_input_colorspace __pyx_string_tab[45]
#define __pyx_kp_u_invalid_input_format_s_planes __pyx_string_tab[46]
#define __pyx_kp_u_invalid_output_colorspace __pyx_string_tab[47]
#define __pyx_kp_u_invalid_pixel_format_s __pyx_string_tab[48]
#define __pyx_kp_u_isenabled __pyx_string_tab[49]
#define __pyx_kp_u_minimum_is __pyx_string_tab[50]
#define __pyx_kp_u_mismatch_in_rowstrides __pyx_string_tab[51]
#define __pyx_kp_u_must_be_one_of __pyx_string_tab[52]
#define __pyx_kp_u_r210_to_BGR48_s_input_s_strides __pyx_string_tab[53]
#define __pyx_kp_u_r210_to_YUV444P10_s_input_s_stri __pyx_string_tab[54]
#define __pyx_kp_u_s_took_1fms __pyx_string_tab[55]
#define __pyx_kp_u_scaling_is_not_supported_for __pyx_string_tab[56]
#define __pyx_kp_u_to __pyx_string_tab[57]
#define __pyx_kp_u_unsupported_dst_format __pyx_string_tab[58]
#define __pyx_kp_u_xpra_codecs_csc_cython_converter_2 __pyx_string_tab[59]
#define __pyx_n_u_Any __pyx_string_tab[60]
#define __pyx_n_u_BGR __pyx_string_tab[61]
#define __pyx_n_u_BGR48 __pyx_string_tab[62]
#define __pyx_n_u_BGRX __pyx_string_tab[63]
#define __pyx_n_u_BGRX_to_YUV420P __pyx_string_tab[64]
#define __pyx_n_u_BGRX_to_YUV444P __pyx_string_tab[65]
#define __pyx_n_u_BGR_to_YUV420P __pyx_string_tab[66]
#define __pyx_n_u_BGR_to_YUV444P __pyx_string_tab[67]
#define __pyx_n_u_Bpp __pyx_string_tab[68]
#define __pyx_n_u_COLORSPACES __pyx_string_tab[69]
#define __pyx_n_u_CSCSpec __pyx_string_tab[70]
#define __pyx_n_u_Converter __pyx_string_tab[71]
#define __pyx_n_u_Converter_BGRX_to_YUV420P __pyx_string_tab[72]
#define __pyx_n_u_Converter_BGRX_to_YUV444P __pyx_string_tab[73]
#define __pyx_n_u_Converter_BGR_to_YUV420P __pyx_string_tab[74]
#define __pyx_n_u_Converter_BGR_to_YUV444P __pyx_string_tab[75]
#define __pyx_n_u_Converter_GBRP10_to_r210 __pyx_string_tab[76]
#define __pyx_n_u_Converter_GBRP_to_BGRX __pyx_string_tab[77]
#define __pyx_n_u_Converter_GBRP_to_RGBX __pyx_string_tab[78]
#define __pyx_n_u_Converter_RGBX_to_YUV420P __pyx_string_tab[79]
#define __pyx_n_u_Converter_RGBX_to_YUV444P __pyx_string_tab[80]
#define __pyx_n_u_Converter_RGB_to_YUV420P __pyx_string_tab[81]
#define __pyx_n_u_Converter_RGB_to_YUV444P __pyx_string_tab[82]
#define __pyx_n_u_Converter_YUV420P_to_BGR __pyx_string_tab[83]
#define __pyx_n_u_Converter_YUV420P_to_BGRX __pyx_string_tab[84]
#define __pyx_n_u_Converter_YUV420P_to_RGB __pyx_string_tab[85]
#define __pyx_n_u_Converter_YUV420P_to_RGBX __pyx_string_tab[86]
#define __pyx_n_u_Converter_YUV444P10_to_r210 __pyx_string_tab[87]
#define __pyx_n_u_Converter_YUV444P_to_RGB __pyx_string_tab[88]
#define __pyx_n_u_Converter_clean __pyx_string_tab[89]
#define __pyx_n_u_Converter_convert_image __pyx_string_tab[90]
#define __pyx_n_u_Converter_get_dst_format __pyx_string_tab[91]
#define __pyx_n_u_Converter_get_dst_height __pyx_string_tab[92]
#define __pyx_n_u_Converter_get_dst_width __pyx_string_tab[93]
#define __pyx_n_u_Converter_get_info __pyx_string_tab[94]
#define __pyx_n_u_Converter_get_src_format __pyx_string_tab[95]
#define __pyx_n_u_Converter_get_src_height __pyx_string_tab[96]
#define __pyx_n_u_Converter_get_src_width __pyx_string_tab[97]
#define __pyx_n_u_Converter_get_type __pyx_string_tab[98]
#define __pyx_n_u_Converter_init_context __pyx_string_tab[99]
#define __pyx_n_u_Converter_is_closed __pyx_string_tab[100]
#define __pyx_n_u_Converter_r210_to_BGR48 __pyx_string_tab[101]
#define __pyx_n_u_Converter_r210_to_YUV420P __pyx_string_tab[102]
#define __pyx_n_u_Converter_r210_to_YUV444P10 __pyx_string_tab[103]
#define __pyx_n_u_Converter_validate_planar3_image __pyx_string_tab[104]
#define __pyx_n_u_Converter_validate_rgb_image __pyx_string_tab[105]
#define __pyx_n_u_CythonImageWrapper __pyx_string_tab[106]
#define __pyx_n_u_CythonImageWrapper__cn __pyx_string_tab[107]
#define __pyx_n_u_CythonImageWrapper_free __pyx_string_tab[108]
#define __pyx_n_u_Dict __pyx_string_tab[109]
#define __pyx_n_u_GBR __pyx_string_tab[110]
#define __pyx_n_u_GBRP __pyx_string_tab[111]
#define __pyx_n_u_GBRP10 __pyx_string_tab[112]
#define __pyx_n_u_GBRP10_to_r210 __pyx_string_tab[113]
#define __pyx_n_u_GBRP_to_BGRX __pyx_string_tab[114]
#define __pyx_n_u_GBRP_to_RGBX __pyx_string_tab[115]
#define __pyx_n_u_ImageWrapper __pyx_string_tab[116]
#define __pyx_n_u_List __pyx_string_tab[117]
#define __pyx_n_u_Logger __pyx_string_tab[118]
#define __pyx_n_u_None __pyx_string_tab[119]
#define __pyx_n_u_PACKED __pyx_string_tab[120]
#define __pyx_n_u_PLANAR_3 __pyx_string_tab[121]
#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[122]
#define __pyx_n_u_RGB __pyx_string_tab[123]
#define __pyx_n_u_RGBX __pyx_string_tab[124]
#define __pyx_n_u_RGBX_to_YUV420P __pyx_string_tab[125]
#define __pyx_n_u_RGBX_to_YUV444P __pyx_string_tab[126]
#define __pyx_n_u_RGB_to_YUV420P __pyx_string_tab[127]
#define __pyx_n_u_RGB_to_YUV444P __pyx_string_tab[128]
#define __pyx_n_u_Sequence __pyx_string_tab[129]
#define __pyx_n_u_Tuple __pyx_string_tab[130]
#define __pyx_n_u_U __pyx_string_tab[131]
#define __pyx_n_u_Ustride __pyx_string_tab[132]
#define __pyx_n_u_V __pyx_string_tab[133]
#define __pyx_n_u_Vstride __pyx_string_tab[134]
#define __pyx_n_u_Y __pyx_string_tab[135]
#define __pyx_n_u_YUV __pyx_string_tab[136]
#define __pyx_n_u_YUV420P __pyx_string_tab[137]
#define __pyx_n_u_YUV420P_to_BGR __pyx_string_tab[138]
#define __pyx_n_u_YUV420P_to_BGRX __pyx_string_tab[139]
#define __pyx_n_u_YUV420P_to_RGB __pyx_string_tab[140]
#define __pyx_n_u_YUV420P_to_RGBX __pyx_string_tab[141]
#define __pyx_n_u_YUV444P __pyx_string_tab[142]
#define __pyx_n_u_YUV444P10 __pyx_string_tab[143]
#define __pyx_n_u_YUV444P10_to_r210 __pyx_string_tab[144]
#define __pyx_n_u_YUV444P_to_RGB __pyx_string_tab[145]
#define __pyx_n_u_YUVstrides __pyx_string_tab[146]
#define __pyx_n_u_Ystride __pyx_string_tab[147]
#define __pyx_n_u_allocate_rgb __pyx_string_tab[148]
#define __pyx_n_u_allocate_yuv __pyx_string_tab[149]
#define __pyx_n_u_assert_no_scaling __pyx_string_tab[150]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[151]
#define __pyx_n_u_bc __pyx_string_tab[152]
#define __pyx_n_u_bgr48 __pyx_string_tab[153]
#define __pyx_n_u_bool __pyx_string_tab[154]
#define __pyx_n_u_boolget __pyx_string_tab[155]
#define __pyx_n_u_buf __pyx_string_tab[156]
#define __pyx_n_u_byteorder __pyx_string_tab[157]
#define __pyx_n_u_can_scale __pyx_string_tab[158]
#define __pyx_n_u_cb __pyx_string_tab[159]
#define __pyx_n_u_clean __pyx_string_tab[160]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[161]
#define __pyx_n_u_cn __pyx_string_tab[162]
#define __pyx_n_u_codec_class __pyx_string_tab[163]
#define __pyx_n_u_codec_type __pyx_string_tab[164]
#define __pyx_n_u_collections_abc __pyx_string_tab[165]
#define __pyx_n_u_convert_image __pyx_string_tab[166]
#define __pyx_n_u_converter __pyx_string_tab[167]
#define __pyx_n_u_cs __pyx_string_tab[168]
#define __pyx_n_u_csc __pyx_string_tab[169]
#define __pyx_n_u_cython __pyx_string_tab[170]
#define __pyx_n_u_cython_buffer __pyx_string_tab[171]
#define __pyx_n_u_div __pyx_string_tab[172]
#define __pyx_n_u_divs __pyx_string_tab[173]
#define __pyx_n_u_doc __pyx_string_tab[174]
#define __pyx_n_u_dst_format __pyx_string_tab[175]
#define __pyx_n_u_dst_height __pyx_string_tab[176]
#define __pyx_n_u_dst_stride __pyx_string_tab[177]
#define __pyx_n_u_dst_width __pyx_string_tab[178]
#define __pyx_n_u_elapsed __pyx_string_tab[179]
#define __pyx_n_u_enter __pyx_string_tab[180]
#define __pyx_n_u_enumerate __pyx_string_tab[181]
#define __pyx_n_u_env_override __pyx_string_tab[182]
#define __pyx_n_u_environ __pyx_string_tab[183]
#define __pyx_n_u_exit __pyx_string_tab[184]
#define __pyx_n_u_fmt __pyx_string_tab[185]
#define __pyx_n_u_fn __pyx_string_tab[186]
#define __pyx_n_u_frames __pyx_string_tab[187]
#define __pyx_n_u_free __pyx_string_tab[188]
#define __pyx_n_u_full __pyx_string_tab[189]
#define __pyx_n_u_full_range_2 __pyx_string_tab[190]
#define __pyx_n_u_func __pyx_string_tab[191]
#define __pyx_n_u_gbrp10 __pyx_string_tab[192]
#define __pyx_n_u_get __pyx_string_tab[193]
#define __pyx_n_u_get_CS __pyx_string_tab[194]
#define __pyx_n_u_get_dst_format __pyx_string_tab[195]
#define __pyx_n_u_get_dst_height __pyx_string_tab[196]
#define __pyx_n_u_get_dst_width __pyx_string_tab[197]
#define __pyx_n_u_get_height __pyx_string_tab[198]
#define __pyx_n_u_get_info __pyx_string_tab[199]
#define __pyx_n_u_get_pixels __pyx_string_tab[200]
#define __pyx_n_u_get_planes __pyx_string_tab[201]
#define __pyx_n_u_get_rowstride __pyx_string_tab[202]
#define __pyx_n_u_get_specs __pyx_string_tab[203]
#define __pyx_n_u_get_src_format __pyx_string_tab[204]
#define __pyx_n_u_get_src_height __pyx_string_tab[205]
#define __pyx_n_u_get_src_width __pyx_string_tab[206]
#define __pyx_n_u_get_subsampling_divs __pyx_string_tab[207]
#define __pyx_n_u_get_type __pyx_string_tab[208]
#define __pyx_n_u_get_version __pyx_string_tab[209]
#define __pyx_n_u_get_width __pyx_string_tab[210]
#define __pyx_n_u_h __pyx_string_tab[211]
#define __pyx_n_u_height __pyx_string_tab[212]
#define __pyx_n_u_height_mask __pyx_string_tab[213]
#define __pyx_n_u_i __pyx_string_tab[214]
#define __pyx_n_u_image __pyx_string_tab[215]
#define __pyx_n_u_in_cs __pyx_string_tab[216]
#define __pyx_n_u_info __pyx_string_tab[217]
#define __pyx_n_u_init_context __pyx_string_tab[218]
#define __pyx_n_u_init_context_locals_allocate_rgb __pyx_string_tab[219]
#define __pyx_n_u_init_context_locals_allocate_yuv __pyx_string_tab[220]
#define __pyx_n_u_init_context_locals_assert_no_sc __pyx_string_tab[221]
#define __pyx_n_u_input_colorspace __pyx_string_tab[222]
#define __pyx_n_u_input_stride __pyx_string_tab[223]
#define __pyx_n_u_input_strides __pyx_string_tab[224]
#define __pyx_n_u_int __pyx_string_tab[225]
#define __pyx_n_u_is_closed __pyx_string_tab[226]
#define __pyx_n_u_is_coroutine __pyx_string_tab[227]
#define __pyx_n_u_is_thread_safe __pyx_string_tab[228]
#define __pyx_n_u_items __pyx_string_tab[229]
#define __pyx_n_u_keys __pyx_string_tab[230]
#define __pyx_n_u_little __pyx_string_tab[231]
#define __pyx_n_u_log __pyx_string_tab[232]
#define __pyx_n_u_main __pyx_string_tab[233]
#define __pyx_n_u_max_h __pyx_string_tab[234]
#define __pyx_n_u_max_w __pyx_string_tab[235]
#define __pyx_n_u_metaclass __pyx_string_tab[236]
#define __pyx_n_u_min_h __pyx_string_tab[237]
#define __pyx_n_u_min_len __pyx_string_tab[238]
#define __pyx_n_u_min_w __pyx_string_tab[239]
#define __pyx_n_u_module __pyx_string_tab[240]
#define __pyx_n_u_mro_entries __pyx_string_tab[241]
#define __pyx_n_u_name __pyx_string_tab[242]
#define __pyx_n_u_options __pyx_string_tab[243]
#define __pyx_n_u_os __pyx_string_tab[244]
#define __pyx_n_u_out_cs __pyx_string_tab[245]
#define __pyx_n_u_out_css __pyx_string_tab[246]
#define __pyx_n_u_output_colorspaces __pyx_string_tab[247]
#define __pyx_n_u_output_image __pyx_string_tab[248]
#define __pyx_n_u_pixels __pyx_string_tab[249]
#define __pyx_n_u_pixels_per_second __pyx_string_tab[250]
#define __pyx_n_u_planes __pyx_string_tab[251]
#define __pyx_n_u_pps __pyx_string_tab[252]
#define __pyx_n_u_prepare __pyx_string_tab[253]
#define __pyx_n_u_py_buf __pyx_string_tab[254]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[255]
#define __pyx_n_u_quality __pyx_string_tab[256]
#define __pyx_n_u_qualname __pyx_string_tab[257]
#define __pyx_n_u_r __pyx_string_tab[258]
#define __pyx_n_u_r210 __pyx_string_tab[259]
#define __pyx_n_u_r210_to_BGR48 __pyx_string_tab[260]
#define __pyx_n_u_r210_to_YUV420P __pyx_string_tab[261]
#define __pyx_n_u_r210_to_YUV444P10 __pyx_string_tab[262]
#define __pyx_n_u_return __pyx_string_tab[263]
#define __pyx_n_u_self __pyx_string_tab[264]
#define __pyx_n_u_selftest __pyx_string_tab[265]
#define __pyx_n_u_set_full_range __pyx_string_tab[266]
#define __pyx_n_u_set_name __pyx_string_tab[267]
#define __pyx_n_u_setdefault __pyx_string_tab[268]
#define __pyx_n_u_setup_cost __pyx_string_tab[269]
#define __pyx_n_u_specs __pyx_string_tab[270]
#define __pyx_n_u_speed __pyx_string_tab[271]
#define __pyx_n_u_split __pyx_string_tab[272]
#define __pyx_n_u_src_format __pyx_string_tab[273]
#define __pyx_n_u_src_height __pyx_string_tab[274]
#define __pyx_n_u_src_stride __pyx_string_tab[275]
#define __pyx_n_u_src_width __pyx_string_tab[276]
#define __pyx_n_u_start __pyx_string_tab[277]
#define __pyx_n_u_str __pyx_string_tab[278]
#define __pyx_n_u_stride __pyx_string_tab[279]
#define __pyx_n_u_super __pyx_string_tab[280]
#define __pyx_n_u_sys __pyx_string_tab[281]
#define __pyx_n_u_test __pyx_string_tab[282]
#define __pyx_n_u_testcsc __pyx_string_tab[283]
#define __pyx_n_u_time __pyx_string_tab[284]
#define __pyx_n_u_total_time_ms __pyx_string_tab[285]
#define __pyx_n_u_typedict __pyx_string_tab[286]
#define __pyx_n_u_typing __pyx_string_tab[287]
#define __pyx_n_u_v __pyx_string_tab[288]
#define __pyx_n_u_valid_options __pyx_string_tab[289]
#define __pyx_n_u_validate_planar3_image __pyx_string_tab[290]
#define __pyx_n_u_validate_rgb_image __pyx_string_tab[291]
#define __pyx_n_u_values __pyx_string_tab[292]
#define __pyx_n_u_version __pyx_string_tab[293]
#define __pyx_n_u_w __pyx_string_tab[294]
#define __pyx_n_u_warn __pyx_string_tab[295]
#define __pyx_n_u_width __pyx_string_tab[296]
#define __pyx_n_u_width_mask __pyx_string_tab[297]
#define __pyx_n_u_x __pyx_string_tab[298]
#define __pyx_n_u_xdiv __pyx_string_tab[299]
#define __pyx_n_u_xpra_codecs_checks __pyx_string_tab[300]
#define __pyx_n_u_xpra_codecs_constants __pyx_string_tab[301]
#define __pyx_n_u_xpra_codecs_csc_cython __pyx_string_tab[302]
#define __pyx_n_u_xpra_codecs_csc_cython_converter __pyx_string_tab[303]
#define __pyx_n_u_xpra_codecs_image __pyx_string_tab[304]
#define __pyx_n_u_xpra_log __pyx_string_tab[305]
#define __pyx_n_u_xpra_util_objects __pyx_string_tab[306]
#define __pyx_n_u_ydiv __pyx_string_tab[307]
#define __pyx_kp_b_PyObject_PyObject_name_PyObject __pyx_string_tab[308]
#define __pyx_kp_b_PyObject_PyObject_void_void_void __pyx_string_tab[309]
#define __pyx_kp_b_iso88591_1 __pyx_string_tab[310]
#define __pyx_kp_b_iso88591_1_9Bj_Jb_Doo __pyx_string_tab[311]
#define __pyx_kp_b_iso88591_1_AU_j_a_5_L_Bd_t_Qb_q_T_t_Qd_l __pyx_string_tab[312]
#define __pyx_kp_b_iso88591_1_q_V1_A_1_Ja_vT_CvRq_A_s_A_vS __pyx_string_tab[313]
#define __pyx_kp_b_iso88591_1_t_3a __pyx_string_tab[314]
#define __pyx_kp_b_iso88591_31_t_7_S_8881 __pyx_string_tab[315]
#define __pyx_kp_b_iso88591_4A_D_Q_T_Baq_d_r_1_d_IQ_Kq_q __pyx_string_tab[316]
#define __pyx_kp_b_iso88591_4A_q_k_uN_1_6gS_7xq_Jaq_d_d_uN __pyx_string_tab[317]
#define __pyx_kp_b_iso88591_5Q_1A_k_1_1_WA_a_4q_81D_4_1A_A __pyx_string_tab[318]
#define __pyx_kp_b_iso88591_5Q_1A_k_1_d_d_AQ_t_q_ARr_D_Qb_N __pyx_string_tab[319]
#define __pyx_kp_b_iso88591_5Q_t_QgS_wa __pyx_string_tab[320]
#define __pyx_kp_b_iso88591_5Q_t_QgS_wgQ __pyx_string_tab[321]
#define __pyx_kp_b_iso88591_6a_t_QgS __pyx_string_tab[322]
#define __pyx_kp_b_iso88591_6a_t_QgS_2 __pyx_string_tab[323]
#define __pyx_kp_b_iso88591_6a_t_QgS_3a __pyx_string_tab[324]
#define __pyx_kp_b_iso88591_8_1A_k_1_1_0_q_a_4q_81D_4_1A_E __pyx_string_tab[325]
#define __pyx_kp_b_iso88591_8_q_k_nA_1_AYa_4q_6l_PRRVV____6 __pyx_string_tab[326]
#define __pyx_kp_b_iso88591_9_uKr_y8ZZ_aallm_uJb_l2__ddnnrr __pyx_string_tab[327]
#define __pyx_kp_b_iso88591_A_a_8_r_A_q_t1_q_1_avQa_3c_q_uA __pyx_string_tab[328]
#define __pyx_kp_b_iso88591_A_q __pyx_string_tab[329]
#define __pyx_kp_b_iso88591_FaFTTaab_llqqrr_C_C_D_6mmy_z_E __pyx_string_tab[330]
#define __pyx_kp_b_iso88591_Q_1_q_1Kq __pyx_string_tab[331]
#define __pyx_kp_b_iso88591_Q_Cq __pyx_string_tab[332]
#define __pyx_kp_b_iso88591_Q_uKr_ccnno_uJb_l2__ddnnrrvvw_u __pyx_string_tab[333]
#define __pyx_kp_b_iso88591_a_1_t1_RuA_T_2Qa_1Jl __pyx_string_tab[334]
#define __pyx_kp_b_iso88591_d_d_d_d_d_4q_Q_4q_Q_4war_T_aq_q __pyx_string_tab[335]
#define __pyx_kp_b_iso88591_k __pyx_string_tab[336]
#define __pyx_kp_b_iso88591_q __pyx_string_tab[337]
#define __pyx_kp_b_iso88591_q_6_5Rq_7_1A_gQ_L_gQgQd_AU_rQWW __pyx_string_tab[338]
#define __pyx_kp_b_iso88591_q_M_N_M_N_N_N_HA_Ja_E_aq_AU_5_a __pyx_string_tab[339]
#define __pyx_kp_b_iso88591_q_t1 __pyx_string_tab[340]
#define __pyx_kp_b_iso88591_t1 __pyx_string_tab[341]
#define __pyx_int_0 __pyx_number_tab[0]
#define __pyx_int_1 __pyx_number_tab[1]
#define __pyx_int_2 __pyx_number_tab[2]
#define __pyx_int_3 __pyx_number_tab[3]
#define __pyx_int_4 __pyx_number_tab[4]
#define __pyx_int_6 __pyx_number_tab[5]
#define __pyx_int_50 __pyx_number_tab[6]
#define __pyx_int_16384 __pyx_number_tab[7]
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  if (!clear_module_state) return 0;
  Py_CLEAR(clear_module_state->__pyx_d);
  Py_CLEAR(clear_module_state->__pyx_b);
  Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __Pyx_State_RemoveModule(NULL);
  #endif
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_7buffers_6membuf_MemBuf);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter);
  Py_CLEAR(clear_module_state->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context);
  Py_CLEAR(clear_module_state->__pyx_type_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context);
  for (int i=0; i<7; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  for (int i=0; i<45; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<342; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<8; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_clear_contents ### */
/* CommonTypesMetaclass.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);

/* CythonFunctionShared.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CyFunctionType);

/* #### Code section: module_state_clear_end ### */
return 0;
}
#endif
/* #### Code section: module_state_traverse ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  if (!traverse_module_state) return 0;
  Py_VISIT(traverse_module_state->__pyx_d);
  Py_VISIT(traverse_module_state->__pyx_b);
  Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_7buffers_6membuf_MemBuf);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter);
  Py_VISIT(traverse_module_state->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context);
  Py_VISIT(traverse_module_state->__pyx_type_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context);
  for (int i=0; i<7; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  for (int i=0; i<45; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<342; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<8; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_traverse_contents ### */
/* CommonTypesMetaclass.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);

/* CythonFunctionShared.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CyFunctionType);

/* #### Code section: module_state_traverse_end ### */
return 0;
}
#endif
/* #### Code section: module_code ### */

/* "xpra/codecs/csc_cython/converter.pyx":34
 * 
 * 
 * cdef inline int roundup(int n, int m) noexcept nogil:             # <<<<<<<<<<<<<<
 *     return (n + m - 1) & ~(m - 1)
 * 
*/

static CYTHON_INLINE int __pyx_f_4xpra_6codecs_10csc_cython_9converter_roundup(int __pyx_v_n, int __pyx_v_m) {
  int __pyx_r;

  /* "xpra/codecs/csc_cython/converter.pyx":35
 * 
 * cdef inline int roundup(int n, int m) noexcept nogil:
 *     return (n + m - 1) & ~(m - 1)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = (((__pyx_v_n + __pyx_v_m) - 1) & (~(__pyx_v_m - 1)));
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":34
 * 
 * 
 * cdef inline int roundup(int n, int m) noexcept nogil:             # <<<<<<<<<<<<<<
 *     return (n + m - 1) & ~(m - 1)
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":64
 * 
 * 
 * def get_CS(in_cs, valid_options) -> Sequence[str]:             # <<<<<<<<<<<<<<
 *     v = os.environ.get("XPRA_CSC_CYTHON_%s_COLORSPACES" % in_cs)
 *     if v is None:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_1get_CS(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_1get_CS = {"get_CS", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_1get_CS, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_1get_CS(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_in_cs = 0;
  PyObject *__pyx_v_valid_options = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_CS (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_in_cs,&__pyx_mstate_global->__pyx_n_u_valid_options,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 64, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 64, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 64, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_CS", 0) < (0)) __PYX_ERR(0, 64, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_CS", 1, 2, 2, i); __PYX_ERR(0, 64, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 64, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 64, __pyx_L3_error)
    }
    __pyx_v_in_cs = values[0];
    __pyx_v_valid_options = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_CS", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 64, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.get_CS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_get_CS(__pyx_self, __pyx_v_in_cs, __pyx_v_valid_options);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_get_CS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_cs, PyObject *__pyx_v_valid_options) {
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_env_override = NULL;
  PyObject *__pyx_v_cs = 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;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_CS", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":65
 * 
 * def get_CS(in_cs, valid_options) -> Sequence[str]:
 *     v = os.environ.get("XPRA_CSC_CYTHON_%s_COLORSPACES" % in_cs)             # <<<<<<<<<<<<<<
 *     if v is None:
 *         return valid_options
*/
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_environ); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_XPRA_CSC_CYTHON__s_COLORSPACES, __pyx_v_in_cs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_v = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":66
 * def get_CS(in_cs, valid_options) -> Sequence[str]:
 *     v = os.environ.get("XPRA_CSC_CYTHON_%s_COLORSPACES" % in_cs)
 *     if v is None:             # <<<<<<<<<<<<<<
 *         return valid_options
 *     if not v:
*/
  __pyx_t_6 = (__pyx_v_v == Py_None);
  if (__pyx_t_6) {

    /* "xpra/codecs/csc_cython/converter.pyx":67
 *     v = os.environ.get("XPRA_CSC_CYTHON_%s_COLORSPACES" % in_cs)
 *     if v is None:
 *         return valid_options             # <<<<<<<<<<<<<<
 *     if not v:
 *         return ()
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_valid_options);
    __pyx_r = __pyx_v_valid_options;
    goto __pyx_L0;

    /* "xpra/codecs/csc_cython/converter.pyx":66
 * def get_CS(in_cs, valid_options) -> Sequence[str]:
 *     v = os.environ.get("XPRA_CSC_CYTHON_%s_COLORSPACES" % in_cs)
 *     if v is None:             # <<<<<<<<<<<<<<
 *         return valid_options
 *     if not v:
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":68
 *     if v is None:
 *         return valid_options
 *     if not v:             # <<<<<<<<<<<<<<
 *         return ()
 *     env_override = []
*/
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_v); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 68, __pyx_L1_error)
  __pyx_t_7 = (!__pyx_t_6);
  if (__pyx_t_7) {

    /* "xpra/codecs/csc_cython/converter.pyx":69
 *         return valid_options
 *     if not v:
 *         return ()             # <<<<<<<<<<<<<<
 *     env_override = []
 *     for cs in v.split(","):
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    goto __pyx_L0;

    /* "xpra/codecs/csc_cython/converter.pyx":68
 *     if v is None:
 *         return valid_options
 *     if not v:             # <<<<<<<<<<<<<<
 *         return ()
 *     env_override = []
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":70
 *     if not v:
 *         return ()
 *     env_override = []             # <<<<<<<<<<<<<<
 *     for cs in v.split(","):
 *         if cs in valid_options:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_env_override = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":71
 *         return ()
 *     env_override = []
 *     for cs in v.split(","):             # <<<<<<<<<<<<<<
 *         if cs in valid_options:
 *             env_override.append(cs)
*/
  __pyx_t_4 = __pyx_v_v;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4);
    __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 71, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 71, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_8;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 71, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8));
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8);
        #endif
        ++__pyx_t_8;
      }
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
    } else {
      __pyx_t_1 = __pyx_t_9(__pyx_t_4);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 71, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_cs, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":72
 *     env_override = []
 *     for cs in v.split(","):
 *         if cs in valid_options:             # <<<<<<<<<<<<<<
 *             env_override.append(cs)
 *         else:
*/
    __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_cs, __pyx_v_valid_options, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 72, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "xpra/codecs/csc_cython/converter.pyx":73
 *     for cs in v.split(","):
 *         if cs in valid_options:
 *             env_override.append(cs)             # <<<<<<<<<<<<<<
 *         else:
 *             log.warn("invalid colorspace override for %s: %s (only supports: %s)", in_cs, cs, valid_options)
*/
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_env_override, __pyx_v_cs); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 73, __pyx_L1_error)

      /* "xpra/codecs/csc_cython/converter.pyx":72
 *     env_override = []
 *     for cs in v.split(","):
 *         if cs in valid_options:             # <<<<<<<<<<<<<<
 *             env_override.append(cs)
 *         else:
*/
      goto __pyx_L7;
    }

    /* "xpra/codecs/csc_cython/converter.pyx":75
 *             env_override.append(cs)
 *         else:
 *             log.warn("invalid colorspace override for %s: %s (only supports: %s)", in_cs, cs, valid_options)             # <<<<<<<<<<<<<<
 *     log("environment override for %s: %s", in_cs, env_override)
 *     return env_override
*/
    /*else*/ {
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 75, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_invalid_colorspace_override_for, __pyx_v_in_cs, __pyx_v_cs, __pyx_v_valid_options};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L7:;

    /* "xpra/codecs/csc_cython/converter.pyx":71
 *         return ()
 *     env_override = []
 *     for cs in v.split(","):             # <<<<<<<<<<<<<<
 *         if cs in valid_options:
 *             env_override.append(cs)
*/
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":76
 *         else:
 *             log.warn("invalid colorspace override for %s: %s (only supports: %s)", in_cs, cs, valid_options)
 *     log("environment override for %s: %s", in_cs, env_override)             # <<<<<<<<<<<<<<
 *     return env_override
 * 
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_environment_override_for_s_s, __pyx_v_in_cs, __pyx_v_env_override};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":77
 *             log.warn("invalid colorspace override for %s: %s (only supports: %s)", in_cs, cs, valid_options)
 *     log("environment override for %s: %s", in_cs, env_override)
 *     return env_override             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_env_override);
  __pyx_r = __pyx_v_env_override;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":64
 * 
 * 
 * def get_CS(in_cs, valid_options) -> Sequence[str]:             # <<<<<<<<<<<<<<
 *     v = os.environ.get("XPRA_CSC_CYTHON_%s_COLORSPACES" % in_cs)
 *     if v is None:
*/

  /* 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_11);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.get_CS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_env_override);
  __Pyx_XDECREF(__pyx_v_cs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":94
 * 
 * 
 * def get_type() -> str:             # <<<<<<<<<<<<<<
 *     return "cython"
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_3get_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_3get_type = {"get_type", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_3get_type, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_3get_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_type (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_2get_type(__pyx_self);

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_2get_type(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_type", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":95
 * 
 * def get_type() -> str:
 *     return "cython"             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_cython);
  __pyx_r = __pyx_mstate_global->__pyx_n_u_cython;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":94
 * 
 * 
 * def get_type() -> str:             # <<<<<<<<<<<<<<
 *     return "cython"
 * 
*/

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

/* "xpra/codecs/csc_cython/converter.pyx":98
 * 
 * 
 * def get_version() -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *     return (4, 2)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_5get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_5get_version = {"get_version", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_5get_version, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_5get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_version (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_4get_version(__pyx_self);

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_4get_version(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_version", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":99
 * 
 * def get_version() -> Tuple[int, int]:
 *     return (4, 2)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[0]);
  __pyx_r = __pyx_mstate_global->__pyx_tuple[0];
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":98
 * 
 * 
 * def get_version() -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *     return (4, 2)
 * 
*/

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

/* "xpra/codecs/csc_cython/converter.pyx":102
 * 
 * 
 * def get_info() -> Dict[str, Any]:             # <<<<<<<<<<<<<<
 *     return {
 *         "version"   : get_version(),
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_7get_info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_7get_info = {"get_info", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_7get_info, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_7get_info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_info (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_6get_info(__pyx_self);

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_6get_info(CYTHON_UNUSED PyObject *__pyx_self) {
  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;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_info", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":103
 * 
 * def get_info() -> Dict[str, Any]:
 *     return {             # <<<<<<<<<<<<<<
 *         "version"   : get_version(),
 *     }
*/
  __Pyx_XDECREF(__pyx_r);

  /* "xpra/codecs/csc_cython/converter.pyx":104
 * def get_info() -> Dict[str, Any]:
 *     return {
 *         "version"   : get_version(),             # <<<<<<<<<<<<<<
 *     }
 * 
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_version, __pyx_t_2) < (0)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":102
 * 
 * 
 * def get_info() -> Dict[str, Any]:             # <<<<<<<<<<<<<<
 *     return {
 *         "version"   : get_version(),
*/

  /* 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("xpra.codecs.csc_cython.converter.get_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":108
 * 
 * 
 * def get_specs() -> Sequence[CSCSpec]:             # <<<<<<<<<<<<<<
 *     specs: Sequence[CSCSpec] = []
 *     for in_cs, out_css in COLORSPACES.items():
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9get_specs(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9get_specs = {"get_specs", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9get_specs, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9get_specs(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_specs (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_8get_specs(__pyx_self);

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_8get_specs(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_specs = NULL;
  PyObject *__pyx_v_in_cs = NULL;
  PyObject *__pyx_v_out_css = NULL;
  int __pyx_v_can_scale;
  long __pyx_v_width_mask;
  long __pyx_v_height_mask;
  PyObject *__pyx_v_out_cs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  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;
  size_t __pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_specs", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":109
 * 
 * def get_specs() -> Sequence[CSCSpec]:
 *     specs: Sequence[CSCSpec] = []             # <<<<<<<<<<<<<<
 *     for in_cs, out_css in COLORSPACES.items():
 *         can_scale = True
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_specs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":110
 * def get_specs() -> Sequence[CSCSpec]:
 *     specs: Sequence[CSCSpec] = []
 *     for in_cs, out_css in COLORSPACES.items():             # <<<<<<<<<<<<<<
 *         can_scale = True
 *         width_mask = height_mask = 0xFFFF
*/
  __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_COLORSPACES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (unlikely(__pyx_t_5 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 110, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_dict_iterator(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_6;
  __pyx_t_6 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_in_cs, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_out_css, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":111
 *     specs: Sequence[CSCSpec] = []
 *     for in_cs, out_css in COLORSPACES.items():
 *         can_scale = True             # <<<<<<<<<<<<<<
 *         width_mask = height_mask = 0xFFFF
 *         for out_cs in out_css:
*/
    __pyx_v_can_scale = 1;

    /* "xpra/codecs/csc_cython/converter.pyx":112
 *     for in_cs, out_css in COLORSPACES.items():
 *         can_scale = True
 *         width_mask = height_mask = 0xFFFF             # <<<<<<<<<<<<<<
 *         for out_cs in out_css:
 *             if in_cs in ("r210", "YUV444P") or out_cs=="r210":
*/
    __pyx_v_width_mask = 0xFFFF;
    __pyx_v_height_mask = 0xFFFF;

    /* "xpra/codecs/csc_cython/converter.pyx":113
 *         can_scale = True
 *         width_mask = height_mask = 0xFFFF
 *         for out_cs in out_css:             # <<<<<<<<<<<<<<
 *             if in_cs in ("r210", "YUV444P") or out_cs=="r210":
 *                 can_scale = False
*/
    if (likely(PyList_CheckExact(__pyx_v_out_css)) || PyTuple_CheckExact(__pyx_v_out_css)) {
      __pyx_t_5 = __pyx_v_out_css; __Pyx_INCREF(__pyx_t_5);
      __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_out_css); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 113, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 113, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 113, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8));
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 113, __pyx_L1_error)
      } else {
        __pyx_t_6 = __pyx_t_9(__pyx_t_5);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 113, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_out_cs, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "xpra/codecs/csc_cython/converter.pyx":114
 *         width_mask = height_mask = 0xFFFF
 *         for out_cs in out_css:
 *             if in_cs in ("r210", "YUV444P") or out_cs=="r210":             # <<<<<<<<<<<<<<
 *                 can_scale = False
 *             elif in_cs == "GBRP10":
*/
      __Pyx_INCREF(__pyx_v_in_cs);
      __pyx_t_6 = __pyx_v_in_cs;
      __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_r210, Py_EQ)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 114, __pyx_L1_error)
      if (!__pyx_t_12) {
      } else {
        __pyx_t_11 = __pyx_t_12;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_YUV444P, Py_EQ)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 114, __pyx_L1_error)
      __pyx_t_11 = __pyx_t_12;
      __pyx_L10_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_12 = __pyx_t_11;
      if (!__pyx_t_12) {
      } else {
        __pyx_t_10 = __pyx_t_12;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_v_out_cs, __pyx_mstate_global->__pyx_n_u_r210, Py_EQ)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 114, __pyx_L1_error)
      __pyx_t_10 = __pyx_t_12;
      __pyx_L8_bool_binop_done:;
      if (__pyx_t_10) {

        /* "xpra/codecs/csc_cython/converter.pyx":115
 *         for out_cs in out_css:
 *             if in_cs in ("r210", "YUV444P") or out_cs=="r210":
 *                 can_scale = False             # <<<<<<<<<<<<<<
 *             elif in_cs == "GBRP10":
 *                 can_scale = False
*/
        __pyx_v_can_scale = 0;

        /* "xpra/codecs/csc_cython/converter.pyx":114
 *         width_mask = height_mask = 0xFFFF
 *         for out_cs in out_css:
 *             if in_cs in ("r210", "YUV444P") or out_cs=="r210":             # <<<<<<<<<<<<<<
 *                 can_scale = False
 *             elif in_cs == "GBRP10":
*/
        goto __pyx_L7;
      }

      /* "xpra/codecs/csc_cython/converter.pyx":116
 *             if in_cs in ("r210", "YUV444P") or out_cs=="r210":
 *                 can_scale = False
 *             elif in_cs == "GBRP10":             # <<<<<<<<<<<<<<
 *                 can_scale = False
 *             if in_cs == "YUV420P":
*/
      __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_in_cs, __pyx_mstate_global->__pyx_n_u_GBRP10, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 116, __pyx_L1_error)
      if (__pyx_t_10) {

        /* "xpra/codecs/csc_cython/converter.pyx":117
 *                 can_scale = False
 *             elif in_cs == "GBRP10":
 *                 can_scale = False             # <<<<<<<<<<<<<<
 *             if in_cs == "YUV420P":
 *                 #safer not to try to handle odd dimensions as input:
*/
        __pyx_v_can_scale = 0;

        /* "xpra/codecs/csc_cython/converter.pyx":116
 *             if in_cs in ("r210", "YUV444P") or out_cs=="r210":
 *                 can_scale = False
 *             elif in_cs == "GBRP10":             # <<<<<<<<<<<<<<
 *                 can_scale = False
 *             if in_cs == "YUV420P":
*/
      }
      __pyx_L7:;

      /* "xpra/codecs/csc_cython/converter.pyx":118
 *             elif in_cs == "GBRP10":
 *                 can_scale = False
 *             if in_cs == "YUV420P":             # <<<<<<<<<<<<<<
 *                 #safer not to try to handle odd dimensions as input:
 *                 width_mask = height_mask = 0xFFFE
*/
      __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_in_cs, __pyx_mstate_global->__pyx_n_u_YUV420P, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 118, __pyx_L1_error)
      if (__pyx_t_10) {

        /* "xpra/codecs/csc_cython/converter.pyx":120
 *             if in_cs == "YUV420P":
 *                 #safer not to try to handle odd dimensions as input:
 *                 width_mask = height_mask = 0xFFFE             # <<<<<<<<<<<<<<
 *             # low score as this should be used as fallback only:
 *             specs.append(CSCSpec(
*/
        __pyx_v_width_mask = 0xFFFE;
        __pyx_v_height_mask = 0xFFFE;

        /* "xpra/codecs/csc_cython/converter.pyx":118
 *             elif in_cs == "GBRP10":
 *                 can_scale = False
 *             if in_cs == "YUV420P":             # <<<<<<<<<<<<<<
 *                 #safer not to try to handle odd dimensions as input:
 *                 width_mask = height_mask = 0xFFFE
*/
      }

      /* "xpra/codecs/csc_cython/converter.pyx":122
 *                 width_mask = height_mask = 0xFFFE
 *             # low score as this should be used as fallback only:
 *             specs.append(CSCSpec(             # <<<<<<<<<<<<<<
 *                     input_colorspace=in_cs, output_colorspaces=(out_cs, ),
 *                     codec_class=Converter, codec_type=get_type(),
*/
      __pyx_t_13 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_CSCSpec); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 122, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);

      /* "xpra/codecs/csc_cython/converter.pyx":123
 *             # low score as this should be used as fallback only:
 *             specs.append(CSCSpec(
 *                     input_colorspace=in_cs, output_colorspaces=(out_cs, ),             # <<<<<<<<<<<<<<
 *                     codec_class=Converter, codec_type=get_type(),
 *                     quality=50, speed=0, setup_cost=0, min_w=2, min_h=2,
*/
      __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_v_out_cs);
      __Pyx_GIVEREF(__pyx_v_out_cs);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_out_cs) != (0)) __PYX_ERR(0, 123, __pyx_L1_error);

      /* "xpra/codecs/csc_cython/converter.pyx":124
 *             specs.append(CSCSpec(
 *                     input_colorspace=in_cs, output_colorspaces=(out_cs, ),
 *                     codec_class=Converter, codec_type=get_type(),             # <<<<<<<<<<<<<<
 *                     quality=50, speed=0, setup_cost=0, min_w=2, min_h=2,
 *                     max_w=16*1024, max_h=16*1024,
*/
      __pyx_t_17 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_get_type); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_19 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_18))) {
        __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_18);
        assert(__pyx_t_17);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_18);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_18, __pyx__function);
        __pyx_t_19 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_17, NULL};
        __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_18, __pyx_callargs+__pyx_t_19, (1-__pyx_t_19) | (__pyx_t_19*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
      }

      /* "xpra/codecs/csc_cython/converter.pyx":127
 *                     quality=50, speed=0, setup_cost=0, min_w=2, min_h=2,
 *                     max_w=16*1024, max_h=16*1024,
 *                     can_scale=can_scale,             # <<<<<<<<<<<<<<
 *                     width_mask=width_mask, height_mask=height_mask)
 *                 )
*/
      __pyx_t_18 = __Pyx_PyBool_FromLong(__pyx_v_can_scale); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 127, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);

      /* "xpra/codecs/csc_cython/converter.pyx":128
 *                     max_w=16*1024, max_h=16*1024,
 *                     can_scale=can_scale,
 *                     width_mask=width_mask, height_mask=height_mask)             # <<<<<<<<<<<<<<
 *                 )
 *     return specs
*/
      __pyx_t_17 = __Pyx_PyLong_From_long(__pyx_v_width_mask); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_20 = __Pyx_PyLong_From_long(__pyx_v_height_mask); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_20);
      __pyx_t_19 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
        assert(__pyx_t_13);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
        __pyx_t_19 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 14 : 0)] = {__pyx_t_13, NULL};
        __pyx_t_21 = __Pyx_MakeVectorcallBuilderKwds(14); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 122, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_21);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_input_colorspace, __pyx_v_in_cs, __pyx_t_21, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_output_colorspaces, __pyx_t_15, __pyx_t_21, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_codec_class, ((PyObject *)__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter), __pyx_t_21, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_codec_type, __pyx_t_16, __pyx_t_21, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_quality, __pyx_mstate_global->__pyx_int_50, __pyx_t_21, __pyx_callargs+1, 4) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_speed, __pyx_mstate_global->__pyx_int_0, __pyx_t_21, __pyx_callargs+1, 5) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_setup_cost, __pyx_mstate_global->__pyx_int_0, __pyx_t_21, __pyx_callargs+1, 6) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_min_w, __pyx_mstate_global->__pyx_int_2, __pyx_t_21, __pyx_callargs+1, 7) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_min_h, __pyx_mstate_global->__pyx_int_2, __pyx_t_21, __pyx_callargs+1, 8) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_max_w, __pyx_mstate_global->__pyx_int_16384, __pyx_t_21, __pyx_callargs+1, 9) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_max_h, __pyx_mstate_global->__pyx_int_16384, __pyx_t_21, __pyx_callargs+1, 10) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_can_scale, __pyx_t_18, __pyx_t_21, __pyx_callargs+1, 11) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_width_mask, __pyx_t_17, __pyx_t_21, __pyx_callargs+1, 12) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_height_mask, __pyx_t_20, __pyx_t_21, __pyx_callargs+1, 13) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        __pyx_t_6 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_19, (1-__pyx_t_19) | (__pyx_t_19*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_21);
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 122, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }

      /* "xpra/codecs/csc_cython/converter.pyx":122
 *                 width_mask = height_mask = 0xFFFE
 *             # low score as this should be used as fallback only:
 *             specs.append(CSCSpec(             # <<<<<<<<<<<<<<
 *                     input_colorspace=in_cs, output_colorspaces=(out_cs, ),
 *                     codec_class=Converter, codec_type=get_type(),
*/
      __pyx_t_22 = __Pyx_PyList_Append(__pyx_v_specs, __pyx_t_6); if (unlikely(__pyx_t_22 == ((int)-1))) __PYX_ERR(0, 122, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "xpra/codecs/csc_cython/converter.pyx":113
 *         can_scale = True
 *         width_mask = height_mask = 0xFFFF
 *         for out_cs in out_css:             # <<<<<<<<<<<<<<
 *             if in_cs in ("r210", "YUV444P") or out_cs=="r210":
 *                 can_scale = False
*/
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":130
 *                     width_mask=width_mask, height_mask=height_mask)
 *                 )
 *     return specs             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_specs);
  __pyx_r = __pyx_v_specs;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":108
 * 
 * 
 * def get_specs() -> Sequence[CSCSpec]:             # <<<<<<<<<<<<<<
 *     specs: Sequence[CSCSpec] = []
 *     for in_cs, out_css in COLORSPACES.items():
*/

  /* 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_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_20);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.get_specs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_specs);
  __Pyx_XDECREF(__pyx_v_in_cs);
  __Pyx_XDECREF(__pyx_v_out_css);
  __Pyx_XDECREF(__pyx_v_out_cs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":135
 * class CythonImageWrapper(ImageWrapper):
 * 
 *     def free(self) -> None:             # <<<<<<<<<<<<<<
 *         log("CythonImageWrapper.free() cython_buffer=%#x", <uintptr_t> self.cython_buffer)
 *         super().free()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_1free(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_1free = {"free", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_1free, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_1free(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("free (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_free(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_free(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_cb = 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;
  uintptr_t __pyx_t_5;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("free", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":136
 * 
 *     def free(self) -> None:
 *         log("CythonImageWrapper.free() cython_buffer=%#x", <uintptr_t> self.cython_buffer)             # <<<<<<<<<<<<<<
 *         super().free()
 *         cb = self.cython_buffer
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_cython_buffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_5 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(((uintptr_t)__pyx_t_5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_CythonImageWrapper_free_cython_b, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":137
 *     def free(self) -> None:
 *         log("CythonImageWrapper.free() cython_buffer=%#x", <uintptr_t> self.cython_buffer)
 *         super().free()             # <<<<<<<<<<<<<<
 *         cb = self.cython_buffer
 *         if cb>0:
*/
  __pyx_t_2 = NULL;
  __pyx_t_7 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_7) { PyErr_SetString(PyExc_RuntimeError, "super(): empty __class__ cell"); __PYX_ERR(0, 137, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_7, __pyx_v_self};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_super, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_3 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_free, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":138
 *         log("CythonImageWrapper.free() cython_buffer=%#x", <uintptr_t> self.cython_buffer)
 *         super().free()
 *         cb = self.cython_buffer             # <<<<<<<<<<<<<<
 *         if cb>0:
 *             self.cython_buffer = 0
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_cython_buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cb = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":139
 *         super().free()
 *         cb = self.cython_buffer
 *         if cb>0:             # <<<<<<<<<<<<<<
 *             self.cython_buffer = 0
 *             memfree(<void *> (<uintptr_t> cb))
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_cb, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {

    /* "xpra/codecs/csc_cython/converter.pyx":140
 *         cb = self.cython_buffer
 *         if cb>0:
 *             self.cython_buffer = 0             # <<<<<<<<<<<<<<
 *             memfree(<void *> (<uintptr_t> cb))
 * 
*/
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_cython_buffer, __pyx_mstate_global->__pyx_int_0) < (0)) __PYX_ERR(0, 140, __pyx_L1_error)

    /* "xpra/codecs/csc_cython/converter.pyx":141
 *         if cb>0:
 *             self.cython_buffer = 0
 *             memfree(<void *> (<uintptr_t> cb))             # <<<<<<<<<<<<<<
 * 
 *     def _cn(self):
*/
    __pyx_t_5 = __Pyx_PyLong_As_size_t(__pyx_v_cb); if (unlikely((__pyx_t_5 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
    __pyx_f_4xpra_7buffers_6membuf_memfree(((void *)((uintptr_t)__pyx_t_5)));

    /* "xpra/codecs/csc_cython/converter.pyx":139
 *         super().free()
 *         cb = self.cython_buffer
 *         if cb>0:             # <<<<<<<<<<<<<<
 *             self.cython_buffer = 0
 *             memfree(<void *> (<uintptr_t> cb))
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":135
 * class CythonImageWrapper(ImageWrapper):
 * 
 *     def free(self) -> None:             # <<<<<<<<<<<<<<
 *         log("CythonImageWrapper.free() cython_buffer=%#x", <uintptr_t> self.cython_buffer)
 *         super().free()
*/

  /* 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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.CythonImageWrapper.free", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":143
 *             memfree(<void *> (<uintptr_t> cb))
 * 
 *     def _cn(self):             # <<<<<<<<<<<<<<
 *         return "CythonImageWrapper"
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_3_cn(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_3_cn = {"_cn", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_3_cn, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_3_cn(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_cn (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_2_cn(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_2_cn(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_cn", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":144
 * 
 *     def _cn(self):
 *         return "CythonImageWrapper"             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_CythonImageWrapper);
  __pyx_r = __pyx_mstate_global->__pyx_n_u_CythonImageWrapper;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":143
 *             memfree(<void *> (<uintptr_t> cb))
 * 
 *     def _cn(self):             # <<<<<<<<<<<<<<
 *         return "CythonImageWrapper"
 * 
*/

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

/* "xpra/codecs/csc_cython/converter.pyx":231
 * 
 * 
 * cdef inline unsigned char clamp(const long value) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if value <= 0:
 *         return 0
*/

static CYTHON_INLINE unsigned char __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp(long const __pyx_v_value) {
  long __pyx_v_v;
  unsigned char __pyx_r;
  int __pyx_t_1;

  /* "xpra/codecs/csc_cython/converter.pyx":232
 * 
 * cdef inline unsigned char clamp(const long value) noexcept nogil:
 *     if value <= 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef long v = value + 2**15
*/
  __pyx_t_1 = (__pyx_v_value <= 0);
  if (__pyx_t_1) {

    /* "xpra/codecs/csc_cython/converter.pyx":233
 * cdef inline unsigned char clamp(const long value) noexcept nogil:
 *     if value <= 0:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "xpra/codecs/csc_cython/converter.pyx":232
 * 
 * cdef inline unsigned char clamp(const long value) noexcept nogil:
 *     if value <= 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef long v = value + 2**15
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":234
 *     if value <= 0:
 *         return 0
 *     cdef long v = value + 2**15             # <<<<<<<<<<<<<<
 *     if v >= MAX_CLAMP:
 *         return 0xff         #2**8-1
*/
  __pyx_v_v = (__pyx_v_value + 0x8000);

  /* "xpra/codecs/csc_cython/converter.pyx":235
 *         return 0
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:             # <<<<<<<<<<<<<<
 *         return 0xff         #2**8-1
 *     return <unsigned char> (v>>16)
*/
  __pyx_t_1 = (__pyx_v_v >= 0x1000000);
  if (__pyx_t_1) {

    /* "xpra/codecs/csc_cython/converter.pyx":236
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:
 *         return 0xff         #2**8-1             # <<<<<<<<<<<<<<
 *     return <unsigned char> (v>>16)
 * 
*/
    __pyx_r = 0xff;
    goto __pyx_L0;

    /* "xpra/codecs/csc_cython/converter.pyx":235
 *         return 0
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:             # <<<<<<<<<<<<<<
 *         return 0xff         #2**8-1
 *     return <unsigned char> (v>>16)
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":237
 *     if v >= MAX_CLAMP:
 *         return 0xff         #2**8-1
 *     return <unsigned char> (v>>16)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = ((unsigned char)(__pyx_v_v >> 16));
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":231
 * 
 * 
 * cdef inline unsigned char clamp(const long value) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if value <= 0:
 *         return 0
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":240
 * 
 * 
 * cdef inline unsigned short clamp10(const long value) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if value <= 0:
 *         return 0
*/

static CYTHON_INLINE unsigned short __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp10(long const __pyx_v_value) {
  long __pyx_v_v;
  unsigned short __pyx_r;
  int __pyx_t_1;

  /* "xpra/codecs/csc_cython/converter.pyx":241
 * 
 * cdef inline unsigned short clamp10(const long value) noexcept nogil:
 *     if value <= 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef long v = value + 2**15
*/
  __pyx_t_1 = (__pyx_v_value <= 0);
  if (__pyx_t_1) {

    /* "xpra/codecs/csc_cython/converter.pyx":242
 * cdef inline unsigned short clamp10(const long value) noexcept nogil:
 *     if value <= 0:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP10:
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "xpra/codecs/csc_cython/converter.pyx":241
 * 
 * cdef inline unsigned short clamp10(const long value) noexcept nogil:
 *     if value <= 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef long v = value + 2**15
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":243
 *     if value <= 0:
 *         return 0
 *     cdef long v = value + 2**15             # <<<<<<<<<<<<<<
 *     if v >= MAX_CLAMP10:
 *         return 0x3ff        #2**10-1
*/
  __pyx_v_v = (__pyx_v_value + 0x8000);

  /* "xpra/codecs/csc_cython/converter.pyx":244
 *         return 0
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP10:             # <<<<<<<<<<<<<<
 *         return 0x3ff        #2**10-1
 *     return <unsigned short> (v>>16)
*/
  __pyx_t_1 = (__pyx_v_v >= 0x4000000);
  if (__pyx_t_1) {

    /* "xpra/codecs/csc_cython/converter.pyx":245
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP10:
 *         return 0x3ff        #2**10-1             # <<<<<<<<<<<<<<
 *     return <unsigned short> (v>>16)
 * 
*/
    __pyx_r = 0x3ff;
    goto __pyx_L0;

    /* "xpra/codecs/csc_cython/converter.pyx":244
 *         return 0
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP10:             # <<<<<<<<<<<<<<
 *         return 0x3ff        #2**10-1
 *     return <unsigned short> (v>>16)
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":246
 *     if v >= MAX_CLAMP10:
 *         return 0x3ff        #2**10-1
 *     return <unsigned short> (v>>16)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = ((unsigned short)(__pyx_v_v >> 16));
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":240
 * 
 * 
 * cdef inline unsigned short clamp10(const long value) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if value <= 0:
 *         return 0
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":249
 * 
 * 
 * cdef inline unsigned char clamp_studio_UV(const long value) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if value <= 0:
 *         return 16
*/

static CYTHON_INLINE unsigned char __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp_studio_UV(long const __pyx_v_value) {
  long __pyx_v_v;
  unsigned char __pyx_r;
  int __pyx_t_1;

  /* "xpra/codecs/csc_cython/converter.pyx":250
 * 
 * cdef inline unsigned char clamp_studio_UV(const long value) noexcept nogil:
 *     if value <= 0:             # <<<<<<<<<<<<<<
 *         return 16
 *     cdef long v = value + 2**15
*/
  __pyx_t_1 = (__pyx_v_value <= 0);
  if (__pyx_t_1) {

    /* "xpra/codecs/csc_cython/converter.pyx":251
 * cdef inline unsigned char clamp_studio_UV(const long value) noexcept nogil:
 *     if value <= 0:
 *         return 16             # <<<<<<<<<<<<<<
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:
*/
    __pyx_r = 16;
    goto __pyx_L0;

    /* "xpra/codecs/csc_cython/converter.pyx":250
 * 
 * cdef inline unsigned char clamp_studio_UV(const long value) noexcept nogil:
 *     if value <= 0:             # <<<<<<<<<<<<<<
 *         return 16
 *     cdef long v = value + 2**15
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":252
 *     if value <= 0:
 *         return 16
 *     cdef long v = value + 2**15             # <<<<<<<<<<<<<<
 *     if v >= MAX_CLAMP:
 *         return 240
*/
  __pyx_v_v = (__pyx_v_value + 0x8000);

  /* "xpra/codecs/csc_cython/converter.pyx":253
 *         return 16
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:             # <<<<<<<<<<<<<<
 *         return 240
 *     # 240-16
*/
  __pyx_t_1 = (__pyx_v_v >= 0x1000000);
  if (__pyx_t_1) {

    /* "xpra/codecs/csc_cython/converter.pyx":254
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:
 *         return 240             # <<<<<<<<<<<<<<
 *     # 240-16
 *     return <unsigned char> (16 + (v // 74898))
*/
    __pyx_r = 0xF0;
    goto __pyx_L0;

    /* "xpra/codecs/csc_cython/converter.pyx":253
 *         return 16
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:             # <<<<<<<<<<<<<<
 *         return 240
 *     # 240-16
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":256
 *         return 240
 *     # 240-16
 *     return <unsigned char> (16 + (v // 74898))             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = ((unsigned char)(16 + (__pyx_v_v / 0x12492)));
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":249
 * 
 * 
 * cdef inline unsigned char clamp_studio_UV(const long value) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if value <= 0:
 *         return 16
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":259
 * 
 * 
 * cdef inline unsigned char clamp_studio_Y(const long value) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if value <= 0:
 *         return 16
*/

static CYTHON_INLINE unsigned char __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp_studio_Y(long const __pyx_v_value) {
  long __pyx_v_v;
  unsigned char __pyx_r;
  int __pyx_t_1;

  /* "xpra/codecs/csc_cython/converter.pyx":260
 * 
 * cdef inline unsigned char clamp_studio_Y(const long value) noexcept nogil:
 *     if value <= 0:             # <<<<<<<<<<<<<<
 *         return 16
 *     cdef long v = value + 2**15
*/
  __pyx_t_1 = (__pyx_v_value <= 0);
  if (__pyx_t_1) {

    /* "xpra/codecs/csc_cython/converter.pyx":261
 * cdef inline unsigned char clamp_studio_Y(const long value) noexcept nogil:
 *     if value <= 0:
 *         return 16             # <<<<<<<<<<<<<<
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:
*/
    __pyx_r = 16;
    goto __pyx_L0;

    /* "xpra/codecs/csc_cython/converter.pyx":260
 * 
 * cdef inline unsigned char clamp_studio_Y(const long value) noexcept nogil:
 *     if value <= 0:             # <<<<<<<<<<<<<<
 *         return 16
 *     cdef long v = value + 2**15
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":262
 *     if value <= 0:
 *         return 16
 *     cdef long v = value + 2**15             # <<<<<<<<<<<<<<
 *     if v >= MAX_CLAMP:
 *         return 235
*/
  __pyx_v_v = (__pyx_v_value + 0x8000);

  /* "xpra/codecs/csc_cython/converter.pyx":263
 *         return 16
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:             # <<<<<<<<<<<<<<
 *         return 235
 *     # 235-16
*/
  __pyx_t_1 = (__pyx_v_v >= 0x1000000);
  if (__pyx_t_1) {

    /* "xpra/codecs/csc_cython/converter.pyx":264
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:
 *         return 235             # <<<<<<<<<<<<<<
 *     # 235-16
 *     return <unsigned char> (16 + (v // 76608))
*/
    __pyx_r = 0xEB;
    goto __pyx_L0;

    /* "xpra/codecs/csc_cython/converter.pyx":263
 *         return 16
 *     cdef long v = value + 2**15
 *     if v >= MAX_CLAMP:             # <<<<<<<<<<<<<<
 *         return 235
 *     # 235-16
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":266
 *         return 235
 *     # 235-16
 *     return <unsigned char> (16 + (v // 76608))             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = ((unsigned char)(16 + (__pyx_v_v / 0x12B40)));
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":259
 * 
 * 
 * cdef inline unsigned char clamp_studio_Y(const long value) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if value <= 0:
 *         return 16
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":269
 * 
 * 
 * cdef inline void r210_to_BGR48_copy(unsigned short *bgr48, const unsigned int *r210,             # <<<<<<<<<<<<<<
 *                                     unsigned int w, unsigned int h,
 *                                     unsigned int src_stride, unsigned int dst_stride) noexcept nogil:
*/

static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_r210_to_BGR48_copy(unsigned short *__pyx_v_bgr48, unsigned int const *__pyx_v_r210, unsigned int __pyx_v_w, unsigned int __pyx_v_h, unsigned int __pyx_v_src_stride, unsigned int __pyx_v_dst_stride) {
  unsigned int __pyx_v_y;
  unsigned int __pyx_v_i;
  unsigned int __pyx_v_v;
  unsigned int __pyx_v_x;
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  unsigned int __pyx_t_4;
  unsigned int __pyx_t_5;
  unsigned int __pyx_t_6;

  /* "xpra/codecs/csc_cython/converter.pyx":275
 *     cdef unsigned int i
 *     cdef unsigned int v
 *     for y in range(h):             # <<<<<<<<<<<<<<
 *         i = y*dst_stride//2
 *         for x in range(w):
*/
  __pyx_t_1 = __pyx_v_h;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_y = __pyx_t_3;

    /* "xpra/codecs/csc_cython/converter.pyx":276
 *     cdef unsigned int v
 *     for y in range(h):
 *         i = y*dst_stride//2             # <<<<<<<<<<<<<<
 *         for x in range(w):
 *             v = r210[x]
*/
    __pyx_v_i = ((__pyx_v_y * __pyx_v_dst_stride) / 2);

    /* "xpra/codecs/csc_cython/converter.pyx":277
 *     for y in range(h):
 *         i = y*dst_stride//2
 *         for x in range(w):             # <<<<<<<<<<<<<<
 *             v = r210[x]
 *             bgr48[i] = v&0x000003ff
*/
    __pyx_t_4 = __pyx_v_w;
    __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;

      /* "xpra/codecs/csc_cython/converter.pyx":278
 *         i = y*dst_stride//2
 *         for x in range(w):
 *             v = r210[x]             # <<<<<<<<<<<<<<
 *             bgr48[i] = v&0x000003ff
 *             bgr48[i+1] = (v&0x000ffc00) >> 10
*/
      __pyx_v_v = (__pyx_v_r210[__pyx_v_x]);

      /* "xpra/codecs/csc_cython/converter.pyx":279
 *         for x in range(w):
 *             v = r210[x]
 *             bgr48[i] = v&0x000003ff             # <<<<<<<<<<<<<<
 *             bgr48[i+1] = (v&0x000ffc00) >> 10
 *             bgr48[i+2] = (v&0x3ff00000) >> 20
*/
      (__pyx_v_bgr48[__pyx_v_i]) = (__pyx_v_v & 0x000003ff);

      /* "xpra/codecs/csc_cython/converter.pyx":280
 *             v = r210[x]
 *             bgr48[i] = v&0x000003ff
 *             bgr48[i+1] = (v&0x000ffc00) >> 10             # <<<<<<<<<<<<<<
 *             bgr48[i+2] = (v&0x3ff00000) >> 20
 *             i += 3
*/
      (__pyx_v_bgr48[(__pyx_v_i + 1)]) = ((__pyx_v_v & 0x000ffc00) >> 10);

      /* "xpra/codecs/csc_cython/converter.pyx":281
 *             bgr48[i] = v&0x000003ff
 *             bgr48[i+1] = (v&0x000ffc00) >> 10
 *             bgr48[i+2] = (v&0x3ff00000) >> 20             # <<<<<<<<<<<<<<
 *             i += 3
 *         r210 = <unsigned int*> ((<uintptr_t> r210) + src_stride)
*/
      (__pyx_v_bgr48[(__pyx_v_i + 2)]) = ((__pyx_v_v & 0x3ff00000) >> 20);

      /* "xpra/codecs/csc_cython/converter.pyx":282
 *             bgr48[i+1] = (v&0x000ffc00) >> 10
 *             bgr48[i+2] = (v&0x3ff00000) >> 20
 *             i += 3             # <<<<<<<<<<<<<<
 *         r210 = <unsigned int*> ((<uintptr_t> r210) + src_stride)
 * 
*/
      __pyx_v_i = (__pyx_v_i + 3);
    }

    /* "xpra/codecs/csc_cython/converter.pyx":283
 *             bgr48[i+2] = (v&0x3ff00000) >> 20
 *             i += 3
 *         r210 = <unsigned int*> ((<uintptr_t> r210) + src_stride)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_v_r210 = ((unsigned int *)(((uintptr_t)__pyx_v_r210) + __pyx_v_src_stride));
  }

  /* "xpra/codecs/csc_cython/converter.pyx":269
 * 
 * 
 * cdef inline void r210_to_BGR48_copy(unsigned short *bgr48, const unsigned int *r210,             # <<<<<<<<<<<<<<
 *                                     unsigned int w, unsigned int h,
 *                                     unsigned int src_stride, unsigned int dst_stride) noexcept nogil:
*/

  /* function exit code */
}

/* "xpra/codecs/csc_cython/converter.pyx":286
 * 
 * 
 * cdef inline void gbrp10_to_r210_copy(uintptr_t r210, uintptr_t[3] gbrp10,             # <<<<<<<<<<<<<<
 *                                      unsigned int width, unsigned int height,
 *                                      unsigned int src_stride, unsigned int dst_stride) noexcept nogil:
*/

static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_gbrp10_to_r210_copy(uintptr_t __pyx_v_r210, uintptr_t *__pyx_v_gbrp10, unsigned int __pyx_v_width, unsigned int __pyx_v_height, unsigned int __pyx_v_src_stride, unsigned int __pyx_v_dst_stride) {
  unsigned int __pyx_v_x;
  unsigned int __pyx_v_y;
  unsigned short *__pyx_v_b;
  unsigned short *__pyx_v_g;
  unsigned short *__pyx_v_r;
  unsigned int *__pyx_v_dst;
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  unsigned int __pyx_t_4;
  unsigned int __pyx_t_5;
  unsigned int __pyx_t_6;

  /* "xpra/codecs/csc_cython/converter.pyx":294
 *     cdef unsigned short *r
 *     cdef unsigned int *dst
 *     for y in range(height):             # <<<<<<<<<<<<<<
 *         dst = <unsigned int*> (r210 + y*dst_stride)
 *         g = <unsigned short*> ((<uintptr_t> gbrp10[0]) + y*src_stride)
*/
  __pyx_t_1 = __pyx_v_height;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_y = __pyx_t_3;

    /* "xpra/codecs/csc_cython/converter.pyx":295
 *     cdef unsigned int *dst
 *     for y in range(height):
 *         dst = <unsigned int*> (r210 + y*dst_stride)             # <<<<<<<<<<<<<<
 *         g = <unsigned short*> ((<uintptr_t> gbrp10[0]) + y*src_stride)
 *         b = <unsigned short*> ((<uintptr_t> gbrp10[1]) + y*src_stride)
*/
    __pyx_v_dst = ((unsigned int *)(__pyx_v_r210 + (__pyx_v_y * __pyx_v_dst_stride)));

    /* "xpra/codecs/csc_cython/converter.pyx":296
 *     for y in range(height):
 *         dst = <unsigned int*> (r210 + y*dst_stride)
 *         g = <unsigned short*> ((<uintptr_t> gbrp10[0]) + y*src_stride)             # <<<<<<<<<<<<<<
 *         b = <unsigned short*> ((<uintptr_t> gbrp10[1]) + y*src_stride)
 *         r = <unsigned short*> ((<uintptr_t> gbrp10[2]) + y*src_stride)
*/
    __pyx_v_g = ((unsigned short *)(((uintptr_t)(__pyx_v_gbrp10[0])) + (__pyx_v_y * __pyx_v_src_stride)));

    /* "xpra/codecs/csc_cython/converter.pyx":297
 *         dst = <unsigned int*> (r210 + y*dst_stride)
 *         g = <unsigned short*> ((<uintptr_t> gbrp10[0]) + y*src_stride)
 *         b = <unsigned short*> ((<uintptr_t> gbrp10[1]) + y*src_stride)             # <<<<<<<<<<<<<<
 *         r = <unsigned short*> ((<uintptr_t> gbrp10[2]) + y*src_stride)
 *         for x in range(width):
*/
    __pyx_v_b = ((unsigned short *)(((uintptr_t)(__pyx_v_gbrp10[1])) + (__pyx_v_y * __pyx_v_src_stride)));

    /* "xpra/codecs/csc_cython/converter.pyx":298
 *         g = <unsigned short*> ((<uintptr_t> gbrp10[0]) + y*src_stride)
 *         b = <unsigned short*> ((<uintptr_t> gbrp10[1]) + y*src_stride)
 *         r = <unsigned short*> ((<uintptr_t> gbrp10[2]) + y*src_stride)             # <<<<<<<<<<<<<<
 *         for x in range(width):
 *             dst[x] = (b[x] & 0x3ff) + ((g[x] & 0x3ff)<<10) + ((r[x] & 0x3ff)<<20)
*/
    __pyx_v_r = ((unsigned short *)(((uintptr_t)(__pyx_v_gbrp10[2])) + (__pyx_v_y * __pyx_v_src_stride)));

    /* "xpra/codecs/csc_cython/converter.pyx":299
 *         b = <unsigned short*> ((<uintptr_t> gbrp10[1]) + y*src_stride)
 *         r = <unsigned short*> ((<uintptr_t> gbrp10[2]) + y*src_stride)
 *         for x in range(width):             # <<<<<<<<<<<<<<
 *             dst[x] = (b[x] & 0x3ff) + ((g[x] & 0x3ff)<<10) + ((r[x] & 0x3ff)<<20)
 * 
*/
    __pyx_t_4 = __pyx_v_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;

      /* "xpra/codecs/csc_cython/converter.pyx":300
 *         r = <unsigned short*> ((<uintptr_t> gbrp10[2]) + y*src_stride)
 *         for x in range(width):
 *             dst[x] = (b[x] & 0x3ff) + ((g[x] & 0x3ff)<<10) + ((r[x] & 0x3ff)<<20)             # <<<<<<<<<<<<<<
 * 
 * 
*/
      (__pyx_v_dst[__pyx_v_x]) = ((((__pyx_v_b[__pyx_v_x]) & 0x3ff) + (((__pyx_v_g[__pyx_v_x]) & 0x3ff) << 10)) + (((__pyx_v_r[__pyx_v_x]) & 0x3ff) << 20));
    }
  }

  /* "xpra/codecs/csc_cython/converter.pyx":286
 * 
 * 
 * cdef inline void gbrp10_to_r210_copy(uintptr_t r210, uintptr_t[3] gbrp10,             # <<<<<<<<<<<<<<
 *                                      unsigned int width, unsigned int height,
 *                                      unsigned int src_stride, unsigned int dst_stride) noexcept nogil:
*/

  /* function exit code */
}

/* "xpra/codecs/csc_cython/converter.pyx":303
 * 
 * 
 * cdef inline void r210_to_YUV444P10_copy(unsigned short *Y, unsigned short *U, unsigned short *V, uintptr_t r210data,             # <<<<<<<<<<<<<<
 *                                         unsigned int width, unsigned int height,
 *                                         unsigned int Ystride, unsigned int Ustride, unsigned int Vstride,
*/

static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_r210_to_YUV444P10_copy(unsigned short *__pyx_v_Y, unsigned short *__pyx_v_U, unsigned short *__pyx_v_V, uintptr_t __pyx_v_r210data, unsigned int __pyx_v_width, unsigned int __pyx_v_height, unsigned int __pyx_v_Ystride, unsigned int __pyx_v_Ustride, unsigned int __pyx_v_Vstride, unsigned int __pyx_v_r210_stride) {
  unsigned int const *__pyx_v_r210_row;
  unsigned int __pyx_v_r210;
  unsigned int __pyx_v_R;
  unsigned int __pyx_v_G;
  unsigned int __pyx_v_B;
  unsigned int __pyx_v_x;
  unsigned int __pyx_v_y;
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  unsigned int __pyx_t_4;
  unsigned int __pyx_t_5;
  unsigned int __pyx_t_6;

  /* "xpra/codecs/csc_cython/converter.pyx":311
 *     cdef unsigned int R, G, B
 *     cdef unsigned int x, y
 *     for y in range(height):             # <<<<<<<<<<<<<<
 *         r210_row = <unsigned int*> (r210data + r210_stride*y)
 *         for x in range(width):
*/
  __pyx_t_1 = __pyx_v_height;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_y = __pyx_t_3;

    /* "xpra/codecs/csc_cython/converter.pyx":312
 *     cdef unsigned int x, y
 *     for y in range(height):
 *         r210_row = <unsigned int*> (r210data + r210_stride*y)             # <<<<<<<<<<<<<<
 *         for x in range(width):
 *             r210 = r210_row[x]
*/
    __pyx_v_r210_row = ((unsigned int *)(__pyx_v_r210data + (__pyx_v_r210_stride * __pyx_v_y)));

    /* "xpra/codecs/csc_cython/converter.pyx":313
 *     for y in range(height):
 *         r210_row = <unsigned int*> (r210data + r210_stride*y)
 *         for x in range(width):             # <<<<<<<<<<<<<<
 *             r210 = r210_row[x]
 *             R = (r210&0x3ff00000) >> 20
*/
    __pyx_t_4 = __pyx_v_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;

      /* "xpra/codecs/csc_cython/converter.pyx":314
 *         r210_row = <unsigned int*> (r210data + r210_stride*y)
 *         for x in range(width):
 *             r210 = r210_row[x]             # <<<<<<<<<<<<<<
 *             R = (r210&0x3ff00000) >> 20
 *             G = (r210&0x000ffc00) >> 10
*/
      __pyx_v_r210 = (__pyx_v_r210_row[__pyx_v_x]);

      /* "xpra/codecs/csc_cython/converter.pyx":315
 *         for x in range(width):
 *             r210 = r210_row[x]
 *             R = (r210&0x3ff00000) >> 20             # <<<<<<<<<<<<<<
 *             G = (r210&0x000ffc00) >> 10
 *             B = (r210&0x000003ff)
*/
      __pyx_v_R = ((__pyx_v_r210 & 0x3ff00000) >> 20);

      /* "xpra/codecs/csc_cython/converter.pyx":316
 *             r210 = r210_row[x]
 *             R = (r210&0x3ff00000) >> 20
 *             G = (r210&0x000ffc00) >> 10             # <<<<<<<<<<<<<<
 *             B = (r210&0x000003ff)
 *             Y[x] = clamp10(YR * R + YG * G + YB * B + YC*4)
*/
      __pyx_v_G = ((__pyx_v_r210 & 0x000ffc00) >> 10);

      /* "xpra/codecs/csc_cython/converter.pyx":317
 *             R = (r210&0x3ff00000) >> 20
 *             G = (r210&0x000ffc00) >> 10
 *             B = (r210&0x000003ff)             # <<<<<<<<<<<<<<
 *             Y[x] = clamp10(YR * R + YG * G + YB * B + YC*4)
 *             U[x] = clamp10(UR * R + UG * G + UB * B + UC*4)
*/
      __pyx_v_B = (__pyx_v_r210 & 0x000003ff);

      /* "xpra/codecs/csc_cython/converter.pyx":318
 *             G = (r210&0x000ffc00) >> 10
 *             B = (r210&0x000003ff)
 *             Y[x] = clamp10(YR * R + YG * G + YB * B + YC*4)             # <<<<<<<<<<<<<<
 *             U[x] = clamp10(UR * R + UG * G + UB * B + UC*4)
 *             V[x] = clamp10(VR * R + VG * G + VB * B + VC*4)
*/
      (__pyx_v_Y[__pyx_v_x]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp10(((((0x4C8B * __pyx_v_R) + (0x9646 * __pyx_v_G)) + (0x1D2F * __pyx_v_B)) + 0x0));

      /* "xpra/codecs/csc_cython/converter.pyx":319
 *             B = (r210&0x000003ff)
 *             Y[x] = clamp10(YR * R + YG * G + YB * B + YC*4)
 *             U[x] = clamp10(UR * R + UG * G + UB * B + UC*4)             # <<<<<<<<<<<<<<
 *             V[x] = clamp10(VR * R + VG * G + VB * B + VC*4)
 *         Y = <unsigned short *> ((<uintptr_t> Y) + Ystride)
*/
      (__pyx_v_U[__pyx_v_x]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp10(((((-11076L * __pyx_v_R) + (-21692L * __pyx_v_G)) + (0x8000 * __pyx_v_B)) + 0x2000000));

      /* "xpra/codecs/csc_cython/converter.pyx":320
 *             Y[x] = clamp10(YR * R + YG * G + YB * B + YC*4)
 *             U[x] = clamp10(UR * R + UG * G + UB * B + UC*4)
 *             V[x] = clamp10(VR * R + VG * G + VB * B + VC*4)             # <<<<<<<<<<<<<<
 *         Y = <unsigned short *> ((<uintptr_t> Y) + Ystride)
 *         U = <unsigned short *> ((<uintptr_t> U) + Ustride)
*/
      (__pyx_v_V[__pyx_v_x]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp10(((((0x8000 * __pyx_v_R) + (-27460L * __pyx_v_G)) + (-5308L * __pyx_v_B)) + 0x2000000));
    }

    /* "xpra/codecs/csc_cython/converter.pyx":321
 *             U[x] = clamp10(UR * R + UG * G + UB * B + UC*4)
 *             V[x] = clamp10(VR * R + VG * G + VB * B + VC*4)
 *         Y = <unsigned short *> ((<uintptr_t> Y) + Ystride)             # <<<<<<<<<<<<<<
 *         U = <unsigned short *> ((<uintptr_t> U) + Ustride)
 *         V = <unsigned short *> ((<uintptr_t> V) + Vstride)
*/
    __pyx_v_Y = ((unsigned short *)(((uintptr_t)__pyx_v_Y) + __pyx_v_Ystride));

    /* "xpra/codecs/csc_cython/converter.pyx":322
 *             V[x] = clamp10(VR * R + VG * G + VB * B + VC*4)
 *         Y = <unsigned short *> ((<uintptr_t> Y) + Ystride)
 *         U = <unsigned short *> ((<uintptr_t> U) + Ustride)             # <<<<<<<<<<<<<<
 *         V = <unsigned short *> ((<uintptr_t> V) + Vstride)
 * 
*/
    __pyx_v_U = ((unsigned short *)(((uintptr_t)__pyx_v_U) + __pyx_v_Ustride));

    /* "xpra/codecs/csc_cython/converter.pyx":323
 *         Y = <unsigned short *> ((<uintptr_t> Y) + Ystride)
 *         U = <unsigned short *> ((<uintptr_t> U) + Ustride)
 *         V = <unsigned short *> ((<uintptr_t> V) + Vstride)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_v_V = ((unsigned short *)(((uintptr_t)__pyx_v_V) + __pyx_v_Vstride));
  }

  /* "xpra/codecs/csc_cython/converter.pyx":303
 * 
 * 
 * cdef inline void r210_to_YUV444P10_copy(unsigned short *Y, unsigned short *U, unsigned short *V, uintptr_t r210data,             # <<<<<<<<<<<<<<
 *                                         unsigned int width, unsigned int height,
 *                                         unsigned int Ystride, unsigned int Ustride, unsigned int Vstride,
*/

  /* function exit code */
}

/* "xpra/codecs/csc_cython/converter.pyx":326
 * 
 * 
 * cdef inline void YUV444P10_to_r210_copy(uintptr_t r210data, const unsigned short *Ybuf, const unsigned short *Ubuf, const unsigned short *Vbuf,             # <<<<<<<<<<<<<<
 *                                         unsigned int width, unsigned int height,
 *                                         unsigned int r210_stride,
*/

static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P10_to_r210_copy(uintptr_t __pyx_v_r210data, unsigned short const *__pyx_v_Ybuf, unsigned short const *__pyx_v_Ubuf, unsigned short const *__pyx_v_Vbuf, unsigned int __pyx_v_width, unsigned int __pyx_v_height, unsigned int __pyx_v_r210_stride, unsigned int __pyx_v_Ystride, unsigned int __pyx_v_Ustride, unsigned int __pyx_v_Vstride) {
  unsigned short *__pyx_v_Yrow;
  unsigned short *__pyx_v_Urow;
  unsigned short *__pyx_v_Vrow;
  short __pyx_v_Y;
  short __pyx_v_U;
  short __pyx_v_V;
  unsigned int *__pyx_v_r210row;
  unsigned int __pyx_v_x;
  unsigned int __pyx_v_y;
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  unsigned int __pyx_t_4;
  unsigned int __pyx_t_5;
  unsigned int __pyx_t_6;

  /* "xpra/codecs/csc_cython/converter.pyx":336
 *         cdef unsigned int *r210row
 *         cdef unsigned int x, y
 *         for y in range(height):             # <<<<<<<<<<<<<<
 *             Yrow = <unsigned short*> ((<uintptr_t> Ybuf) + y*Ystride)
 *             Urow = <unsigned short*> ((<uintptr_t> Ubuf) + y*Ustride)
*/
  __pyx_t_1 = __pyx_v_height;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_y = __pyx_t_3;

    /* "xpra/codecs/csc_cython/converter.pyx":337
 *         cdef unsigned int x, y
 *         for y in range(height):
 *             Yrow = <unsigned short*> ((<uintptr_t> Ybuf) + y*Ystride)             # <<<<<<<<<<<<<<
 *             Urow = <unsigned short*> ((<uintptr_t> Ubuf) + y*Ustride)
 *             Vrow = <unsigned short*> ((<uintptr_t> Vbuf) + y*Vstride)
*/
    __pyx_v_Yrow = ((unsigned short *)(((uintptr_t)__pyx_v_Ybuf) + (__pyx_v_y * __pyx_v_Ystride)));

    /* "xpra/codecs/csc_cython/converter.pyx":338
 *         for y in range(height):
 *             Yrow = <unsigned short*> ((<uintptr_t> Ybuf) + y*Ystride)
 *             Urow = <unsigned short*> ((<uintptr_t> Ubuf) + y*Ustride)             # <<<<<<<<<<<<<<
 *             Vrow = <unsigned short*> ((<uintptr_t> Vbuf) + y*Vstride)
 *             r210row = <unsigned int*> (r210data + y*r210_stride)
*/
    __pyx_v_Urow = ((unsigned short *)(((uintptr_t)__pyx_v_Ubuf) + (__pyx_v_y * __pyx_v_Ustride)));

    /* "xpra/codecs/csc_cython/converter.pyx":339
 *             Yrow = <unsigned short*> ((<uintptr_t> Ybuf) + y*Ystride)
 *             Urow = <unsigned short*> ((<uintptr_t> Ubuf) + y*Ustride)
 *             Vrow = <unsigned short*> ((<uintptr_t> Vbuf) + y*Vstride)             # <<<<<<<<<<<<<<
 *             r210row = <unsigned int*> (r210data + y*r210_stride)
 *             for x in range(width):
*/
    __pyx_v_Vrow = ((unsigned short *)(((uintptr_t)__pyx_v_Vbuf) + (__pyx_v_y * __pyx_v_Vstride)));

    /* "xpra/codecs/csc_cython/converter.pyx":340
 *             Urow = <unsigned short*> ((<uintptr_t> Ubuf) + y*Ustride)
 *             Vrow = <unsigned short*> ((<uintptr_t> Vbuf) + y*Vstride)
 *             r210row = <unsigned int*> (r210data + y*r210_stride)             # <<<<<<<<<<<<<<
 *             for x in range(width):
 *                 Y = (Yrow[x] & 0x3ff) - Yc*4
*/
    __pyx_v_r210row = ((unsigned int *)(__pyx_v_r210data + (__pyx_v_y * __pyx_v_r210_stride)));

    /* "xpra/codecs/csc_cython/converter.pyx":341
 *             Vrow = <unsigned short*> ((<uintptr_t> Vbuf) + y*Vstride)
 *             r210row = <unsigned int*> (r210data + y*r210_stride)
 *             for x in range(width):             # <<<<<<<<<<<<<<
 *                 Y = (Yrow[x] & 0x3ff) - Yc*4
 *                 U = (Urow[x] & 0x3ff) - Uc*4
*/
    __pyx_t_4 = __pyx_v_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;

      /* "xpra/codecs/csc_cython/converter.pyx":342
 *             r210row = <unsigned int*> (r210data + y*r210_stride)
 *             for x in range(width):
 *                 Y = (Yrow[x] & 0x3ff) - Yc*4             # <<<<<<<<<<<<<<
 *                 U = (Urow[x] & 0x3ff) - Uc*4
 *                 V = (Vrow[x] & 0x3ff) - Vc*4
*/
      __pyx_v_Y = (((__pyx_v_Yrow[__pyx_v_x]) & 0x3ff) - 0x0);

      /* "xpra/codecs/csc_cython/converter.pyx":343
 *             for x in range(width):
 *                 Y = (Yrow[x] & 0x3ff) - Yc*4
 *                 U = (Urow[x] & 0x3ff) - Uc*4             # <<<<<<<<<<<<<<
 *                 V = (Vrow[x] & 0x3ff) - Vc*4
 *                 r210row[x] = (
*/
      __pyx_v_U = (((__pyx_v_Urow[__pyx_v_x]) & 0x3ff) - 0x200);

      /* "xpra/codecs/csc_cython/converter.pyx":344
 *                 Y = (Yrow[x] & 0x3ff) - Yc*4
 *                 U = (Urow[x] & 0x3ff) - Uc*4
 *                 V = (Vrow[x] & 0x3ff) - Vc*4             # <<<<<<<<<<<<<<
 *                 r210row[x] = (
 *                     (clamp10(RY * Y + RU * U + RV * V)<<20) |
*/
      __pyx_v_V = (((__pyx_v_Vrow[__pyx_v_x]) & 0x3ff) - 0x200);

      /* "xpra/codecs/csc_cython/converter.pyx":345
 *                 U = (Urow[x] & 0x3ff) - Uc*4
 *                 V = (Vrow[x] & 0x3ff) - Vc*4
 *                 r210row[x] = (             # <<<<<<<<<<<<<<
 *                     (clamp10(RY * Y + RU * U + RV * V)<<20) |
 *                     (clamp10(GY * Y + GU * U + GV * V)<<10) |
*/
      (__pyx_v_r210row[__pyx_v_x]) = (((__pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp10((((0x10000 * __pyx_v_Y) + (0 * __pyx_v_U)) + (0x1672B * __pyx_v_V))) << 20) | (__pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp10((((0x10000 * __pyx_v_Y) + (-22544L * __pyx_v_U)) + (-46793L * __pyx_v_V))) << 10)) | __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp10((((0x10000 * __pyx_v_Y) + (0x1C51F * __pyx_v_U)) + (0 * __pyx_v_V))));
    }
  }

  /* "xpra/codecs/csc_cython/converter.pyx":326
 * 
 * 
 * cdef inline void YUV444P10_to_r210_copy(uintptr_t r210data, const unsigned short *Ybuf, const unsigned short *Ubuf, const unsigned short *Vbuf,             # <<<<<<<<<<<<<<
 *                                         unsigned int width, unsigned int height,
 *                                         unsigned int r210_stride,
*/

  /* function exit code */
}

/* "xpra/codecs/csc_cython/converter.pyx":352
 * 
 * 
 * cdef inline void YUV444P_to_BGRX_copy(uintptr_t bgrxdata,             # <<<<<<<<<<<<<<
 *                                      const unsigned char *Ybuf, const unsigned char *Ubuf, const unsigned char *Vbuf,
 *                                      unsigned int width, unsigned int height,
*/

static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P_to_BGRX_copy(uintptr_t __pyx_v_bgrxdata, unsigned char const *__pyx_v_Ybuf, unsigned char const *__pyx_v_Ubuf, unsigned char const *__pyx_v_Vbuf, unsigned int __pyx_v_width, unsigned int __pyx_v_height, unsigned int __pyx_v_rgb_stride, unsigned int __pyx_v_Ystride, unsigned int __pyx_v_Ustride, unsigned int __pyx_v_Vstride, unsigned char __pyx_v_full_range) {
  unsigned char *__pyx_v_Yrow;
  unsigned char *__pyx_v_Urow;
  unsigned char *__pyx_v_Vrow;
  short __pyx_v_Y;
  short __pyx_v_U;
  short __pyx_v_V;
  unsigned int *__pyx_v_bgrxrow;
  unsigned int __pyx_v_x;
  unsigned int __pyx_v_y;
  int __pyx_t_1;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  unsigned int __pyx_t_4;
  unsigned int __pyx_t_5;
  unsigned int __pyx_t_6;
  unsigned int __pyx_t_7;

  /* "xpra/codecs/csc_cython/converter.pyx":364
 *         cdef unsigned int *bgrxrow
 *         cdef unsigned int x, y
 *         if full_range:             # <<<<<<<<<<<<<<
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
*/
  __pyx_t_1 = (__pyx_v_full_range != 0);
  if (__pyx_t_1) {

    /* "xpra/codecs/csc_cython/converter.pyx":365
 *         cdef unsigned int x, y
 *         if full_range:
 *             for y in range(height):             # <<<<<<<<<<<<<<
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
*/
    __pyx_t_2 = __pyx_v_height;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_y = __pyx_t_4;

      /* "xpra/codecs/csc_cython/converter.pyx":366
 *         if full_range:
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)             # <<<<<<<<<<<<<<
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
*/
      __pyx_v_Yrow = ((unsigned char *)(((uintptr_t)__pyx_v_Ybuf) + (__pyx_v_y * __pyx_v_Ystride)));

      /* "xpra/codecs/csc_cython/converter.pyx":367
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)             # <<<<<<<<<<<<<<
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 bgrxrow = <unsigned int*> (bgrxdata + y*rgb_stride)
*/
      __pyx_v_Urow = ((unsigned char *)(((uintptr_t)__pyx_v_Ubuf) + (__pyx_v_y * __pyx_v_Ustride)));

      /* "xpra/codecs/csc_cython/converter.pyx":368
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)             # <<<<<<<<<<<<<<
 *                 bgrxrow = <unsigned int*> (bgrxdata + y*rgb_stride)
 *                 for x in range(width):
*/
      __pyx_v_Vrow = ((unsigned char *)(((uintptr_t)__pyx_v_Vbuf) + (__pyx_v_y * __pyx_v_Vstride)));

      /* "xpra/codecs/csc_cython/converter.pyx":369
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 bgrxrow = <unsigned int*> (bgrxdata + y*rgb_stride)             # <<<<<<<<<<<<<<
 *                 for x in range(width):
 *                     Y = Yrow[x] - Yc
*/
      __pyx_v_bgrxrow = ((unsigned int *)(__pyx_v_bgrxdata + (__pyx_v_y * __pyx_v_rgb_stride)));

      /* "xpra/codecs/csc_cython/converter.pyx":370
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 bgrxrow = <unsigned int*> (bgrxdata + y*rgb_stride)
 *                 for x in range(width):             # <<<<<<<<<<<<<<
 *                     Y = Yrow[x] - Yc
 *                     U = Urow[x] - Uc
*/
      __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_x = __pyx_t_7;

        /* "xpra/codecs/csc_cython/converter.pyx":371
 *                 bgrxrow = <unsigned int*> (bgrxdata + y*rgb_stride)
 *                 for x in range(width):
 *                     Y = Yrow[x] - Yc             # <<<<<<<<<<<<<<
 *                     U = Urow[x] - Uc
 *                     V = Vrow[x] - Vc
*/
        __pyx_v_Y = ((__pyx_v_Yrow[__pyx_v_x]) - 0);

        /* "xpra/codecs/csc_cython/converter.pyx":372
 *                 for x in range(width):
 *                     Y = Yrow[x] - Yc
 *                     U = Urow[x] - Uc             # <<<<<<<<<<<<<<
 *                     V = Vrow[x] - Vc
 *                     bgrxrow[x] = (
*/
        __pyx_v_U = ((__pyx_v_Urow[__pyx_v_x]) - 0x80);

        /* "xpra/codecs/csc_cython/converter.pyx":373
 *                     Y = Yrow[x] - Yc
 *                     U = Urow[x] - Uc
 *                     V = Vrow[x] - Vc             # <<<<<<<<<<<<<<
 *                     bgrxrow[x] = (
 *                         (<unsigned int> (0xff)<<24) |
*/
        __pyx_v_V = ((__pyx_v_Vrow[__pyx_v_x]) - 0x80);

        /* "xpra/codecs/csc_cython/converter.pyx":374
 *                     U = Urow[x] - Uc
 *                     V = Vrow[x] - Vc
 *                     bgrxrow[x] = (             # <<<<<<<<<<<<<<
 *                         (<unsigned int> (0xff)<<24) |
 *                         (clamp(RY * Y + RU * U + RV * V)<<16) |
*/
        (__pyx_v_bgrxrow[__pyx_v_x]) = ((((((unsigned int)0xff) << 24) | (__pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x10000 * __pyx_v_Y) + (0 * __pyx_v_U)) + (0x1672B * __pyx_v_V))) << 16)) | (__pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x10000 * __pyx_v_Y) + (-22544L * __pyx_v_U)) + (-46793L * __pyx_v_V))) << 8)) | __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x10000 * __pyx_v_Y) + (0x1C51F * __pyx_v_U)) + (0 * __pyx_v_V))));
      }
    }

    /* "xpra/codecs/csc_cython/converter.pyx":364
 *         cdef unsigned int *bgrxrow
 *         cdef unsigned int x, y
 *         if full_range:             # <<<<<<<<<<<<<<
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
*/
    goto __pyx_L3;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":381
 *                     )
 *         else:
 *             for y in range(height):             # <<<<<<<<<<<<<<
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
*/
  /*else*/ {
    __pyx_t_2 = __pyx_v_height;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_y = __pyx_t_4;

      /* "xpra/codecs/csc_cython/converter.pyx":382
 *         else:
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)             # <<<<<<<<<<<<<<
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
*/
      __pyx_v_Yrow = ((unsigned char *)(((uintptr_t)__pyx_v_Ybuf) + (__pyx_v_y * __pyx_v_Ystride)));

      /* "xpra/codecs/csc_cython/converter.pyx":383
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)             # <<<<<<<<<<<<<<
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 bgrxrow = <unsigned int*> (bgrxdata + y*rgb_stride)
*/
      __pyx_v_Urow = ((unsigned char *)(((uintptr_t)__pyx_v_Ubuf) + (__pyx_v_y * __pyx_v_Ustride)));

      /* "xpra/codecs/csc_cython/converter.pyx":384
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)             # <<<<<<<<<<<<<<
 *                 bgrxrow = <unsigned int*> (bgrxdata + y*rgb_stride)
 *                 for x in range(width):
*/
      __pyx_v_Vrow = ((unsigned char *)(((uintptr_t)__pyx_v_Vbuf) + (__pyx_v_y * __pyx_v_Vstride)));

      /* "xpra/codecs/csc_cython/converter.pyx":385
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 bgrxrow = <unsigned int*> (bgrxdata + y*rgb_stride)             # <<<<<<<<<<<<<<
 *                 for x in range(width):
 *                     Y = Yrow[x] - SYc
*/
      __pyx_v_bgrxrow = ((unsigned int *)(__pyx_v_bgrxdata + (__pyx_v_y * __pyx_v_rgb_stride)));

      /* "xpra/codecs/csc_cython/converter.pyx":386
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 bgrxrow = <unsigned int*> (bgrxdata + y*rgb_stride)
 *                 for x in range(width):             # <<<<<<<<<<<<<<
 *                     Y = Yrow[x] - SYc
 *                     U = Urow[x] - SUc
*/
      __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_x = __pyx_t_7;

        /* "xpra/codecs/csc_cython/converter.pyx":387
 *                 bgrxrow = <unsigned int*> (bgrxdata + y*rgb_stride)
 *                 for x in range(width):
 *                     Y = Yrow[x] - SYc             # <<<<<<<<<<<<<<
 *                     U = Urow[x] - SUc
 *                     V = Vrow[x] - SVc
*/
        __pyx_v_Y = ((__pyx_v_Yrow[__pyx_v_x]) - 16);

        /* "xpra/codecs/csc_cython/converter.pyx":388
 *                 for x in range(width):
 *                     Y = Yrow[x] - SYc
 *                     U = Urow[x] - SUc             # <<<<<<<<<<<<<<
 *                     V = Vrow[x] - SVc
 *                     bgrxrow[x] = (
*/
        __pyx_v_U = ((__pyx_v_Urow[__pyx_v_x]) - 0x80);

        /* "xpra/codecs/csc_cython/converter.pyx":389
 *                     Y = Yrow[x] - SYc
 *                     U = Urow[x] - SUc
 *                     V = Vrow[x] - SVc             # <<<<<<<<<<<<<<
 *                     bgrxrow[x] = (
 *                         (<unsigned int> (0xff)<<24) |
*/
        __pyx_v_V = ((__pyx_v_Vrow[__pyx_v_x]) - 0x80);

        /* "xpra/codecs/csc_cython/converter.pyx":390
 *                     U = Urow[x] - SUc
 *                     V = Vrow[x] - SVc
 *                     bgrxrow[x] = (             # <<<<<<<<<<<<<<
 *                         (<unsigned int> (0xff)<<24) |
 *                         (clamp(SRY * Y + SRU * U + SRV * V)<<16) |
*/
        (__pyx_v_bgrxrow[__pyx_v_x]) = ((((((unsigned int)0xff) << 24) | (__pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x12A15 * __pyx_v_Y) + (0 * __pyx_v_U)) + (0x198E0 * __pyx_v_V))) << 16)) | (__pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x12A15 * __pyx_v_Y) + (-25664L * __pyx_v_U)) + (-53268L * __pyx_v_V))) << 8)) | __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x12A15 * __pyx_v_Y) + (0x203D4 * __pyx_v_U)) + (0 * __pyx_v_V))));
      }
    }
  }
  __pyx_L3:;

  /* "xpra/codecs/csc_cython/converter.pyx":352
 * 
 * 
 * cdef inline void YUV444P_to_BGRX_copy(uintptr_t bgrxdata,             # <<<<<<<<<<<<<<
 *                                      const unsigned char *Ybuf, const unsigned char *Ubuf, const unsigned char *Vbuf,
 *                                      unsigned int width, unsigned int height,
*/

  /* function exit code */
}

/* "xpra/codecs/csc_cython/converter.pyx":398
 * 
 * 
 * cdef inline void YUV444P_to_RGBX_copy(uintptr_t rgbxdata,             # <<<<<<<<<<<<<<
 *                                      const unsigned char *Ybuf, const unsigned char *Ubuf, const unsigned char *Vbuf,
 *                                      unsigned int width, unsigned int height,
*/

static CYTHON_INLINE void __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P_to_RGBX_copy(uintptr_t __pyx_v_rgbxdata, unsigned char const *__pyx_v_Ybuf, unsigned char const *__pyx_v_Ubuf, unsigned char const *__pyx_v_Vbuf, unsigned int __pyx_v_width, unsigned int __pyx_v_height, unsigned int __pyx_v_rgb_stride, unsigned int __pyx_v_Ystride, unsigned int __pyx_v_Ustride, unsigned int __pyx_v_Vstride, unsigned char __pyx_v_full_range) {
  unsigned char *__pyx_v_Yrow;
  unsigned char *__pyx_v_Urow;
  unsigned char *__pyx_v_Vrow;
  short __pyx_v_Y;
  short __pyx_v_U;
  short __pyx_v_V;
  unsigned int __pyx_v_x;
  unsigned int __pyx_v_y;
  unsigned int *__pyx_v_rgbxrow;
  int __pyx_t_1;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  unsigned int __pyx_t_4;
  unsigned int __pyx_t_5;
  unsigned int __pyx_t_6;
  unsigned int __pyx_t_7;

  /* "xpra/codecs/csc_cython/converter.pyx":410
 *         cdef unsigned int *bgrxrow
 *         cdef unsigned int x, y
 *         if full_range:             # <<<<<<<<<<<<<<
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
*/
  __pyx_t_1 = (__pyx_v_full_range != 0);
  if (__pyx_t_1) {

    /* "xpra/codecs/csc_cython/converter.pyx":411
 *         cdef unsigned int x, y
 *         if full_range:
 *             for y in range(height):             # <<<<<<<<<<<<<<
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
*/
    __pyx_t_2 = __pyx_v_height;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_y = __pyx_t_4;

      /* "xpra/codecs/csc_cython/converter.pyx":412
 *         if full_range:
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)             # <<<<<<<<<<<<<<
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
*/
      __pyx_v_Yrow = ((unsigned char *)(((uintptr_t)__pyx_v_Ybuf) + (__pyx_v_y * __pyx_v_Ystride)));

      /* "xpra/codecs/csc_cython/converter.pyx":413
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)             # <<<<<<<<<<<<<<
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 rgbxrow = <unsigned int*> (rgbxdata + y*rgb_stride)
*/
      __pyx_v_Urow = ((unsigned char *)(((uintptr_t)__pyx_v_Ubuf) + (__pyx_v_y * __pyx_v_Ustride)));

      /* "xpra/codecs/csc_cython/converter.pyx":414
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)             # <<<<<<<<<<<<<<
 *                 rgbxrow = <unsigned int*> (rgbxdata + y*rgb_stride)
 *                 for x in range(width):
*/
      __pyx_v_Vrow = ((unsigned char *)(((uintptr_t)__pyx_v_Vbuf) + (__pyx_v_y * __pyx_v_Vstride)));

      /* "xpra/codecs/csc_cython/converter.pyx":415
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 rgbxrow = <unsigned int*> (rgbxdata + y*rgb_stride)             # <<<<<<<<<<<<<<
 *                 for x in range(width):
 *                     Y = Yrow[x] - Yc
*/
      __pyx_v_rgbxrow = ((unsigned int *)(__pyx_v_rgbxdata + (__pyx_v_y * __pyx_v_rgb_stride)));

      /* "xpra/codecs/csc_cython/converter.pyx":416
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 rgbxrow = <unsigned int*> (rgbxdata + y*rgb_stride)
 *                 for x in range(width):             # <<<<<<<<<<<<<<
 *                     Y = Yrow[x] - Yc
 *                     U = Urow[x] - Uc
*/
      __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_x = __pyx_t_7;

        /* "xpra/codecs/csc_cython/converter.pyx":417
 *                 rgbxrow = <unsigned int*> (rgbxdata + y*rgb_stride)
 *                 for x in range(width):
 *                     Y = Yrow[x] - Yc             # <<<<<<<<<<<<<<
 *                     U = Urow[x] - Uc
 *                     V = Vrow[x] - Vc
*/
        __pyx_v_Y = ((__pyx_v_Yrow[__pyx_v_x]) - 0);

        /* "xpra/codecs/csc_cython/converter.pyx":418
 *                 for x in range(width):
 *                     Y = Yrow[x] - Yc
 *                     U = Urow[x] - Uc             # <<<<<<<<<<<<<<
 *                     V = Vrow[x] - Vc
 *                     rgbxrow[x] = (
*/
        __pyx_v_U = ((__pyx_v_Urow[__pyx_v_x]) - 0x80);

        /* "xpra/codecs/csc_cython/converter.pyx":419
 *                     Y = Yrow[x] - Yc
 *                     U = Urow[x] - Uc
 *                     V = Vrow[x] - Vc             # <<<<<<<<<<<<<<
 *                     rgbxrow[x] = (
 *                         (<unsigned int> 0xff<<24) |
*/
        __pyx_v_V = ((__pyx_v_Vrow[__pyx_v_x]) - 0x80);

        /* "xpra/codecs/csc_cython/converter.pyx":420
 *                     U = Urow[x] - Uc
 *                     V = Vrow[x] - Vc
 *                     rgbxrow[x] = (             # <<<<<<<<<<<<<<
 *                         (<unsigned int> 0xff<<24) |
 *                         (clamp(BY * Y + GU * U + GV * V)<<8) |
*/
        (__pyx_v_rgbxrow[__pyx_v_x]) = ((((((unsigned int)0xff) << 24) | (__pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x10000 * __pyx_v_Y) + (-22544L * __pyx_v_U)) + (-46793L * __pyx_v_V))) << 8)) | (__pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x10000 * __pyx_v_Y) + (0 * __pyx_v_U)) + (0x1672B * __pyx_v_V))) << 16)) | __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x10000 * __pyx_v_Y) + (0x1C51F * __pyx_v_U)) + (0 * __pyx_v_V))));
      }
    }

    /* "xpra/codecs/csc_cython/converter.pyx":410
 *         cdef unsigned int *bgrxrow
 *         cdef unsigned int x, y
 *         if full_range:             # <<<<<<<<<<<<<<
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
*/
    goto __pyx_L3;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":427
 *                     )
 *         else:
 *             for y in range(height):             # <<<<<<<<<<<<<<
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
*/
  /*else*/ {
    __pyx_t_2 = __pyx_v_height;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_y = __pyx_t_4;

      /* "xpra/codecs/csc_cython/converter.pyx":428
 *         else:
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)             # <<<<<<<<<<<<<<
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
*/
      __pyx_v_Yrow = ((unsigned char *)(((uintptr_t)__pyx_v_Ybuf) + (__pyx_v_y * __pyx_v_Ystride)));

      /* "xpra/codecs/csc_cython/converter.pyx":429
 *             for y in range(height):
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)             # <<<<<<<<<<<<<<
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 rgbxrow = <unsigned int*> (rgbxdata + y*rgb_stride)
*/
      __pyx_v_Urow = ((unsigned char *)(((uintptr_t)__pyx_v_Ubuf) + (__pyx_v_y * __pyx_v_Ustride)));

      /* "xpra/codecs/csc_cython/converter.pyx":430
 *                 Yrow = <unsigned char*> ((<uintptr_t> Ybuf) + y*Ystride)
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)             # <<<<<<<<<<<<<<
 *                 rgbxrow = <unsigned int*> (rgbxdata + y*rgb_stride)
 *                 for x in range(width):
*/
      __pyx_v_Vrow = ((unsigned char *)(((uintptr_t)__pyx_v_Vbuf) + (__pyx_v_y * __pyx_v_Vstride)));

      /* "xpra/codecs/csc_cython/converter.pyx":431
 *                 Urow = <unsigned char*> ((<uintptr_t> Ubuf) + y*Ustride)
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 rgbxrow = <unsigned int*> (rgbxdata + y*rgb_stride)             # <<<<<<<<<<<<<<
 *                 for x in range(width):
 *                     Y = Yrow[x] - SYc
*/
      __pyx_v_rgbxrow = ((unsigned int *)(__pyx_v_rgbxdata + (__pyx_v_y * __pyx_v_rgb_stride)));

      /* "xpra/codecs/csc_cython/converter.pyx":432
 *                 Vrow = <unsigned char*> ((<uintptr_t> Vbuf) + y*Vstride)
 *                 rgbxrow = <unsigned int*> (rgbxdata + y*rgb_stride)
 *                 for x in range(width):             # <<<<<<<<<<<<<<
 *                     Y = Yrow[x] - SYc
 *                     U = Urow[x] - SUc
*/
      __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_x = __pyx_t_7;

        /* "xpra/codecs/csc_cython/converter.pyx":433
 *                 rgbxrow = <unsigned int*> (rgbxdata + y*rgb_stride)
 *                 for x in range(width):
 *                     Y = Yrow[x] - SYc             # <<<<<<<<<<<<<<
 *                     U = Urow[x] - SUc
 *                     V = Vrow[x] - SVc
*/
        __pyx_v_Y = ((__pyx_v_Yrow[__pyx_v_x]) - 16);

        /* "xpra/codecs/csc_cython/converter.pyx":434
 *                 for x in range(width):
 *                     Y = Yrow[x] - SYc
 *                     U = Urow[x] - SUc             # <<<<<<<<<<<<<<
 *                     V = Vrow[x] - SVc
 *                     rgbxrow[x] = (
*/
        __pyx_v_U = ((__pyx_v_Urow[__pyx_v_x]) - 0x80);

        /* "xpra/codecs/csc_cython/converter.pyx":435
 *                     Y = Yrow[x] - SYc
 *                     U = Urow[x] - SUc
 *                     V = Vrow[x] - SVc             # <<<<<<<<<<<<<<
 *                     rgbxrow[x] = (
 *                         (<unsigned int> 0xff<<24) |
*/
        __pyx_v_V = ((__pyx_v_Vrow[__pyx_v_x]) - 0x80);

        /* "xpra/codecs/csc_cython/converter.pyx":436
 *                     U = Urow[x] - SUc
 *                     V = Vrow[x] - SVc
 *                     rgbxrow[x] = (             # <<<<<<<<<<<<<<
 *                         (<unsigned int> 0xff<<24) |
 *                         (clamp(SBY * Y + SGU * U + SGV * V)<<8) |
*/
        (__pyx_v_rgbxrow[__pyx_v_x]) = ((((((unsigned int)0xff) << 24) | (__pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x12A15 * __pyx_v_Y) + (-25664L * __pyx_v_U)) + (-53268L * __pyx_v_V))) << 8)) | (__pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x12A15 * __pyx_v_Y) + (0 * __pyx_v_U)) + (0x198E0 * __pyx_v_V))) << 16)) | __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((0x12A15 * __pyx_v_Y) + (0x203D4 * __pyx_v_U)) + (0 * __pyx_v_V))));
      }
    }
  }
  __pyx_L3:;

  /* "xpra/codecs/csc_cython/converter.pyx":398
 * 
 * 
 * cdef inline void YUV444P_to_RGBX_copy(uintptr_t rgbxdata,             # <<<<<<<<<<<<<<
 *                                      const unsigned char *Ybuf, const unsigned char *Ubuf, const unsigned char *Vbuf,
 *                                      unsigned int width, unsigned int height,
*/

  /* function exit code */
}

/* "xpra/codecs/csc_cython/converter.pyx":464
 *     cdef object __weakref__
 * 
 *     def init_context(self, int src_width, int src_height, src_format: str,             # <<<<<<<<<<<<<<
 *                            int dst_width, int dst_height, dst_format: str, options: typedict) -> None:
 *         cdef int i
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_1init_context(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_1init_context = {"init_context", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_1init_context, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_1init_context(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_src_width;
  int __pyx_v_src_height;
  PyObject *__pyx_v_src_format = 0;
  int __pyx_v_dst_width;
  int __pyx_v_dst_height;
  PyObject *__pyx_v_dst_format = 0;
  PyObject *__pyx_v_options = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[7] = {0,0,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("init_context (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_src_width,&__pyx_mstate_global->__pyx_n_u_src_height,&__pyx_mstate_global->__pyx_n_u_src_format,&__pyx_mstate_global->__pyx_n_u_dst_width,&__pyx_mstate_global->__pyx_n_u_dst_height,&__pyx_mstate_global->__pyx_n_u_dst_format,&__pyx_mstate_global->__pyx_n_u_options,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 464, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 464, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 464, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 464, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 464, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 464, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 464, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 464, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "init_context", 0) < (0)) __PYX_ERR(0, 464, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 7; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("init_context", 1, 7, 7, i); __PYX_ERR(0, 464, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 7)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 464, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 464, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 464, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 464, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 464, __pyx_L3_error)
      values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 464, __pyx_L3_error)
      values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 464, __pyx_L3_error)
    }
    __pyx_v_src_width = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_src_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 464, __pyx_L3_error)
    __pyx_v_src_height = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_src_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 464, __pyx_L3_error)
    __pyx_v_src_format = ((PyObject*)values[2]);
    __pyx_v_dst_width = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_dst_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L3_error)
    __pyx_v_dst_height = __Pyx_PyLong_As_int(values[4]); if (unlikely((__pyx_v_dst_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L3_error)
    __pyx_v_dst_format = ((PyObject*)values[5]);
    __pyx_v_options = values[6];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("init_context", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 464, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.init_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src_format), (&PyUnicode_Type), 0, "src_format", 2))) __PYX_ERR(0, 464, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dst_format), (&PyUnicode_Type), 0, "dst_format", 2))) __PYX_ERR(0, 465, __pyx_L1_error)
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_init_context(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), __pyx_v_src_width, __pyx_v_src_height, __pyx_v_src_format, __pyx_v_dst_width, __pyx_v_dst_height, __pyx_v_dst_format, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":488
 *             self.offsets[i]     = 0
 * 
 *         def assert_no_scaling() -> None:             # <<<<<<<<<<<<<<
 *             assert src_width==dst_width and src_height==dst_height, "scaling is not supported for %s to %s" % (src_format, dst_format)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_1assert_no_scaling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_1assert_no_scaling = {"assert_no_scaling", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_1assert_no_scaling, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_1assert_no_scaling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assert_no_scaling (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_assert_no_scaling(__pyx_self);

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_assert_no_scaling(PyObject *__pyx_self) {
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *__pyx_cur_scope;
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *__pyx_outer_scope;
  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[4];
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assert_no_scaling", 0);
  __pyx_outer_scope = (struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "xpra/codecs/csc_cython/converter.pyx":489
 * 
 *         def assert_no_scaling() -> None:
 *             assert src_width==dst_width and src_height==dst_height, "scaling is not supported for %s to %s" % (src_format, dst_format)             # <<<<<<<<<<<<<<
 * 
 *         def allocate_yuv(fmt="YUV420P", Bpp=1) -> None:
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (__pyx_cur_scope->__pyx_v_src_width == __pyx_cur_scope->__pyx_v_dst_width);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_cur_scope->__pyx_v_src_height == __pyx_cur_scope->__pyx_v_dst_height);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      if (unlikely(!__pyx_cur_scope->__pyx_v_src_format)) { __Pyx_RaiseClosureNameError("src_format"); __PYX_ERR(0, 489, __pyx_L1_error) }
      __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_cur_scope->__pyx_v_src_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(!__pyx_cur_scope->__pyx_v_dst_format)) { __Pyx_RaiseClosureNameError("dst_format"); __PYX_ERR(0, 489, __pyx_L1_error) }
      __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_cur_scope->__pyx_v_dst_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_scaling_is_not_supported_for;
      __pyx_t_5[1] = __pyx_t_3;
      __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_to;
      __pyx_t_5[3] = __pyx_t_4;
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 4, 29 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_6, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 489, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 489, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":488
 *             self.offsets[i]     = 0
 * 
 *         def assert_no_scaling() -> None:             # <<<<<<<<<<<<<<
 *             assert src_width==dst_width and src_height==dst_height, "scaling is not supported for %s to %s" % (src_format, dst_format)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.init_context.assert_no_scaling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":491
 *             assert src_width==dst_width and src_height==dst_height, "scaling is not supported for %s to %s" % (src_format, dst_format)
 * 
 *         def allocate_yuv(fmt="YUV420P", Bpp=1) -> None:             # <<<<<<<<<<<<<<
 *             divs = get_subsampling_divs(fmt)
 *             assert divs, "invalid pixel format '%s'" % fmt
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_3allocate_yuv(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_3allocate_yuv = {"allocate_yuv", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_3allocate_yuv, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_3allocate_yuv(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_fmt = 0;
  PyObject *__pyx_v_Bpp = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("allocate_yuv (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_fmt,&__pyx_mstate_global->__pyx_n_u_Bpp,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 491, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 491, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 491, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "allocate_yuv", 0) < (0)) __PYX_ERR(0, 491, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_YUV420P)));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 491, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 491, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_YUV420P)));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));
    }
    __pyx_v_fmt = values[0];
    __pyx_v_Bpp = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("allocate_yuv", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 491, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.init_context.allocate_yuv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_2allocate_yuv(__pyx_self, __pyx_v_fmt, __pyx_v_Bpp);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_2allocate_yuv(PyObject *__pyx_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_Bpp) {
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *__pyx_cur_scope;
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *__pyx_outer_scope;
  PyObject *__pyx_v_divs = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_div = NULL;
  PyObject *__pyx_v_xdiv = NULL;
  PyObject *__pyx_v_ydiv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  unsigned long __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("allocate_yuv", 0);
  __pyx_outer_scope = (struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "xpra/codecs/csc_cython/converter.pyx":492
 * 
 *         def allocate_yuv(fmt="YUV420P", Bpp=1) -> None:
 *             divs = get_subsampling_divs(fmt)             # <<<<<<<<<<<<<<
 *             assert divs, "invalid pixel format '%s'" % fmt
 *             for i, div in enumerate(divs):
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_subsampling_divs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_fmt};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_divs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":493
 *         def allocate_yuv(fmt="YUV420P", Bpp=1) -> None:
 *             divs = get_subsampling_divs(fmt)
 *             assert divs, "invalid pixel format '%s'" % fmt             # <<<<<<<<<<<<<<
 *             for i, div in enumerate(divs):
 *                 xdiv, ydiv = div
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_divs); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 493, __pyx_L1_error)
    if (unlikely(!__pyx_t_5)) {
      __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_invalid_pixel_format_s, __pyx_v_fmt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 493, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 493, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":494
 *             divs = get_subsampling_divs(fmt)
 *             assert divs, "invalid pixel format '%s'" % fmt
 *             for i, div in enumerate(divs):             # <<<<<<<<<<<<<<
 *                 xdiv, ydiv = div
 *                 self.dst_strides[i] = roundup(roundup(self.dst_width*Bpp, xdiv)//xdiv, STRIDE_ROUNDUP)
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_divs)) || PyTuple_CheckExact(__pyx_v_divs)) {
    __pyx_t_3 = __pyx_v_divs; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_divs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 494, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 494, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_6;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 494, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6));
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6);
        #endif
        ++__pyx_t_6;
      }
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error)
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 494, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_div, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_2 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":495
 *             assert divs, "invalid pixel format '%s'" % fmt
 *             for i, div in enumerate(divs):
 *                 xdiv, ydiv = div             # <<<<<<<<<<<<<<
 *                 self.dst_strides[i] = roundup(roundup(self.dst_width*Bpp, xdiv)//xdiv, STRIDE_ROUNDUP)
 *                 self.dst_sizes[i] = self.dst_strides[i] * roundup(self.dst_height, ydiv)//ydiv
*/
    if ((likely(PyTuple_CheckExact(__pyx_v_div))) || (PyList_CheckExact(__pyx_v_div))) {
      PyObject* sequence = __pyx_v_div;
      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(0, 495, __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_INCREF(__pyx_t_2);
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_8);
      } else {
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 495, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_8);
      }
      #else
      __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_v_div); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
      index = 0; __pyx_t_2 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 495, __pyx_L1_error)
      __pyx_t_10 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 495, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_xdiv, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ydiv, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":496
 *             for i, div in enumerate(divs):
 *                 xdiv, ydiv = div
 *                 self.dst_strides[i] = roundup(roundup(self.dst_width*Bpp, xdiv)//xdiv, STRIDE_ROUNDUP)             # <<<<<<<<<<<<<<
 *                 self.dst_sizes[i] = self.dst_strides[i] * roundup(self.dst_height, ydiv)//ydiv
 *             #U channel follows Y with 1 line padding, V follows U with another line of padding:
*/
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 496, __pyx_L1_error) }
    __pyx_t_8 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_self->dst_width); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_8, __pyx_v_Bpp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = __Pyx_PyLong_As_int(__pyx_v_xdiv); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_f_4xpra_6codecs_10csc_cython_9converter_roundup(__pyx_t_11, __pyx_t_12)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = PyNumber_FloorDivide(__pyx_t_2, __pyx_v_xdiv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = __Pyx_PyLong_As_int(__pyx_t_8); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 496, __pyx_L1_error) }
    __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L1_error)
    (__pyx_cur_scope->__pyx_v_self->dst_strides[__pyx_t_13]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_roundup(__pyx_t_12, 2);

    /* "xpra/codecs/csc_cython/converter.pyx":497
 *                 xdiv, ydiv = div
 *                 self.dst_strides[i] = roundup(roundup(self.dst_width*Bpp, xdiv)//xdiv, STRIDE_ROUNDUP)
 *                 self.dst_sizes[i] = self.dst_strides[i] * roundup(self.dst_height, ydiv)//ydiv             # <<<<<<<<<<<<<<
 *             #U channel follows Y with 1 line padding, V follows U with another line of padding:
 *             self.offsets[0] = 0
*/
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 497, __pyx_L1_error) }
    __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 497, __pyx_L1_error) }
    __pyx_t_12 = __Pyx_PyLong_As_int(__pyx_v_ydiv); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyLong_From_unsigned_long(((__pyx_cur_scope->__pyx_v_self->dst_strides[__pyx_t_13]) * __pyx_f_4xpra_6codecs_10csc_cython_9converter_roundup(__pyx_cur_scope->__pyx_v_self->dst_height, __pyx_t_12))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = PyNumber_FloorDivide(__pyx_t_8, __pyx_v_ydiv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_14 = __Pyx_PyLong_As_unsigned_long(__pyx_t_2); if (unlikely((__pyx_t_14 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 497, __pyx_L1_error) }
    __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
    (__pyx_cur_scope->__pyx_v_self->dst_sizes[__pyx_t_13]) = __pyx_t_14;

    /* "xpra/codecs/csc_cython/converter.pyx":494
 *             divs = get_subsampling_divs(fmt)
 *             assert divs, "invalid pixel format '%s'" % fmt
 *             for i, div in enumerate(divs):             # <<<<<<<<<<<<<<
 *                 xdiv, ydiv = div
 *                 self.dst_strides[i] = roundup(roundup(self.dst_width*Bpp, xdiv)//xdiv, STRIDE_ROUNDUP)
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":499
 *                 self.dst_sizes[i] = self.dst_strides[i] * roundup(self.dst_height, ydiv)//ydiv
 *             #U channel follows Y with 1 line padding, V follows U with another line of padding:
 *             self.offsets[0] = 0             # <<<<<<<<<<<<<<
 *             self.offsets[1] = self.offsets[0] + self.dst_sizes[0] + self.dst_strides[0]
 *             self.offsets[2] = self.offsets[1] + self.dst_sizes[1] + self.dst_strides[1]
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 499, __pyx_L1_error) }
  (__pyx_cur_scope->__pyx_v_self->offsets[0]) = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":500
 *             #U channel follows Y with 1 line padding, V follows U with another line of padding:
 *             self.offsets[0] = 0
 *             self.offsets[1] = self.offsets[0] + self.dst_sizes[0] + self.dst_strides[0]             # <<<<<<<<<<<<<<
 *             self.offsets[2] = self.offsets[1] + self.dst_sizes[1] + self.dst_strides[1]
 *             #output buffer ends after V + 1 line of padding:
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 500, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 500, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 500, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 500, __pyx_L1_error) }
  (__pyx_cur_scope->__pyx_v_self->offsets[1]) = (((__pyx_cur_scope->__pyx_v_self->offsets[0]) + (__pyx_cur_scope->__pyx_v_self->dst_sizes[0])) + (__pyx_cur_scope->__pyx_v_self->dst_strides[0]));

  /* "xpra/codecs/csc_cython/converter.pyx":501
 *             self.offsets[0] = 0
 *             self.offsets[1] = self.offsets[0] + self.dst_sizes[0] + self.dst_strides[0]
 *             self.offsets[2] = self.offsets[1] + self.dst_sizes[1] + self.dst_strides[1]             # <<<<<<<<<<<<<<
 *             #output buffer ends after V + 1 line of padding:
 *             self.buffer_size = self.offsets[2] + self.dst_sizes[2] + self.dst_strides[2]
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 501, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 501, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 501, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 501, __pyx_L1_error) }
  (__pyx_cur_scope->__pyx_v_self->offsets[2]) = (((__pyx_cur_scope->__pyx_v_self->offsets[1]) + (__pyx_cur_scope->__pyx_v_self->dst_sizes[1])) + (__pyx_cur_scope->__pyx_v_self->dst_strides[1]));

  /* "xpra/codecs/csc_cython/converter.pyx":503
 *             self.offsets[2] = self.offsets[1] + self.dst_sizes[1] + self.dst_strides[1]
 *             #output buffer ends after V + 1 line of padding:
 *             self.buffer_size = self.offsets[2] + self.dst_sizes[2] + self.dst_strides[2]             # <<<<<<<<<<<<<<
 *             log("allocate_yuv(%s, %i) buffer_size=%s, sizes=%s, strides=%s",
 *                 fmt, Bpp, self.buffer_size,
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 503, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 503, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 503, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 503, __pyx_L1_error) }
  __pyx_cur_scope->__pyx_v_self->buffer_size = (((__pyx_cur_scope->__pyx_v_self->offsets[2]) + (__pyx_cur_scope->__pyx_v_self->dst_sizes[2])) + (__pyx_cur_scope->__pyx_v_self->dst_strides[2]));

  /* "xpra/codecs/csc_cython/converter.pyx":504
 *             #output buffer ends after V + 1 line of padding:
 *             self.buffer_size = self.offsets[2] + self.dst_sizes[2] + self.dst_strides[2]
 *             log("allocate_yuv(%s, %i) buffer_size=%s, sizes=%s, strides=%s",             # <<<<<<<<<<<<<<
 *                 fmt, Bpp, self.buffer_size,
 *                 (self.dst_sizes[0], self.dst_sizes[1], self.dst_sizes[2]),
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "xpra/codecs/csc_cython/converter.pyx":505
 *             self.buffer_size = self.offsets[2] + self.dst_sizes[2] + self.dst_strides[2]
 *             log("allocate_yuv(%s, %i) buffer_size=%s, sizes=%s, strides=%s",
 *                 fmt, Bpp, self.buffer_size,             # <<<<<<<<<<<<<<
 *                 (self.dst_sizes[0], self.dst_sizes[1], self.dst_sizes[2]),
 *                 (self.dst_strides[0], self.dst_strides[1], self.dst_strides[2])
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 505, __pyx_L1_error) }
  __pyx_t_8 = __Pyx_PyLong_From_unsigned_long(__pyx_cur_scope->__pyx_v_self->buffer_size); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "xpra/codecs/csc_cython/converter.pyx":506
 *             log("allocate_yuv(%s, %i) buffer_size=%s, sizes=%s, strides=%s",
 *                 fmt, Bpp, self.buffer_size,
 *                 (self.dst_sizes[0], self.dst_sizes[1], self.dst_sizes[2]),             # <<<<<<<<<<<<<<
 *                 (self.dst_strides[0], self.dst_strides[1], self.dst_strides[2])
 *                 )
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 506, __pyx_L1_error) }
  __pyx_t_9 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_v_self->dst_sizes[0])); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 506, __pyx_L1_error) }
  __pyx_t_15 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_v_self->dst_sizes[1])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 506, __pyx_L1_error) }
  __pyx_t_16 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_v_self->dst_sizes[2])); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_9);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 506, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_15);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_15) != (0)) __PYX_ERR(0, 506, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_16);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_16) != (0)) __PYX_ERR(0, 506, __pyx_L1_error);
  __pyx_t_9 = 0;
  __pyx_t_15 = 0;
  __pyx_t_16 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":507
 *                 fmt, Bpp, self.buffer_size,
 *                 (self.dst_sizes[0], self.dst_sizes[1], self.dst_sizes[2]),
 *                 (self.dst_strides[0], self.dst_strides[1], self.dst_strides[2])             # <<<<<<<<<<<<<<
 *                 )
 * 
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 507, __pyx_L1_error) }
  __pyx_t_16 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_v_self->dst_strides[0])); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 507, __pyx_L1_error) }
  __pyx_t_15 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_v_self->dst_strides[1])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 507, __pyx_L1_error) }
  __pyx_t_9 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_v_self->dst_strides[2])); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_GIVEREF(__pyx_t_16);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_16) != (0)) __PYX_ERR(0, 507, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_15);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_15) != (0)) __PYX_ERR(0, 507, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_9);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_9) != (0)) __PYX_ERR(0, 507, __pyx_L1_error);
  __pyx_t_16 = 0;
  __pyx_t_15 = 0;
  __pyx_t_9 = 0;
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[7] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_allocate_yuv_s_i_buffer_size_s_s, __pyx_v_fmt, __pyx_v_Bpp, __pyx_t_8, __pyx_t_17, __pyx_t_18};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (7-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":491
 *             assert src_width==dst_width and src_height==dst_height, "scaling is not supported for %s to %s" % (src_format, dst_format)
 * 
 *         def allocate_yuv(fmt="YUV420P", Bpp=1) -> None:             # <<<<<<<<<<<<<<
 *             divs = get_subsampling_divs(fmt)
 *             assert divs, "invalid pixel format '%s'" % fmt
*/

  /* 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_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.init_context.allocate_yuv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_divs);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_div);
  __Pyx_XDECREF(__pyx_v_xdiv);
  __Pyx_XDECREF(__pyx_v_ydiv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":510
 *                 )
 * 
 *         def allocate_rgb(Bpp=4) -> None:             # <<<<<<<<<<<<<<
 *             self.dst_strides[0] = roundup(self.dst_width*Bpp, STRIDE_ROUNDUP)
 *             self.dst_sizes[0] = self.dst_strides[0] * self.dst_height
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_5allocate_rgb(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_5allocate_rgb = {"allocate_rgb", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_5allocate_rgb, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_5allocate_rgb(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_Bpp = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("allocate_rgb (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_Bpp,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 510, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 510, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "allocate_rgb", 0) < (0)) __PYX_ERR(0, 510, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_4)));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 510, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_4)));
    }
    __pyx_v_Bpp = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("allocate_rgb", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 510, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.init_context.allocate_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_4allocate_rgb(__pyx_self, __pyx_v_Bpp);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_4allocate_rgb(PyObject *__pyx_self, PyObject *__pyx_v_Bpp) {
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *__pyx_cur_scope;
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *__pyx_outer_scope;
  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 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("allocate_rgb", 0);
  __pyx_outer_scope = (struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "xpra/codecs/csc_cython/converter.pyx":511
 * 
 *         def allocate_rgb(Bpp=4) -> None:
 *             self.dst_strides[0] = roundup(self.dst_width*Bpp, STRIDE_ROUNDUP)             # <<<<<<<<<<<<<<
 *             self.dst_sizes[0] = self.dst_strides[0] * self.dst_height
 *             self.buffer_size = self.dst_sizes[0]+self.dst_strides[0]
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 511, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_cur_scope->__pyx_v_self->dst_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_Bpp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 511, __pyx_L1_error) }
  (__pyx_cur_scope->__pyx_v_self->dst_strides[0]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_roundup(__pyx_t_3, 2);

  /* "xpra/codecs/csc_cython/converter.pyx":512
 *         def allocate_rgb(Bpp=4) -> None:
 *             self.dst_strides[0] = roundup(self.dst_width*Bpp, STRIDE_ROUNDUP)
 *             self.dst_sizes[0] = self.dst_strides[0] * self.dst_height             # <<<<<<<<<<<<<<
 *             self.buffer_size = self.dst_sizes[0]+self.dst_strides[0]
 *             log("allocate_rgb(%i) buffer_size=%s, dst size=%s, stride=%s",
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 512, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 512, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 512, __pyx_L1_error) }
  (__pyx_cur_scope->__pyx_v_self->dst_sizes[0]) = ((__pyx_cur_scope->__pyx_v_self->dst_strides[0]) * __pyx_cur_scope->__pyx_v_self->dst_height);

  /* "xpra/codecs/csc_cython/converter.pyx":513
 *             self.dst_strides[0] = roundup(self.dst_width*Bpp, STRIDE_ROUNDUP)
 *             self.dst_sizes[0] = self.dst_strides[0] * self.dst_height
 *             self.buffer_size = self.dst_sizes[0]+self.dst_strides[0]             # <<<<<<<<<<<<<<
 *             log("allocate_rgb(%i) buffer_size=%s, dst size=%s, stride=%s",
 *                 Bpp, self.buffer_size, self.dst_sizes[0], self.dst_strides[0])
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 513, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 513, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 513, __pyx_L1_error) }
  __pyx_cur_scope->__pyx_v_self->buffer_size = ((__pyx_cur_scope->__pyx_v_self->dst_sizes[0]) + (__pyx_cur_scope->__pyx_v_self->dst_strides[0]));

  /* "xpra/codecs/csc_cython/converter.pyx":514
 *             self.dst_sizes[0] = self.dst_strides[0] * self.dst_height
 *             self.buffer_size = self.dst_sizes[0]+self.dst_strides[0]
 *             log("allocate_rgb(%i) buffer_size=%s, dst size=%s, stride=%s",             # <<<<<<<<<<<<<<
 *                 Bpp, self.buffer_size, self.dst_sizes[0], self.dst_strides[0])
 * 
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "xpra/codecs/csc_cython/converter.pyx":515
 *             self.buffer_size = self.dst_sizes[0]+self.dst_strides[0]
 *             log("allocate_rgb(%i) buffer_size=%s, dst size=%s, stride=%s",
 *                 Bpp, self.buffer_size, self.dst_sizes[0], self.dst_strides[0])             # <<<<<<<<<<<<<<
 * 
 *         if src_format in ("BGRX", "RGBX", "RGB", "BGR", "r210") and dst_format in ("YUV420P", "YUV444P"):
*/
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 515, __pyx_L1_error) }
  __pyx_t_5 = __Pyx_PyLong_From_unsigned_long(__pyx_cur_scope->__pyx_v_self->buffer_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 515, __pyx_L1_error) }
  __pyx_t_6 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_v_self->dst_sizes[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 515, __pyx_L1_error) }
  __pyx_t_7 = __Pyx_PyLong_From_unsigned_long((__pyx_cur_scope->__pyx_v_self->dst_strides[0])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_allocate_rgb_i_buffer_size_s_dst, __pyx_v_Bpp, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_8, (6-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":510
 *                 )
 * 
 *         def allocate_rgb(Bpp=4) -> None:             # <<<<<<<<<<<<<<
 *             self.dst_strides[0] = roundup(self.dst_width*Bpp, STRIDE_ROUNDUP)
 *             self.dst_sizes[0] = self.dst_strides[0] * self.dst_height
*/

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.init_context.allocate_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":464
 *     cdef object __weakref__
 * 
 *     def init_context(self, int src_width, int src_height, src_format: str,             # <<<<<<<<<<<<<<
 *                            int dst_width, int dst_height, dst_format: str, options: typedict) -> None:
 *         cdef int i
*/

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_init_context(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, int __pyx_v_src_width, int __pyx_v_src_height, PyObject *__pyx_v_src_format, int __pyx_v_dst_width, int __pyx_v_dst_height, PyObject *__pyx_v_dst_format, PyObject *__pyx_v_options) {
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *__pyx_cur_scope;
  int __pyx_v_i;
  PyObject *__pyx_v_assert_no_scaling = 0;
  PyObject *__pyx_v_allocate_yuv = 0;
  PyObject *__pyx_v_allocate_rgb = 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[5];
  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;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  unsigned char __pyx_t_12;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_t_16;
  PyObject *__pyx_t_17[4];
  Py_ssize_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_context", 0);
  __pyx_cur_scope = (struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *)__pyx_tp_new_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 464, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_src_width = __pyx_v_src_width;
  __pyx_cur_scope->__pyx_v_src_height = __pyx_v_src_height;
  __pyx_cur_scope->__pyx_v_src_format = __pyx_v_src_format;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_src_format);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_src_format);
  __pyx_cur_scope->__pyx_v_dst_width = __pyx_v_dst_width;
  __pyx_cur_scope->__pyx_v_dst_height = __pyx_v_dst_height;
  __pyx_cur_scope->__pyx_v_dst_format = __pyx_v_dst_format;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_dst_format);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_dst_format);

  /* "xpra/codecs/csc_cython/converter.pyx":467
 *                            int dst_width, int dst_height, dst_format: str, options: typedict) -> None:
 *         cdef int i
 *         assert src_format in COLORSPACES, "invalid input colorspace: %s (must be one of %s)" % (src_format, tuple(COLORSPACES.keys()))             # <<<<<<<<<<<<<<
 *         assert dst_format in COLORSPACES[src_format], "invalid output colorspace: %s (must be one of %s)" % (dst_format, COLORSPACES[src_format])
 *         log("csc_cython.Converter.init_context%s", (
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_cur_scope->__pyx_v_src_format, __pyx_t_1, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 467, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) {
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_keys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_invalid_input_colorspace;
      __pyx_t_4[1] = __pyx_cur_scope->__pyx_v_src_format;
      __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_must_be_one_of;
      __pyx_t_4[3] = __pyx_t_1;
      __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__2;
      __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 26 + __Pyx_PyUnicode_GET_LENGTH(__pyx_cur_scope->__pyx_v_src_format) + 17 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_cur_scope->__pyx_v_src_format) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 467, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 467, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":468
 *         cdef int i
 *         assert src_format in COLORSPACES, "invalid input colorspace: %s (must be one of %s)" % (src_format, tuple(COLORSPACES.keys()))
 *         assert dst_format in COLORSPACES[src_format], "invalid output colorspace: %s (must be one of %s)" % (dst_format, COLORSPACES[src_format])             # <<<<<<<<<<<<<<
 *         log("csc_cython.Converter.init_context%s", (
 *             src_width, src_height, src_format, dst_width, dst_height, dst_format, options))
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_COLORSPACES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_src_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_cur_scope->__pyx_v_dst_format, __pyx_t_1, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) {
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_src_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_invalid_output_colorspace;
      __pyx_t_4[1] = __pyx_cur_scope->__pyx_v_dst_format;
      __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_must_be_one_of;
      __pyx_t_4[3] = __pyx_t_1;
      __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__2;
      __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 27 + __Pyx_PyUnicode_GET_LENGTH(__pyx_cur_scope->__pyx_v_dst_format) + 17 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_cur_scope->__pyx_v_dst_format) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 468, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 468, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":469
 *         assert src_format in COLORSPACES, "invalid input colorspace: %s (must be one of %s)" % (src_format, tuple(COLORSPACES.keys()))
 *         assert dst_format in COLORSPACES[src_format], "invalid output colorspace: %s (must be one of %s)" % (dst_format, COLORSPACES[src_format])
 *         log("csc_cython.Converter.init_context%s", (             # <<<<<<<<<<<<<<
 *             src_width, src_height, src_format, dst_width, dst_height, dst_format, options))
 *         self.src_width = src_width
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "xpra/codecs/csc_cython/converter.pyx":470
 *         assert dst_format in COLORSPACES[src_format], "invalid output colorspace: %s (must be one of %s)" % (dst_format, COLORSPACES[src_format])
 *         log("csc_cython.Converter.init_context%s", (
 *             src_width, src_height, src_format, dst_width, dst_height, dst_format, options))             # <<<<<<<<<<<<<<
 *         self.src_width = src_width
 *         self.src_height = src_height
*/
  __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_src_width); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_src_height); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_dst_width); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_cur_scope->__pyx_v_dst_height); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 470, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 470, __pyx_L1_error);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_src_format);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_src_format);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_cur_scope->__pyx_v_src_format) != (0)) __PYX_ERR(0, 470, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_8);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_8) != (0)) __PYX_ERR(0, 470, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_9);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_9) != (0)) __PYX_ERR(0, 470, __pyx_L1_error);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_dst_format);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_dst_format);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_cur_scope->__pyx_v_dst_format) != (0)) __PYX_ERR(0, 470, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_v_options) != (0)) __PYX_ERR(0, 470, __pyx_L1_error);
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_11 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_11 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_csc_cython_Converter_init_contex, __pyx_t_10};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_11, (3-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":471
 *         log("csc_cython.Converter.init_context%s", (
 *             src_width, src_height, src_format, dst_width, dst_height, dst_format, options))
 *         self.src_width = src_width             # <<<<<<<<<<<<<<
 *         self.src_height = src_height
 *         self.dst_width = dst_width
*/
  __pyx_cur_scope->__pyx_v_self->src_width = __pyx_cur_scope->__pyx_v_src_width;

  /* "xpra/codecs/csc_cython/converter.pyx":472
 *             src_width, src_height, src_format, dst_width, dst_height, dst_format, options))
 *         self.src_width = src_width
 *         self.src_height = src_height             # <<<<<<<<<<<<<<
 *         self.dst_width = dst_width
 *         self.dst_height = dst_height
*/
  __pyx_cur_scope->__pyx_v_self->src_height = __pyx_cur_scope->__pyx_v_src_height;

  /* "xpra/codecs/csc_cython/converter.pyx":473
 *         self.src_width = src_width
 *         self.src_height = src_height
 *         self.dst_width = dst_width             # <<<<<<<<<<<<<<
 *         self.dst_height = dst_height
 *         self.src_format = src_format
*/
  __pyx_cur_scope->__pyx_v_self->dst_width = __pyx_cur_scope->__pyx_v_dst_width;

  /* "xpra/codecs/csc_cython/converter.pyx":474
 *         self.src_height = src_height
 *         self.dst_width = dst_width
 *         self.dst_height = dst_height             # <<<<<<<<<<<<<<
 *         self.src_format = src_format
 *         self.dst_format = dst_format
*/
  __pyx_cur_scope->__pyx_v_self->dst_height = __pyx_cur_scope->__pyx_v_dst_height;

  /* "xpra/codecs/csc_cython/converter.pyx":475
 *         self.dst_width = dst_width
 *         self.dst_height = dst_height
 *         self.src_format = src_format             # <<<<<<<<<<<<<<
 *         self.dst_format = dst_format
 *         self.full_range = options.boolget("full-range", True)
*/
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_src_format);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_src_format);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->src_format);
  __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->src_format);
  __pyx_cur_scope->__pyx_v_self->src_format = __pyx_cur_scope->__pyx_v_src_format;

  /* "xpra/codecs/csc_cython/converter.pyx":476
 *         self.dst_height = dst_height
 *         self.src_format = src_format
 *         self.dst_format = dst_format             # <<<<<<<<<<<<<<
 *         self.full_range = options.boolget("full-range", True)
 * 
*/
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_dst_format);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_dst_format);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->dst_format);
  __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->dst_format);
  __pyx_cur_scope->__pyx_v_self->dst_format = __pyx_cur_scope->__pyx_v_dst_format;

  /* "xpra/codecs/csc_cython/converter.pyx":477
 *         self.src_format = src_format
 *         self.dst_format = dst_format
 *         self.full_range = options.boolget("full-range", True)             # <<<<<<<<<<<<<<
 * 
 *         self.time = 0
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_mstate_global->__pyx_n_u_boolget); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[1], NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_12 = __Pyx_PyLong_As_unsigned_char(__pyx_t_5); if (unlikely((__pyx_t_12 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_cur_scope->__pyx_v_self->full_range = __pyx_t_12;

  /* "xpra/codecs/csc_cython/converter.pyx":479
 *         self.full_range = options.boolget("full-range", True)
 * 
 *         self.time = 0             # <<<<<<<<<<<<<<
 *         self.frames = 0
 * 
*/
  __pyx_cur_scope->__pyx_v_self->time = 0.0;

  /* "xpra/codecs/csc_cython/converter.pyx":480
 * 
 *         self.time = 0
 *         self.frames = 0             # <<<<<<<<<<<<<<
 * 
 *         #explicitly clear all strides / sizes / offsets:
*/
  __pyx_cur_scope->__pyx_v_self->frames = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":483
 * 
 *         #explicitly clear all strides / sizes / offsets:
 *         for i in range(2):             # <<<<<<<<<<<<<<
 *             self.dst_strides[i] = 0
 *             self.dst_sizes[i]   = 0
*/
  for (__pyx_t_13 = 0; __pyx_t_13 < 2; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "xpra/codecs/csc_cython/converter.pyx":484
 *         #explicitly clear all strides / sizes / offsets:
 *         for i in range(2):
 *             self.dst_strides[i] = 0             # <<<<<<<<<<<<<<
 *             self.dst_sizes[i]   = 0
 *             self.offsets[i]     = 0
*/
    (__pyx_cur_scope->__pyx_v_self->dst_strides[__pyx_v_i]) = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":485
 *         for i in range(2):
 *             self.dst_strides[i] = 0
 *             self.dst_sizes[i]   = 0             # <<<<<<<<<<<<<<
 *             self.offsets[i]     = 0
 * 
*/
    (__pyx_cur_scope->__pyx_v_self->dst_sizes[__pyx_v_i]) = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":486
 *             self.dst_strides[i] = 0
 *             self.dst_sizes[i]   = 0
 *             self.offsets[i]     = 0             # <<<<<<<<<<<<<<
 * 
 *         def assert_no_scaling() -> None:
*/
    (__pyx_cur_scope->__pyx_v_self->offsets[__pyx_v_i]) = 0;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":488
 *             self.offsets[i]     = 0
 * 
 *         def assert_no_scaling() -> None:             # <<<<<<<<<<<<<<
 *             assert src_width==dst_width and src_height==dst_height, "scaling is not supported for %s to %s" % (src_format, dst_format)
 * 
*/
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 488, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_1assert_no_scaling, 0, __pyx_mstate_global->__pyx_n_u_init_context_locals_assert_no_sc, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_assert_no_scaling = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":491
 *             assert src_width==dst_width and src_height==dst_height, "scaling is not supported for %s to %s" % (src_format, dst_format)
 * 
 *         def allocate_yuv(fmt="YUV420P", Bpp=1) -> None:             # <<<<<<<<<<<<<<
 *             divs = get_subsampling_divs(fmt)
 *             assert divs, "invalid pixel format '%s'" % fmt
*/
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 491, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_3allocate_yuv, 0, __pyx_mstate_global->__pyx_n_u_init_context_locals_allocate_yuv, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_allocate_yuv = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":510
 *                 )
 * 
 *         def allocate_rgb(Bpp=4) -> None:             # <<<<<<<<<<<<<<
 *             self.dst_strides[0] = roundup(self.dst_width*Bpp, STRIDE_ROUNDUP)
 *             self.dst_sizes[0] = self.dst_strides[0] * self.dst_height
*/
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 510, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_5allocate_rgb, 0, __pyx_mstate_global->__pyx_n_u_init_context_locals_allocate_rgb, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[3]);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_allocate_rgb = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":517
 *                 Bpp, self.buffer_size, self.dst_sizes[0], self.dst_strides[0])
 * 
 *         if src_format in ("BGRX", "RGBX", "RGB", "BGR", "r210") and dst_format in ("YUV420P", "YUV444P"):             # <<<<<<<<<<<<<<
 *             if dst_format == "YUV420P":
 *                 allocate_yuv(dst_format)
*/
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_src_format);
  __pyx_t_14 = __pyx_cur_scope->__pyx_v_src_format;
  __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 517, __pyx_L1_error)
  if (!__pyx_t_16) {
  } else {
    __pyx_t_15 = __pyx_t_16;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_RGBX, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 517, __pyx_L1_error)
  if (!__pyx_t_16) {
  } else {
    __pyx_t_15 = __pyx_t_16;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_RGB, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 517, __pyx_L1_error)
  if (!__pyx_t_16) {
  } else {
    __pyx_t_15 = __pyx_t_16;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_BGR, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 517, __pyx_L1_error)
  if (!__pyx_t_16) {
  } else {
    __pyx_t_15 = __pyx_t_16;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_r210, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 517, __pyx_L1_error)
  __pyx_t_15 = __pyx_t_16;
  __pyx_L8_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_16 = __pyx_t_15;
  if (__pyx_t_16) {
  } else {
    __pyx_t_2 = __pyx_t_16;
    goto __pyx_L6_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_dst_format);
  __pyx_t_14 = __pyx_cur_scope->__pyx_v_dst_format;
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_YUV420P, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 517, __pyx_L1_error)
  if (!__pyx_t_15) {
  } else {
    __pyx_t_16 = __pyx_t_15;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_YUV444P, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 517, __pyx_L1_error)
  __pyx_t_16 = __pyx_t_15;
  __pyx_L13_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_15 = __pyx_t_16;
  __pyx_t_2 = __pyx_t_15;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_2) {

    /* "xpra/codecs/csc_cython/converter.pyx":518
 * 
 *         if src_format in ("BGRX", "RGBX", "RGB", "BGR", "r210") and dst_format in ("YUV420P", "YUV444P"):
 *             if dst_format == "YUV420P":             # <<<<<<<<<<<<<<
 *                 allocate_yuv(dst_format)
 *                 if src_format=="BGRX":
*/
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_YUV420P, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 518, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "xpra/codecs/csc_cython/converter.pyx":519
 *         if src_format in ("BGRX", "RGBX", "RGB", "BGR", "r210") and dst_format in ("YUV420P", "YUV444P"):
 *             if dst_format == "YUV420P":
 *                 allocate_yuv(dst_format)             # <<<<<<<<<<<<<<
 *                 if src_format=="BGRX":
 *                     self.convert_image_function = self.BGRX_to_YUV420P
*/
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_v_allocate_yuv, __pyx_cur_scope->__pyx_v_dst_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "xpra/codecs/csc_cython/converter.pyx":520
 *             if dst_format == "YUV420P":
 *                 allocate_yuv(dst_format)
 *                 if src_format=="BGRX":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.BGRX_to_YUV420P
 *                 elif src_format=="RGBX":
*/
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 520, __pyx_L1_error)
      if (__pyx_t_2) {

        /* "xpra/codecs/csc_cython/converter.pyx":521
 *                 allocate_yuv(dst_format)
 *                 if src_format=="BGRX":
 *                     self.convert_image_function = self.BGRX_to_YUV420P             # <<<<<<<<<<<<<<
 *                 elif src_format=="RGBX":
 *                     self.convert_image_function = self.RGBX_to_YUV420P
*/
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_BGRX_to_YUV420P); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "xpra/codecs/csc_cython/converter.pyx":520
 *             if dst_format == "YUV420P":
 *                 allocate_yuv(dst_format)
 *                 if src_format=="BGRX":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.BGRX_to_YUV420P
 *                 elif src_format=="RGBX":
*/
        goto __pyx_L16;
      }

      /* "xpra/codecs/csc_cython/converter.pyx":522
 *                 if src_format=="BGRX":
 *                     self.convert_image_function = self.BGRX_to_YUV420P
 *                 elif src_format=="RGBX":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.RGBX_to_YUV420P
 *                 elif src_format=="BGR":
*/
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_RGBX, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 522, __pyx_L1_error)
      if (__pyx_t_2) {

        /* "xpra/codecs/csc_cython/converter.pyx":523
 *                     self.convert_image_function = self.BGRX_to_YUV420P
 *                 elif src_format=="RGBX":
 *                     self.convert_image_function = self.RGBX_to_YUV420P             # <<<<<<<<<<<<<<
 *                 elif src_format=="BGR":
 *                     self.convert_image_function = self.BGR_to_YUV420P
*/
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_RGBX_to_YUV420P); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "xpra/codecs/csc_cython/converter.pyx":522
 *                 if src_format=="BGRX":
 *                     self.convert_image_function = self.BGRX_to_YUV420P
 *                 elif src_format=="RGBX":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.RGBX_to_YUV420P
 *                 elif src_format=="BGR":
*/
        goto __pyx_L16;
      }

      /* "xpra/codecs/csc_cython/converter.pyx":524
 *                 elif src_format=="RGBX":
 *                     self.convert_image_function = self.RGBX_to_YUV420P
 *                 elif src_format=="BGR":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.BGR_to_YUV420P
 *                 elif src_format=="RGB":
*/
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_BGR, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 524, __pyx_L1_error)
      if (__pyx_t_2) {

        /* "xpra/codecs/csc_cython/converter.pyx":525
 *                     self.convert_image_function = self.RGBX_to_YUV420P
 *                 elif src_format=="BGR":
 *                     self.convert_image_function = self.BGR_to_YUV420P             # <<<<<<<<<<<<<<
 *                 elif src_format=="RGB":
 *                     self.convert_image_function = self.RGB_to_YUV420P
*/
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_BGR_to_YUV420P); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "xpra/codecs/csc_cython/converter.pyx":524
 *                 elif src_format=="RGBX":
 *                     self.convert_image_function = self.RGBX_to_YUV420P
 *                 elif src_format=="BGR":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.BGR_to_YUV420P
 *                 elif src_format=="RGB":
*/
        goto __pyx_L16;
      }

      /* "xpra/codecs/csc_cython/converter.pyx":526
 *                 elif src_format=="BGR":
 *                     self.convert_image_function = self.BGR_to_YUV420P
 *                 elif src_format=="RGB":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.RGB_to_YUV420P
 *                 else:
*/
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_RGB, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 526, __pyx_L1_error)
      if (__pyx_t_2) {

        /* "xpra/codecs/csc_cython/converter.pyx":527
 *                     self.convert_image_function = self.BGR_to_YUV420P
 *                 elif src_format=="RGB":
 *                     self.convert_image_function = self.RGB_to_YUV420P             # <<<<<<<<<<<<<<
 *                 else:
 *                     assert src_format=="r210"
*/
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_RGB_to_YUV420P); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 527, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "xpra/codecs/csc_cython/converter.pyx":526
 *                 elif src_format=="BGR":
 *                     self.convert_image_function = self.BGR_to_YUV420P
 *                 elif src_format=="RGB":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.RGB_to_YUV420P
 *                 else:
*/
        goto __pyx_L16;
      }

      /* "xpra/codecs/csc_cython/converter.pyx":529
 *                     self.convert_image_function = self.RGB_to_YUV420P
 *                 else:
 *                     assert src_format=="r210"             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.r210_to_YUV420P
 *             elif dst_format == "YUV444P":
*/
      /*else*/ {
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_r210, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 529, __pyx_L1_error)
          if (unlikely(!__pyx_t_2)) {
            __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
            __PYX_ERR(0, 529, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(0, 529, __pyx_L1_error)
        #endif

        /* "xpra/codecs/csc_cython/converter.pyx":530
 *                 else:
 *                     assert src_format=="r210"
 *                     self.convert_image_function = self.r210_to_YUV420P             # <<<<<<<<<<<<<<
 *             elif dst_format == "YUV444P":
 *                 allocate_yuv(dst_format)
*/
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_r210_to_YUV420P); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      __pyx_L16:;

      /* "xpra/codecs/csc_cython/converter.pyx":518
 * 
 *         if src_format in ("BGRX", "RGBX", "RGB", "BGR", "r210") and dst_format in ("YUV420P", "YUV444P"):
 *             if dst_format == "YUV420P":             # <<<<<<<<<<<<<<
 *                 allocate_yuv(dst_format)
 *                 if src_format=="BGRX":
*/
      goto __pyx_L15;
    }

    /* "xpra/codecs/csc_cython/converter.pyx":531
 *                     assert src_format=="r210"
 *                     self.convert_image_function = self.r210_to_YUV420P
 *             elif dst_format == "YUV444P":             # <<<<<<<<<<<<<<
 *                 allocate_yuv(dst_format)
 *                 if src_format=="BGRX":
*/
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_YUV444P, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 531, __pyx_L1_error)
    if (likely(__pyx_t_2)) {

      /* "xpra/codecs/csc_cython/converter.pyx":532
 *                     self.convert_image_function = self.r210_to_YUV420P
 *             elif dst_format == "YUV444P":
 *                 allocate_yuv(dst_format)             # <<<<<<<<<<<<<<
 *                 if src_format=="BGRX":
 *                     self.convert_image_function = self.BGRX_to_YUV444P
*/
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_v_allocate_yuv, __pyx_cur_scope->__pyx_v_dst_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "xpra/codecs/csc_cython/converter.pyx":533
 *             elif dst_format == "YUV444P":
 *                 allocate_yuv(dst_format)
 *                 if src_format=="BGRX":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.BGRX_to_YUV444P
 *                 elif src_format=="RGBX":
*/
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 533, __pyx_L1_error)
      if (__pyx_t_2) {

        /* "xpra/codecs/csc_cython/converter.pyx":534
 *                 allocate_yuv(dst_format)
 *                 if src_format=="BGRX":
 *                     self.convert_image_function = self.BGRX_to_YUV444P             # <<<<<<<<<<<<<<
 *                 elif src_format=="RGBX":
 *                     self.convert_image_function = self.RGBX_to_YUV444P
*/
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_BGRX_to_YUV444P); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 534, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "xpra/codecs/csc_cython/converter.pyx":533
 *             elif dst_format == "YUV444P":
 *                 allocate_yuv(dst_format)
 *                 if src_format=="BGRX":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.BGRX_to_YUV444P
 *                 elif src_format=="RGBX":
*/
        goto __pyx_L17;
      }

      /* "xpra/codecs/csc_cython/converter.pyx":535
 *                 if src_format=="BGRX":
 *                     self.convert_image_function = self.BGRX_to_YUV444P
 *                 elif src_format=="RGBX":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.RGBX_to_YUV444P
 *                 elif src_format=="BGR":
*/
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_RGBX, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 535, __pyx_L1_error)
      if (__pyx_t_2) {

        /* "xpra/codecs/csc_cython/converter.pyx":536
 *                     self.convert_image_function = self.BGRX_to_YUV444P
 *                 elif src_format=="RGBX":
 *                     self.convert_image_function = self.RGBX_to_YUV444P             # <<<<<<<<<<<<<<
 *                 elif src_format=="BGR":
 *                     self.convert_image_function = self.BGR_to_YUV444P
*/
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_RGBX_to_YUV444P); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "xpra/codecs/csc_cython/converter.pyx":535
 *                 if src_format=="BGRX":
 *                     self.convert_image_function = self.BGRX_to_YUV444P
 *                 elif src_format=="RGBX":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.RGBX_to_YUV444P
 *                 elif src_format=="BGR":
*/
        goto __pyx_L17;
      }

      /* "xpra/codecs/csc_cython/converter.pyx":537
 *                 elif src_format=="RGBX":
 *                     self.convert_image_function = self.RGBX_to_YUV444P
 *                 elif src_format=="BGR":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.BGR_to_YUV444P
 *                 elif src_format=="RGB":
*/
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_BGR, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 537, __pyx_L1_error)
      if (__pyx_t_2) {

        /* "xpra/codecs/csc_cython/converter.pyx":538
 *                     self.convert_image_function = self.RGBX_to_YUV444P
 *                 elif src_format=="BGR":
 *                     self.convert_image_function = self.BGR_to_YUV444P             # <<<<<<<<<<<<<<
 *                 elif src_format=="RGB":
 *                     self.convert_image_function = self.RGB_to_YUV444P
*/
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_BGR_to_YUV444P); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "xpra/codecs/csc_cython/converter.pyx":537
 *                 elif src_format=="RGBX":
 *                     self.convert_image_function = self.RGBX_to_YUV444P
 *                 elif src_format=="BGR":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.BGR_to_YUV444P
 *                 elif src_format=="RGB":
*/
        goto __pyx_L17;
      }

      /* "xpra/codecs/csc_cython/converter.pyx":539
 *                 elif src_format=="BGR":
 *                     self.convert_image_function = self.BGR_to_YUV444P
 *                 elif src_format=="RGB":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.RGB_to_YUV444P
 *                 else:
*/
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_RGB, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 539, __pyx_L1_error)
      if (likely(__pyx_t_2)) {

        /* "xpra/codecs/csc_cython/converter.pyx":540
 *                     self.convert_image_function = self.BGR_to_YUV444P
 *                 elif src_format=="RGB":
 *                     self.convert_image_function = self.RGB_to_YUV444P             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(f"unsupported dst format {dst_format} for {src_format}")
*/
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_RGB_to_YUV444P); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
        __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "xpra/codecs/csc_cython/converter.pyx":539
 *                 elif src_format=="BGR":
 *                     self.convert_image_function = self.BGR_to_YUV444P
 *                 elif src_format=="RGB":             # <<<<<<<<<<<<<<
 *                     self.convert_image_function = self.RGB_to_YUV444P
 *                 else:
*/
        goto __pyx_L17;
      }

      /* "xpra/codecs/csc_cython/converter.pyx":542
 *                     self.convert_image_function = self.RGB_to_YUV444P
 *                 else:
 *                     raise ValueError(f"unsupported dst format {dst_format} for {src_format}")             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(f"unsupported dst format {dst_format}")
*/
      /*else*/ {
        __pyx_t_5 = NULL;
        __pyx_t_17[0] = __pyx_mstate_global->__pyx_kp_u_unsupported_dst_format;
        __pyx_t_17[1] = __pyx_cur_scope->__pyx_v_dst_format;
        __pyx_t_17[2] = __pyx_mstate_global->__pyx_kp_u_for;
        __pyx_t_17[3] = __pyx_cur_scope->__pyx_v_src_format;
        __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_17, 4, 23 + __Pyx_PyUnicode_GET_LENGTH(__pyx_cur_scope->__pyx_v_dst_format) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_cur_scope->__pyx_v_src_format), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_cur_scope->__pyx_v_dst_format) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_cur_scope->__pyx_v_src_format));
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 542, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10};
          __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __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(0, 542, __pyx_L1_error)
      }
      __pyx_L17:;

      /* "xpra/codecs/csc_cython/converter.pyx":531
 *                     assert src_format=="r210"
 *                     self.convert_image_function = self.r210_to_YUV420P
 *             elif dst_format == "YUV444P":             # <<<<<<<<<<<<<<
 *                 allocate_yuv(dst_format)
 *                 if src_format=="BGRX":
*/
      goto __pyx_L15;
    }

    /* "xpra/codecs/csc_cython/converter.pyx":544
 *                     raise ValueError(f"unsupported dst format {dst_format} for {src_format}")
 *             else:
 *                 raise ValueError(f"unsupported dst format {dst_format}")             # <<<<<<<<<<<<<<
 *         elif src_format=="r210" and dst_format=="BGR48":
 *             assert_no_scaling()
*/
    /*else*/ {
      __pyx_t_10 = NULL;
      __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_unsupported_dst_format, __pyx_cur_scope->__pyx_v_dst_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_5};
        __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __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(0, 544, __pyx_L1_error)
    }
    __pyx_L15:;

    /* "xpra/codecs/csc_cython/converter.pyx":517
 *                 Bpp, self.buffer_size, self.dst_sizes[0], self.dst_strides[0])
 * 
 *         if src_format in ("BGRX", "RGBX", "RGB", "BGR", "r210") and dst_format in ("YUV420P", "YUV444P"):             # <<<<<<<<<<<<<<
 *             if dst_format == "YUV420P":
 *                 allocate_yuv(dst_format)
*/
    goto __pyx_L5;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":545
 *             else:
 *                 raise ValueError(f"unsupported dst format {dst_format}")
 *         elif src_format=="r210" and dst_format=="BGR48":             # <<<<<<<<<<<<<<
 *             assert_no_scaling()
 *             allocate_rgb(6)
*/
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_r210, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 545, __pyx_L1_error)
  if (__pyx_t_15) {
  } else {
    __pyx_t_2 = __pyx_t_15;
    goto __pyx_L18_bool_binop_done;
  }
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_BGR48, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 545, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_15;
  __pyx_L18_bool_binop_done:;
  if (__pyx_t_2) {

    /* "xpra/codecs/csc_cython/converter.pyx":546
 *                 raise ValueError(f"unsupported dst format {dst_format}")
 *         elif src_format=="r210" and dst_format=="BGR48":
 *             assert_no_scaling()             # <<<<<<<<<<<<<<
 *             allocate_rgb(6)
 *             self.convert_image_function = self.r210_to_BGR48
*/
    __pyx_t_3 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_assert_no_scaling(__pyx_v_assert_no_scaling); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":547
 *         elif src_format=="r210" and dst_format=="BGR48":
 *             assert_no_scaling()
 *             allocate_rgb(6)             # <<<<<<<<<<<<<<
 *             self.convert_image_function = self.r210_to_BGR48
 *         elif src_format=="r210" and dst_format=="YUV444P10":
*/
    __pyx_t_3 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_4allocate_rgb(__pyx_v_allocate_rgb, __pyx_mstate_global->__pyx_int_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 547, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":548
 *             assert_no_scaling()
 *             allocate_rgb(6)
 *             self.convert_image_function = self.r210_to_BGR48             # <<<<<<<<<<<<<<
 *         elif src_format=="r210" and dst_format=="YUV444P10":
 *             assert_no_scaling()
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_r210_to_BGR48); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
    __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":545
 *             else:
 *                 raise ValueError(f"unsupported dst format {dst_format}")
 *         elif src_format=="r210" and dst_format=="BGR48":             # <<<<<<<<<<<<<<
 *             assert_no_scaling()
 *             allocate_rgb(6)
*/
    goto __pyx_L5;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":549
 *             allocate_rgb(6)
 *             self.convert_image_function = self.r210_to_BGR48
 *         elif src_format=="r210" and dst_format=="YUV444P10":             # <<<<<<<<<<<<<<
 *             assert_no_scaling()
 *             allocate_yuv(dst_format, 2)
*/
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_r210, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 549, __pyx_L1_error)
  if (__pyx_t_15) {
  } else {
    __pyx_t_2 = __pyx_t_15;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_YUV444P10, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 549, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_15;
  __pyx_L20_bool_binop_done:;
  if (__pyx_t_2) {

    /* "xpra/codecs/csc_cython/converter.pyx":550
 *             self.convert_image_function = self.r210_to_BGR48
 *         elif src_format=="r210" and dst_format=="YUV444P10":
 *             assert_no_scaling()             # <<<<<<<<<<<<<<
 *             allocate_yuv(dst_format, 2)
 *             self.convert_image_function = self.r210_to_YUV444P10
*/
    __pyx_t_3 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_assert_no_scaling(__pyx_v_assert_no_scaling); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":551
 *         elif src_format=="r210" and dst_format=="YUV444P10":
 *             assert_no_scaling()
 *             allocate_yuv(dst_format, 2)             # <<<<<<<<<<<<<<
 *             self.convert_image_function = self.r210_to_YUV444P10
 *         elif src_format=="YUV444P10" and dst_format=="r210":
*/
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_dst_format;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_2allocate_yuv(__pyx_v_allocate_yuv, __pyx_t_3, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":552
 *             assert_no_scaling()
 *             allocate_yuv(dst_format, 2)
 *             self.convert_image_function = self.r210_to_YUV444P10             # <<<<<<<<<<<<<<
 *         elif src_format=="YUV444P10" and dst_format=="r210":
 *             assert_no_scaling()
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_r210_to_YUV444P10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 552, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
    __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":549
 *             allocate_rgb(6)
 *             self.convert_image_function = self.r210_to_BGR48
 *         elif src_format=="r210" and dst_format=="YUV444P10":             # <<<<<<<<<<<<<<
 *             assert_no_scaling()
 *             allocate_yuv(dst_format, 2)
*/
    goto __pyx_L5;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":553
 *             allocate_yuv(dst_format, 2)
 *             self.convert_image_function = self.r210_to_YUV444P10
 *         elif src_format=="YUV444P10" and dst_format=="r210":             # <<<<<<<<<<<<<<
 *             assert_no_scaling()
 *             allocate_rgb(4)
*/
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_YUV444P10, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 553, __pyx_L1_error)
  if (__pyx_t_15) {
  } else {
    __pyx_t_2 = __pyx_t_15;
    goto __pyx_L22_bool_binop_done;
  }
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_r210, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 553, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_15;
  __pyx_L22_bool_binop_done:;
  if (__pyx_t_2) {

    /* "xpra/codecs/csc_cython/converter.pyx":554
 *             self.convert_image_function = self.r210_to_YUV444P10
 *         elif src_format=="YUV444P10" and dst_format=="r210":
 *             assert_no_scaling()             # <<<<<<<<<<<<<<
 *             allocate_rgb(4)
 *             self.convert_image_function = self.YUV444P10_to_r210
*/
    __pyx_t_5 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_assert_no_scaling(__pyx_v_assert_no_scaling); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 554, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":555
 *         elif src_format=="YUV444P10" and dst_format=="r210":
 *             assert_no_scaling()
 *             allocate_rgb(4)             # <<<<<<<<<<<<<<
 *             self.convert_image_function = self.YUV444P10_to_r210
 *         elif src_format=="YUV444P" and (dst_format=="BGRX" or dst_format=="RGBX"):
*/
    __pyx_t_5 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_4allocate_rgb(__pyx_v_allocate_rgb, __pyx_mstate_global->__pyx_int_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":556
 *             assert_no_scaling()
 *             allocate_rgb(4)
 *             self.convert_image_function = self.YUV444P10_to_r210             # <<<<<<<<<<<<<<
 *         elif src_format=="YUV444P" and (dst_format=="BGRX" or dst_format=="RGBX"):
 *             assert_no_scaling()
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_YUV444P10_to_r210); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
    __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":553
 *             allocate_yuv(dst_format, 2)
 *             self.convert_image_function = self.r210_to_YUV444P10
 *         elif src_format=="YUV444P10" and dst_format=="r210":             # <<<<<<<<<<<<<<
 *             assert_no_scaling()
 *             allocate_rgb(4)
*/
    goto __pyx_L5;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":557
 *             allocate_rgb(4)
 *             self.convert_image_function = self.YUV444P10_to_r210
 *         elif src_format=="YUV444P" and (dst_format=="BGRX" or dst_format=="RGBX"):             # <<<<<<<<<<<<<<
 *             assert_no_scaling()
 *             allocate_rgb(3)
*/
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_YUV444P, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 557, __pyx_L1_error)
  if (__pyx_t_15) {
  } else {
    __pyx_t_2 = __pyx_t_15;
    goto __pyx_L24_bool_binop_done;
  }
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 557, __pyx_L1_error)
  if (!__pyx_t_15) {
  } else {
    __pyx_t_2 = __pyx_t_15;
    goto __pyx_L24_bool_binop_done;
  }
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_RGBX, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 557, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_15;
  __pyx_L24_bool_binop_done:;
  if (__pyx_t_2) {

    /* "xpra/codecs/csc_cython/converter.pyx":558
 *             self.convert_image_function = self.YUV444P10_to_r210
 *         elif src_format=="YUV444P" and (dst_format=="BGRX" or dst_format=="RGBX"):
 *             assert_no_scaling()             # <<<<<<<<<<<<<<
 *             allocate_rgb(3)
 *             self.convert_image_function = self.YUV444P_to_RGB
*/
    __pyx_t_5 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_assert_no_scaling(__pyx_v_assert_no_scaling); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":559
 *         elif src_format=="YUV444P" and (dst_format=="BGRX" or dst_format=="RGBX"):
 *             assert_no_scaling()
 *             allocate_rgb(3)             # <<<<<<<<<<<<<<
 *             self.convert_image_function = self.YUV444P_to_RGB
 *         elif src_format=="GBRP10" and dst_format=="r210":
*/
    __pyx_t_5 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_4allocate_rgb(__pyx_v_allocate_rgb, __pyx_mstate_global->__pyx_int_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":560
 *             assert_no_scaling()
 *             allocate_rgb(3)
 *             self.convert_image_function = self.YUV444P_to_RGB             # <<<<<<<<<<<<<<
 *         elif src_format=="GBRP10" and dst_format=="r210":
 *             assert_no_scaling()
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_YUV444P_to_RGB); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
    __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":557
 *             allocate_rgb(4)
 *             self.convert_image_function = self.YUV444P10_to_r210
 *         elif src_format=="YUV444P" and (dst_format=="BGRX" or dst_format=="RGBX"):             # <<<<<<<<<<<<<<
 *             assert_no_scaling()
 *             allocate_rgb(3)
*/
    goto __pyx_L5;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":561
 *             allocate_rgb(3)
 *             self.convert_image_function = self.YUV444P_to_RGB
 *         elif src_format=="GBRP10" and dst_format=="r210":             # <<<<<<<<<<<<<<
 *             assert_no_scaling()
 *             allocate_rgb(4)
*/
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_GBRP10, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 561, __pyx_L1_error)
  if (__pyx_t_15) {
  } else {
    __pyx_t_2 = __pyx_t_15;
    goto __pyx_L27_bool_binop_done;
  }
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_r210, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 561, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_15;
  __pyx_L27_bool_binop_done:;
  if (__pyx_t_2) {

    /* "xpra/codecs/csc_cython/converter.pyx":562
 *             self.convert_image_function = self.YUV444P_to_RGB
 *         elif src_format=="GBRP10" and dst_format=="r210":
 *             assert_no_scaling()             # <<<<<<<<<<<<<<
 *             allocate_rgb(4)
 *             self.convert_image_function = self.GBRP10_to_r210
*/
    __pyx_t_5 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_assert_no_scaling(__pyx_v_assert_no_scaling); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":563
 *         elif src_format=="GBRP10" and dst_format=="r210":
 *             assert_no_scaling()
 *             allocate_rgb(4)             # <<<<<<<<<<<<<<
 *             self.convert_image_function = self.GBRP10_to_r210
 *         elif src_format=="YUV420P" and dst_format in ("RGBX", "BGRX", "RGB", "BGR"):
*/
    __pyx_t_5 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_4allocate_rgb(__pyx_v_allocate_rgb, __pyx_mstate_global->__pyx_int_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":564
 *             assert_no_scaling()
 *             allocate_rgb(4)
 *             self.convert_image_function = self.GBRP10_to_r210             # <<<<<<<<<<<<<<
 *         elif src_format=="YUV420P" and dst_format in ("RGBX", "BGRX", "RGB", "BGR"):
 *             #3 or 4 bytes per pixel:
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_GBRP10_to_r210); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
    __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":561
 *             allocate_rgb(3)
 *             self.convert_image_function = self.YUV444P_to_RGB
 *         elif src_format=="GBRP10" and dst_format=="r210":             # <<<<<<<<<<<<<<
 *             assert_no_scaling()
 *             allocate_rgb(4)
*/
    goto __pyx_L5;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":565
 *             allocate_rgb(4)
 *             self.convert_image_function = self.GBRP10_to_r210
 *         elif src_format=="YUV420P" and dst_format in ("RGBX", "BGRX", "RGB", "BGR"):             # <<<<<<<<<<<<<<
 *             #3 or 4 bytes per pixel:
 *             allocate_rgb(len(dst_format))
*/
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_YUV420P, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 565, __pyx_L1_error)
  if (__pyx_t_15) {
  } else {
    __pyx_t_2 = __pyx_t_15;
    goto __pyx_L29_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_dst_format);
  __pyx_t_14 = __pyx_cur_scope->__pyx_v_dst_format;
  __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_RGBX, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 565, __pyx_L1_error)
  if (!__pyx_t_16) {
  } else {
    __pyx_t_15 = __pyx_t_16;
    goto __pyx_L31_bool_binop_done;
  }
  __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 565, __pyx_L1_error)
  if (!__pyx_t_16) {
  } else {
    __pyx_t_15 = __pyx_t_16;
    goto __pyx_L31_bool_binop_done;
  }
  __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_RGB, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 565, __pyx_L1_error)
  if (!__pyx_t_16) {
  } else {
    __pyx_t_15 = __pyx_t_16;
    goto __pyx_L31_bool_binop_done;
  }
  __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_BGR, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 565, __pyx_L1_error)
  __pyx_t_15 = __pyx_t_16;
  __pyx_L31_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_16 = __pyx_t_15;
  __pyx_t_2 = __pyx_t_16;
  __pyx_L29_bool_binop_done:;
  if (__pyx_t_2) {

    /* "xpra/codecs/csc_cython/converter.pyx":567
 *         elif src_format=="YUV420P" and dst_format in ("RGBX", "BGRX", "RGB", "BGR"):
 *             #3 or 4 bytes per pixel:
 *             allocate_rgb(len(dst_format))             # <<<<<<<<<<<<<<
 *             if dst_format=="RGBX":
 *                 self.convert_image_function = self.YUV420P_to_RGBX
*/
    __pyx_t_5 = __pyx_cur_scope->__pyx_v_dst_format;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_18 = __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyLong_FromSsize_t(__pyx_t_18); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_4allocate_rgb(__pyx_v_allocate_rgb, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":568
 *             #3 or 4 bytes per pixel:
 *             allocate_rgb(len(dst_format))
 *             if dst_format=="RGBX":             # <<<<<<<<<<<<<<
 *                 self.convert_image_function = self.YUV420P_to_RGBX
 *             elif dst_format=="BGRX":
*/
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_RGBX, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 568, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "xpra/codecs/csc_cython/converter.pyx":569
 *             allocate_rgb(len(dst_format))
 *             if dst_format=="RGBX":
 *                 self.convert_image_function = self.YUV420P_to_RGBX             # <<<<<<<<<<<<<<
 *             elif dst_format=="BGRX":
 *                 self.convert_image_function = self.YUV420P_to_BGRX
*/
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_YUV420P_to_RGBX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "xpra/codecs/csc_cython/converter.pyx":568
 *             #3 or 4 bytes per pixel:
 *             allocate_rgb(len(dst_format))
 *             if dst_format=="RGBX":             # <<<<<<<<<<<<<<
 *                 self.convert_image_function = self.YUV420P_to_RGBX
 *             elif dst_format=="BGRX":
*/
      goto __pyx_L35;
    }

    /* "xpra/codecs/csc_cython/converter.pyx":570
 *             if dst_format=="RGBX":
 *                 self.convert_image_function = self.YUV420P_to_RGBX
 *             elif dst_format=="BGRX":             # <<<<<<<<<<<<<<
 *                 self.convert_image_function = self.YUV420P_to_BGRX
 *             elif dst_format=="RGB":
*/
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 570, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "xpra/codecs/csc_cython/converter.pyx":571
 *                 self.convert_image_function = self.YUV420P_to_RGBX
 *             elif dst_format=="BGRX":
 *                 self.convert_image_function = self.YUV420P_to_BGRX             # <<<<<<<<<<<<<<
 *             elif dst_format=="RGB":
 *                 self.convert_image_function = self.YUV420P_to_RGB
*/
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_YUV420P_to_BGRX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "xpra/codecs/csc_cython/converter.pyx":570
 *             if dst_format=="RGBX":
 *                 self.convert_image_function = self.YUV420P_to_RGBX
 *             elif dst_format=="BGRX":             # <<<<<<<<<<<<<<
 *                 self.convert_image_function = self.YUV420P_to_BGRX
 *             elif dst_format=="RGB":
*/
      goto __pyx_L35;
    }

    /* "xpra/codecs/csc_cython/converter.pyx":572
 *             elif dst_format=="BGRX":
 *                 self.convert_image_function = self.YUV420P_to_BGRX
 *             elif dst_format=="RGB":             # <<<<<<<<<<<<<<
 *                 self.convert_image_function = self.YUV420P_to_RGB
 *             else:
*/
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_RGB, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 572, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "xpra/codecs/csc_cython/converter.pyx":573
 *                 self.convert_image_function = self.YUV420P_to_BGRX
 *             elif dst_format=="RGB":
 *                 self.convert_image_function = self.YUV420P_to_RGB             # <<<<<<<<<<<<<<
 *             else:
 *                 assert dst_format=="BGR"
*/
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_YUV420P_to_RGB); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "xpra/codecs/csc_cython/converter.pyx":572
 *             elif dst_format=="BGRX":
 *                 self.convert_image_function = self.YUV420P_to_BGRX
 *             elif dst_format=="RGB":             # <<<<<<<<<<<<<<
 *                 self.convert_image_function = self.YUV420P_to_RGB
 *             else:
*/
      goto __pyx_L35;
    }

    /* "xpra/codecs/csc_cython/converter.pyx":575
 *                 self.convert_image_function = self.YUV420P_to_RGB
 *             else:
 *                 assert dst_format=="BGR"             # <<<<<<<<<<<<<<
 *                 self.convert_image_function = self.YUV420P_to_BGR
 *         elif src_format=="GBRP" and dst_format in ("RGBX", "BGRX"):
*/
    /*else*/ {
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_BGR, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 575, __pyx_L1_error)
        if (unlikely(!__pyx_t_2)) {
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
          __PYX_ERR(0, 575, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(0, 575, __pyx_L1_error)
      #endif

      /* "xpra/codecs/csc_cython/converter.pyx":576
 *             else:
 *                 assert dst_format=="BGR"
 *                 self.convert_image_function = self.YUV420P_to_BGR             # <<<<<<<<<<<<<<
 *         elif src_format=="GBRP" and dst_format in ("RGBX", "BGRX"):
 *             #4 bytes per pixel:
*/
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_YUV420P_to_BGR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L35:;

    /* "xpra/codecs/csc_cython/converter.pyx":565
 *             allocate_rgb(4)
 *             self.convert_image_function = self.GBRP10_to_r210
 *         elif src_format=="YUV420P" and dst_format in ("RGBX", "BGRX", "RGB", "BGR"):             # <<<<<<<<<<<<<<
 *             #3 or 4 bytes per pixel:
 *             allocate_rgb(len(dst_format))
*/
    goto __pyx_L5;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":577
 *                 assert dst_format=="BGR"
 *                 self.convert_image_function = self.YUV420P_to_BGR
 *         elif src_format=="GBRP" and dst_format in ("RGBX", "BGRX"):             # <<<<<<<<<<<<<<
 *             #4 bytes per pixel:
 *             allocate_rgb(4)
*/
  __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_src_format, __pyx_mstate_global->__pyx_n_u_GBRP, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 577, __pyx_L1_error)
  if (__pyx_t_16) {
  } else {
    __pyx_t_2 = __pyx_t_16;
    goto __pyx_L36_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_dst_format);
  __pyx_t_14 = __pyx_cur_scope->__pyx_v_dst_format;
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_RGBX, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 577, __pyx_L1_error)
  if (!__pyx_t_15) {
  } else {
    __pyx_t_16 = __pyx_t_15;
    goto __pyx_L38_bool_binop_done;
  }
  __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 577, __pyx_L1_error)
  __pyx_t_16 = __pyx_t_15;
  __pyx_L38_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_15 = __pyx_t_16;
  __pyx_t_2 = __pyx_t_15;
  __pyx_L36_bool_binop_done:;
  if (likely(__pyx_t_2)) {

    /* "xpra/codecs/csc_cython/converter.pyx":579
 *         elif src_format=="GBRP" and dst_format in ("RGBX", "BGRX"):
 *             #4 bytes per pixel:
 *             allocate_rgb(4)             # <<<<<<<<<<<<<<
 *             if dst_format=="RGBX":
 *                 self.convert_image_function = self.GBRP_to_RGBX
*/
    __pyx_t_3 = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12init_context_4allocate_rgb(__pyx_v_allocate_rgb, __pyx_mstate_global->__pyx_int_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":580
 *             #4 bytes per pixel:
 *             allocate_rgb(4)
 *             if dst_format=="RGBX":             # <<<<<<<<<<<<<<
 *                 self.convert_image_function = self.GBRP_to_RGBX
 *             else:
*/
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_RGBX, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 580, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "xpra/codecs/csc_cython/converter.pyx":581
 *             allocate_rgb(4)
 *             if dst_format=="RGBX":
 *                 self.convert_image_function = self.GBRP_to_RGBX             # <<<<<<<<<<<<<<
 *             else:
 *                 assert dst_format=="BGRX"
*/
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_GBRP_to_RGBX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "xpra/codecs/csc_cython/converter.pyx":580
 *             #4 bytes per pixel:
 *             allocate_rgb(4)
 *             if dst_format=="RGBX":             # <<<<<<<<<<<<<<
 *                 self.convert_image_function = self.GBRP_to_RGBX
 *             else:
*/
      goto __pyx_L40;
    }

    /* "xpra/codecs/csc_cython/converter.pyx":583
 *                 self.convert_image_function = self.GBRP_to_RGBX
 *             else:
 *                 assert dst_format=="BGRX"             # <<<<<<<<<<<<<<
 *                 self.convert_image_function = self.GBRP_to_BGRX
 *         else:
*/
    /*else*/ {
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_dst_format, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 583, __pyx_L1_error)
        if (unlikely(!__pyx_t_2)) {
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
          __PYX_ERR(0, 583, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(0, 583, __pyx_L1_error)
      #endif

      /* "xpra/codecs/csc_cython/converter.pyx":584
 *             else:
 *                 assert dst_format=="BGRX"
 *                 self.convert_image_function = self.GBRP_to_BGRX             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("BUG: src_format=%s, dst_format=%s", src_format, dst_format)
*/
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_GBRP_to_BGRX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->convert_image_function);
      __pyx_cur_scope->__pyx_v_self->convert_image_function = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L40:;

    /* "xpra/codecs/csc_cython/converter.pyx":577
 *                 assert dst_format=="BGR"
 *                 self.convert_image_function = self.YUV420P_to_BGR
 *         elif src_format=="GBRP" and dst_format in ("RGBX", "BGRX"):             # <<<<<<<<<<<<<<
 *             #4 bytes per pixel:
 *             allocate_rgb(4)
*/
    goto __pyx_L5;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":586
 *                 self.convert_image_function = self.GBRP_to_BGRX
 *         else:
 *             raise ValueError("BUG: src_format=%s, dst_format=%s", src_format, dst_format)             # <<<<<<<<<<<<<<
 * 
 *     def clean(self) -> None:
*/
  /*else*/ {
    __pyx_t_5 = NULL;
    __pyx_t_11 = 1;
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_BUG_src_format_s_dst_format_s, __pyx_cur_scope->__pyx_v_src_format, __pyx_cur_scope->__pyx_v_dst_format};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (4-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 586, __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(0, 586, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "xpra/codecs/csc_cython/converter.pyx":464
 *     cdef object __weakref__
 * 
 *     def init_context(self, int src_width, int src_height, src_format: str,             # <<<<<<<<<<<<<<
 *                            int dst_width, int dst_height, dst_format: str, options: typedict) -> None:
 *         cdef int i
*/

  /* 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_3);
  __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_10);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.init_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_assert_no_scaling);
  __Pyx_XDECREF(__pyx_v_allocate_yuv);
  __Pyx_XDECREF(__pyx_v_allocate_rgb);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":588
 *             raise ValueError("BUG: src_format=%s, dst_format=%s", src_format, dst_format)
 * 
 *     def clean(self) -> None:             # <<<<<<<<<<<<<<
 *         # overzealous clean is cheap!
 *         cdef int i                          #
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_3clean(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_3clean = {"clean", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_3clean, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_3clean(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clean (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_2clean(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_2clean(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self) {
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("clean", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":591
 *         # overzealous clean is cheap!
 *         cdef int i                          #
 *         self.src_width = 0             # <<<<<<<<<<<<<<
 *         self.src_height = 0
 *         self.dst_width = 0
*/
  __pyx_v_self->src_width = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":592
 *         cdef int i                          #
 *         self.src_width = 0
 *         self.src_height = 0             # <<<<<<<<<<<<<<
 *         self.dst_width = 0
 *         self.dst_height = 0
*/
  __pyx_v_self->src_height = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":593
 *         self.src_width = 0
 *         self.src_height = 0
 *         self.dst_width = 0             # <<<<<<<<<<<<<<
 *         self.dst_height = 0
 *         self.src_format = ""
*/
  __pyx_v_self->dst_width = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":594
 *         self.src_height = 0
 *         self.dst_width = 0
 *         self.dst_height = 0             # <<<<<<<<<<<<<<
 *         self.src_format = ""
 *         self.dst_format = ""
*/
  __pyx_v_self->dst_height = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":595
 *         self.dst_width = 0
 *         self.dst_height = 0
 *         self.src_format = ""             # <<<<<<<<<<<<<<
 *         self.dst_format = ""
 *         self.time = 0
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__3);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u__3);
  __Pyx_GOTREF(__pyx_v_self->src_format);
  __Pyx_DECREF(__pyx_v_self->src_format);
  __pyx_v_self->src_format = __pyx_mstate_global->__pyx_kp_u__3;

  /* "xpra/codecs/csc_cython/converter.pyx":596
 *         self.dst_height = 0
 *         self.src_format = ""
 *         self.dst_format = ""             # <<<<<<<<<<<<<<
 *         self.time = 0
 *         self.frames = 0
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__3);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u__3);
  __Pyx_GOTREF(__pyx_v_self->dst_format);
  __Pyx_DECREF(__pyx_v_self->dst_format);
  __pyx_v_self->dst_format = __pyx_mstate_global->__pyx_kp_u__3;

  /* "xpra/codecs/csc_cython/converter.pyx":597
 *         self.src_format = ""
 *         self.dst_format = ""
 *         self.time = 0             # <<<<<<<<<<<<<<
 *         self.frames = 0
 *         for i in range(3):
*/
  __pyx_v_self->time = 0.0;

  /* "xpra/codecs/csc_cython/converter.pyx":598
 *         self.dst_format = ""
 *         self.time = 0
 *         self.frames = 0             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             self.dst_strides[i] = 0
*/
  __pyx_v_self->frames = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":599
 *         self.time = 0
 *         self.frames = 0
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             self.dst_strides[i] = 0
 *             self.dst_sizes[i] = 0
*/
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "xpra/codecs/csc_cython/converter.pyx":600
 *         self.frames = 0
 *         for i in range(3):
 *             self.dst_strides[i] = 0             # <<<<<<<<<<<<<<
 *             self.dst_sizes[i] = 0
 *             self.offsets[i] = 0
*/
    (__pyx_v_self->dst_strides[__pyx_v_i]) = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":601
 *         for i in range(3):
 *             self.dst_strides[i] = 0
 *             self.dst_sizes[i] = 0             # <<<<<<<<<<<<<<
 *             self.offsets[i] = 0
 *         self.convert_image_function = None
*/
    (__pyx_v_self->dst_sizes[__pyx_v_i]) = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":602
 *             self.dst_strides[i] = 0
 *             self.dst_sizes[i] = 0
 *             self.offsets[i] = 0             # <<<<<<<<<<<<<<
 *         self.convert_image_function = None
 *         self.buffer_size = 0
*/
    (__pyx_v_self->offsets[__pyx_v_i]) = 0;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":603
 *             self.dst_sizes[i] = 0
 *             self.offsets[i] = 0
 *         self.convert_image_function = None             # <<<<<<<<<<<<<<
 *         self.buffer_size = 0
 * 
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->convert_image_function);
  __Pyx_DECREF(__pyx_v_self->convert_image_function);
  __pyx_v_self->convert_image_function = Py_None;

  /* "xpra/codecs/csc_cython/converter.pyx":604
 *             self.offsets[i] = 0
 *         self.convert_image_function = None
 *         self.buffer_size = 0             # <<<<<<<<<<<<<<
 * 
 *     def is_closed(self) -> bool:
*/
  __pyx_v_self->buffer_size = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":588
 *             raise ValueError("BUG: src_format=%s, dst_format=%s", src_format, dst_format)
 * 
 *     def clean(self) -> None:             # <<<<<<<<<<<<<<
 *         # overzealous clean is cheap!
 *         cdef int i                          #
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":606
 *         self.buffer_size = 0
 * 
 *     def is_closed(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.convert_image_function is None
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_5is_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_5is_closed = {"is_closed", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_5is_closed, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_5is_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_closed (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_4is_closed(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_4is_closed(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self) {
  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("is_closed", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":607
 * 
 *     def is_closed(self) -> bool:
 *         return self.convert_image_function is None             # <<<<<<<<<<<<<<
 * 
 *     def get_info(self) -> Dict[str,Any]:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (__pyx_v_self->convert_image_function == Py_None);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":606
 *         self.buffer_size = 0
 * 
 *     def is_closed(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.convert_image_function is None
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.is_closed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":609
 *         return self.convert_image_function is None
 * 
 *     def get_info(self) -> Dict[str,Any]:             # <<<<<<<<<<<<<<
 *         info = {
 *                 "frames"    : self.frames,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_7get_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_7get_info = {"get_info", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_7get_info, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_7get_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_info (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_6get_info(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_6get_info(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self) {
  PyObject *__pyx_v_info = NULL;
  double __pyx_v_pps;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_info", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":611
 *     def get_info(self) -> Dict[str,Any]:
 *         info = {
 *                 "frames"    : self.frames,             # <<<<<<<<<<<<<<
 *                 "src_width" : self.src_width,
 *                 "src_height": self.src_height,
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_long(__pyx_v_self->frames); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_frames, __pyx_t_2) < (0)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":612
 *         info = {
 *                 "frames"    : self.frames,
 *                 "src_width" : self.src_width,             # <<<<<<<<<<<<<<
 *                 "src_height": self.src_height,
 *                 "dst_width" : self.dst_width,
*/
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->src_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_src_width, __pyx_t_2) < (0)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":613
 *                 "frames"    : self.frames,
 *                 "src_width" : self.src_width,
 *                 "src_height": self.src_height,             # <<<<<<<<<<<<<<
 *                 "dst_width" : self.dst_width,
 *                 "dst_height": self.dst_height,
*/
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->src_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_src_height, __pyx_t_2) < (0)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":614
 *                 "src_width" : self.src_width,
 *                 "src_height": self.src_height,
 *                 "dst_width" : self.dst_width,             # <<<<<<<<<<<<<<
 *                 "dst_height": self.dst_height,
 *                 }
*/
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->dst_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_dst_width, __pyx_t_2) < (0)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":615
 *                 "src_height": self.src_height,
 *                 "dst_width" : self.dst_width,
 *                 "dst_height": self.dst_height,             # <<<<<<<<<<<<<<
 *                 }
 *         if self.src_format:
*/
  __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->dst_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_dst_height, __pyx_t_2) < (0)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_info = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":617
 *                 "dst_height": self.dst_height,
 *                 }
 *         if self.src_format:             # <<<<<<<<<<<<<<
 *             info["src_format"] = self.src_format
 *         if self.dst_format:
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->src_format); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 617, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "xpra/codecs/csc_cython/converter.pyx":618
 *                 }
 *         if self.src_format:
 *             info["src_format"] = self.src_format             # <<<<<<<<<<<<<<
 *         if self.dst_format:
 *             info["dst_format"] = self.dst_format
*/
    __pyx_t_1 = __pyx_v_self->src_format;
    __Pyx_INCREF(__pyx_t_1);
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_src_format, __pyx_t_1) < 0))) __PYX_ERR(0, 618, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":617
 *                 "dst_height": self.dst_height,
 *                 }
 *         if self.src_format:             # <<<<<<<<<<<<<<
 *             info["src_format"] = self.src_format
 *         if self.dst_format:
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":619
 *         if self.src_format:
 *             info["src_format"] = self.src_format
 *         if self.dst_format:             # <<<<<<<<<<<<<<
 *             info["dst_format"] = self.dst_format
 *         if self.frames>0 and self.time>0:
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->dst_format); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 619, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "xpra/codecs/csc_cython/converter.pyx":620
 *             info["src_format"] = self.src_format
 *         if self.dst_format:
 *             info["dst_format"] = self.dst_format             # <<<<<<<<<<<<<<
 *         if self.frames>0 and self.time>0:
 *             pps = float(self.src_width) * float(self.src_height) * float(self.frames) / self.time
*/
    __pyx_t_1 = __pyx_v_self->dst_format;
    __Pyx_INCREF(__pyx_t_1);
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_dst_format, __pyx_t_1) < 0))) __PYX_ERR(0, 620, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":619
 *         if self.src_format:
 *             info["src_format"] = self.src_format
 *         if self.dst_format:             # <<<<<<<<<<<<<<
 *             info["dst_format"] = self.dst_format
 *         if self.frames>0 and self.time>0:
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":621
 *         if self.dst_format:
 *             info["dst_format"] = self.dst_format
 *         if self.frames>0 and self.time>0:             # <<<<<<<<<<<<<<
 *             pps = float(self.src_width) * float(self.src_height) * float(self.frames) / self.time
 *             info["total_time_ms"] = int(self.time * 1000)
*/
  __pyx_t_4 = (__pyx_v_self->frames > 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_self->time > 0.0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_3) {

    /* "xpra/codecs/csc_cython/converter.pyx":622
 *             info["dst_format"] = self.dst_format
 *         if self.frames>0 and self.time>0:
 *             pps = float(self.src_width) * float(self.src_height) * float(self.frames) / self.time             # <<<<<<<<<<<<<<
 *             info["total_time_ms"] = int(self.time * 1000)
 *             info["pixels_per_second"] = int(pps)
*/
    __pyx_v_pps = (((((double)__pyx_v_self->src_width) * ((double)__pyx_v_self->src_height)) * ((double)__pyx_v_self->frames)) / __pyx_v_self->time);

    /* "xpra/codecs/csc_cython/converter.pyx":623
 *         if self.frames>0 and self.time>0:
 *             pps = float(self.src_width) * float(self.src_height) * float(self.frames) / self.time
 *             info["total_time_ms"] = int(self.time * 1000)             # <<<<<<<<<<<<<<
 *             info["pixels_per_second"] = int(pps)
 *         return info
*/
    __pyx_t_1 = PyLong_FromDouble((__pyx_v_self->time * 1000.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_total_time_ms, __pyx_t_1) < 0))) __PYX_ERR(0, 623, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":624
 *             pps = float(self.src_width) * float(self.src_height) * float(self.frames) / self.time
 *             info["total_time_ms"] = int(self.time * 1000)
 *             info["pixels_per_second"] = int(pps)             # <<<<<<<<<<<<<<
 *         return info
 * 
*/
    __pyx_t_1 = PyLong_FromDouble(__pyx_v_pps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely((PyDict_SetItem(__pyx_v_info, __pyx_mstate_global->__pyx_n_u_pixels_per_second, __pyx_t_1) < 0))) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":621
 *         if self.dst_format:
 *             info["dst_format"] = self.dst_format
 *         if self.frames>0 and self.time>0:             # <<<<<<<<<<<<<<
 *             pps = float(self.src_width) * float(self.src_height) * float(self.frames) / self.time
 *             info["total_time_ms"] = int(self.time * 1000)
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":625
 *             info["total_time_ms"] = int(self.time * 1000)
 *             info["pixels_per_second"] = int(pps)
 *         return info             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_info);
  __pyx_r = __pyx_v_info;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":609
 *         return self.convert_image_function is None
 * 
 *     def get_info(self) -> Dict[str,Any]:             # <<<<<<<<<<<<<<
 *         info = {
 *                 "frames"    : self.frames,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.get_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_info);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":627
 *         return info
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "csc_cython(%s %sx%s - %s %sx%s)" % (self.src_format, self.src_width, self.src_height,
 *                                                  self.dst_format, self.dst_width, self.dst_height)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_9__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_9__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_8__repr__(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_8__repr__(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self) {
  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[13];
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":628
 * 
 *     def __repr__(self):
 *         return "csc_cython(%s %sx%s - %s %sx%s)" % (self.src_format, self.src_width, self.src_height,             # <<<<<<<<<<<<<<
 *                                                  self.dst_format, self.dst_width, self.dst_height)
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_self->src_format), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_self->src_width, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_self->src_height, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "xpra/codecs/csc_cython/converter.pyx":629
 *     def __repr__(self):
 *         return "csc_cython(%s %sx%s - %s %sx%s)" % (self.src_format, self.src_width, self.src_height,
 *                                                  self.dst_format, self.dst_width, self.dst_height)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_self->dst_format), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_self->dst_width, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_self->dst_height, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_csc_cython;
  __pyx_t_7[1] = __pyx_t_1;
  __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__4;
  __pyx_t_7[3] = __pyx_t_2;
  __pyx_t_7[4] = __pyx_mstate_global->__pyx_n_u_x;
  __pyx_t_7[5] = __pyx_t_3;
  __pyx_t_7[6] = __pyx_mstate_global->__pyx_kp_u__5;
  __pyx_t_7[7] = __pyx_t_4;
  __pyx_t_7[8] = __pyx_mstate_global->__pyx_kp_u__4;
  __pyx_t_7[9] = __pyx_t_5;
  __pyx_t_7[10] = __pyx_mstate_global->__pyx_n_u_x;
  __pyx_t_7[11] = __pyx_t_6;
  __pyx_t_7[12] = __pyx_mstate_global->__pyx_kp_u__2;

  /* "xpra/codecs/csc_cython/converter.pyx":628
 * 
 *     def __repr__(self):
 *         return "csc_cython(%s %sx%s - %s %sx%s)" % (self.src_format, self.src_width, self.src_height,             # <<<<<<<<<<<<<<
 *                                                  self.dst_format, self.dst_width, self.dst_height)
 * 
*/
  __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 13, 11 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1 * 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __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_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":627
 *         return info
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "csc_cython(%s %sx%s - %s %sx%s)" % (self.src_format, self.src_width, self.src_height,
 *                                                  self.dst_format, self.dst_width, self.dst_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_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":631
 *                                                  self.dst_format, self.dst_width, self.dst_height)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.clean()
 * 
*/

/* Python wrapper */
static void __pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_11__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_11__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_10__dealloc__(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static void __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_10__dealloc__(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":632
 * 
 *     def __dealloc__(self):
 *         self.clean()             # <<<<<<<<<<<<<<
 * 
 *     def get_src_width(self) -> int:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_clean, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":631
 *                                                  self.dst_format, self.dst_width, self.dst_height)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.clean()
 * 
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("xpra.codecs.csc_cython.converter.Converter.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "xpra/codecs/csc_cython/converter.pyx":634
 *         self.clean()
 * 
 *     def get_src_width(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.src_width
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_13get_src_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_13get_src_width = {"get_src_width", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_13get_src_width, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_13get_src_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_src_width (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12get_src_width(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_12get_src_width(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__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_src_width", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":635
 * 
 *     def get_src_width(self) -> int:
 *         return self.src_width             # <<<<<<<<<<<<<<
 * 
 *     def get_src_height(self) -> int:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->src_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 635, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":634
 *         self.clean()
 * 
 *     def get_src_width(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.src_width
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.get_src_width", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":637
 *         return self.src_width
 * 
 *     def get_src_height(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.src_height
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_15get_src_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_15get_src_height = {"get_src_height", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_15get_src_height, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_15get_src_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_src_height (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_14get_src_height(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_14get_src_height(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__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_src_height", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":638
 * 
 *     def get_src_height(self) -> int:
 *         return self.src_height             # <<<<<<<<<<<<<<
 * 
 *     def get_src_format(self) -> str:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->src_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 638, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":637
 *         return self.src_width
 * 
 *     def get_src_height(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.src_height
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.get_src_height", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":640
 *         return self.src_height
 * 
 *     def get_src_format(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.src_format
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_17get_src_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_17get_src_format = {"get_src_format", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_17get_src_format, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_17get_src_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_src_format (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_16get_src_format(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_16get_src_format(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__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_src_format", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":641
 * 
 *     def get_src_format(self) -> str:
 *         return self.src_format             # <<<<<<<<<<<<<<
 * 
 *     def get_dst_width(self) -> int:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->src_format;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 641, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":640
 *         return self.src_height
 * 
 *     def get_src_format(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.src_format
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.get_src_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":643
 *         return self.src_format
 * 
 *     def get_dst_width(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.dst_width
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_19get_dst_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_19get_dst_width = {"get_dst_width", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_19get_dst_width, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_19get_dst_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_dst_width (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_18get_dst_width(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_18get_dst_width(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__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_dst_width", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":644
 * 
 *     def get_dst_width(self) -> int:
 *         return self.dst_width             # <<<<<<<<<<<<<<
 * 
 *     def get_dst_height(self) -> int:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->dst_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 644, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":643
 *         return self.src_format
 * 
 *     def get_dst_width(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.dst_width
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.get_dst_width", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":646
 *         return self.dst_width
 * 
 *     def get_dst_height(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.dst_height
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_21get_dst_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_21get_dst_height = {"get_dst_height", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_21get_dst_height, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_21get_dst_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_dst_height (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_20get_dst_height(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_20get_dst_height(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__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_dst_height", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":647
 * 
 *     def get_dst_height(self) -> int:
 *         return self.dst_height             # <<<<<<<<<<<<<<
 * 
 *     def get_dst_format(self) -> str:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->dst_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 647, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":646
 *         return self.dst_width
 * 
 *     def get_dst_height(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.dst_height
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.get_dst_height", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":649
 *         return self.dst_height
 * 
 *     def get_dst_format(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.dst_format
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_23get_dst_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_23get_dst_format = {"get_dst_format", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_23get_dst_format, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_23get_dst_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_dst_format (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_22get_dst_format(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_22get_dst_format(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__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_dst_format", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":650
 * 
 *     def get_dst_format(self) -> str:
 *         return self.dst_format             # <<<<<<<<<<<<<<
 * 
 *     def get_type(self) -> str:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->dst_format;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 650, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":649
 *         return self.dst_height
 * 
 *     def get_dst_format(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.dst_format
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.get_dst_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":652
 *         return self.dst_format
 * 
 *     def get_type(self) -> str:             # <<<<<<<<<<<<<<
 *         return "cython"
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_25get_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_25get_type = {"get_type", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_25get_type, METH_NOARGS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_25get_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_type (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_24get_type(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_24get_type(CYTHON_UNUSED struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_type", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":653
 * 
 *     def get_type(self) -> str:
 *         return "cython"             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_cython);
  __pyx_r = __pyx_mstate_global->__pyx_n_u_cython;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":652
 *         return self.dst_format
 * 
 *     def get_type(self) -> str:             # <<<<<<<<<<<<<<
 *         return "cython"
 * 
*/

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

/* "xpra/codecs/csc_cython/converter.pyx":656
 * 
 * 
 *     def convert_image(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         cdef double start = time.time()
 *         fn = self.convert_image_function
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_27convert_image(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_27convert_image = {"convert_image", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_27convert_image, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_27convert_image(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert_image (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_26convert_image(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_26convert_image(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  double __pyx_v_start;
  PyObject *__pyx_v_fn = NULL;
  PyObject *__pyx_v_r = NULL;
  double __pyx_v_elapsed;
  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;
  size_t __pyx_t_5;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_image", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":657
 * 
 *     def convert_image(self, image: ImageWrapper) -> CythonImageWrapper:
 *         cdef double start = time.time()             # <<<<<<<<<<<<<<
 *         fn = self.convert_image_function
 *         r = fn(image)
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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(0, 657, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_start = __pyx_t_6;

  /* "xpra/codecs/csc_cython/converter.pyx":658
 *     def convert_image(self, image: ImageWrapper) -> CythonImageWrapper:
 *         cdef double start = time.time()
 *         fn = self.convert_image_function             # <<<<<<<<<<<<<<
 *         r = fn(image)
 *         cdef double elapsed = time.time()-start
*/
  __pyx_t_1 = __pyx_v_self->convert_image_function;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_fn = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":659
 *         cdef double start = time.time()
 *         fn = self.convert_image_function
 *         r = fn(image)             # <<<<<<<<<<<<<<
 *         cdef double elapsed = time.time()-start
 *         log("%s took %.1fms", fn, 1000.0*elapsed)
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF(__pyx_v_fn);
  __pyx_t_2 = __pyx_v_fn; 
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_image};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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(0, 659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_r = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":660
 *         fn = self.convert_image_function
 *         r = fn(image)
 *         cdef double elapsed = time.time()-start             # <<<<<<<<<<<<<<
 *         log("%s took %.1fms", fn, 1000.0*elapsed)
 *         self.time += elapsed
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 660, __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_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_elapsed = __pyx_t_6;

  /* "xpra/codecs/csc_cython/converter.pyx":661
 *         r = fn(image)
 *         cdef double elapsed = time.time()-start
 *         log("%s took %.1fms", fn, 1000.0*elapsed)             # <<<<<<<<<<<<<<
 *         self.time += elapsed
 *         self.frames += 1
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyFloat_FromDouble((1000.0 * __pyx_v_elapsed)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_s_took_1fms, __pyx_v_fn, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":662
 *         cdef double elapsed = time.time()-start
 *         log("%s took %.1fms", fn, 1000.0*elapsed)
 *         self.time += elapsed             # <<<<<<<<<<<<<<
 *         self.frames += 1
 *         return r
*/
  __pyx_v_self->time = (__pyx_v_self->time + __pyx_v_elapsed);

  /* "xpra/codecs/csc_cython/converter.pyx":663
 *         log("%s took %.1fms", fn, 1000.0*elapsed)
 *         self.time += elapsed
 *         self.frames += 1             # <<<<<<<<<<<<<<
 *         return r
 * 
*/
  __pyx_v_self->frames = (__pyx_v_self->frames + 1);

  /* "xpra/codecs/csc_cython/converter.pyx":664
 *         self.time += elapsed
 *         self.frames += 1
 *         return r             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_r);
  __pyx_r = __pyx_v_r;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":656
 * 
 * 
 *     def convert_image(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         cdef double start = time.time()
 *         fn = self.convert_image_function
*/

  /* 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("xpra.codecs.csc_cython.converter.Converter.convert_image", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fn);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":667
 * 
 * 
 *     def r210_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 4, 0, 0, 0)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_29r210_to_YUV420P(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_29r210_to_YUV420P = {"r210_to_YUV420P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_29r210_to_YUV420P, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_29r210_to_YUV420P(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("r210_to_YUV420P (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_28r210_to_YUV420P(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_28r210_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("r210_to_YUV420P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":668
 * 
 *     def r210_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGB_to_YUV420P(image, 4, 0, 0, 0)             # <<<<<<<<<<<<<<
 * 
 *     def BGR_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGB_to_YUV420P(__pyx_v_self, __pyx_v_image, 4, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":667
 * 
 * 
 *     def r210_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 4, 0, 0, 0)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.r210_to_YUV420P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":670
 *         return self.do_RGB_to_YUV420P(image, 4, 0, 0, 0)
 * 
 *     def BGR_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_31BGR_to_YUV420P(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_31BGR_to_YUV420P = {"BGR_to_YUV420P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_31BGR_to_YUV420P, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_31BGR_to_YUV420P(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("BGR_to_YUV420P (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_30BGR_to_YUV420P(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_30BGR_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("BGR_to_YUV420P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":671
 * 
 *     def BGR_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGB_to_YUV420P(image, 3, BGR_R, BGR_G, BGR_B)             # <<<<<<<<<<<<<<
 * 
 *     def RGB_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGB_to_YUV420P(__pyx_v_self, __pyx_v_image, 3, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_R, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_B); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":670
 *         return self.do_RGB_to_YUV420P(image, 4, 0, 0, 0)
 * 
 *     def BGR_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.BGR_to_YUV420P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":673
 *         return self.do_RGB_to_YUV420P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
 *     def RGB_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_33RGB_to_YUV420P(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_33RGB_to_YUV420P = {"RGB_to_YUV420P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_33RGB_to_YUV420P, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_33RGB_to_YUV420P(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RGB_to_YUV420P (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_32RGB_to_YUV420P(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_32RGB_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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_YUV420P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":674
 * 
 *     def RGB_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGB_to_YUV420P(image, 3, RGB_B, RGB_G, RGB_R)             # <<<<<<<<<<<<<<
 * 
 *     def BGRX_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGB_to_YUV420P(__pyx_v_self, __pyx_v_image, 3, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_B, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_R); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":673
 *         return self.do_RGB_to_YUV420P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
 *     def RGB_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.RGB_to_YUV420P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":676
 *         return self.do_RGB_to_YUV420P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
 *     def BGRX_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_35BGRX_to_YUV420P(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_35BGRX_to_YUV420P = {"BGRX_to_YUV420P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_35BGRX_to_YUV420P, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_35BGRX_to_YUV420P(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("BGRX_to_YUV420P (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_34BGRX_to_YUV420P(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_34BGRX_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("BGRX_to_YUV420P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":677
 * 
 *     def BGRX_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGB_to_YUV420P(image, 4, BGRX_R, BGRX_G, BGRX_B)             # <<<<<<<<<<<<<<
 * 
 *     def RGBX_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGB_to_YUV420P(__pyx_v_self, __pyx_v_image, 4, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_R, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_B); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":676
 *         return self.do_RGB_to_YUV420P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
 *     def BGRX_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.BGRX_to_YUV420P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":679
 *         return self.do_RGB_to_YUV420P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
 *     def RGBX_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 4, RGBX_B, RGBX_G, RGBX_R)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_37RGBX_to_YUV420P(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_37RGBX_to_YUV420P = {"RGBX_to_YUV420P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_37RGBX_to_YUV420P, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_37RGBX_to_YUV420P(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RGBX_to_YUV420P (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_36RGBX_to_YUV420P(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_36RGBX_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("RGBX_to_YUV420P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":680
 * 
 *     def RGBX_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGB_to_YUV420P(image, 4, RGBX_B, RGBX_G, RGBX_R)             # <<<<<<<<<<<<<<
 * 
 *     cdef do_RGB_to_YUV420P(self,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGB_to_YUV420P(__pyx_v_self, __pyx_v_image, 4, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_B, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_R); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":679
 *         return self.do_RGB_to_YUV420P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
 *     def RGBX_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 4, RGBX_B, RGBX_G, RGBX_R)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.RGBX_to_YUV420P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":682
 *         return self.do_RGB_to_YUV420P(image, 4, RGBX_B, RGBX_G, RGBX_R)
 * 
 *     cdef do_RGB_to_YUV420P(self,             # <<<<<<<<<<<<<<
 *                            image: ImageWrapper,
 *                            const uint8_t Bpp,
*/

static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_RGB_to_YUV420P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image, uint8_t const __pyx_v_Bpp, uint8_t const __pyx_v_Rindex, uint8_t const __pyx_v_Gindex, uint8_t const __pyx_v_Bindex) {
  unsigned int const *__pyx_v_input_r210;
  unsigned int __pyx_v_x;
  unsigned int __pyx_v_y;
  unsigned int __pyx_v_o;
  unsigned int __pyx_v_sx;
  unsigned int __pyx_v_sy;
  unsigned int __pyx_v_ox;
  unsigned int __pyx_v_oy;
  unsigned int __pyx_v_r210;
  unsigned char __pyx_v_R;
  unsigned char __pyx_v_G;
  unsigned char __pyx_v_B;
  unsigned short __pyx_v_Rsum;
  unsigned short __pyx_v_Gsum;
  unsigned short __pyx_v_Bsum;
  unsigned char __pyx_v_count;
  unsigned char __pyx_v_dx;
  unsigned char __pyx_v_dy;
  PyObject *__pyx_v_pixels = NULL;
  unsigned int __pyx_v_input_stride;
  unsigned char *__pyx_v_output_image;
  unsigned char *__pyx_v_Y;
  unsigned char *__pyx_v_U;
  unsigned char *__pyx_v_V;
  unsigned int __pyx_v_Ystride;
  unsigned int __pyx_v_Ustride;
  unsigned int __pyx_v_Vstride;
  unsigned int __pyx_v_src_width;
  unsigned int __pyx_v_src_height;
  unsigned int __pyx_v_dst_width;
  unsigned int __pyx_v_dst_height;
  unsigned char __pyx_v_full_range;
  unsigned int __pyx_v_workw;
  unsigned int __pyx_v_workh;
  Py_buffer __pyx_v_py_buf;
  unsigned char const *__pyx_v_input_image;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __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 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  unsigned char __pyx_t_13;
  int __pyx_t_14;
  unsigned int __pyx_t_15;
  unsigned int __pyx_t_16;
  unsigned int __pyx_t_17;
  unsigned int __pyx_t_18;
  unsigned int __pyx_t_19;
  unsigned char __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("do_RGB_to_YUV420P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":697
 *         cdef unsigned char count, dx, dy
 * 
 *         self.validate_rgb_image(image)             # <<<<<<<<<<<<<<
 *         pixels = image.get_pixels()
 *         cdef unsigned int input_stride = image.get_rowstride()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_image};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate_rgb_image, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":698
 * 
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()             # <<<<<<<<<<<<<<
 *         cdef unsigned int input_stride = image.get_rowstride()
 *         log("do_RGB_to_YUV420P(%s, %i, %i, %i, %i) input=%s, strides=%s", image, Bpp, Rindex, Gindex, Bindex, len(pixels), input_stride)
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_pixels = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":699
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()
 *         cdef unsigned int input_stride = image.get_rowstride()             # <<<<<<<<<<<<<<
 *         log("do_RGB_to_YUV420P(%s, %i, %i, %i, %i) input=%s, strides=%s", image, Bpp, Rindex, Gindex, Bindex, len(pixels), input_stride)
 * 
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_rowstride, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_input_stride = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":700
 *         pixels = image.get_pixels()
 *         cdef unsigned int input_stride = image.get_rowstride()
 *         log("do_RGB_to_YUV420P(%s, %i, %i, %i, %i) input=%s, strides=%s", image, Bpp, Rindex, Gindex, Bindex, len(pixels), input_stride)             # <<<<<<<<<<<<<<
 * 
 *         #allocate output buffer:
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyLong_From_uint8_t(__pyx_v_Bpp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyLong_From_uint8_t(__pyx_v_Rindex); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyLong_From_uint8_t(__pyx_v_Gindex); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyLong_From_uint8_t(__pyx_v_Bindex); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_Length(__pyx_v_pixels); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 700, __pyx_L1_error)
  __pyx_t_11 = PyLong_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyLong_From_unsigned_int(__pyx_v_input_stride); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[9] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_do_RGB_to_YUV420P_s_i_i_i_i_inpu, __pyx_v_image, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_11, __pyx_t_12};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (9-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":703
 * 
 *         #allocate output buffer:
 *         cdef unsigned char *output_image = <unsigned char*> memalign(self.buffer_size)             # <<<<<<<<<<<<<<
 *         cdef unsigned char *Y = output_image + self.offsets[0]
 *         cdef unsigned char *U = output_image + self.offsets[1]
*/
  __pyx_v_output_image = ((unsigned char *)__pyx_f_4xpra_7buffers_6membuf_memalign(__pyx_v_self->buffer_size));

  /* "xpra/codecs/csc_cython/converter.pyx":704
 *         #allocate output buffer:
 *         cdef unsigned char *output_image = <unsigned char*> memalign(self.buffer_size)
 *         cdef unsigned char *Y = output_image + self.offsets[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned char *U = output_image + self.offsets[1]
 *         cdef unsigned char *V = output_image + self.offsets[2]
*/
  __pyx_v_Y = (__pyx_v_output_image + (__pyx_v_self->offsets[0]));

  /* "xpra/codecs/csc_cython/converter.pyx":705
 *         cdef unsigned char *output_image = <unsigned char*> memalign(self.buffer_size)
 *         cdef unsigned char *Y = output_image + self.offsets[0]
 *         cdef unsigned char *U = output_image + self.offsets[1]             # <<<<<<<<<<<<<<
 *         cdef unsigned char *V = output_image + self.offsets[2]
 * 
*/
  __pyx_v_U = (__pyx_v_output_image + (__pyx_v_self->offsets[1]));

  /* "xpra/codecs/csc_cython/converter.pyx":706
 *         cdef unsigned char *Y = output_image + self.offsets[0]
 *         cdef unsigned char *U = output_image + self.offsets[1]
 *         cdef unsigned char *V = output_image + self.offsets[2]             # <<<<<<<<<<<<<<
 * 
 *         #copy to local variables (ensures C code will be optimized correctly)
*/
  __pyx_v_V = (__pyx_v_output_image + (__pyx_v_self->offsets[2]));

  /* "xpra/codecs/csc_cython/converter.pyx":709
 * 
 *         #copy to local variables (ensures C code will be optimized correctly)
 *         cdef unsigned int Ystride = self.dst_strides[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned int Ustride = self.dst_strides[1]
 *         cdef unsigned int Vstride = self.dst_strides[2]
*/
  __pyx_v_Ystride = (__pyx_v_self->dst_strides[0]);

  /* "xpra/codecs/csc_cython/converter.pyx":710
 *         #copy to local variables (ensures C code will be optimized correctly)
 *         cdef unsigned int Ystride = self.dst_strides[0]
 *         cdef unsigned int Ustride = self.dst_strides[1]             # <<<<<<<<<<<<<<
 *         cdef unsigned int Vstride = self.dst_strides[2]
 *         cdef unsigned int src_width = self.src_width
*/
  __pyx_v_Ustride = (__pyx_v_self->dst_strides[1]);

  /* "xpra/codecs/csc_cython/converter.pyx":711
 *         cdef unsigned int Ystride = self.dst_strides[0]
 *         cdef unsigned int Ustride = self.dst_strides[1]
 *         cdef unsigned int Vstride = self.dst_strides[2]             # <<<<<<<<<<<<<<
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height
*/
  __pyx_v_Vstride = (__pyx_v_self->dst_strides[2]);

  /* "xpra/codecs/csc_cython/converter.pyx":712
 *         cdef unsigned int Ustride = self.dst_strides[1]
 *         cdef unsigned int Vstride = self.dst_strides[2]
 *         cdef unsigned int src_width = self.src_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width
*/
  __pyx_t_4 = __pyx_v_self->src_width;
  __pyx_v_src_width = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":713
 *         cdef unsigned int Vstride = self.dst_strides[2]
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height             # <<<<<<<<<<<<<<
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height
*/
  __pyx_t_4 = __pyx_v_self->src_height;
  __pyx_v_src_height = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":714
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int dst_height = self.dst_height
 *         cdef unsigned char full_range = self.full_range
*/
  __pyx_t_4 = __pyx_v_self->dst_width;
  __pyx_v_dst_width = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":715
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height             # <<<<<<<<<<<<<<
 *         cdef unsigned char full_range = self.full_range
 * 
*/
  __pyx_t_4 = __pyx_v_self->dst_height;
  __pyx_v_dst_height = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":716
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height
 *         cdef unsigned char full_range = self.full_range             # <<<<<<<<<<<<<<
 * 
 *         #we process 4 pixels at a time:
*/
  __pyx_t_13 = __pyx_v_self->full_range;
  __pyx_v_full_range = __pyx_t_13;

  /* "xpra/codecs/csc_cython/converter.pyx":719
 * 
 *         #we process 4 pixels at a time:
 *         cdef unsigned int workw = roundup(dst_width, 2)//2             # <<<<<<<<<<<<<<
 *         cdef unsigned int workh = roundup(dst_height, 2)//2
 * 
*/
  __pyx_v_workw = (__pyx_f_4xpra_6codecs_10csc_cython_9converter_roundup(__pyx_v_dst_width, 2) / 2);

  /* "xpra/codecs/csc_cython/converter.pyx":720
 *         #we process 4 pixels at a time:
 *         cdef unsigned int workw = roundup(dst_width, 2)//2
 *         cdef unsigned int workh = roundup(dst_height, 2)//2             # <<<<<<<<<<<<<<
 * 
 *         cdef Py_buffer py_buf
*/
  __pyx_v_workh = (__pyx_f_4xpra_6codecs_10csc_cython_9converter_roundup(__pyx_v_dst_height, 2) / 2);

  /* "xpra/codecs/csc_cython/converter.pyx":723
 * 
 *         cdef Py_buffer py_buf
 *         if PyObject_GetBuffer(pixels, &py_buf, PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *             raise ValueError("failed to read pixel data from %s" % type(pixels))
 *         cdef const unsigned char *input_image = <const unsigned char *> py_buf.buf
*/
  __pyx_t_14 = (PyObject_GetBuffer(__pyx_v_pixels, (&__pyx_v_py_buf), PyBUF_ANY_CONTIGUOUS) != 0);
  if (unlikely(__pyx_t_14)) {

    /* "xpra/codecs/csc_cython/converter.pyx":724
 *         cdef Py_buffer py_buf
 *         if PyObject_GetBuffer(pixels, &py_buf, PyBUF_ANY_CONTIGUOUS):
 *             raise ValueError("failed to read pixel data from %s" % type(pixels))             # <<<<<<<<<<<<<<
 *         cdef const unsigned char *input_image = <const unsigned char *> py_buf.buf
 * 
*/
    __pyx_t_5 = NULL;
    __pyx_t_12 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_failed_to_read_pixel_data_from_s, ((PyObject *)Py_TYPE(__pyx_v_pixels))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_12};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __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(0, 724, __pyx_L1_error)

    /* "xpra/codecs/csc_cython/converter.pyx":723
 * 
 *         cdef Py_buffer py_buf
 *         if PyObject_GetBuffer(pixels, &py_buf, PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *             raise ValueError("failed to read pixel data from %s" % type(pixels))
 *         cdef const unsigned char *input_image = <const unsigned char *> py_buf.buf
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":725
 *         if PyObject_GetBuffer(pixels, &py_buf, PyBUF_ANY_CONTIGUOUS):
 *             raise ValueError("failed to read pixel data from %s" % type(pixels))
 *         cdef const unsigned char *input_image = <const unsigned char *> py_buf.buf             # <<<<<<<<<<<<<<
 * 
 *         #from now on, we can release the gil:
*/
  __pyx_v_input_image = ((unsigned char const *)__pyx_v_py_buf.buf);

  /* "xpra/codecs/csc_cython/converter.pyx":728
 * 
 *         #from now on, we can release the gil:
 *         if self.src_format=="r210":             # <<<<<<<<<<<<<<
 *             assert Bpp==4
 *             input_r210 = <unsigned int*> input_image
*/
  __pyx_t_14 = (__Pyx_PyUnicode_Equals(__pyx_v_self->src_format, __pyx_mstate_global->__pyx_n_u_r210, Py_EQ)); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 728, __pyx_L1_error)
  if (__pyx_t_14) {

    /* "xpra/codecs/csc_cython/converter.pyx":729
 *         #from now on, we can release the gil:
 *         if self.src_format=="r210":
 *             assert Bpp==4             # <<<<<<<<<<<<<<
 *             input_r210 = <unsigned int*> input_image
 *             with nogil:
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_14 = (__pyx_v_Bpp == 4);
      if (unlikely(!__pyx_t_14)) {
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
        __PYX_ERR(0, 729, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 729, __pyx_L1_error)
    #endif

    /* "xpra/codecs/csc_cython/converter.pyx":730
 *         if self.src_format=="r210":
 *             assert Bpp==4
 *             input_r210 = <unsigned int*> input_image             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 for y in range(workh):
*/
    __pyx_v_input_r210 = ((unsigned int *)__pyx_v_input_image);

    /* "xpra/codecs/csc_cython/converter.pyx":731
 *             assert Bpp==4
 *             input_r210 = <unsigned int*> input_image
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 for y in range(workh):
 *                     for x in range(workw):
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "xpra/codecs/csc_cython/converter.pyx":732
 *             input_r210 = <unsigned int*> input_image
 *             with nogil:
 *                 for y in range(workh):             # <<<<<<<<<<<<<<
 *                     for x in range(workw):
 *                         Rsum = Gsum = Bsum = 0
*/
          __pyx_t_4 = __pyx_v_workh;
          __pyx_t_15 = __pyx_t_4;
          for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
            __pyx_v_y = __pyx_t_16;

            /* "xpra/codecs/csc_cython/converter.pyx":733
 *             with nogil:
 *                 for y in range(workh):
 *                     for x in range(workw):             # <<<<<<<<<<<<<<
 *                         Rsum = Gsum = Bsum = 0
 *                         count = 0
*/
            __pyx_t_17 = __pyx_v_workw;
            __pyx_t_18 = __pyx_t_17;
            for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
              __pyx_v_x = __pyx_t_19;

              /* "xpra/codecs/csc_cython/converter.pyx":734
 *                 for y in range(workh):
 *                     for x in range(workw):
 *                         Rsum = Gsum = Bsum = 0             # <<<<<<<<<<<<<<
 *                         count = 0
 *                         for dy in range(2):
*/
              __pyx_v_Rsum = 0;
              __pyx_v_Gsum = 0;
              __pyx_v_Bsum = 0;

              /* "xpra/codecs/csc_cython/converter.pyx":735
 *                     for x in range(workw):
 *                         Rsum = Gsum = Bsum = 0
 *                         count = 0             # <<<<<<<<<<<<<<
 *                         for dy in range(2):
 *                             oy = y*2 + dy
*/
              __pyx_v_count = 0;

              /* "xpra/codecs/csc_cython/converter.pyx":736
 *                         Rsum = Gsum = Bsum = 0
 *                         count = 0
 *                         for dy in range(2):             # <<<<<<<<<<<<<<
 *                             oy = y*2 + dy
 *                             if oy>=dst_height:
*/
              for (__pyx_t_13 = 0; __pyx_t_13 < 2; __pyx_t_13+=1) {
                __pyx_v_dy = __pyx_t_13;

                /* "xpra/codecs/csc_cython/converter.pyx":737
 *                         count = 0
 *                         for dy in range(2):
 *                             oy = y*2 + dy             # <<<<<<<<<<<<<<
 *                             if oy>=dst_height:
 *                                 break
*/
                __pyx_v_oy = ((__pyx_v_y * 2) + __pyx_v_dy);

                /* "xpra/codecs/csc_cython/converter.pyx":738
 *                         for dy in range(2):
 *                             oy = y*2 + dy
 *                             if oy>=dst_height:             # <<<<<<<<<<<<<<
 *                                 break
 *                             sy = oy*src_height//dst_height
*/
                __pyx_t_14 = (__pyx_v_oy >= __pyx_v_dst_height);
                if (__pyx_t_14) {

                  /* "xpra/codecs/csc_cython/converter.pyx":739
 *                             oy = y*2 + dy
 *                             if oy>=dst_height:
 *                                 break             # <<<<<<<<<<<<<<
 *                             sy = oy*src_height//dst_height
 *                             for dx in range(2):
*/
                  goto __pyx_L13_break;

                  /* "xpra/codecs/csc_cython/converter.pyx":738
 *                         for dy in range(2):
 *                             oy = y*2 + dy
 *                             if oy>=dst_height:             # <<<<<<<<<<<<<<
 *                                 break
 *                             sy = oy*src_height//dst_height
*/
                }

                /* "xpra/codecs/csc_cython/converter.pyx":740
 *                             if oy>=dst_height:
 *                                 break
 *                             sy = oy*src_height//dst_height             # <<<<<<<<<<<<<<
 *                             for dx in range(2):
 *                                 ox = x*2 + dx
*/
                __pyx_v_sy = ((__pyx_v_oy * __pyx_v_src_height) / __pyx_v_dst_height);

                /* "xpra/codecs/csc_cython/converter.pyx":741
 *                                 break
 *                             sy = oy*src_height//dst_height
 *                             for dx in range(2):             # <<<<<<<<<<<<<<
 *                                 ox = x*2 + dx
 *                                 if ox>=dst_width:
*/
                for (__pyx_t_20 = 0; __pyx_t_20 < 2; __pyx_t_20+=1) {
                  __pyx_v_dx = __pyx_t_20;

                  /* "xpra/codecs/csc_cython/converter.pyx":742
 *                             sy = oy*src_height//dst_height
 *                             for dx in range(2):
 *                                 ox = x*2 + dx             # <<<<<<<<<<<<<<
 *                                 if ox>=dst_width:
 *                                     break
*/
                  __pyx_v_ox = ((__pyx_v_x * 2) + __pyx_v_dx);

                  /* "xpra/codecs/csc_cython/converter.pyx":743
 *                             for dx in range(2):
 *                                 ox = x*2 + dx
 *                                 if ox>=dst_width:             # <<<<<<<<<<<<<<
 *                                     break
 *                                 sx = ox*src_width//dst_width
*/
                  __pyx_t_14 = (__pyx_v_ox >= __pyx_v_dst_width);
                  if (__pyx_t_14) {

                    /* "xpra/codecs/csc_cython/converter.pyx":744
 *                                 ox = x*2 + dx
 *                                 if ox>=dst_width:
 *                                     break             # <<<<<<<<<<<<<<
 *                                 sx = ox*src_width//dst_width
 *                                 o = sy*input_stride + sx*Bpp
*/
                    goto __pyx_L16_break;

                    /* "xpra/codecs/csc_cython/converter.pyx":743
 *                             for dx in range(2):
 *                                 ox = x*2 + dx
 *                                 if ox>=dst_width:             # <<<<<<<<<<<<<<
 *                                     break
 *                                 sx = ox*src_width//dst_width
*/
                  }

                  /* "xpra/codecs/csc_cython/converter.pyx":745
 *                                 if ox>=dst_width:
 *                                     break
 *                                 sx = ox*src_width//dst_width             # <<<<<<<<<<<<<<
 *                                 o = sy*input_stride + sx*Bpp
 *                                 r210 = input_r210[o//4]
*/
                  __pyx_v_sx = ((__pyx_v_ox * __pyx_v_src_width) / __pyx_v_dst_width);

                  /* "xpra/codecs/csc_cython/converter.pyx":746
 *                                     break
 *                                 sx = ox*src_width//dst_width
 *                                 o = sy*input_stride + sx*Bpp             # <<<<<<<<<<<<<<
 *                                 r210 = input_r210[o//4]
 *                                 B = (r210&0x3ff00000) >> 22
*/
                  __pyx_v_o = ((__pyx_v_sy * __pyx_v_input_stride) + (__pyx_v_sx * __pyx_v_Bpp));

                  /* "xpra/codecs/csc_cython/converter.pyx":747
 *                                 sx = ox*src_width//dst_width
 *                                 o = sy*input_stride + sx*Bpp
 *                                 r210 = input_r210[o//4]             # <<<<<<<<<<<<<<
 *                                 B = (r210&0x3ff00000) >> 22
 *                                 G = (r210&0x000ffc00) >> 12
*/
                  __pyx_v_r210 = (__pyx_v_input_r210[(__pyx_v_o / 4)]);

                  /* "xpra/codecs/csc_cython/converter.pyx":748
 *                                 o = sy*input_stride + sx*Bpp
 *                                 r210 = input_r210[o//4]
 *                                 B = (r210&0x3ff00000) >> 22             # <<<<<<<<<<<<<<
 *                                 G = (r210&0x000ffc00) >> 12
 *                                 R = (r210&0x000003ff) >> 2
*/
                  __pyx_v_B = ((__pyx_v_r210 & 0x3ff00000) >> 22);

                  /* "xpra/codecs/csc_cython/converter.pyx":749
 *                                 r210 = input_r210[o//4]
 *                                 B = (r210&0x3ff00000) >> 22
 *                                 G = (r210&0x000ffc00) >> 12             # <<<<<<<<<<<<<<
 *                                 R = (r210&0x000003ff) >> 2
 *                                 o = oy*Ystride + ox
*/
                  __pyx_v_G = ((__pyx_v_r210 & 0x000ffc00) >> 12);

                  /* "xpra/codecs/csc_cython/converter.pyx":750
 *                                 B = (r210&0x3ff00000) >> 22
 *                                 G = (r210&0x000ffc00) >> 12
 *                                 R = (r210&0x000003ff) >> 2             # <<<<<<<<<<<<<<
 *                                 o = oy*Ystride + ox
 *                                 Y[o] = clamp(YR * R + YG * G + YB * B + YC)
*/
                  __pyx_v_R = ((__pyx_v_r210 & 0x000003ff) >> 2);

                  /* "xpra/codecs/csc_cython/converter.pyx":751
 *                                 G = (r210&0x000ffc00) >> 12
 *                                 R = (r210&0x000003ff) >> 2
 *                                 o = oy*Ystride + ox             # <<<<<<<<<<<<<<
 *                                 Y[o] = clamp(YR * R + YG * G + YB * B + YC)
 *                                 count += 1
*/
                  __pyx_v_o = ((__pyx_v_oy * __pyx_v_Ystride) + __pyx_v_ox);

                  /* "xpra/codecs/csc_cython/converter.pyx":752
 *                                 R = (r210&0x000003ff) >> 2
 *                                 o = oy*Ystride + ox
 *                                 Y[o] = clamp(YR * R + YG * G + YB * B + YC)             # <<<<<<<<<<<<<<
 *                                 count += 1
 *                                 Rsum += R
*/
                  (__pyx_v_Y[__pyx_v_o]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp(((((0x4C8B * __pyx_v_R) + (0x9646 * __pyx_v_G)) + (0x1D2F * __pyx_v_B)) + 0));

                  /* "xpra/codecs/csc_cython/converter.pyx":753
 *                                 o = oy*Ystride + ox
 *                                 Y[o] = clamp(YR * R + YG * G + YB * B + YC)
 *                                 count += 1             # <<<<<<<<<<<<<<
 *                                 Rsum += R
 *                                 Gsum += G
*/
                  __pyx_v_count = (__pyx_v_count + 1);

                  /* "xpra/codecs/csc_cython/converter.pyx":754
 *                                 Y[o] = clamp(YR * R + YG * G + YB * B + YC)
 *                                 count += 1
 *                                 Rsum += R             # <<<<<<<<<<<<<<
 *                                 Gsum += G
 *                                 Bsum += B
*/
                  __pyx_v_Rsum = (__pyx_v_Rsum + __pyx_v_R);

                  /* "xpra/codecs/csc_cython/converter.pyx":755
 *                                 count += 1
 *                                 Rsum += R
 *                                 Gsum += G             # <<<<<<<<<<<<<<
 *                                 Bsum += B
 *                         #write 1U and 1V:
*/
                  __pyx_v_Gsum = (__pyx_v_Gsum + __pyx_v_G);

                  /* "xpra/codecs/csc_cython/converter.pyx":756
 *                                 Rsum += R
 *                                 Gsum += G
 *                                 Bsum += B             # <<<<<<<<<<<<<<
 *                         #write 1U and 1V:
 *                         if count>0:
*/
                  __pyx_v_Bsum = (__pyx_v_Bsum + __pyx_v_B);
                }
                __pyx_L16_break:;
              }
              __pyx_L13_break:;

              /* "xpra/codecs/csc_cython/converter.pyx":758
 *                                 Bsum += B
 *                         #write 1U and 1V:
 *                         if count>0:             # <<<<<<<<<<<<<<
 *                             U[y*Ustride + x] = clamp(UR * Rsum//count + UG * Gsum//count + UB * Bsum//count + UC)
 *                             V[y*Vstride + x] = clamp(VR * Rsum//count + VG * Gsum//count + VB * Bsum//count + VC)
*/
              __pyx_t_14 = (__pyx_v_count > 0);
              if (__pyx_t_14) {

                /* "xpra/codecs/csc_cython/converter.pyx":759
 *                         #write 1U and 1V:
 *                         if count>0:
 *                             U[y*Ustride + x] = clamp(UR * Rsum//count + UG * Gsum//count + UB * Bsum//count + UC)             # <<<<<<<<<<<<<<
 *                             V[y*Vstride + x] = clamp(VR * Rsum//count + VG * Gsum//count + VB * Bsum//count + VC)
 *         else:
*/
                (__pyx_v_U[((__pyx_v_y * __pyx_v_Ustride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((((-11076L * __pyx_v_Rsum) / __pyx_v_count) + ((-21692L * __pyx_v_Gsum) / __pyx_v_count)) + ((0x8000 * __pyx_v_Bsum) / __pyx_v_count)) + 0x800000));

                /* "xpra/codecs/csc_cython/converter.pyx":760
 *                         if count>0:
 *                             U[y*Ustride + x] = clamp(UR * Rsum//count + UG * Gsum//count + UB * Bsum//count + UC)
 *                             V[y*Vstride + x] = clamp(VR * Rsum//count + VG * Gsum//count + VB * Bsum//count + VC)             # <<<<<<<<<<<<<<
 *         else:
 *             with nogil:
*/
                (__pyx_v_V[((__pyx_v_y * __pyx_v_Vstride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((((0x8000 * __pyx_v_Rsum) / __pyx_v_count) + ((-27460L * __pyx_v_Gsum) / __pyx_v_count)) + ((-5308L * __pyx_v_Bsum) / __pyx_v_count)) + 0x800000));

                /* "xpra/codecs/csc_cython/converter.pyx":758
 *                                 Bsum += B
 *                         #write 1U and 1V:
 *                         if count>0:             # <<<<<<<<<<<<<<
 *                             U[y*Ustride + x] = clamp(UR * Rsum//count + UG * Gsum//count + UB * Bsum//count + UC)
 *                             V[y*Vstride + x] = clamp(VR * Rsum//count + VG * Gsum//count + VB * Bsum//count + VC)
*/
              }
            }
          }
        }

        /* "xpra/codecs/csc_cython/converter.pyx":731
 *             assert Bpp==4
 *             input_r210 = <unsigned int*> input_image
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 for y in range(workh):
 *                     for x in range(workw):
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L7;
          }
          __pyx_L7:;
        }
    }

    /* "xpra/codecs/csc_cython/converter.pyx":728
 * 
 *         #from now on, we can release the gil:
 *         if self.src_format=="r210":             # <<<<<<<<<<<<<<
 *             assert Bpp==4
 *             input_r210 = <unsigned int*> input_image
*/
    goto __pyx_L4;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":762
 *                             V[y*Vstride + x] = clamp(VR * Rsum//count + VG * Gsum//count + VB * Bsum//count + VC)
 *         else:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 for y in range(workh):
 *                     for x in range(workw):
*/
  /*else*/ {
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "xpra/codecs/csc_cython/converter.pyx":763
 *         else:
 *             with nogil:
 *                 for y in range(workh):             # <<<<<<<<<<<<<<
 *                     for x in range(workw):
 *                         Rsum = Gsum = Bsum = 0
*/
          __pyx_t_4 = __pyx_v_workh;
          __pyx_t_15 = __pyx_t_4;
          for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
            __pyx_v_y = __pyx_t_16;

            /* "xpra/codecs/csc_cython/converter.pyx":764
 *             with nogil:
 *                 for y in range(workh):
 *                     for x in range(workw):             # <<<<<<<<<<<<<<
 *                         Rsum = Gsum = Bsum = 0
 *                         count = 0
*/
            __pyx_t_17 = __pyx_v_workw;
            __pyx_t_18 = __pyx_t_17;
            for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
              __pyx_v_x = __pyx_t_19;

              /* "xpra/codecs/csc_cython/converter.pyx":765
 *                 for y in range(workh):
 *                     for x in range(workw):
 *                         Rsum = Gsum = Bsum = 0             # <<<<<<<<<<<<<<
 *                         count = 0
 *                         for dy in range(2):
*/
              __pyx_v_Rsum = 0;
              __pyx_v_Gsum = 0;
              __pyx_v_Bsum = 0;

              /* "xpra/codecs/csc_cython/converter.pyx":766
 *                     for x in range(workw):
 *                         Rsum = Gsum = Bsum = 0
 *                         count = 0             # <<<<<<<<<<<<<<
 *                         for dy in range(2):
 *                             oy = y*2 + dy
*/
              __pyx_v_count = 0;

              /* "xpra/codecs/csc_cython/converter.pyx":767
 *                         Rsum = Gsum = Bsum = 0
 *                         count = 0
 *                         for dy in range(2):             # <<<<<<<<<<<<<<
 *                             oy = y*2 + dy
 *                             if oy>=dst_height:
*/
              for (__pyx_t_13 = 0; __pyx_t_13 < 2; __pyx_t_13+=1) {
                __pyx_v_dy = __pyx_t_13;

                /* "xpra/codecs/csc_cython/converter.pyx":768
 *                         count = 0
 *                         for dy in range(2):
 *                             oy = y*2 + dy             # <<<<<<<<<<<<<<
 *                             if oy>=dst_height:
 *                                 break
*/
                __pyx_v_oy = ((__pyx_v_y * 2) + __pyx_v_dy);

                /* "xpra/codecs/csc_cython/converter.pyx":769
 *                         for dy in range(2):
 *                             oy = y*2 + dy
 *                             if oy>=dst_height:             # <<<<<<<<<<<<<<
 *                                 break
 *                             sy = oy*src_height//dst_height
*/
                __pyx_t_14 = (__pyx_v_oy >= __pyx_v_dst_height);
                if (__pyx_t_14) {

                  /* "xpra/codecs/csc_cython/converter.pyx":770
 *                             oy = y*2 + dy
 *                             if oy>=dst_height:
 *                                 break             # <<<<<<<<<<<<<<
 *                             sy = oy*src_height//dst_height
 *                             for dx in range(2):
*/
                  goto __pyx_L27_break;

                  /* "xpra/codecs/csc_cython/converter.pyx":769
 *                         for dy in range(2):
 *                             oy = y*2 + dy
 *                             if oy>=dst_height:             # <<<<<<<<<<<<<<
 *                                 break
 *                             sy = oy*src_height//dst_height
*/
                }

                /* "xpra/codecs/csc_cython/converter.pyx":771
 *                             if oy>=dst_height:
 *                                 break
 *                             sy = oy*src_height//dst_height             # <<<<<<<<<<<<<<
 *                             for dx in range(2):
 *                                 ox = x*2 + dx
*/
                __pyx_v_sy = ((__pyx_v_oy * __pyx_v_src_height) / __pyx_v_dst_height);

                /* "xpra/codecs/csc_cython/converter.pyx":772
 *                                 break
 *                             sy = oy*src_height//dst_height
 *                             for dx in range(2):             # <<<<<<<<<<<<<<
 *                                 ox = x*2 + dx
 *                                 if ox>=dst_width:
*/
                for (__pyx_t_20 = 0; __pyx_t_20 < 2; __pyx_t_20+=1) {
                  __pyx_v_dx = __pyx_t_20;

                  /* "xpra/codecs/csc_cython/converter.pyx":773
 *                             sy = oy*src_height//dst_height
 *                             for dx in range(2):
 *                                 ox = x*2 + dx             # <<<<<<<<<<<<<<
 *                                 if ox>=dst_width:
 *                                     break
*/
                  __pyx_v_ox = ((__pyx_v_x * 2) + __pyx_v_dx);

                  /* "xpra/codecs/csc_cython/converter.pyx":774
 *                             for dx in range(2):
 *                                 ox = x*2 + dx
 *                                 if ox>=dst_width:             # <<<<<<<<<<<<<<
 *                                     break
 *                                 sx = ox*src_width//dst_width
*/
                  __pyx_t_14 = (__pyx_v_ox >= __pyx_v_dst_width);
                  if (__pyx_t_14) {

                    /* "xpra/codecs/csc_cython/converter.pyx":775
 *                                 ox = x*2 + dx
 *                                 if ox>=dst_width:
 *                                     break             # <<<<<<<<<<<<<<
 *                                 sx = ox*src_width//dst_width
 *                                 o = sy*input_stride + sx*Bpp
*/
                    goto __pyx_L30_break;

                    /* "xpra/codecs/csc_cython/converter.pyx":774
 *                             for dx in range(2):
 *                                 ox = x*2 + dx
 *                                 if ox>=dst_width:             # <<<<<<<<<<<<<<
 *                                     break
 *                                 sx = ox*src_width//dst_width
*/
                  }

                  /* "xpra/codecs/csc_cython/converter.pyx":776
 *                                 if ox>=dst_width:
 *                                     break
 *                                 sx = ox*src_width//dst_width             # <<<<<<<<<<<<<<
 *                                 o = sy*input_stride + sx*Bpp
 *                                 R = input_image[o + Rindex]
*/
                  __pyx_v_sx = ((__pyx_v_ox * __pyx_v_src_width) / __pyx_v_dst_width);

                  /* "xpra/codecs/csc_cython/converter.pyx":777
 *                                     break
 *                                 sx = ox*src_width//dst_width
 *                                 o = sy*input_stride + sx*Bpp             # <<<<<<<<<<<<<<
 *                                 R = input_image[o + Rindex]
 *                                 G = input_image[o + Gindex]
*/
                  __pyx_v_o = ((__pyx_v_sy * __pyx_v_input_stride) + (__pyx_v_sx * __pyx_v_Bpp));

                  /* "xpra/codecs/csc_cython/converter.pyx":778
 *                                 sx = ox*src_width//dst_width
 *                                 o = sy*input_stride + sx*Bpp
 *                                 R = input_image[o + Rindex]             # <<<<<<<<<<<<<<
 *                                 G = input_image[o + Gindex]
 *                                 B = input_image[o + Bindex]
*/
                  __pyx_v_R = (__pyx_v_input_image[(__pyx_v_o + __pyx_v_Rindex)]);

                  /* "xpra/codecs/csc_cython/converter.pyx":779
 *                                 o = sy*input_stride + sx*Bpp
 *                                 R = input_image[o + Rindex]
 *                                 G = input_image[o + Gindex]             # <<<<<<<<<<<<<<
 *                                 B = input_image[o + Bindex]
 *                                 o = oy*Ystride + ox
*/
                  __pyx_v_G = (__pyx_v_input_image[(__pyx_v_o + __pyx_v_Gindex)]);

                  /* "xpra/codecs/csc_cython/converter.pyx":780
 *                                 R = input_image[o + Rindex]
 *                                 G = input_image[o + Gindex]
 *                                 B = input_image[o + Bindex]             # <<<<<<<<<<<<<<
 *                                 o = oy*Ystride + ox
 *                                 if full_range:
*/
                  __pyx_v_B = (__pyx_v_input_image[(__pyx_v_o + __pyx_v_Bindex)]);

                  /* "xpra/codecs/csc_cython/converter.pyx":781
 *                                 G = input_image[o + Gindex]
 *                                 B = input_image[o + Bindex]
 *                                 o = oy*Ystride + ox             # <<<<<<<<<<<<<<
 *                                 if full_range:
 *                                     Y[o] = clamp(YR * R + YG * G + YB * B + YC)
*/
                  __pyx_v_o = ((__pyx_v_oy * __pyx_v_Ystride) + __pyx_v_ox);

                  /* "xpra/codecs/csc_cython/converter.pyx":782
 *                                 B = input_image[o + Bindex]
 *                                 o = oy*Ystride + ox
 *                                 if full_range:             # <<<<<<<<<<<<<<
 *                                     Y[o] = clamp(YR * R + YG * G + YB * B + YC)
 *                                 else:
*/
                  __pyx_t_14 = (__pyx_v_full_range != 0);
                  if (__pyx_t_14) {

                    /* "xpra/codecs/csc_cython/converter.pyx":783
 *                                 o = oy*Ystride + ox
 *                                 if full_range:
 *                                     Y[o] = clamp(YR * R + YG * G + YB * B + YC)             # <<<<<<<<<<<<<<
 *                                 else:
 *                                     Y[o] = clamp_studio_Y(YR * R + YG * G + YB * B + YC)
*/
                    (__pyx_v_Y[__pyx_v_o]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp(((((0x4C8B * __pyx_v_R) + (0x9646 * __pyx_v_G)) + (0x1D2F * __pyx_v_B)) + 0));

                    /* "xpra/codecs/csc_cython/converter.pyx":782
 *                                 B = input_image[o + Bindex]
 *                                 o = oy*Ystride + ox
 *                                 if full_range:             # <<<<<<<<<<<<<<
 *                                     Y[o] = clamp(YR * R + YG * G + YB * B + YC)
 *                                 else:
*/
                    goto __pyx_L32;
                  }

                  /* "xpra/codecs/csc_cython/converter.pyx":785
 *                                     Y[o] = clamp(YR * R + YG * G + YB * B + YC)
 *                                 else:
 *                                     Y[o] = clamp_studio_Y(YR * R + YG * G + YB * B + YC)             # <<<<<<<<<<<<<<
 *                                 count += 1
 *                                 Rsum += R
*/
                  /*else*/ {
                    (__pyx_v_Y[__pyx_v_o]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp_studio_Y(((((0x4C8B * __pyx_v_R) + (0x9646 * __pyx_v_G)) + (0x1D2F * __pyx_v_B)) + 0));
                  }
                  __pyx_L32:;

                  /* "xpra/codecs/csc_cython/converter.pyx":786
 *                                 else:
 *                                     Y[o] = clamp_studio_Y(YR * R + YG * G + YB * B + YC)
 *                                 count += 1             # <<<<<<<<<<<<<<
 *                                 Rsum += R
 *                                 Gsum += G
*/
                  __pyx_v_count = (__pyx_v_count + 1);

                  /* "xpra/codecs/csc_cython/converter.pyx":787
 *                                     Y[o] = clamp_studio_Y(YR * R + YG * G + YB * B + YC)
 *                                 count += 1
 *                                 Rsum += R             # <<<<<<<<<<<<<<
 *                                 Gsum += G
 *                                 Bsum += B
*/
                  __pyx_v_Rsum = (__pyx_v_Rsum + __pyx_v_R);

                  /* "xpra/codecs/csc_cython/converter.pyx":788
 *                                 count += 1
 *                                 Rsum += R
 *                                 Gsum += G             # <<<<<<<<<<<<<<
 *                                 Bsum += B
 *                         #write 1U and 1V:
*/
                  __pyx_v_Gsum = (__pyx_v_Gsum + __pyx_v_G);

                  /* "xpra/codecs/csc_cython/converter.pyx":789
 *                                 Rsum += R
 *                                 Gsum += G
 *                                 Bsum += B             # <<<<<<<<<<<<<<
 *                         #write 1U and 1V:
 *                         if count>0:
*/
                  __pyx_v_Bsum = (__pyx_v_Bsum + __pyx_v_B);
                }
                __pyx_L30_break:;
              }
              __pyx_L27_break:;

              /* "xpra/codecs/csc_cython/converter.pyx":791
 *                                 Bsum += B
 *                         #write 1U and 1V:
 *                         if count>0:             # <<<<<<<<<<<<<<
 *                             Rsum /= count
 *                             Gsum /= count
*/
              __pyx_t_14 = (__pyx_v_count > 0);
              if (__pyx_t_14) {

                /* "xpra/codecs/csc_cython/converter.pyx":792
 *                         #write 1U and 1V:
 *                         if count>0:
 *                             Rsum /= count             # <<<<<<<<<<<<<<
 *                             Gsum /= count
 *                             Bsum /= count
*/
                __pyx_v_Rsum = (__pyx_v_Rsum / __pyx_v_count);

                /* "xpra/codecs/csc_cython/converter.pyx":793
 *                         if count>0:
 *                             Rsum /= count
 *                             Gsum /= count             # <<<<<<<<<<<<<<
 *                             Bsum /= count
 *                             if full_range:
*/
                __pyx_v_Gsum = (__pyx_v_Gsum / __pyx_v_count);

                /* "xpra/codecs/csc_cython/converter.pyx":794
 *                             Rsum /= count
 *                             Gsum /= count
 *                             Bsum /= count             # <<<<<<<<<<<<<<
 *                             if full_range:
 *                                 U[y*Ustride + x] = clamp(UR * Rsum + UG * Gsum + UB * Bsum + UC)
*/
                __pyx_v_Bsum = (__pyx_v_Bsum / __pyx_v_count);

                /* "xpra/codecs/csc_cython/converter.pyx":795
 *                             Gsum /= count
 *                             Bsum /= count
 *                             if full_range:             # <<<<<<<<<<<<<<
 *                                 U[y*Ustride + x] = clamp(UR * Rsum + UG * Gsum + UB * Bsum + UC)
 *                                 V[y*Vstride + x] = clamp(VR * Rsum + VG * Gsum + VB * Bsum + VC)
*/
                __pyx_t_14 = (__pyx_v_full_range != 0);
                if (__pyx_t_14) {

                  /* "xpra/codecs/csc_cython/converter.pyx":796
 *                             Bsum /= count
 *                             if full_range:
 *                                 U[y*Ustride + x] = clamp(UR * Rsum + UG * Gsum + UB * Bsum + UC)             # <<<<<<<<<<<<<<
 *                                 V[y*Vstride + x] = clamp(VR * Rsum + VG * Gsum + VB * Bsum + VC)
 *                             else:
*/
                  (__pyx_v_U[((__pyx_v_y * __pyx_v_Ustride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp(((((-11076L * __pyx_v_Rsum) + (-21692L * __pyx_v_Gsum)) + (0x8000 * __pyx_v_Bsum)) + 0x800000));

                  /* "xpra/codecs/csc_cython/converter.pyx":797
 *                             if full_range:
 *                                 U[y*Ustride + x] = clamp(UR * Rsum + UG * Gsum + UB * Bsum + UC)
 *                                 V[y*Vstride + x] = clamp(VR * Rsum + VG * Gsum + VB * Bsum + VC)             # <<<<<<<<<<<<<<
 *                             else:
 *                                 U[y*Ustride + x] = clamp_studio_UV(UR * Rsum + UG * Gsum + UB * Bsum + UC)
*/
                  (__pyx_v_V[((__pyx_v_y * __pyx_v_Vstride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp(((((0x8000 * __pyx_v_Rsum) + (-27460L * __pyx_v_Gsum)) + (-5308L * __pyx_v_Bsum)) + 0x800000));

                  /* "xpra/codecs/csc_cython/converter.pyx":795
 *                             Gsum /= count
 *                             Bsum /= count
 *                             if full_range:             # <<<<<<<<<<<<<<
 *                                 U[y*Ustride + x] = clamp(UR * Rsum + UG * Gsum + UB * Bsum + UC)
 *                                 V[y*Vstride + x] = clamp(VR * Rsum + VG * Gsum + VB * Bsum + VC)
*/
                  goto __pyx_L34;
                }

                /* "xpra/codecs/csc_cython/converter.pyx":799
 *                                 V[y*Vstride + x] = clamp(VR * Rsum + VG * Gsum + VB * Bsum + VC)
 *                             else:
 *                                 U[y*Ustride + x] = clamp_studio_UV(UR * Rsum + UG * Gsum + UB * Bsum + UC)             # <<<<<<<<<<<<<<
 *                                 V[y*Vstride + x] = clamp_studio_UV(VR * Rsum + VG * Gsum + VB * Bsum + VC)
 *         PyBuffer_Release(&py_buf)
*/
                /*else*/ {
                  (__pyx_v_U[((__pyx_v_y * __pyx_v_Ustride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp_studio_UV(((((-11076L * __pyx_v_Rsum) + (-21692L * __pyx_v_Gsum)) + (0x8000 * __pyx_v_Bsum)) + 0x800000));

                  /* "xpra/codecs/csc_cython/converter.pyx":800
 *                             else:
 *                                 U[y*Ustride + x] = clamp_studio_UV(UR * Rsum + UG * Gsum + UB * Bsum + UC)
 *                                 V[y*Vstride + x] = clamp_studio_UV(VR * Rsum + VG * Gsum + VB * Bsum + VC)             # <<<<<<<<<<<<<<
 *         PyBuffer_Release(&py_buf)
 *         return self.planar3_image_wrapper(<void *> output_image)
*/
                  (__pyx_v_V[((__pyx_v_y * __pyx_v_Vstride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp_studio_UV(((((0x8000 * __pyx_v_Rsum) + (-27460L * __pyx_v_Gsum)) + (-5308L * __pyx_v_Bsum)) + 0x800000));
                }
                __pyx_L34:;

                /* "xpra/codecs/csc_cython/converter.pyx":791
 *                                 Bsum += B
 *                         #write 1U and 1V:
 *                         if count>0:             # <<<<<<<<<<<<<<
 *                             Rsum /= count
 *                             Gsum /= count
*/
              }
            }
          }
        }

        /* "xpra/codecs/csc_cython/converter.pyx":762
 *                             V[y*Vstride + x] = clamp(VR * Rsum//count + VG * Gsum//count + VB * Bsum//count + VC)
 *         else:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 for y in range(workh):
 *                     for x in range(workw):
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L21;
          }
          __pyx_L21:;
        }
    }
  }
  __pyx_L4:;

  /* "xpra/codecs/csc_cython/converter.pyx":801
 *                                 U[y*Ustride + x] = clamp_studio_UV(UR * Rsum + UG * Gsum + UB * Bsum + UC)
 *                                 V[y*Vstride + x] = clamp_studio_UV(VR * Rsum + VG * Gsum + VB * Bsum + VC)
 *         PyBuffer_Release(&py_buf)             # <<<<<<<<<<<<<<
 *         return self.planar3_image_wrapper(<void *> output_image)
 * 
*/
  PyBuffer_Release((&__pyx_v_py_buf));

  /* "xpra/codecs/csc_cython/converter.pyx":802
 *                                 V[y*Vstride + x] = clamp_studio_UV(VR * Rsum + VG * Gsum + VB * Bsum + VC)
 *         PyBuffer_Release(&py_buf)
 *         return self.planar3_image_wrapper(<void *> output_image)             # <<<<<<<<<<<<<<
 * 
 *     def BGR_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->planar3_image_wrapper(__pyx_v_self, ((void *)__pyx_v_output_image), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":682
 *         return self.do_RGB_to_YUV420P(image, 4, RGBX_B, RGBX_G, RGBX_R)
 * 
 *     cdef do_RGB_to_YUV420P(self,             # <<<<<<<<<<<<<<
 *                            image: ImageWrapper,
 *                            const uint8_t Bpp,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __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_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.do_RGB_to_YUV420P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pixels);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":804
 *         return self.planar3_image_wrapper(<void *> output_image)
 * 
 *     def BGR_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_39BGR_to_YUV444P(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_39BGR_to_YUV444P = {"BGR_to_YUV444P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_39BGR_to_YUV444P, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_39BGR_to_YUV444P(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("BGR_to_YUV444P (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_38BGR_to_YUV444P(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_38BGR_to_YUV444P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("BGR_to_YUV444P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":805
 * 
 *     def BGR_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGB_to_YUV444P(image, 3, BGR_R, BGR_G, BGR_B)             # <<<<<<<<<<<<<<
 * 
 *     def RGB_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGB_to_YUV444P(__pyx_v_self, __pyx_v_image, 3, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_R, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_B); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":804
 *         return self.planar3_image_wrapper(<void *> output_image)
 * 
 *     def BGR_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.BGR_to_YUV444P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":807
 *         return self.do_RGB_to_YUV444P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
 *     def RGB_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_41RGB_to_YUV444P(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_41RGB_to_YUV444P = {"RGB_to_YUV444P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_41RGB_to_YUV444P, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_41RGB_to_YUV444P(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RGB_to_YUV444P (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_40RGB_to_YUV444P(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_40RGB_to_YUV444P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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_YUV444P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":808
 * 
 *     def RGB_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGB_to_YUV444P(image, 3, RGB_B, RGB_G, RGB_R)             # <<<<<<<<<<<<<<
 * 
 *     def BGRX_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGB_to_YUV444P(__pyx_v_self, __pyx_v_image, 3, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_B, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_R); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":807
 *         return self.do_RGB_to_YUV444P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
 *     def RGB_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.RGB_to_YUV444P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":810
 *         return self.do_RGB_to_YUV444P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
 *     def BGRX_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_43BGRX_to_YUV444P(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_43BGRX_to_YUV444P = {"BGRX_to_YUV444P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_43BGRX_to_YUV444P, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_43BGRX_to_YUV444P(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("BGRX_to_YUV444P (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_42BGRX_to_YUV444P(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_42BGRX_to_YUV444P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("BGRX_to_YUV444P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":811
 * 
 *     def BGRX_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGB_to_YUV444P(image, 4, BGRX_R, BGRX_G, BGRX_B)             # <<<<<<<<<<<<<<
 * 
 *     def RGBX_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGB_to_YUV444P(__pyx_v_self, __pyx_v_image, 4, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_R, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_B); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":810
 *         return self.do_RGB_to_YUV444P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
 *     def BGRX_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.BGRX_to_YUV444P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":813
 *         return self.do_RGB_to_YUV444P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
 *     def RGBX_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 4, RGBX_B, RGBX_G, RGBX_R)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_45RGBX_to_YUV444P(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_45RGBX_to_YUV444P = {"RGBX_to_YUV444P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_45RGBX_to_YUV444P, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_45RGBX_to_YUV444P(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RGBX_to_YUV444P (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_44RGBX_to_YUV444P(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_44RGBX_to_YUV444P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("RGBX_to_YUV444P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":814
 * 
 *     def RGBX_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGB_to_YUV444P(image, 4, RGBX_B, RGBX_G, RGBX_R)             # <<<<<<<<<<<<<<
 * 
 *     cdef do_RGB_to_YUV444P(self,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGB_to_YUV444P(__pyx_v_self, __pyx_v_image, 4, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_B, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_R); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":813
 *         return self.do_RGB_to_YUV444P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
 *     def RGBX_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 4, RGBX_B, RGBX_G, RGBX_R)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.RGBX_to_YUV444P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":816
 *         return self.do_RGB_to_YUV444P(image, 4, RGBX_B, RGBX_G, RGBX_R)
 * 
 *     cdef do_RGB_to_YUV444P(self,             # <<<<<<<<<<<<<<
 *                            image: ImageWrapper,
 *                            const uint8_t Bpp,
*/

static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_RGB_to_YUV444P(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image, uint8_t const __pyx_v_Bpp, uint8_t const __pyx_v_Rindex, uint8_t const __pyx_v_Gindex, uint8_t const __pyx_v_Bindex) {
  unsigned int __pyx_v_x;
  unsigned int __pyx_v_y;
  unsigned int __pyx_v_o;
  unsigned int __pyx_v_sx;
  unsigned int __pyx_v_sy;
  unsigned char __pyx_v_R;
  unsigned char __pyx_v_G;
  unsigned char __pyx_v_B;
  PyObject *__pyx_v_pixels = NULL;
  unsigned int __pyx_v_input_stride;
  unsigned char *__pyx_v_output_image;
  unsigned char *__pyx_v_Y;
  unsigned char *__pyx_v_U;
  unsigned char *__pyx_v_V;
  unsigned int __pyx_v_Ystride;
  unsigned int __pyx_v_Ustride;
  unsigned int __pyx_v_Vstride;
  unsigned int __pyx_v_src_width;
  unsigned int __pyx_v_src_height;
  unsigned int __pyx_v_dst_width;
  unsigned int __pyx_v_dst_height;
  unsigned char __pyx_v_full_range;
  unsigned char const *__pyx_v_input_image;
  PyObject *__pyx_v_bc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __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 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  unsigned char __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  uintptr_t __pyx_t_18;
  unsigned int __pyx_t_19;
  unsigned int __pyx_t_20;
  unsigned int __pyx_t_21;
  unsigned int __pyx_t_22;
  unsigned int __pyx_t_23;
  int __pyx_t_24;
  PyObject *__pyx_t_25 = NULL;
  int __pyx_t_26;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("do_RGB_to_YUV444P", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":827
 *         cdef unsigned char R, G, B
 * 
 *         self.validate_rgb_image(image)             # <<<<<<<<<<<<<<
 *         pixels = image.get_pixels()
 *         cdef unsigned int input_stride = image.get_rowstride()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_image};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate_rgb_image, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":828
 * 
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()             # <<<<<<<<<<<<<<
 *         cdef unsigned int input_stride = image.get_rowstride()
 *         log("do_RGB_to_YUV444P(%s, %i, %i, %i, %i) input=%s, strides=%s", image, Bpp, Rindex, Gindex, Bindex, len(pixels), input_stride)
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_pixels = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":829
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()
 *         cdef unsigned int input_stride = image.get_rowstride()             # <<<<<<<<<<<<<<
 *         log("do_RGB_to_YUV444P(%s, %i, %i, %i, %i) input=%s, strides=%s", image, Bpp, Rindex, Gindex, Bindex, len(pixels), input_stride)
 * 
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_rowstride, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 829, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_input_stride = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":830
 *         pixels = image.get_pixels()
 *         cdef unsigned int input_stride = image.get_rowstride()
 *         log("do_RGB_to_YUV444P(%s, %i, %i, %i, %i) input=%s, strides=%s", image, Bpp, Rindex, Gindex, Bindex, len(pixels), input_stride)             # <<<<<<<<<<<<<<
 * 
 *         #allocate output buffer:
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyLong_From_uint8_t(__pyx_v_Bpp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyLong_From_uint8_t(__pyx_v_Rindex); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyLong_From_uint8_t(__pyx_v_Gindex); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyLong_From_uint8_t(__pyx_v_Bindex); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_Length(__pyx_v_pixels); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 830, __pyx_L1_error)
  __pyx_t_11 = PyLong_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyLong_From_unsigned_int(__pyx_v_input_stride); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[9] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_do_RGB_to_YUV444P_s_i_i_i_i_inpu, __pyx_v_image, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_11, __pyx_t_12};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (9-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":833
 * 
 *         #allocate output buffer:
 *         cdef unsigned char *output_image = <unsigned char*> memalign(self.buffer_size)             # <<<<<<<<<<<<<<
 *         cdef unsigned char *Y = output_image + self.offsets[0]
 *         cdef unsigned char *U = output_image + self.offsets[1]
*/
  __pyx_v_output_image = ((unsigned char *)__pyx_f_4xpra_7buffers_6membuf_memalign(__pyx_v_self->buffer_size));

  /* "xpra/codecs/csc_cython/converter.pyx":834
 *         #allocate output buffer:
 *         cdef unsigned char *output_image = <unsigned char*> memalign(self.buffer_size)
 *         cdef unsigned char *Y = output_image + self.offsets[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned char *U = output_image + self.offsets[1]
 *         cdef unsigned char *V = output_image + self.offsets[2]
*/
  __pyx_v_Y = (__pyx_v_output_image + (__pyx_v_self->offsets[0]));

  /* "xpra/codecs/csc_cython/converter.pyx":835
 *         cdef unsigned char *output_image = <unsigned char*> memalign(self.buffer_size)
 *         cdef unsigned char *Y = output_image + self.offsets[0]
 *         cdef unsigned char *U = output_image + self.offsets[1]             # <<<<<<<<<<<<<<
 *         cdef unsigned char *V = output_image + self.offsets[2]
 * 
*/
  __pyx_v_U = (__pyx_v_output_image + (__pyx_v_self->offsets[1]));

  /* "xpra/codecs/csc_cython/converter.pyx":836
 *         cdef unsigned char *Y = output_image + self.offsets[0]
 *         cdef unsigned char *U = output_image + self.offsets[1]
 *         cdef unsigned char *V = output_image + self.offsets[2]             # <<<<<<<<<<<<<<
 * 
 *         #copy to local variables (ensures C code will be optimized correctly)
*/
  __pyx_v_V = (__pyx_v_output_image + (__pyx_v_self->offsets[2]));

  /* "xpra/codecs/csc_cython/converter.pyx":839
 * 
 *         #copy to local variables (ensures C code will be optimized correctly)
 *         cdef unsigned int Ystride = self.dst_strides[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned int Ustride = self.dst_strides[1]
 *         cdef unsigned int Vstride = self.dst_strides[2]
*/
  __pyx_v_Ystride = (__pyx_v_self->dst_strides[0]);

  /* "xpra/codecs/csc_cython/converter.pyx":840
 *         #copy to local variables (ensures C code will be optimized correctly)
 *         cdef unsigned int Ystride = self.dst_strides[0]
 *         cdef unsigned int Ustride = self.dst_strides[1]             # <<<<<<<<<<<<<<
 *         cdef unsigned int Vstride = self.dst_strides[2]
 *         cdef unsigned int src_width = self.src_width
*/
  __pyx_v_Ustride = (__pyx_v_self->dst_strides[1]);

  /* "xpra/codecs/csc_cython/converter.pyx":841
 *         cdef unsigned int Ystride = self.dst_strides[0]
 *         cdef unsigned int Ustride = self.dst_strides[1]
 *         cdef unsigned int Vstride = self.dst_strides[2]             # <<<<<<<<<<<<<<
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height
*/
  __pyx_v_Vstride = (__pyx_v_self->dst_strides[2]);

  /* "xpra/codecs/csc_cython/converter.pyx":842
 *         cdef unsigned int Ustride = self.dst_strides[1]
 *         cdef unsigned int Vstride = self.dst_strides[2]
 *         cdef unsigned int src_width = self.src_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width
*/
  __pyx_t_4 = __pyx_v_self->src_width;
  __pyx_v_src_width = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":843
 *         cdef unsigned int Vstride = self.dst_strides[2]
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height             # <<<<<<<<<<<<<<
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height
*/
  __pyx_t_4 = __pyx_v_self->src_height;
  __pyx_v_src_height = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":844
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int dst_height = self.dst_height
 *         cdef unsigned char full_range = self.full_range
*/
  __pyx_t_4 = __pyx_v_self->dst_width;
  __pyx_v_dst_width = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":845
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height             # <<<<<<<<<<<<<<
 *         cdef unsigned char full_range = self.full_range
 * 
*/
  __pyx_t_4 = __pyx_v_self->dst_height;
  __pyx_v_dst_height = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":846
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height
 *         cdef unsigned char full_range = self.full_range             # <<<<<<<<<<<<<<
 * 
 *         cdef const unsigned char *input_image
*/
  __pyx_t_13 = __pyx_v_self->full_range;
  __pyx_v_full_range = __pyx_t_13;

  /* "xpra/codecs/csc_cython/converter.pyx":850
 *         cdef const unsigned char *input_image
 *         cdef uintptr_t buf
 *         with buffer_context(pixels) as bc:             # <<<<<<<<<<<<<<
 *             input_image = <const unsigned char *> (<uintptr_t> int(bc))
 *             # buf_size = len(bc)
*/
  /*with:*/ {
    __pyx_t_1 = __pyx_f_4xpra_7buffers_6membuf_buffer_context(__pyx_v_pixels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_12 = NULL;
    __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 850, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
      assert(__pyx_t_12);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 850, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_11 = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
        __Pyx_XGOTREF(__pyx_t_15);
        __Pyx_XGOTREF(__pyx_t_16);
        __Pyx_XGOTREF(__pyx_t_17);
        /*try:*/ {
          __pyx_v_bc = __pyx_t_11;
          __pyx_t_11 = 0;

          /* "xpra/codecs/csc_cython/converter.pyx":851
 *         cdef uintptr_t buf
 *         with buffer_context(pixels) as bc:
 *             input_image = <const unsigned char *> (<uintptr_t> int(bc))             # <<<<<<<<<<<<<<
 *             # buf_size = len(bc)
 *             with nogil:
*/
          __pyx_t_11 = __Pyx_PyNumber_Int(__pyx_v_bc); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 851, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_18 = __Pyx_PyLong_As_size_t(__pyx_t_11); if (unlikely((__pyx_t_18 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 851, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_v_input_image = ((unsigned char const *)((uintptr_t)__pyx_t_18));

          /* "xpra/codecs/csc_cython/converter.pyx":853
 *             input_image = <const unsigned char *> (<uintptr_t> int(bc))
 *             # buf_size = len(bc)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 for y in range(dst_height):
 *                     for x in range(dst_width):
*/
          {
              PyThreadState * _save;
              _save = PyEval_SaveThread();
              __Pyx_FastGIL_Remember();
              /*try:*/ {

                /* "xpra/codecs/csc_cython/converter.pyx":854
 *             # buf_size = len(bc)
 *             with nogil:
 *                 for y in range(dst_height):             # <<<<<<<<<<<<<<
 *                     for x in range(dst_width):
 *                         sx = x * src_width // dst_width
*/
                __pyx_t_4 = __pyx_v_dst_height;
                __pyx_t_19 = __pyx_t_4;
                for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
                  __pyx_v_y = __pyx_t_20;

                  /* "xpra/codecs/csc_cython/converter.pyx":855
 *             with nogil:
 *                 for y in range(dst_height):
 *                     for x in range(dst_width):             # <<<<<<<<<<<<<<
 *                         sx = x * src_width // dst_width
 *                         sy = y * src_height // dst_height
*/
                  __pyx_t_21 = __pyx_v_dst_width;
                  __pyx_t_22 = __pyx_t_21;
                  for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
                    __pyx_v_x = __pyx_t_23;

                    /* "xpra/codecs/csc_cython/converter.pyx":856
 *                 for y in range(dst_height):
 *                     for x in range(dst_width):
 *                         sx = x * src_width // dst_width             # <<<<<<<<<<<<<<
 *                         sy = y * src_height // dst_height
 *                         o = sy * input_stride + sx * Bpp
*/
                    __pyx_v_sx = ((__pyx_v_x * __pyx_v_src_width) / __pyx_v_dst_width);

                    /* "xpra/codecs/csc_cython/converter.pyx":857
 *                     for x in range(dst_width):
 *                         sx = x * src_width // dst_width
 *                         sy = y * src_height // dst_height             # <<<<<<<<<<<<<<
 *                         o = sy * input_stride + sx * Bpp
 *                         # assert o + Bpp <= buf_size
*/
                    __pyx_v_sy = ((__pyx_v_y * __pyx_v_src_height) / __pyx_v_dst_height);

                    /* "xpra/codecs/csc_cython/converter.pyx":858
 *                         sx = x * src_width // dst_width
 *                         sy = y * src_height // dst_height
 *                         o = sy * input_stride + sx * Bpp             # <<<<<<<<<<<<<<
 *                         # assert o + Bpp <= buf_size
 *                         R = input_image[o + Rindex]
*/
                    __pyx_v_o = ((__pyx_v_sy * __pyx_v_input_stride) + (__pyx_v_sx * __pyx_v_Bpp));

                    /* "xpra/codecs/csc_cython/converter.pyx":860
 *                         o = sy * input_stride + sx * Bpp
 *                         # assert o + Bpp <= buf_size
 *                         R = input_image[o + Rindex]             # <<<<<<<<<<<<<<
 *                         G = input_image[o + Gindex]
 *                         B = input_image[o + Bindex]
*/
                    __pyx_v_R = (__pyx_v_input_image[(__pyx_v_o + __pyx_v_Rindex)]);

                    /* "xpra/codecs/csc_cython/converter.pyx":861
 *                         # assert o + Bpp <= buf_size
 *                         R = input_image[o + Rindex]
 *                         G = input_image[o + Gindex]             # <<<<<<<<<<<<<<
 *                         B = input_image[o + Bindex]
 *                         if full_range:
*/
                    __pyx_v_G = (__pyx_v_input_image[(__pyx_v_o + __pyx_v_Gindex)]);

                    /* "xpra/codecs/csc_cython/converter.pyx":862
 *                         R = input_image[o + Rindex]
 *                         G = input_image[o + Gindex]
 *                         B = input_image[o + Bindex]             # <<<<<<<<<<<<<<
 *                         if full_range:
 *                             Y[y * Ystride + x] = clamp(YR * R + YG * G + YB * B + YC)
*/
                    __pyx_v_B = (__pyx_v_input_image[(__pyx_v_o + __pyx_v_Bindex)]);

                    /* "xpra/codecs/csc_cython/converter.pyx":863
 *                         G = input_image[o + Gindex]
 *                         B = input_image[o + Bindex]
 *                         if full_range:             # <<<<<<<<<<<<<<
 *                             Y[y * Ystride + x] = clamp(YR * R + YG * G + YB * B + YC)
 *                             U[y * Ustride + x] = clamp(UR * R + UG * G + UB * B + UC)
*/
                    __pyx_t_24 = (__pyx_v_full_range != 0);
                    if (__pyx_t_24) {

                      /* "xpra/codecs/csc_cython/converter.pyx":864
 *                         B = input_image[o + Bindex]
 *                         if full_range:
 *                             Y[y * Ystride + x] = clamp(YR * R + YG * G + YB * B + YC)             # <<<<<<<<<<<<<<
 *                             U[y * Ustride + x] = clamp(UR * R + UG * G + UB * B + UC)
 *                             V[y * Vstride + x] = clamp(VR * R + VG * G + VB * B + VC)
*/
                      (__pyx_v_Y[((__pyx_v_y * __pyx_v_Ystride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp(((((0x4C8B * __pyx_v_R) + (0x9646 * __pyx_v_G)) + (0x1D2F * __pyx_v_B)) + 0));

                      /* "xpra/codecs/csc_cython/converter.pyx":865
 *                         if full_range:
 *                             Y[y * Ystride + x] = clamp(YR * R + YG * G + YB * B + YC)
 *                             U[y * Ustride + x] = clamp(UR * R + UG * G + UB * B + UC)             # <<<<<<<<<<<<<<
 *                             V[y * Vstride + x] = clamp(VR * R + VG * G + VB * B + VC)
 *                         else:
*/
                      (__pyx_v_U[((__pyx_v_y * __pyx_v_Ustride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp(((((-11076L * __pyx_v_R) + (-21692L * __pyx_v_G)) + (0x8000 * __pyx_v_B)) + 0x800000));

                      /* "xpra/codecs/csc_cython/converter.pyx":866
 *                             Y[y * Ystride + x] = clamp(YR * R + YG * G + YB * B + YC)
 *                             U[y * Ustride + x] = clamp(UR * R + UG * G + UB * B + UC)
 *                             V[y * Vstride + x] = clamp(VR * R + VG * G + VB * B + VC)             # <<<<<<<<<<<<<<
 *                         else:
 *                             Y[y * Ystride + x] = clamp_studio_Y(YR * R + YG * G + YB * B + YC)
*/
                      (__pyx_v_V[((__pyx_v_y * __pyx_v_Vstride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp(((((0x8000 * __pyx_v_R) + (-27460L * __pyx_v_G)) + (-5308L * __pyx_v_B)) + 0x800000));

                      /* "xpra/codecs/csc_cython/converter.pyx":863
 *                         G = input_image[o + Gindex]
 *                         B = input_image[o + Bindex]
 *                         if full_range:             # <<<<<<<<<<<<<<
 *                             Y[y * Ystride + x] = clamp(YR * R + YG * G + YB * B + YC)
 *                             U[y * Ustride + x] = clamp(UR * R + UG * G + UB * B + UC)
*/
                      goto __pyx_L20;
                    }

                    /* "xpra/codecs/csc_cython/converter.pyx":868
 *                             V[y * Vstride + x] = clamp(VR * R + VG * G + VB * B + VC)
 *                         else:
 *                             Y[y * Ystride + x] = clamp_studio_Y(YR * R + YG * G + YB * B + YC)             # <<<<<<<<<<<<<<
 *                             U[y * Ustride + x] = clamp_studio_UV(UR * R + UG * G + UB * B + UC)
 *                             V[y * Vstride + x] = clamp_studio_UV(VR * R + VG * G + VB * B + VC)
*/
                    /*else*/ {
                      (__pyx_v_Y[((__pyx_v_y * __pyx_v_Ystride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp_studio_Y(((((0x4C8B * __pyx_v_R) + (0x9646 * __pyx_v_G)) + (0x1D2F * __pyx_v_B)) + 0));

                      /* "xpra/codecs/csc_cython/converter.pyx":869
 *                         else:
 *                             Y[y * Ystride + x] = clamp_studio_Y(YR * R + YG * G + YB * B + YC)
 *                             U[y * Ustride + x] = clamp_studio_UV(UR * R + UG * G + UB * B + UC)             # <<<<<<<<<<<<<<
 *                             V[y * Vstride + x] = clamp_studio_UV(VR * R + VG * G + VB * B + VC)
 *         return self.planar3_image_wrapper(<void *> output_image)
*/
                      (__pyx_v_U[((__pyx_v_y * __pyx_v_Ustride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp_studio_UV(((((-11076L * __pyx_v_R) + (-21692L * __pyx_v_G)) + (0x8000 * __pyx_v_B)) + 0x800000));

                      /* "xpra/codecs/csc_cython/converter.pyx":870
 *                             Y[y * Ystride + x] = clamp_studio_Y(YR * R + YG * G + YB * B + YC)
 *                             U[y * Ustride + x] = clamp_studio_UV(UR * R + UG * G + UB * B + UC)
 *                             V[y * Vstride + x] = clamp_studio_UV(VR * R + VG * G + VB * B + VC)             # <<<<<<<<<<<<<<
 *         return self.planar3_image_wrapper(<void *> output_image)
 * 
*/
                      (__pyx_v_V[((__pyx_v_y * __pyx_v_Vstride) + __pyx_v_x)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp_studio_UV(((((0x8000 * __pyx_v_R) + (-27460L * __pyx_v_G)) + (-5308L * __pyx_v_B)) + 0x800000));
                    }
                    __pyx_L20:;
                  }
                }
              }

              /* "xpra/codecs/csc_cython/converter.pyx":853
 *             input_image = <const unsigned char *> (<uintptr_t> int(bc))
 *             # buf_size = len(bc)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 for y in range(dst_height):
 *                     for x in range(dst_width):
*/
              /*finally:*/ {
                /*normal exit:*/{
                  __Pyx_FastGIL_Forget();
                  PyEval_RestoreThread(_save);
                  goto __pyx_L15;
                }
                __pyx_L15:;
              }
          }

          /* "xpra/codecs/csc_cython/converter.pyx":850
 *         cdef const unsigned char *input_image
 *         cdef uintptr_t buf
 *         with buffer_context(pixels) as bc:             # <<<<<<<<<<<<<<
 *             input_image = <const unsigned char *> (<uintptr_t> int(bc))
 *             # buf_size = len(bc)
*/
        }
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        goto __pyx_L12_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 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_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.do_RGB_to_YUV444P", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 850, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_5);
          __pyx_t_12 = PyTuple_Pack(3, __pyx_t_11, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 850, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_12, NULL);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 850, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_25);
          __pyx_t_24 = __Pyx_PyObject_IsTrue(__pyx_t_25);
          __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
          if (__pyx_t_24 < (0)) __PYX_ERR(0, 850, __pyx_L9_except_error)
          __pyx_t_26 = (!__pyx_t_24);
          if (unlikely(__pyx_t_26)) {
            __Pyx_GIVEREF(__pyx_t_11);
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ErrRestoreWithState(__pyx_t_11, __pyx_t_1, __pyx_t_5);
            __pyx_t_11 = 0;  __pyx_t_1 = 0;  __pyx_t_5 = 0; 
            __PYX_ERR(0, 850, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
        __pyx_L12_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_14) {
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[4], NULL);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 850, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L24;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    goto __pyx_L1_error;
    __pyx_L24:;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":871
 *                             U[y * Ustride + x] = clamp_studio_UV(UR * R + UG * G + UB * B + UC)
 *                             V[y * Vstride + x] = clamp_studio_UV(VR * R + VG * G + VB * B + VC)
 *         return self.planar3_image_wrapper(<void *> output_image)             # <<<<<<<<<<<<<<
 * 
 *     cdef object planar3_image_wrapper(self, void *buf, unsigned char bpp=24):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->planar3_image_wrapper(__pyx_v_self, ((void *)__pyx_v_output_image), NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":816
 *         return self.do_RGB_to_YUV444P(image, 4, RGBX_B, RGBX_G, RGBX_R)
 * 
 *     cdef do_RGB_to_YUV444P(self,             # <<<<<<<<<<<<<<
 *                            image: ImageWrapper,
 *                            const uint8_t Bpp,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __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_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.do_RGB_to_YUV444P", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pixels);
  __Pyx_XDECREF(__pyx_v_bc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":873
 *         return self.planar3_image_wrapper(<void *> output_image)
 * 
 *     cdef object planar3_image_wrapper(self, void *buf, unsigned char bpp=24):             # <<<<<<<<<<<<<<
 *         #create python buffer from each plane:
 *         planes = []
*/

static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_planar3_image_wrapper(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, void *__pyx_v_buf, struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_planar3_image_wrapper *__pyx_optional_args) {
  unsigned char __pyx_v_bpp = ((unsigned char)24);
  PyObject *__pyx_v_planes = NULL;
  PyObject *__pyx_v_strides = NULL;
  unsigned char __pyx_v_i;
  PyObject *__pyx_v_out_image = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  unsigned char __pyx_t_2;
  int __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;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("planar3_image_wrapper", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_bpp = __pyx_optional_args->bpp;
    }
  }

  /* "xpra/codecs/csc_cython/converter.pyx":875
 *     cdef object planar3_image_wrapper(self, void *buf, unsigned char bpp=24):
 *         #create python buffer from each plane:
 *         planes = []             # <<<<<<<<<<<<<<
 *         strides = []
 *         cdef unsigned char i
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_planes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":876
 *         #create python buffer from each plane:
 *         planes = []
 *         strides = []             # <<<<<<<<<<<<<<
 *         cdef unsigned char i
 *         for i in range(3):
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_strides = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":878
 *         strides = []
 *         cdef unsigned char i
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             strides.append(self.dst_strides[i])
 *             planes.append(PyMemoryView_FromMemory(<char *> ((<uintptr_t> buf) + self.offsets[i]), self.dst_sizes[i], PyBUF_WRITE))
*/
  for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "xpra/codecs/csc_cython/converter.pyx":879
 *         cdef unsigned char i
 *         for i in range(3):
 *             strides.append(self.dst_strides[i])             # <<<<<<<<<<<<<<
 *             planes.append(PyMemoryView_FromMemory(<char *> ((<uintptr_t> buf) + self.offsets[i]), self.dst_sizes[i], PyBUF_WRITE))
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height,
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_long((__pyx_v_self->dst_strides[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_strides, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 879, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":880
 *         for i in range(3):
 *             strides.append(self.dst_strides[i])
 *             planes.append(PyMemoryView_FromMemory(<char *> ((<uintptr_t> buf) + self.offsets[i]), self.dst_sizes[i], PyBUF_WRITE))             # <<<<<<<<<<<<<<
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height,
 *                                        planes, self.dst_format, bpp, strides,
*/
    __pyx_t_1 = PyMemoryView_FromMemory(((char *)(((uintptr_t)__pyx_v_buf) + (__pyx_v_self->offsets[__pyx_v_i]))), (__pyx_v_self->dst_sizes[__pyx_v_i]), PyBUF_WRITE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_planes, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":881
 *             strides.append(self.dst_strides[i])
 *             planes.append(PyMemoryView_FromMemory(<char *> ((<uintptr_t> buf) + self.offsets[i]), self.dst_sizes[i], PyBUF_WRITE))
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height,             # <<<<<<<<<<<<<<
 *                                        planes, self.dst_format, bpp, strides,
 *                                        planes=ImageWrapper.PLANAR_3)
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->dst_width); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->dst_height); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "xpra/codecs/csc_cython/converter.pyx":882
 *             planes.append(PyMemoryView_FromMemory(<char *> ((<uintptr_t> buf) + self.offsets[i]), self.dst_sizes[i], PyBUF_WRITE))
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height,
 *                                        planes, self.dst_format, bpp, strides,             # <<<<<<<<<<<<<<
 *                                        planes=ImageWrapper.PLANAR_3)
 *         out_image.set_full_range(self.full_range)
*/
  __pyx_t_8 = __Pyx_PyLong_From_unsigned_char(__pyx_v_bpp); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "xpra/codecs/csc_cython/converter.pyx":883
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height,
 *                                        planes, self.dst_format, bpp, strides,
 *                                        planes=ImageWrapper.PLANAR_3)             # <<<<<<<<<<<<<<
 *         out_image.set_full_range(self.full_range)
 *         out_image.cython_buffer = <uintptr_t> buf
*/
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_ImageWrapper); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_PLANAR_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_11 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_11 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[9 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0, __pyx_t_6, __pyx_t_7, __pyx_v_planes, __pyx_v_self->dst_format, __pyx_t_8, __pyx_v_strides};
    __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_planes, __pyx_t_10, __pyx_t_9, __pyx_callargs+9, 0) < (0)) __PYX_ERR(0, 881, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_11, (9-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __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;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_out_image = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":884
 *                                        planes, self.dst_format, bpp, strides,
 *                                        planes=ImageWrapper.PLANAR_3)
 *         out_image.set_full_range(self.full_range)             # <<<<<<<<<<<<<<
 *         out_image.cython_buffer = <uintptr_t> buf
 *         return out_image
*/
  __pyx_t_5 = __pyx_v_out_image;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_9 = __Pyx_PyLong_From_unsigned_char(__pyx_v_self->full_range); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_full_range, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":885
 *                                        planes=ImageWrapper.PLANAR_3)
 *         out_image.set_full_range(self.full_range)
 *         out_image.cython_buffer = <uintptr_t> buf             # <<<<<<<<<<<<<<
 *         return out_image
 * 
*/
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(((uintptr_t)__pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_out_image, __pyx_mstate_global->__pyx_n_u_cython_buffer, __pyx_t_1) < (0)) __PYX_ERR(0, 885, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":886
 *         out_image.set_full_range(self.full_range)
 *         out_image.cython_buffer = <uintptr_t> buf
 *         return out_image             # <<<<<<<<<<<<<<
 * 
 *     def validate_rgb_image(self, image: ImageWrapper) -> None:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out_image);
  __pyx_r = __pyx_v_out_image;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":873
 *         return self.planar3_image_wrapper(<void *> output_image)
 * 
 *     cdef object planar3_image_wrapper(self, void *buf, unsigned char bpp=24):             # <<<<<<<<<<<<<<
 *         #create python buffer from each plane:
 *         planes = []
*/

  /* function exit code */
  __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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.planar3_image_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_planes);
  __Pyx_XDECREF(__pyx_v_strides);
  __Pyx_XDECREF(__pyx_v_out_image);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":888
 *         return out_image
 * 
 *     def validate_rgb_image(self, image: ImageWrapper) -> None:             # <<<<<<<<<<<<<<
 *         assert image.get_planes()==ImageWrapper.PACKED, "invalid input format: %s planes" % image.get_planes()
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_47validate_rgb_image(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_47validate_rgb_image = {"validate_rgb_image", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_47validate_rgb_image, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_47validate_rgb_image(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("validate_rgb_image (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_46validate_rgb_image(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_46validate_rgb_image(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("validate_rgb_image", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":889
 * 
 *     def validate_rgb_image(self, image: ImageWrapper) -> None:
 *         assert image.get_planes()==ImageWrapper.PACKED, "invalid input format: %s planes" % image.get_planes()             # <<<<<<<<<<<<<<
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
 *         assert image.get_height()>=self.src_height, "invalid image height: %s (minimum is %s)" % (image.get_height(), self.src_height)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_planes, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ImageWrapper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PACKED); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 889, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) {
      __pyx_t_4 = __pyx_v_image;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_planes, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_4 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_invalid_input_format_s_planes, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 889, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 889, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 889, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":890
 *     def validate_rgb_image(self, image: ImageWrapper) -> None:
 *         assert image.get_planes()==ImageWrapper.PACKED, "invalid input format: %s planes" % image.get_planes()
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)             # <<<<<<<<<<<<<<
 *         assert image.get_height()>=self.src_height, "invalid image height: %s (minimum is %s)" % (image.get_height(), self.src_height)
 *         assert image.get_pixels(), "failed to get pixels from %s" % image
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_width, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 890, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->src_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 890, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_mstate_global->__pyx_n_u_get_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_2), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_self->src_width, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_invalid_image_width;
      __pyx_t_6[1] = __pyx_t_1;
      __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_minimum_is;
      __pyx_t_6[3] = __pyx_t_2;
      __pyx_t_6[4] = __pyx_mstate_global->__pyx_kp_u__2;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 890, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 890, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 890, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":891
 *         assert image.get_planes()==ImageWrapper.PACKED, "invalid input format: %s planes" % image.get_planes()
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
 *         assert image.get_height()>=self.src_height, "invalid image height: %s (minimum is %s)" % (image.get_height(), self.src_height)             # <<<<<<<<<<<<<<
 *         assert image.get_pixels(), "failed to get pixels from %s" % image
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_height, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->src_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 891, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 891, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 891, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_mstate_global->__pyx_n_u_get_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_2), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_self->src_height, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_invalid_image_height;
      __pyx_t_6[1] = __pyx_t_1;
      __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_minimum_is;
      __pyx_t_6[3] = __pyx_t_2;
      __pyx_t_6[4] = __pyx_mstate_global->__pyx_kp_u__2;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 891, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 891, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":892
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
 *         assert image.get_height()>=self.src_height, "invalid image height: %s (minimum is %s)" % (image.get_height(), self.src_height)
 *         assert image.get_pixels(), "failed to get pixels from %s" % image             # <<<<<<<<<<<<<<
 * 
 *     def r210_to_YUV444P10(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 892, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) {
      __pyx_t_4 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_failed_to_get_pixels_from_s, __pyx_v_image); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 892, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 892, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":888
 *         return out_image
 * 
 *     def validate_rgb_image(self, image: ImageWrapper) -> None:             # <<<<<<<<<<<<<<
 *         assert image.get_planes()==ImageWrapper.PACKED, "invalid input format: %s planes" % image.get_planes()
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
*/

  /* 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_AddTraceback("xpra.codecs.csc_cython.converter.Converter.validate_rgb_image", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":894
 *         assert image.get_pixels(), "failed to get pixels from %s" % image
 * 
 *     def r210_to_YUV444P10(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_49r210_to_YUV444P10(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_49r210_to_YUV444P10 = {"r210_to_YUV444P10", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_49r210_to_YUV444P10, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_49r210_to_YUV444P10(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("r210_to_YUV444P10 (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_48r210_to_YUV444P10(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_48r210_to_YUV444P10(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  PyObject *__pyx_v_pixels = NULL;
  unsigned int __pyx_v_input_stride;
  void *__pyx_v_output_image;
  unsigned short *__pyx_v_Y;
  unsigned short *__pyx_v_U;
  unsigned short *__pyx_v_V;
  unsigned int __pyx_v_Ystride;
  unsigned int __pyx_v_Ustride;
  unsigned int __pyx_v_Vstride;
  uintptr_t __pyx_v_buf;
  PyObject *__pyx_v_bc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  unsigned int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __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;
  uintptr_t __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("r210_to_YUV444P10", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":895
 * 
 *     def r210_to_YUV444P10(self, image: ImageWrapper) -> CythonImageWrapper:
 *         self.validate_rgb_image(image)             # <<<<<<<<<<<<<<
 *         pixels = image.get_pixels()
 *         cdef unsigned int input_stride = image.get_rowstride()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_image};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate_rgb_image, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 895, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":896
 *     def r210_to_YUV444P10(self, image: ImageWrapper) -> CythonImageWrapper:
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()             # <<<<<<<<<<<<<<
 *         cdef unsigned int input_stride = image.get_rowstride()
 *         log("r210_to_YUV444P10(%s) input=%s, strides=%s", image, len(pixels), input_stride)
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_pixels = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":897
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()
 *         cdef unsigned int input_stride = image.get_rowstride()             # <<<<<<<<<<<<<<
 *         log("r210_to_YUV444P10(%s) input=%s, strides=%s", image, len(pixels), input_stride)
 * 
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_rowstride, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 897, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_input_stride = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":898
 *         pixels = image.get_pixels()
 *         cdef unsigned int input_stride = image.get_rowstride()
 *         log("r210_to_YUV444P10(%s) input=%s, strides=%s", image, len(pixels), input_stride)             # <<<<<<<<<<<<<<
 * 
 *         #allocate output buffer:
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_Length(__pyx_v_pixels); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 898, __pyx_L1_error)
  __pyx_t_7 = PyLong_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyLong_From_unsigned_int(__pyx_v_input_stride); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_r210_to_YUV444P10_s_input_s_stri, __pyx_v_image, __pyx_t_7, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (5-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":901
 * 
 *         #allocate output buffer:
 *         cdef void *output_image = memalign(self.buffer_size)             # <<<<<<<<<<<<<<
 *         cdef unsigned short *Y = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[0])
 *         cdef unsigned short *U = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[1])
*/
  __pyx_v_output_image = __pyx_f_4xpra_7buffers_6membuf_memalign(__pyx_v_self->buffer_size);

  /* "xpra/codecs/csc_cython/converter.pyx":902
 *         #allocate output buffer:
 *         cdef void *output_image = memalign(self.buffer_size)
 *         cdef unsigned short *Y = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[0])             # <<<<<<<<<<<<<<
 *         cdef unsigned short *U = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[1])
 *         cdef unsigned short *V = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[2])
*/
  __pyx_v_Y = ((unsigned short *)(((uintptr_t)__pyx_v_output_image) + (__pyx_v_self->offsets[0])));

  /* "xpra/codecs/csc_cython/converter.pyx":903
 *         cdef void *output_image = memalign(self.buffer_size)
 *         cdef unsigned short *Y = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[0])
 *         cdef unsigned short *U = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[1])             # <<<<<<<<<<<<<<
 *         cdef unsigned short *V = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[2])
 *         #copy to local variables (ensures C code will be optimized correctly)
*/
  __pyx_v_U = ((unsigned short *)(((uintptr_t)__pyx_v_output_image) + (__pyx_v_self->offsets[1])));

  /* "xpra/codecs/csc_cython/converter.pyx":904
 *         cdef unsigned short *Y = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[0])
 *         cdef unsigned short *U = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[1])
 *         cdef unsigned short *V = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[2])             # <<<<<<<<<<<<<<
 *         #copy to local variables (ensures C code will be optimized correctly)
 *         cdef unsigned int Ystride = self.dst_strides[0]
*/
  __pyx_v_V = ((unsigned short *)(((uintptr_t)__pyx_v_output_image) + (__pyx_v_self->offsets[2])));

  /* "xpra/codecs/csc_cython/converter.pyx":906
 *         cdef unsigned short *V = <unsigned short *> ((<uintptr_t> output_image) + self.offsets[2])
 *         #copy to local variables (ensures C code will be optimized correctly)
 *         cdef unsigned int Ystride = self.dst_strides[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned int Ustride = self.dst_strides[1]
 *         cdef unsigned int Vstride = self.dst_strides[2]
*/
  __pyx_v_Ystride = (__pyx_v_self->dst_strides[0]);

  /* "xpra/codecs/csc_cython/converter.pyx":907
 *         #copy to local variables (ensures C code will be optimized correctly)
 *         cdef unsigned int Ystride = self.dst_strides[0]
 *         cdef unsigned int Ustride = self.dst_strides[1]             # <<<<<<<<<<<<<<
 *         cdef unsigned int Vstride = self.dst_strides[2]
 * 
*/
  __pyx_v_Ustride = (__pyx_v_self->dst_strides[1]);

  /* "xpra/codecs/csc_cython/converter.pyx":908
 *         cdef unsigned int Ystride = self.dst_strides[0]
 *         cdef unsigned int Ustride = self.dst_strides[1]
 *         cdef unsigned int Vstride = self.dst_strides[2]             # <<<<<<<<<<<<<<
 * 
 *         cdef uintptr_t buf
*/
  __pyx_v_Vstride = (__pyx_v_self->dst_strides[2]);

  /* "xpra/codecs/csc_cython/converter.pyx":911
 * 
 *         cdef uintptr_t buf
 *         with buffer_context(pixels) as bc:             # <<<<<<<<<<<<<<
 *             buf = <uintptr_t> int(bc)
 *             if image.is_thread_safe():
*/
  /*with:*/ {
    __pyx_t_1 = __pyx_f_4xpra_7buffers_6membuf_buffer_context(__pyx_v_pixels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = NULL;
    __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 911, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_8);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 911, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_7 = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {
          __pyx_v_bc = __pyx_t_7;
          __pyx_t_7 = 0;

          /* "xpra/codecs/csc_cython/converter.pyx":912
 *         cdef uintptr_t buf
 *         with buffer_context(pixels) as bc:
 *             buf = <uintptr_t> int(bc)             # <<<<<<<<<<<<<<
 *             if image.is_thread_safe():
 *                 with nogil:
*/
          __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_v_bc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 912, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_13 = __Pyx_PyLong_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_13 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_v_buf = ((uintptr_t)__pyx_t_13);

          /* "xpra/codecs/csc_cython/converter.pyx":913
 *         with buffer_context(pixels) as bc:
 *             buf = <uintptr_t> int(bc)
 *             if image.is_thread_safe():             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     r210_to_YUV444P10_copy(Y, U, V, buf,
*/
          __pyx_t_1 = __pyx_v_image;
          __Pyx_INCREF(__pyx_t_1);
          __pyx_t_3 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
            __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_thread_safe, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 913, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_7);
          }
          __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 913, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (__pyx_t_14) {

            /* "xpra/codecs/csc_cython/converter.pyx":914
 *             buf = <uintptr_t> int(bc)
 *             if image.is_thread_safe():
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     r210_to_YUV444P10_copy(Y, U, V, buf,
 *                                            self.dst_width, self.dst_height,
*/
            {
                PyThreadState * _save;
                _save = PyEval_SaveThread();
                __Pyx_FastGIL_Remember();
                /*try:*/ {

                  /* "xpra/codecs/csc_cython/converter.pyx":915
 *             if image.is_thread_safe():
 *                 with nogil:
 *                     r210_to_YUV444P10_copy(Y, U, V, buf,             # <<<<<<<<<<<<<<
 *                                            self.dst_width, self.dst_height,
 *                                            Ystride, Ustride, Vstride,
*/
                  __pyx_f_4xpra_6codecs_10csc_cython_9converter_r210_to_YUV444P10_copy(__pyx_v_Y, __pyx_v_U, __pyx_v_V, __pyx_v_buf, __pyx_v_self->dst_width, __pyx_v_self->dst_height, __pyx_v_Ystride, __pyx_v_Ustride, __pyx_v_Vstride, __pyx_v_input_stride);
                }

                /* "xpra/codecs/csc_cython/converter.pyx":914
 *             buf = <uintptr_t> int(bc)
 *             if image.is_thread_safe():
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     r210_to_YUV444P10_copy(Y, U, V, buf,
 *                                            self.dst_width, self.dst_height,
*/
                /*finally:*/ {
                  /*normal exit:*/{
                    __Pyx_FastGIL_Forget();
                    PyEval_RestoreThread(_save);
                    goto __pyx_L16;
                  }
                  __pyx_L16:;
                }
            }

            /* "xpra/codecs/csc_cython/converter.pyx":913
 *         with buffer_context(pixels) as bc:
 *             buf = <uintptr_t> int(bc)
 *             if image.is_thread_safe():             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     r210_to_YUV444P10_copy(Y, U, V, buf,
*/
            goto __pyx_L13;
          }

          /* "xpra/codecs/csc_cython/converter.pyx":920
 *                                            input_stride)
 *             else:
 *                 r210_to_YUV444P10_copy(Y, U, V, buf,             # <<<<<<<<<<<<<<
 *                                        self.dst_width, self.dst_height,
 *                                        Ystride, Ustride, Vstride,
*/
          /*else*/ {

            /* "xpra/codecs/csc_cython/converter.pyx":923
 *                                        self.dst_width, self.dst_height,
 *                                        Ystride, Ustride, Vstride,
 *                                        input_stride)             # <<<<<<<<<<<<<<
 *         return self.planar3_image_wrapper(output_image)
 * 
*/
            __pyx_f_4xpra_6codecs_10csc_cython_9converter_r210_to_YUV444P10_copy(__pyx_v_Y, __pyx_v_U, __pyx_v_V, __pyx_v_buf, __pyx_v_self->dst_width, __pyx_v_self->dst_height, __pyx_v_Ystride, __pyx_v_Ustride, __pyx_v_Vstride, __pyx_v_input_stride);
          }
          __pyx_L13:;

          /* "xpra/codecs/csc_cython/converter.pyx":911
 * 
 *         cdef uintptr_t buf
 *         with buffer_context(pixels) as bc:             # <<<<<<<<<<<<<<
 *             buf = <uintptr_t> int(bc)
 *             if image.is_thread_safe():
*/
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L12_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.r210_to_YUV444P10", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 911, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_5);
          __pyx_t_8 = PyTuple_Pack(3, __pyx_t_7, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 911, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 911, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          if (__pyx_t_14 < (0)) __PYX_ERR(0, 911, __pyx_L9_except_error)
          __pyx_t_16 = (!__pyx_t_14);
          if (unlikely(__pyx_t_16)) {
            __Pyx_GIVEREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_1, __pyx_t_5);
            __pyx_t_7 = 0;  __pyx_t_1 = 0;  __pyx_t_5 = 0; 
            __PYX_ERR(0, 911, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __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);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __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_L12_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_9) {
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_mstate_global->__pyx_tuple[4], NULL);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 911, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L20;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L1_error;
    __pyx_L20:;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":924
 *                                        Ystride, Ustride, Vstride,
 *                                        input_stride)
 *         return self.planar3_image_wrapper(output_image)             # <<<<<<<<<<<<<<
 * 
 *     def YUV444P10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->planar3_image_wrapper(__pyx_v_self, __pyx_v_output_image, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":894
 *         assert image.get_pixels(), "failed to get pixels from %s" % image
 * 
 *     def r210_to_YUV444P10(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.r210_to_YUV444P10", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pixels);
  __Pyx_XDECREF(__pyx_v_bc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":926
 *         return self.planar3_image_wrapper(output_image)
 * 
 *     def YUV444P10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_51YUV444P10_to_r210(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_51YUV444P10_to_r210 = {"YUV444P10_to_r210", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_51YUV444P10_to_r210, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_51YUV444P10_to_r210(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("YUV444P10_to_r210 (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_50YUV444P10_to_r210(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_50YUV444P10_to_r210(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  PyObject *__pyx_v_planes = NULL;
  PyObject *__pyx_v_input_strides = NULL;
  unsigned int __pyx_v_width;
  unsigned int __pyx_v_height;
  char *__pyx_v_output_image;
  unsigned int __pyx_v_stride;
  unsigned int __pyx_v_YUVstrides[3];
  Py_buffer __pyx_v_py_buf[3];
  unsigned short const *__pyx_v_YUV[3];
  int __pyx_v_i;
  PyObject *__pyx_v_min_len = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[4];
  struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("YUV444P10_to_r210", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":927
 * 
 *     def YUV444P10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:
 *         self.validate_planar3_image(image)             # <<<<<<<<<<<<<<
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_image};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate_planar3_image, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":928
 *     def YUV444P10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()             # <<<<<<<<<<<<<<
 *         input_strides = image.get_rowstride()
 *         log("YUV444P10_to_r210(%s) strides=%s", image, input_strides)
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_planes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":929
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()             # <<<<<<<<<<<<<<
 *         log("YUV444P10_to_r210(%s) strides=%s", image, input_strides)
 * 
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_rowstride, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_input_strides = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":930
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()
 *         log("YUV444P10_to_r210(%s) strides=%s", image, input_strides)             # <<<<<<<<<<<<<<
 * 
 *         #copy to local variables:
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_YUV444P10_to_r210_s_strides_s, __pyx_v_image, __pyx_v_input_strides};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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(0, 930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":933
 * 
 *         #copy to local variables:
 *         cdef unsigned int width = self.dst_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int height = self.dst_height
 * 
*/
  __pyx_t_5 = __pyx_v_self->dst_width;
  __pyx_v_width = __pyx_t_5;

  /* "xpra/codecs/csc_cython/converter.pyx":934
 *         #copy to local variables:
 *         cdef unsigned int width = self.dst_width
 *         cdef unsigned int height = self.dst_height             # <<<<<<<<<<<<<<
 * 
 *         #allocate output buffer:
*/
  __pyx_t_5 = __pyx_v_self->dst_height;
  __pyx_v_height = __pyx_t_5;

  /* "xpra/codecs/csc_cython/converter.pyx":937
 * 
 *         #allocate output buffer:
 *         cdef char *output_image = <char *> memalign(self.buffer_size)             # <<<<<<<<<<<<<<
 *         cdef unsigned int stride = self.dst_strides[0]
 * 
*/
  __pyx_v_output_image = ((char *)__pyx_f_4xpra_7buffers_6membuf_memalign(__pyx_v_self->buffer_size));

  /* "xpra/codecs/csc_cython/converter.pyx":938
 *         #allocate output buffer:
 *         cdef char *output_image = <char *> memalign(self.buffer_size)
 *         cdef unsigned int stride = self.dst_strides[0]             # <<<<<<<<<<<<<<
 * 
 *         cdef unsigned int YUVstrides[3]
*/
  __pyx_v_stride = (__pyx_v_self->dst_strides[0]);

  /* "xpra/codecs/csc_cython/converter.pyx":944
 *         cdef const unsigned short * YUV[3]
 *         cdef int i
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             YUVstrides[i] = input_strides[i]
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
*/
  for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "xpra/codecs/csc_cython/converter.pyx":945
 *         cdef int i
 *         for i in range(3):
 *             YUVstrides[i] = input_strides[i]             # <<<<<<<<<<<<<<
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
*/
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    (__pyx_v_YUVstrides[__pyx_v_i]) = __pyx_t_5;

    /* "xpra/codecs/csc_cython/converter.pyx":946
 *         for i in range(3):
 *             YUVstrides[i] = input_strides[i]
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             YUV[i] = <const unsigned short *> py_buf[i].buf
*/
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_planes, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = (PyObject_GetBuffer(__pyx_t_1, (&(__pyx_v_py_buf[__pyx_v_i])), PyBUF_ANY_CONTIGUOUS) != 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(__pyx_t_7)) {

      /* "xpra/codecs/csc_cython/converter.pyx":947
 *             YUVstrides[i] = input_strides[i]
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))             # <<<<<<<<<<<<<<
 *             YUV[i] = <const unsigned short *> py_buf[i].buf
 *             min_len = YUVstrides[i]*image.get_height()
*/
      __pyx_t_4 = NULL;
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_planes, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_failed_to_read_pixel_data_from_s, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 947, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __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(0, 947, __pyx_L1_error)

      /* "xpra/codecs/csc_cython/converter.pyx":946
 *         for i in range(3):
 *             YUVstrides[i] = input_strides[i]
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             YUV[i] = <const unsigned short *> py_buf[i].buf
*/
    }

    /* "xpra/codecs/csc_cython/converter.pyx":948
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             YUV[i] = <const unsigned short *> py_buf[i].buf             # <<<<<<<<<<<<<<
 *             min_len = YUVstrides[i]*image.get_height()
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
*/
    (__pyx_v_YUV[__pyx_v_i]) = ((unsigned short const *)(__pyx_v_py_buf[__pyx_v_i]).buf);

    /* "xpra/codecs/csc_cython/converter.pyx":949
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             YUV[i] = <const unsigned short *> py_buf[i].buf
 *             min_len = YUVstrides[i]*image.get_height()             # <<<<<<<<<<<<<<
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 * 
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int((__pyx_v_YUVstrides[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_height, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 949, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_min_len, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":950
 *             YUV[i] = <const unsigned short *> py_buf[i].buf
 *             min_len = YUVstrides[i]*image.get_height()
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)             # <<<<<<<<<<<<<<
 * 
 *         if image.is_thread_safe():
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_4 = PyLong_FromSsize_t(__pyx_v_py_buf->len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 950, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_v_min_len, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 950, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 950, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_7)) {
        __pyx_t_8 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_py_buf->len, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 950, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_min_len), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 950, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_buffer_for_Y_plane_is_too_small;
        __pyx_t_9[1] = __pyx_t_8;
        __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_bytes_expected_at_least;
        __pyx_t_9[3] = __pyx_t_4;
        __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_9, 4, 33 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 26 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_1, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 950, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 950, __pyx_L1_error)
    #endif
  }

  /* "xpra/codecs/csc_cython/converter.pyx":952
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 * 
 *         if image.is_thread_safe():             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 YUV444P10_to_r210_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
*/
  __pyx_t_4 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_thread_safe, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 952, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "xpra/codecs/csc_cython/converter.pyx":953
 * 
 *         if image.is_thread_safe():
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 YUV444P10_to_r210_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
 *                                        width, height,
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "xpra/codecs/csc_cython/converter.pyx":954
 *         if image.is_thread_safe():
 *             with nogil:
 *                 YUV444P10_to_r210_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],             # <<<<<<<<<<<<<<
 *                                        width, height,
 *                                        stride,
*/
          __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P10_to_r210_copy(((uintptr_t)__pyx_v_output_image), (__pyx_v_YUV[0]), (__pyx_v_YUV[1]), (__pyx_v_YUV[2]), __pyx_v_width, __pyx_v_height, __pyx_v_stride, (__pyx_v_YUVstrides[0]), (__pyx_v_YUVstrides[1]), (__pyx_v_YUVstrides[2]));
        }

        /* "xpra/codecs/csc_cython/converter.pyx":953
 * 
 *         if image.is_thread_safe():
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 YUV444P10_to_r210_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
 *                                        width, height,
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "xpra/codecs/csc_cython/converter.pyx":952
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 * 
 *         if image.is_thread_safe():             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 YUV444P10_to_r210_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
*/
    goto __pyx_L6;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":959
 *                                        YUVstrides[0], YUVstrides[1], YUVstrides[2])
 *         else:
 *             YUV444P10_to_r210_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],             # <<<<<<<<<<<<<<
 *                                    width, height,
 *                                    stride,
*/
  /*else*/ {

    /* "xpra/codecs/csc_cython/converter.pyx":962
 *                                    width, height,
 *                                    stride,
 *                                    YUVstrides[0], YUVstrides[1], YUVstrides[2])             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])
*/
    __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P10_to_r210_copy(((uintptr_t)__pyx_v_output_image), (__pyx_v_YUV[0]), (__pyx_v_YUV[1]), (__pyx_v_YUV[2]), __pyx_v_width, __pyx_v_height, __pyx_v_stride, (__pyx_v_YUVstrides[0]), (__pyx_v_YUVstrides[1]), (__pyx_v_YUVstrides[2]));
  }
  __pyx_L6:;

  /* "xpra/codecs/csc_cython/converter.pyx":963
 *                                    stride,
 *                                    YUVstrides[0], YUVstrides[1], YUVstrides[2])
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&py_buf[i])
 *         return self.packed_image_wrapper(output_image, 30)
*/
  for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "xpra/codecs/csc_cython/converter.pyx":964
 *                                    YUVstrides[0], YUVstrides[1], YUVstrides[2])
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])             # <<<<<<<<<<<<<<
 *         return self.packed_image_wrapper(output_image, 30)
 * 
*/
    PyBuffer_Release((&(__pyx_v_py_buf[__pyx_v_i])));
  }

  /* "xpra/codecs/csc_cython/converter.pyx":965
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])
 *         return self.packed_image_wrapper(output_image, 30)             # <<<<<<<<<<<<<<
 * 
 *     def YUV444P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10.__pyx_n = 1;
  __pyx_t_10.bpp = 30;
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->packed_image_wrapper(__pyx_v_self, __pyx_v_output_image, &__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":926
 *         return self.planar3_image_wrapper(output_image)
 * 
 *     def YUV444P10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.YUV444P10_to_r210", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_planes);
  __Pyx_XDECREF(__pyx_v_input_strides);
  __Pyx_XDECREF(__pyx_v_min_len);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":967
 *         return self.packed_image_wrapper(output_image, 30)
 * 
 *     def YUV444P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_53YUV444P_to_RGB(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_53YUV444P_to_RGB = {"YUV444P_to_RGB", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_53YUV444P_to_RGB, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_53YUV444P_to_RGB(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("YUV444P_to_RGB (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_52YUV444P_to_RGB(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_52YUV444P_to_RGB(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  PyObject *__pyx_v_planes = NULL;
  PyObject *__pyx_v_input_strides = NULL;
  unsigned int __pyx_v_width;
  unsigned int __pyx_v_height;
  char *__pyx_v_output_image;
  unsigned int __pyx_v_stride;
  unsigned char __pyx_v_full_range;
  unsigned int __pyx_v_YUVstrides[3];
  Py_buffer __pyx_v_py_buf[3];
  unsigned char const *__pyx_v_YUV[3];
  int __pyx_v_i;
  PyObject *__pyx_v_min_len = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  unsigned char __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10[4];
  int __pyx_t_11;
  struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("YUV444P_to_RGB", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":968
 * 
 *     def YUV444P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:
 *         self.validate_planar3_image(image)             # <<<<<<<<<<<<<<
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_image};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate_planar3_image, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":969
 *     def YUV444P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()             # <<<<<<<<<<<<<<
 *         input_strides = image.get_rowstride()
 *         log("YUV444P_to_RGB(%s) strides=%s", image, input_strides)
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_planes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":970
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()             # <<<<<<<<<<<<<<
 *         log("YUV444P_to_RGB(%s) strides=%s", image, input_strides)
 * 
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_rowstride, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 970, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_input_strides = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":971
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()
 *         log("YUV444P_to_RGB(%s) strides=%s", image, input_strides)             # <<<<<<<<<<<<<<
 * 
 *         #copy to local variables:
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_YUV444P_to_RGB_s_strides_s, __pyx_v_image, __pyx_v_input_strides};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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(0, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":974
 * 
 *         #copy to local variables:
 *         cdef unsigned int width = self.dst_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int height = self.dst_height
 * 
*/
  __pyx_t_5 = __pyx_v_self->dst_width;
  __pyx_v_width = __pyx_t_5;

  /* "xpra/codecs/csc_cython/converter.pyx":975
 *         #copy to local variables:
 *         cdef unsigned int width = self.dst_width
 *         cdef unsigned int height = self.dst_height             # <<<<<<<<<<<<<<
 * 
 *         #allocate output buffer:
*/
  __pyx_t_5 = __pyx_v_self->dst_height;
  __pyx_v_height = __pyx_t_5;

  /* "xpra/codecs/csc_cython/converter.pyx":978
 * 
 *         #allocate output buffer:
 *         cdef char *output_image = <char *> memalign(self.buffer_size)             # <<<<<<<<<<<<<<
 *         cdef unsigned int stride = self.dst_strides[0]
 *         cdef unsigned char full_range = self.full_range
*/
  __pyx_v_output_image = ((char *)__pyx_f_4xpra_7buffers_6membuf_memalign(__pyx_v_self->buffer_size));

  /* "xpra/codecs/csc_cython/converter.pyx":979
 *         #allocate output buffer:
 *         cdef char *output_image = <char *> memalign(self.buffer_size)
 *         cdef unsigned int stride = self.dst_strides[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned char full_range = self.full_range
 * 
*/
  __pyx_v_stride = (__pyx_v_self->dst_strides[0]);

  /* "xpra/codecs/csc_cython/converter.pyx":980
 *         cdef char *output_image = <char *> memalign(self.buffer_size)
 *         cdef unsigned int stride = self.dst_strides[0]
 *         cdef unsigned char full_range = self.full_range             # <<<<<<<<<<<<<<
 * 
 *         cdef unsigned int YUVstrides[3]
*/
  __pyx_t_6 = __pyx_v_self->full_range;
  __pyx_v_full_range = __pyx_t_6;

  /* "xpra/codecs/csc_cython/converter.pyx":986
 *         cdef const unsigned char * YUV[3]
 *         cdef int i
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             YUVstrides[i] = input_strides[i]
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
*/
  for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "xpra/codecs/csc_cython/converter.pyx":987
 *         cdef int i
 *         for i in range(3):
 *             YUVstrides[i] = input_strides[i]             # <<<<<<<<<<<<<<
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
*/
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 987, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 987, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    (__pyx_v_YUVstrides[__pyx_v_i]) = __pyx_t_5;

    /* "xpra/codecs/csc_cython/converter.pyx":988
 *         for i in range(3):
 *             YUVstrides[i] = input_strides[i]
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             YUV[i] = <const unsigned char *> py_buf[i].buf
*/
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_planes, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = (PyObject_GetBuffer(__pyx_t_1, (&(__pyx_v_py_buf[__pyx_v_i])), PyBUF_ANY_CONTIGUOUS) != 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(__pyx_t_8)) {

      /* "xpra/codecs/csc_cython/converter.pyx":989
 *             YUVstrides[i] = input_strides[i]
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))             # <<<<<<<<<<<<<<
 *             YUV[i] = <const unsigned char *> py_buf[i].buf
 *             min_len = YUVstrides[i]*image.get_height()
*/
      __pyx_t_4 = NULL;
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_planes, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_failed_to_read_pixel_data_from_s, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __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(0, 989, __pyx_L1_error)

      /* "xpra/codecs/csc_cython/converter.pyx":988
 *         for i in range(3):
 *             YUVstrides[i] = input_strides[i]
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             YUV[i] = <const unsigned char *> py_buf[i].buf
*/
    }

    /* "xpra/codecs/csc_cython/converter.pyx":990
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             YUV[i] = <const unsigned char *> py_buf[i].buf             # <<<<<<<<<<<<<<
 *             min_len = YUVstrides[i]*image.get_height()
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
*/
    (__pyx_v_YUV[__pyx_v_i]) = ((unsigned char const *)(__pyx_v_py_buf[__pyx_v_i]).buf);

    /* "xpra/codecs/csc_cython/converter.pyx":991
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             YUV[i] = <const unsigned char *> py_buf[i].buf
 *             min_len = YUVstrides[i]*image.get_height()             # <<<<<<<<<<<<<<
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 * 
*/
    __pyx_t_1 = __Pyx_PyLong_From_unsigned_int((__pyx_v_YUVstrides[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_height, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_min_len, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":992
 *             YUV[i] = <const unsigned char *> py_buf[i].buf
 *             min_len = YUVstrides[i]*image.get_height()
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)             # <<<<<<<<<<<<<<
 * 
 *         assert self.dst_format=="BGRX" or self.dst_format=="RGBX"
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_4 = PyLong_FromSsize_t(__pyx_v_py_buf->len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 992, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_4, __pyx_v_min_len, Py_GE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 992, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 992, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) {
        __pyx_t_9 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_py_buf->len, 0, ' ', 'd'); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 992, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_min_len), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 992, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u_buffer_for_Y_plane_is_too_small;
        __pyx_t_10[1] = __pyx_t_9;
        __pyx_t_10[2] = __pyx_mstate_global->__pyx_kp_u_bytes_expected_at_least;
        __pyx_t_10[3] = __pyx_t_4;
        __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_10, 4, 33 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 26 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 992, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_1, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 992, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 992, __pyx_L1_error)
    #endif
  }

  /* "xpra/codecs/csc_cython/converter.pyx":994
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 * 
 *         assert self.dst_format=="BGRX" or self.dst_format=="RGBX"             # <<<<<<<<<<<<<<
 *         if image.is_thread_safe():
 *             if self.dst_format=="BGRX":
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_11 = (__Pyx_PyUnicode_Equals(__pyx_v_self->dst_format, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 994, __pyx_L1_error)
    if (!__pyx_t_11) {
    } else {
      __pyx_t_8 = __pyx_t_11;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_11 = (__Pyx_PyUnicode_Equals(__pyx_v_self->dst_format, __pyx_mstate_global->__pyx_n_u_RGBX, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 994, __pyx_L1_error)
    __pyx_t_8 = __pyx_t_11;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_8)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 994, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 994, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":995
 * 
 *         assert self.dst_format=="BGRX" or self.dst_format=="RGBX"
 *         if image.is_thread_safe():             # <<<<<<<<<<<<<<
 *             if self.dst_format=="BGRX":
 *                 with nogil:
*/
  __pyx_t_4 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_thread_safe, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 995, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {

    /* "xpra/codecs/csc_cython/converter.pyx":996
 *         assert self.dst_format=="BGRX" or self.dst_format=="RGBX"
 *         if image.is_thread_safe():
 *             if self.dst_format=="BGRX":             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     YUV444P_to_BGRX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
*/
    __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_self->dst_format, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 996, __pyx_L1_error)
    if (__pyx_t_8) {

      /* "xpra/codecs/csc_cython/converter.pyx":997
 *         if image.is_thread_safe():
 *             if self.dst_format=="BGRX":
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     YUV444P_to_BGRX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
 *                                          width, height,
*/
      {
          PyThreadState * _save;
          _save = PyEval_SaveThread();
          __Pyx_FastGIL_Remember();
          /*try:*/ {

            /* "xpra/codecs/csc_cython/converter.pyx":998
 *             if self.dst_format=="BGRX":
 *                 with nogil:
 *                     YUV444P_to_BGRX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],             # <<<<<<<<<<<<<<
 *                                          width, height,
 *                                          stride,
*/
            __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P_to_BGRX_copy(((uintptr_t)__pyx_v_output_image), (__pyx_v_YUV[0]), (__pyx_v_YUV[1]), (__pyx_v_YUV[2]), __pyx_v_width, __pyx_v_height, __pyx_v_stride, (__pyx_v_YUVstrides[0]), (__pyx_v_YUVstrides[1]), (__pyx_v_YUVstrides[2]), __pyx_v_full_range);
          }

          /* "xpra/codecs/csc_cython/converter.pyx":997
 *         if image.is_thread_safe():
 *             if self.dst_format=="BGRX":
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     YUV444P_to_BGRX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
 *                                          width, height,
*/
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_FastGIL_Forget();
              PyEval_RestoreThread(_save);
              goto __pyx_L12;
            }
            __pyx_L12:;
          }
      }

      /* "xpra/codecs/csc_cython/converter.pyx":996
 *         assert self.dst_format=="BGRX" or self.dst_format=="RGBX"
 *         if image.is_thread_safe():
 *             if self.dst_format=="BGRX":             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     YUV444P_to_BGRX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
*/
      goto __pyx_L9;
    }

    /* "xpra/codecs/csc_cython/converter.pyx":1004
 *                                          full_range)
 *             else:
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     YUV444P_to_RGBX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
 *                                          width, height,
*/
    /*else*/ {
      {
          PyThreadState * _save;
          _save = PyEval_SaveThread();
          __Pyx_FastGIL_Remember();
          /*try:*/ {

            /* "xpra/codecs/csc_cython/converter.pyx":1005
 *             else:
 *                 with nogil:
 *                     YUV444P_to_RGBX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],             # <<<<<<<<<<<<<<
 *                                          width, height,
 *                                          stride,
*/
            __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P_to_RGBX_copy(((uintptr_t)__pyx_v_output_image), (__pyx_v_YUV[0]), (__pyx_v_YUV[1]), (__pyx_v_YUV[2]), __pyx_v_width, __pyx_v_height, __pyx_v_stride, (__pyx_v_YUVstrides[0]), (__pyx_v_YUVstrides[1]), (__pyx_v_YUVstrides[2]), __pyx_v_full_range);
          }

          /* "xpra/codecs/csc_cython/converter.pyx":1004
 *                                          full_range)
 *             else:
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     YUV444P_to_RGBX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
 *                                          width, height,
*/
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_FastGIL_Forget();
              PyEval_RestoreThread(_save);
              goto __pyx_L15;
            }
            __pyx_L15:;
          }
      }
    }
    __pyx_L9:;

    /* "xpra/codecs/csc_cython/converter.pyx":995
 * 
 *         assert self.dst_format=="BGRX" or self.dst_format=="RGBX"
 *         if image.is_thread_safe():             # <<<<<<<<<<<<<<
 *             if self.dst_format=="BGRX":
 *                 with nogil:
*/
    goto __pyx_L8;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1011
 *                                          full_range)
 *         else:
 *             if self.dst_format=="BGRX":             # <<<<<<<<<<<<<<
 *                 YUV444P_to_BGRX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
 *                                      width, height,
*/
  /*else*/ {
    __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_self->dst_format, __pyx_mstate_global->__pyx_n_u_BGRX, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1011, __pyx_L1_error)
    if (__pyx_t_8) {

      /* "xpra/codecs/csc_cython/converter.pyx":1012
 *         else:
 *             if self.dst_format=="BGRX":
 *                 YUV444P_to_BGRX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],             # <<<<<<<<<<<<<<
 *                                      width, height,
 *                                      stride,
*/
      __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P_to_BGRX_copy(((uintptr_t)__pyx_v_output_image), (__pyx_v_YUV[0]), (__pyx_v_YUV[1]), (__pyx_v_YUV[2]), __pyx_v_width, __pyx_v_height, __pyx_v_stride, (__pyx_v_YUVstrides[0]), (__pyx_v_YUVstrides[1]), (__pyx_v_YUVstrides[2]), __pyx_v_full_range);

      /* "xpra/codecs/csc_cython/converter.pyx":1011
 *                                          full_range)
 *         else:
 *             if self.dst_format=="BGRX":             # <<<<<<<<<<<<<<
 *                 YUV444P_to_BGRX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],
 *                                      width, height,
*/
      goto __pyx_L16;
    }

    /* "xpra/codecs/csc_cython/converter.pyx":1018
 *                                      full_range)
 *             else:
 *                 YUV444P_to_RGBX_copy(<uintptr_t> output_image, YUV[0], YUV[1], YUV[2],             # <<<<<<<<<<<<<<
 *                                      width, height,
 *                                      stride,
*/
    /*else*/ {

      /* "xpra/codecs/csc_cython/converter.pyx":1022
 *                                      stride,
 *                                      YUVstrides[0], YUVstrides[1], YUVstrides[2],
 *                                      full_range)             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])
*/
      __pyx_f_4xpra_6codecs_10csc_cython_9converter_YUV444P_to_RGBX_copy(((uintptr_t)__pyx_v_output_image), (__pyx_v_YUV[0]), (__pyx_v_YUV[1]), (__pyx_v_YUV[2]), __pyx_v_width, __pyx_v_height, __pyx_v_stride, (__pyx_v_YUVstrides[0]), (__pyx_v_YUVstrides[1]), (__pyx_v_YUVstrides[2]), __pyx_v_full_range);
    }
    __pyx_L16:;
  }
  __pyx_L8:;

  /* "xpra/codecs/csc_cython/converter.pyx":1023
 *                                      YUVstrides[0], YUVstrides[1], YUVstrides[2],
 *                                      full_range)
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&py_buf[i])
 *         return self.packed_image_wrapper(output_image, 30)
*/
  for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "xpra/codecs/csc_cython/converter.pyx":1024
 *                                      full_range)
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])             # <<<<<<<<<<<<<<
 *         return self.packed_image_wrapper(output_image, 30)
 * 
*/
    PyBuffer_Release((&(__pyx_v_py_buf[__pyx_v_i])));
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1025
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])
 *         return self.packed_image_wrapper(output_image, 30)             # <<<<<<<<<<<<<<
 * 
 *     def r210_to_BGR48(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_12.__pyx_n = 1;
  __pyx_t_12.bpp = 30;
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->packed_image_wrapper(__pyx_v_self, __pyx_v_output_image, &__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":967
 *         return self.packed_image_wrapper(output_image, 30)
 * 
 *     def YUV444P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.YUV444P_to_RGB", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_planes);
  __Pyx_XDECREF(__pyx_v_input_strides);
  __Pyx_XDECREF(__pyx_v_min_len);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1027
 *         return self.packed_image_wrapper(output_image, 30)
 * 
 *     def r210_to_BGR48(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_55r210_to_BGR48(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_55r210_to_BGR48 = {"r210_to_BGR48", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_55r210_to_BGR48, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_55r210_to_BGR48(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("r210_to_BGR48 (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_54r210_to_BGR48(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_54r210_to_BGR48(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  PyObject *__pyx_v_pixels = NULL;
  PyObject *__pyx_v_input_stride = NULL;
  unsigned short *__pyx_v_bgr48;
  unsigned int __pyx_v_w;
  unsigned int __pyx_v_h;
  unsigned int __pyx_v_src_stride;
  unsigned int __pyx_v_dst_stride;
  unsigned int const *__pyx_v_r210;
  PyObject *__pyx_v_bc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  unsigned int __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;
  uintptr_t __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("r210_to_BGR48", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1028
 * 
 *     def r210_to_BGR48(self, image: ImageWrapper) -> CythonImageWrapper:
 *         self.validate_rgb_image(image)             # <<<<<<<<<<<<<<
 *         pixels = image.get_pixels()
 *         input_stride = image.get_rowstride()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_image};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate_rgb_image, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1029
 *     def r210_to_BGR48(self, image: ImageWrapper) -> CythonImageWrapper:
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()             # <<<<<<<<<<<<<<
 *         input_stride = image.get_rowstride()
 *         log("r210_to_BGR48(%s) input=%s, strides=%s", image, len(pixels), input_stride)
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_pixels = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1030
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()
 *         input_stride = image.get_rowstride()             # <<<<<<<<<<<<<<
 *         log("r210_to_BGR48(%s) input=%s, strides=%s", image, len(pixels), input_stride)
 * 
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_rowstride, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_input_stride = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1031
 *         pixels = image.get_pixels()
 *         input_stride = image.get_rowstride()
 *         log("r210_to_BGR48(%s) input=%s, strides=%s", image, len(pixels), input_stride)             # <<<<<<<<<<<<<<
 * 
 *         #allocate output buffer:
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_Length(__pyx_v_pixels); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1031, __pyx_L1_error)
  __pyx_t_6 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_r210_to_BGR48_s_input_s_strides, __pyx_v_image, __pyx_t_6, __pyx_v_input_stride};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (5-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1034
 * 
 *         #allocate output buffer:
 *         cdef unsigned short *bgr48 = <unsigned short*> memalign(self.dst_sizes[0])             # <<<<<<<<<<<<<<
 * 
 *         cdef unsigned int w = self.src_width
*/
  __pyx_v_bgr48 = ((unsigned short *)__pyx_f_4xpra_7buffers_6membuf_memalign((__pyx_v_self->dst_sizes[0])));

  /* "xpra/codecs/csc_cython/converter.pyx":1036
 *         cdef unsigned short *bgr48 = <unsigned short*> memalign(self.dst_sizes[0])
 * 
 *         cdef unsigned int w = self.src_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int h = self.src_height
 *         cdef unsigned int src_stride = image.get_rowstride()
*/
  __pyx_t_7 = __pyx_v_self->src_width;
  __pyx_v_w = __pyx_t_7;

  /* "xpra/codecs/csc_cython/converter.pyx":1037
 * 
 *         cdef unsigned int w = self.src_width
 *         cdef unsigned int h = self.src_height             # <<<<<<<<<<<<<<
 *         cdef unsigned int src_stride = image.get_rowstride()
 *         cdef unsigned int dst_stride = self.dst_strides[0]
*/
  __pyx_t_7 = __pyx_v_self->src_height;
  __pyx_v_h = __pyx_t_7;

  /* "xpra/codecs/csc_cython/converter.pyx":1038
 *         cdef unsigned int w = self.src_width
 *         cdef unsigned int h = self.src_height
 *         cdef unsigned int src_stride = image.get_rowstride()             # <<<<<<<<<<<<<<
 *         cdef unsigned int dst_stride = self.dst_strides[0]
 * 
*/
  __pyx_t_4 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_rowstride, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_7 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_src_stride = __pyx_t_7;

  /* "xpra/codecs/csc_cython/converter.pyx":1039
 *         cdef unsigned int h = self.src_height
 *         cdef unsigned int src_stride = image.get_rowstride()
 *         cdef unsigned int dst_stride = self.dst_strides[0]             # <<<<<<<<<<<<<<
 * 
 *         assert (dst_stride%2)==0
*/
  __pyx_v_dst_stride = (__pyx_v_self->dst_strides[0]);

  /* "xpra/codecs/csc_cython/converter.pyx":1041
 *         cdef unsigned int dst_stride = self.dst_strides[0]
 * 
 *         assert (dst_stride%2)==0             # <<<<<<<<<<<<<<
 * 
 *         cdef const unsigned int *r210
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_8 = ((__pyx_v_dst_stride % 2) == 0);
    if (unlikely(!__pyx_t_8)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 1041, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1041, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":1044
 * 
 *         cdef const unsigned int *r210
 *         with buffer_context(pixels) as bc:             # <<<<<<<<<<<<<<
 *             r210 = <const unsigned int*> (<uintptr_t> int(bc))
 *             if image.is_thread_safe():
*/
  /*with:*/ {
    __pyx_t_1 = __pyx_f_4xpra_7buffers_6membuf_buffer_context(__pyx_v_pixels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = NULL;
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1044, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1044, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_2 = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {
          __pyx_v_bc = __pyx_t_2;
          __pyx_t_2 = 0;

          /* "xpra/codecs/csc_cython/converter.pyx":1045
 *         cdef const unsigned int *r210
 *         with buffer_context(pixels) as bc:
 *             r210 = <const unsigned int*> (<uintptr_t> int(bc))             # <<<<<<<<<<<<<<
 *             if image.is_thread_safe():
 *                 with nogil:
*/
          __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_bc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1045, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_13 = __Pyx_PyLong_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_13 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1045, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_r210 = ((unsigned int const *)((uintptr_t)__pyx_t_13));

          /* "xpra/codecs/csc_cython/converter.pyx":1046
 *         with buffer_context(pixels) as bc:
 *             r210 = <const unsigned int*> (<uintptr_t> int(bc))
 *             if image.is_thread_safe():             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     r210_to_BGR48_copy(bgr48, r210, w, h, src_stride, dst_stride)
*/
          __pyx_t_1 = __pyx_v_image;
          __Pyx_INCREF(__pyx_t_1);
          __pyx_t_3 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
            __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_thread_safe, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1046, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_2);
          }
          __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1046, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (__pyx_t_8) {

            /* "xpra/codecs/csc_cython/converter.pyx":1047
 *             r210 = <const unsigned int*> (<uintptr_t> int(bc))
 *             if image.is_thread_safe():
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     r210_to_BGR48_copy(bgr48, r210, w, h, src_stride, dst_stride)
 *             else:
*/
            {
                PyThreadState * _save;
                _save = PyEval_SaveThread();
                __Pyx_FastGIL_Remember();
                /*try:*/ {

                  /* "xpra/codecs/csc_cython/converter.pyx":1048
 *             if image.is_thread_safe():
 *                 with nogil:
 *                     r210_to_BGR48_copy(bgr48, r210, w, h, src_stride, dst_stride)             # <<<<<<<<<<<<<<
 *             else:
 *                 r210_to_BGR48_copy(bgr48, r210, w, h, src_stride, dst_stride)
*/
                  __pyx_f_4xpra_6codecs_10csc_cython_9converter_r210_to_BGR48_copy(__pyx_v_bgr48, __pyx_v_r210, __pyx_v_w, __pyx_v_h, __pyx_v_src_stride, __pyx_v_dst_stride);
                }

                /* "xpra/codecs/csc_cython/converter.pyx":1047
 *             r210 = <const unsigned int*> (<uintptr_t> int(bc))
 *             if image.is_thread_safe():
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     r210_to_BGR48_copy(bgr48, r210, w, h, src_stride, dst_stride)
 *             else:
*/
                /*finally:*/ {
                  /*normal exit:*/{
                    __Pyx_FastGIL_Forget();
                    PyEval_RestoreThread(_save);
                    goto __pyx_L16;
                  }
                  __pyx_L16:;
                }
            }

            /* "xpra/codecs/csc_cython/converter.pyx":1046
 *         with buffer_context(pixels) as bc:
 *             r210 = <const unsigned int*> (<uintptr_t> int(bc))
 *             if image.is_thread_safe():             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     r210_to_BGR48_copy(bgr48, r210, w, h, src_stride, dst_stride)
*/
            goto __pyx_L13;
          }

          /* "xpra/codecs/csc_cython/converter.pyx":1050
 *                     r210_to_BGR48_copy(bgr48, r210, w, h, src_stride, dst_stride)
 *             else:
 *                 r210_to_BGR48_copy(bgr48, r210, w, h, src_stride, dst_stride)             # <<<<<<<<<<<<<<
 *         return self.packed_image_wrapper(<char *> bgr48, 48)
 * 
*/
          /*else*/ {
            __pyx_f_4xpra_6codecs_10csc_cython_9converter_r210_to_BGR48_copy(__pyx_v_bgr48, __pyx_v_r210, __pyx_v_w, __pyx_v_h, __pyx_v_src_stride, __pyx_v_dst_stride);
          }
          __pyx_L13:;

          /* "xpra/codecs/csc_cython/converter.pyx":1044
 * 
 *         cdef const unsigned int *r210
 *         with buffer_context(pixels) as bc:             # <<<<<<<<<<<<<<
 *             r210 = <const unsigned int*> (<uintptr_t> int(bc))
 *             if image.is_thread_safe():
*/
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L12_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.r210_to_BGR48", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 1044, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_2);
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_6 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1044, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1044, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (__pyx_t_8 < (0)) __PYX_ERR(0, 1044, __pyx_L9_except_error)
          __pyx_t_15 = (!__pyx_t_8);
          if (unlikely(__pyx_t_15)) {
            __Pyx_GIVEREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_4);
            __pyx_t_2 = 0;  __pyx_t_1 = 0;  __pyx_t_4 = 0; 
            __PYX_ERR(0, 1044, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __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);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __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_L12_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_9) {
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_mstate_global->__pyx_tuple[4], NULL);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1044, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L20;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L1_error;
    __pyx_L20:;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1051
 *             else:
 *                 r210_to_BGR48_copy(bgr48, r210, w, h, src_stride, dst_stride)
 *         return self.packed_image_wrapper(<char *> bgr48, 48)             # <<<<<<<<<<<<<<
 * 
 *     cdef object packed_image_wrapper(self, char *buf, unsigned char bpp=24):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_16.__pyx_n = 1;
  __pyx_t_16.bpp = 48;
  __pyx_t_4 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->packed_image_wrapper(__pyx_v_self, ((char *)__pyx_v_bgr48), &__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1027
 *         return self.packed_image_wrapper(output_image, 30)
 * 
 *     def r210_to_BGR48(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.r210_to_BGR48", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pixels);
  __Pyx_XDECREF(__pyx_v_input_stride);
  __Pyx_XDECREF(__pyx_v_bc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1053
 *         return self.packed_image_wrapper(<char *> bgr48, 48)
 * 
 *     cdef object packed_image_wrapper(self, char *buf, unsigned char bpp=24):             # <<<<<<<<<<<<<<
 *         pybuf = PyMemoryView_FromMemory(buf, self.dst_sizes[0], PyBUF_WRITE)
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height, pybuf, self.dst_format, bpp, self.dst_strides[0], planes=ImageWrapper.PACKED)
*/

static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, char *__pyx_v_buf, struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper *__pyx_optional_args) {
  unsigned char __pyx_v_bpp = ((unsigned char)24);
  PyObject *__pyx_v_pybuf = NULL;
  PyObject *__pyx_v_out_image = 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;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("packed_image_wrapper", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_bpp = __pyx_optional_args->bpp;
    }
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1054
 * 
 *     cdef object packed_image_wrapper(self, char *buf, unsigned char bpp=24):
 *         pybuf = PyMemoryView_FromMemory(buf, self.dst_sizes[0], PyBUF_WRITE)             # <<<<<<<<<<<<<<
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height, pybuf, self.dst_format, bpp, self.dst_strides[0], planes=ImageWrapper.PACKED)
 *         out_image.cython_buffer = <uintptr_t> buf
*/
  __pyx_t_1 = PyMemoryView_FromMemory(__pyx_v_buf, (__pyx_v_self->dst_sizes[0]), PyBUF_WRITE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pybuf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1055
 *     cdef object packed_image_wrapper(self, char *buf, unsigned char bpp=24):
 *         pybuf = PyMemoryView_FromMemory(buf, self.dst_sizes[0], PyBUF_WRITE)
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height, pybuf, self.dst_format, bpp, self.dst_strides[0], planes=ImageWrapper.PACKED)             # <<<<<<<<<<<<<<
 *         out_image.cython_buffer = <uintptr_t> buf
 *         return out_image
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->dst_width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->dst_height); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyLong_From_unsigned_char(__pyx_v_bpp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyLong_From_unsigned_long((__pyx_v_self->dst_strides[0])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_ImageWrapper); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_PACKED); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_10 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_10 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[9 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0, __pyx_t_4, __pyx_t_5, __pyx_v_pybuf, __pyx_v_self->dst_format, __pyx_t_6, __pyx_t_7};
    __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_planes, __pyx_t_9, __pyx_t_8, __pyx_callargs+9, 0) < (0)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_10, (9-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __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_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_out_image = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1056
 *         pybuf = PyMemoryView_FromMemory(buf, self.dst_sizes[0], PyBUF_WRITE)
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height, pybuf, self.dst_format, bpp, self.dst_strides[0], planes=ImageWrapper.PACKED)
 *         out_image.cython_buffer = <uintptr_t> buf             # <<<<<<<<<<<<<<
 *         return out_image
 * 
*/
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(((uintptr_t)__pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_out_image, __pyx_mstate_global->__pyx_n_u_cython_buffer, __pyx_t_1) < (0)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1057
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height, pybuf, self.dst_format, bpp, self.dst_strides[0], planes=ImageWrapper.PACKED)
 *         out_image.cython_buffer = <uintptr_t> buf
 *         return out_image             # <<<<<<<<<<<<<<
 * 
 *     def validate_planar3_image(self, image: ImageWrapper) -> None:
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out_image);
  __pyx_r = __pyx_v_out_image;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1053
 *         return self.packed_image_wrapper(<char *> bgr48, 48)
 * 
 *     cdef object packed_image_wrapper(self, char *buf, unsigned char bpp=24):             # <<<<<<<<<<<<<<
 *         pybuf = PyMemoryView_FromMemory(buf, self.dst_sizes[0], PyBUF_WRITE)
 *         out_image = CythonImageWrapper(0, 0, self.dst_width, self.dst_height, pybuf, self.dst_format, bpp, self.dst_strides[0], planes=ImageWrapper.PACKED)
*/

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.packed_image_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pybuf);
  __Pyx_XDECREF(__pyx_v_out_image);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1059
 *         return out_image
 * 
 *     def validate_planar3_image(self, image: ImageWrapper) -> None:             # <<<<<<<<<<<<<<
 *         assert image.get_planes()==ImageWrapper.PLANAR_3, "invalid input format: %s planes" % image.get_planes()
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_57validate_planar3_image(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_57validate_planar3_image = {"validate_planar3_image", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_57validate_planar3_image, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_57validate_planar3_image(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("validate_planar3_image (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_56validate_planar3_image(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_56validate_planar3_image(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("validate_planar3_image", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1060
 * 
 *     def validate_planar3_image(self, image: ImageWrapper) -> None:
 *         assert image.get_planes()==ImageWrapper.PLANAR_3, "invalid input format: %s planes" % image.get_planes()             # <<<<<<<<<<<<<<
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
 *         assert image.get_height()>=self.src_height, "invalid image height: %s (minimum is %s)" % (image.get_height(), self.src_height)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_planes, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ImageWrapper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PLANAR_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) {
      __pyx_t_4 = __pyx_v_image;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_planes, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_4 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_invalid_input_format_s_planes, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 1060, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1060, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":1061
 *     def validate_planar3_image(self, image: ImageWrapper) -> None:
 *         assert image.get_planes()==ImageWrapper.PLANAR_3, "invalid input format: %s planes" % image.get_planes()
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)             # <<<<<<<<<<<<<<
 *         assert image.get_height()>=self.src_height, "invalid image height: %s (minimum is %s)" % (image.get_height(), self.src_height)
 *         assert image.get_pixels(), "failed to get pixels from %s" % image
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_width, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->src_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1061, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1061, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1061, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_mstate_global->__pyx_n_u_get_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_2), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_self->src_width, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_invalid_image_width;
      __pyx_t_6[1] = __pyx_t_1;
      __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_minimum_is;
      __pyx_t_6[3] = __pyx_t_2;
      __pyx_t_6[4] = __pyx_mstate_global->__pyx_kp_u__2;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 1061, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1061, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":1062
 *         assert image.get_planes()==ImageWrapper.PLANAR_3, "invalid input format: %s planes" % image.get_planes()
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
 *         assert image.get_height()>=self.src_height, "invalid image height: %s (minimum is %s)" % (image.get_height(), self.src_height)             # <<<<<<<<<<<<<<
 *         assert image.get_pixels(), "failed to get pixels from %s" % image
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_height, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1062, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->src_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1062, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1062, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_mstate_global->__pyx_n_u_get_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1062, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1062, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_2), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1062, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyUnicode_From_unsigned_int(__pyx_v_self->src_height, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1062, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_invalid_image_height;
      __pyx_t_6[1] = __pyx_t_1;
      __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_minimum_is;
      __pyx_t_6[3] = __pyx_t_2;
      __pyx_t_6[4] = __pyx_mstate_global->__pyx_kp_u__2;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1062, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 1062, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1062, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":1063
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
 *         assert image.get_height()>=self.src_height, "invalid image height: %s (minimum is %s)" % (image.get_height(), self.src_height)
 *         assert image.get_pixels(), "failed to get pixels from %s" % image             # <<<<<<<<<<<<<<
 * 
 *     def GBRP10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1063, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) {
      __pyx_t_4 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_failed_to_get_pixels_from_s, __pyx_v_image); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 1063, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1063, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":1059
 *         return out_image
 * 
 *     def validate_planar3_image(self, image: ImageWrapper) -> None:             # <<<<<<<<<<<<<<
 *         assert image.get_planes()==ImageWrapper.PLANAR_3, "invalid input format: %s planes" % image.get_planes()
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
*/

  /* 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_AddTraceback("xpra.codecs.csc_cython.converter.Converter.validate_planar3_image", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1065
 *         assert image.get_pixels(), "failed to get pixels from %s" % image
 * 
 *     def GBRP10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_planar3_image(image)
 *         pixels = image.get_pixels()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_59GBRP10_to_r210(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_59GBRP10_to_r210 = {"GBRP10_to_r210", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_59GBRP10_to_r210, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_59GBRP10_to_r210(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GBRP10_to_r210 (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_58GBRP10_to_r210(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_58GBRP10_to_r210(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  PyObject *__pyx_v_pixels = NULL;
  PyObject *__pyx_v_input_strides = NULL;
  unsigned int __pyx_v_w;
  unsigned int __pyx_v_h;
  unsigned int __pyx_v_src_stride;
  unsigned int __pyx_v_dst_stride;
  unsigned int *__pyx_v_r210;
  uintptr_t __pyx_v_gbrp10[3];
  unsigned int __pyx_v_i;
  Py_buffer __pyx_v_py_buf[3];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  unsigned int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_UCS4 __pyx_t_9;
  struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GBRP10_to_r210", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1066
 * 
 *     def GBRP10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:
 *         self.validate_planar3_image(image)             # <<<<<<<<<<<<<<
 *         pixels = image.get_pixels()
 *         input_strides = image.get_rowstride()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_image};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate_planar3_image, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1067
 *     def GBRP10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:
 *         self.validate_planar3_image(image)
 *         pixels = image.get_pixels()             # <<<<<<<<<<<<<<
 *         input_strides = image.get_rowstride()
 *         cdef unsigned int w = self.src_width
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1067, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_pixels = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1068
 *         self.validate_planar3_image(image)
 *         pixels = image.get_pixels()
 *         input_strides = image.get_rowstride()             # <<<<<<<<<<<<<<
 *         cdef unsigned int w = self.src_width
 *         cdef unsigned int h = self.src_height
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_rowstride, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_input_strides = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1069
 *         pixels = image.get_pixels()
 *         input_strides = image.get_rowstride()
 *         cdef unsigned int w = self.src_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int h = self.src_height
 *         cdef unsigned int src_stride = input_strides[0]
*/
  __pyx_t_4 = __pyx_v_self->src_width;
  __pyx_v_w = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":1070
 *         input_strides = image.get_rowstride()
 *         cdef unsigned int w = self.src_width
 *         cdef unsigned int h = self.src_height             # <<<<<<<<<<<<<<
 *         cdef unsigned int src_stride = input_strides[0]
 *         cdef unsigned int dst_stride = self.dst_strides[0]
*/
  __pyx_t_4 = __pyx_v_self->src_height;
  __pyx_v_h = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":1071
 *         cdef unsigned int w = self.src_width
 *         cdef unsigned int h = self.src_height
 *         cdef unsigned int src_stride = input_strides[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned int dst_stride = self.dst_strides[0]
 *         assert input_strides[1]==src_stride and input_strides[2]==src_stride, "mismatch in rowstrides: %s" % (input_strides,)
*/
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1071, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_src_stride = __pyx_t_4;

  /* "xpra/codecs/csc_cython/converter.pyx":1072
 *         cdef unsigned int h = self.src_height
 *         cdef unsigned int src_stride = input_strides[0]
 *         cdef unsigned int dst_stride = self.dst_strides[0]             # <<<<<<<<<<<<<<
 *         assert input_strides[1]==src_stride and input_strides[2]==src_stride, "mismatch in rowstrides: %s" % (input_strides,)
 *         assert src_stride>=w*2
*/
  __pyx_v_dst_stride = (__pyx_v_self->dst_strides[0]);

  /* "xpra/codecs/csc_cython/converter.pyx":1073
 *         cdef unsigned int src_stride = input_strides[0]
 *         cdef unsigned int dst_stride = self.dst_strides[0]
 *         assert input_strides[1]==src_stride and input_strides[2]==src_stride, "mismatch in rowstrides: %s" % (input_strides,)             # <<<<<<<<<<<<<<
 *         assert src_stride>=w*2
 *         assert dst_stride>=w*4
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_src_stride); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_7) {
    } else {
      __pyx_t_5 = __pyx_t_7;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_input_strides, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyLong_From_unsigned_int(__pyx_v_src_stride); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __pyx_t_7;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_5)) {
      __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_input_strides), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1073, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_mismatch_in_rowstrides, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1073, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 1073, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1073, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":1074
 *         cdef unsigned int dst_stride = self.dst_strides[0]
 *         assert input_strides[1]==src_stride and input_strides[2]==src_stride, "mismatch in rowstrides: %s" % (input_strides,)
 *         assert src_stride>=w*2             # <<<<<<<<<<<<<<
 *         assert dst_stride>=w*4
 *         assert self.dst_sizes[0]>=dst_stride*h
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_5 = (__pyx_v_src_stride >= (__pyx_v_w * 2));
    if (unlikely(!__pyx_t_5)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 1074, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1074, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":1075
 *         assert input_strides[1]==src_stride and input_strides[2]==src_stride, "mismatch in rowstrides: %s" % (input_strides,)
 *         assert src_stride>=w*2
 *         assert dst_stride>=w*4             # <<<<<<<<<<<<<<
 *         assert self.dst_sizes[0]>=dst_stride*h
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_5 = (__pyx_v_dst_stride >= (__pyx_v_w * 4));
    if (unlikely(!__pyx_t_5)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 1075, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1075, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":1076
 *         assert src_stride>=w*2
 *         assert dst_stride>=w*4
 *         assert self.dst_sizes[0]>=dst_stride*h             # <<<<<<<<<<<<<<
 * 
 *         #allocate output buffer:
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_5 = ((__pyx_v_self->dst_sizes[0]) >= (__pyx_v_dst_stride * __pyx_v_h));
    if (unlikely(!__pyx_t_5)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 1076, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1076, __pyx_L1_error)
  #endif

  /* "xpra/codecs/csc_cython/converter.pyx":1079
 * 
 *         #allocate output buffer:
 *         cdef unsigned int *r210 = <unsigned int*> memalign(self.dst_sizes[0])             # <<<<<<<<<<<<<<
 * 
 *         cdef uintptr_t gbrp10[3]
*/
  __pyx_v_r210 = ((unsigned int *)__pyx_f_4xpra_7buffers_6membuf_memalign((__pyx_v_self->dst_sizes[0])));

  /* "xpra/codecs/csc_cython/converter.pyx":1084
 *         cdef unsigned int i
 *         cdef Py_buffer py_buf[3]
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             if PyObject_GetBuffer(pixels[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(pixels[i]))
*/
  for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "xpra/codecs/csc_cython/converter.pyx":1085
 *         cdef Py_buffer py_buf[3]
 *         for i in range(3):
 *             if PyObject_GetBuffer(pixels[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *                 raise ValueError("failed to read pixel data from %s" % type(pixels[i]))
 *             gbrp10[i] = <uintptr_t> py_buf[i].buf
*/
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pixels, __pyx_v_i, unsigned int, 0, __Pyx_PyLong_From_unsigned_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (PyObject_GetBuffer(__pyx_t_2, (&(__pyx_v_py_buf[__pyx_v_i])), PyBUF_ANY_CONTIGUOUS) != 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_t_5)) {

      /* "xpra/codecs/csc_cython/converter.pyx":1086
 *         for i in range(3):
 *             if PyObject_GetBuffer(pixels[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(pixels[i]))             # <<<<<<<<<<<<<<
 *             gbrp10[i] = <uintptr_t> py_buf[i].buf
 *             assert (<unsigned long> py_buf[i].len)>=src_stride*h, "input plane '%s' is too small: %i bytes" % ("GBR"[i], py_buf[i].len)
*/
      __pyx_t_1 = NULL;
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_pixels, __pyx_v_i, unsigned int, 0, __Pyx_PyLong_From_unsigned_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1086, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_failed_to_read_pixel_data_from_s, ((PyObject *)Py_TYPE(__pyx_t_6))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1086, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1086, __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(0, 1086, __pyx_L1_error)

      /* "xpra/codecs/csc_cython/converter.pyx":1085
 *         cdef Py_buffer py_buf[3]
 *         for i in range(3):
 *             if PyObject_GetBuffer(pixels[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *                 raise ValueError("failed to read pixel data from %s" % type(pixels[i]))
 *             gbrp10[i] = <uintptr_t> py_buf[i].buf
*/
    }

    /* "xpra/codecs/csc_cython/converter.pyx":1087
 *             if PyObject_GetBuffer(pixels[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(pixels[i]))
 *             gbrp10[i] = <uintptr_t> py_buf[i].buf             # <<<<<<<<<<<<<<
 *             assert (<unsigned long> py_buf[i].len)>=src_stride*h, "input plane '%s' is too small: %i bytes" % ("GBR"[i], py_buf[i].len)
 * 
*/
    (__pyx_v_gbrp10[__pyx_v_i]) = ((uintptr_t)(__pyx_v_py_buf[__pyx_v_i]).buf);

    /* "xpra/codecs/csc_cython/converter.pyx":1088
 *                 raise ValueError("failed to read pixel data from %s" % type(pixels[i]))
 *             gbrp10[i] = <uintptr_t> py_buf[i].buf
 *             assert (<unsigned long> py_buf[i].len)>=src_stride*h, "input plane '%s' is too small: %i bytes" % ("GBR"[i], py_buf[i].len)             # <<<<<<<<<<<<<<
 * 
 *         if image.is_thread_safe():
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_5 = (((unsigned long)(__pyx_v_py_buf[__pyx_v_i]).len) >= (__pyx_v_src_stride * __pyx_v_h));
      if (unlikely(!__pyx_t_5)) {
        __pyx_t_9 = __Pyx_GetItemInt_Unicode(__pyx_mstate_global->__pyx_n_u_GBR, __pyx_v_i, unsigned int, 0, __Pyx_PyLong_From_unsigned_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(__pyx_t_9 == (Py_UCS4)-1)) __PYX_ERR(0, 1088, __pyx_L1_error)
        __pyx_t_2 = __Pyx_PyUnicode_FromOrdinal(__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1088, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = PyLong_FromSsize_t((__pyx_v_py_buf[__pyx_v_i]).len); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1088, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_2);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1088, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_8);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8) != (0)) __PYX_ERR(0, 1088, __pyx_L1_error);
        __pyx_t_2 = 0;
        __pyx_t_8 = 0;
        __pyx_t_8 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_input_plane_s_is_too_small_i_byt, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1088, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_8, 0, 0);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __PYX_ERR(0, 1088, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 1088, __pyx_L1_error)
    #endif
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1090
 *             assert (<unsigned long> py_buf[i].len)>=src_stride*h, "input plane '%s' is too small: %i bytes" % ("GBR"[i], py_buf[i].len)
 * 
 *         if image.is_thread_safe():             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 gbrp10_to_r210_copy(<uintptr_t> r210, gbrp10,
*/
  __pyx_t_1 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
    __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_thread_safe, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
  }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_5) {

    /* "xpra/codecs/csc_cython/converter.pyx":1091
 * 
 *         if image.is_thread_safe():
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 gbrp10_to_r210_copy(<uintptr_t> r210, gbrp10,
 *                                     w, h,
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "xpra/codecs/csc_cython/converter.pyx":1092
 *         if image.is_thread_safe():
 *             with nogil:
 *                 gbrp10_to_r210_copy(<uintptr_t> r210, gbrp10,             # <<<<<<<<<<<<<<
 *                                     w, h,
 *                                     src_stride, dst_stride)
*/
          __pyx_f_4xpra_6codecs_10csc_cython_9converter_gbrp10_to_r210_copy(((uintptr_t)__pyx_v_r210), __pyx_v_gbrp10, __pyx_v_w, __pyx_v_h, __pyx_v_src_stride, __pyx_v_dst_stride);
        }

        /* "xpra/codecs/csc_cython/converter.pyx":1091
 * 
 *         if image.is_thread_safe():
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 gbrp10_to_r210_copy(<uintptr_t> r210, gbrp10,
 *                                     w, h,
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L11;
          }
          __pyx_L11:;
        }
    }

    /* "xpra/codecs/csc_cython/converter.pyx":1090
 *             assert (<unsigned long> py_buf[i].len)>=src_stride*h, "input plane '%s' is too small: %i bytes" % ("GBR"[i], py_buf[i].len)
 * 
 *         if image.is_thread_safe():             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 gbrp10_to_r210_copy(<uintptr_t> r210, gbrp10,
*/
    goto __pyx_L8;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1096
 *                                     src_stride, dst_stride)
 *         else:
 *             gbrp10_to_r210_copy(<uintptr_t> r210, gbrp10,             # <<<<<<<<<<<<<<
 *                                 w, h,
 *                                 src_stride, dst_stride)
*/
  /*else*/ {

    /* "xpra/codecs/csc_cython/converter.pyx":1098
 *             gbrp10_to_r210_copy(<uintptr_t> r210, gbrp10,
 *                                 w, h,
 *                                 src_stride, dst_stride)             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])
*/
    __pyx_f_4xpra_6codecs_10csc_cython_9converter_gbrp10_to_r210_copy(((uintptr_t)__pyx_v_r210), __pyx_v_gbrp10, __pyx_v_w, __pyx_v_h, __pyx_v_src_stride, __pyx_v_dst_stride);
  }
  __pyx_L8:;

  /* "xpra/codecs/csc_cython/converter.pyx":1099
 *                                 w, h,
 *                                 src_stride, dst_stride)
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&py_buf[i])
 *         return self.packed_image_wrapper(<char *> r210, 30)
*/
  for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "xpra/codecs/csc_cython/converter.pyx":1100
 *                                 src_stride, dst_stride)
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])             # <<<<<<<<<<<<<<
 *         return self.packed_image_wrapper(<char *> r210, 30)
 * 
*/
    PyBuffer_Release((&(__pyx_v_py_buf[__pyx_v_i])));
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1101
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])
 *         return self.packed_image_wrapper(<char *> r210, 30)             # <<<<<<<<<<<<<<
 * 
 *     def YUV420P_to_RGBX(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10.__pyx_n = 1;
  __pyx_t_10.bpp = 30;
  __pyx_t_8 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->packed_image_wrapper(__pyx_v_self, ((char *)__pyx_v_r210), &__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1065
 *         assert image.get_pixels(), "failed to get pixels from %s" % image
 * 
 *     def GBRP10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_planar3_image(image)
 *         pixels = image.get_pixels()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.GBRP10_to_r210", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pixels);
  __Pyx_XDECREF(__pyx_v_input_strides);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1103
 *         return self.packed_image_wrapper(<char *> r210, 30)
 * 
 *     def YUV420P_to_RGBX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 4, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_61YUV420P_to_RGBX(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_61YUV420P_to_RGBX = {"YUV420P_to_RGBX", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_61YUV420P_to_RGBX, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_61YUV420P_to_RGBX(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("YUV420P_to_RGBX (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_60YUV420P_to_RGBX(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_60YUV420P_to_RGBX(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("YUV420P_to_RGBX", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1104
 * 
 *     def YUV420P_to_RGBX(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_YUV420P_to_RGB(image, 4, RGBX_B, RGBX_G, RGBX_R, RGBX_X)             # <<<<<<<<<<<<<<
 * 
 *     def YUV420P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_YUV420P_to_RGB(__pyx_v_self, __pyx_v_image, 4, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_B, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_R, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1103
 *         return self.packed_image_wrapper(<char *> r210, 30)
 * 
 *     def YUV420P_to_RGBX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 4, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.YUV420P_to_RGBX", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1106
 *         return self.do_YUV420P_to_RGB(image, 4, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
 *     def YUV420P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 3, RGB_B, RGB_G, RGB_R, 0)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_63YUV420P_to_RGB(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_63YUV420P_to_RGB = {"YUV420P_to_RGB", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_63YUV420P_to_RGB, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_63YUV420P_to_RGB(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("YUV420P_to_RGB (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_62YUV420P_to_RGB(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_62YUV420P_to_RGB(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("YUV420P_to_RGB", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1107
 * 
 *     def YUV420P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_YUV420P_to_RGB(image, 3, RGB_B, RGB_G, RGB_R, 0)             # <<<<<<<<<<<<<<
 * 
 *     def YUV420P_to_BGRX(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_YUV420P_to_RGB(__pyx_v_self, __pyx_v_image, 3, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_B, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_R, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1106
 *         return self.do_YUV420P_to_RGB(image, 4, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
 *     def YUV420P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 3, RGB_B, RGB_G, RGB_R, 0)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.YUV420P_to_RGB", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1109
 *         return self.do_YUV420P_to_RGB(image, 3, RGB_B, RGB_G, RGB_R, 0)
 * 
 *     def YUV420P_to_BGRX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 4, BGRX_R, BGRX_G, BGRX_B, BGRX_X)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_65YUV420P_to_BGRX(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_65YUV420P_to_BGRX = {"YUV420P_to_BGRX", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_65YUV420P_to_BGRX, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_65YUV420P_to_BGRX(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("YUV420P_to_BGRX (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_64YUV420P_to_BGRX(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_64YUV420P_to_BGRX(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("YUV420P_to_BGRX", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1110
 * 
 *     def YUV420P_to_BGRX(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_YUV420P_to_RGB(image, 4, BGRX_R, BGRX_G, BGRX_B, BGRX_X)             # <<<<<<<<<<<<<<
 * 
 *     def YUV420P_to_BGR(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_YUV420P_to_RGB(__pyx_v_self, __pyx_v_image, 4, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_R, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_B, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1109
 *         return self.do_YUV420P_to_RGB(image, 3, RGB_B, RGB_G, RGB_R, 0)
 * 
 *     def YUV420P_to_BGRX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 4, BGRX_R, BGRX_G, BGRX_B, BGRX_X)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.YUV420P_to_BGRX", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1112
 *         return self.do_YUV420P_to_RGB(image, 4, BGRX_R, BGRX_G, BGRX_B, BGRX_X)
 * 
 *     def YUV420P_to_BGR(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 3, BGR_R, BGR_G, BGR_B, 0)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_67YUV420P_to_BGR(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_67YUV420P_to_BGR = {"YUV420P_to_BGR", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_67YUV420P_to_BGR, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_67YUV420P_to_BGR(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("YUV420P_to_BGR (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_66YUV420P_to_BGR(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_66YUV420P_to_BGR(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("YUV420P_to_BGR", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1113
 * 
 *     def YUV420P_to_BGR(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_YUV420P_to_RGB(image, 3, BGR_R, BGR_G, BGR_B, 0)             # <<<<<<<<<<<<<<
 * 
 *     cdef do_YUV420P_to_RGB(self, image: ImageWrapper,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_YUV420P_to_RGB(__pyx_v_self, __pyx_v_image, 3, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_R, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_B, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1112
 *         return self.do_YUV420P_to_RGB(image, 4, BGRX_R, BGRX_G, BGRX_B, BGRX_X)
 * 
 *     def YUV420P_to_BGR(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 3, BGR_R, BGR_G, BGR_B, 0)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.YUV420P_to_BGR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1115
 *         return self.do_YUV420P_to_RGB(image, 3, BGR_R, BGR_G, BGR_B, 0)
 * 
 *     cdef do_YUV420P_to_RGB(self, image: ImageWrapper,             # <<<<<<<<<<<<<<
 *                            const uint8_t Bpp,
 *                            const uint8_t Rindex,
*/

static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_YUV420P_to_RGB(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image, uint8_t const __pyx_v_Bpp, uint8_t const __pyx_v_Rindex, uint8_t const __pyx_v_Gindex, uint8_t const __pyx_v_Bindex, uint8_t const __pyx_v_Xindex) {
  unsigned int __pyx_v_x;
  unsigned int __pyx_v_y;
  unsigned int __pyx_v_o;
  unsigned int __pyx_v_sx;
  unsigned int __pyx_v_sy;
  unsigned int __pyx_v_ox;
  unsigned int __pyx_v_oy;
  unsigned char __pyx_v_dx;
  unsigned char __pyx_v_dy;
  short __pyx_v_Y;
  short __pyx_v_U;
  short __pyx_v_V;
  PyObject *__pyx_v_planes = NULL;
  PyObject *__pyx_v_input_strides = NULL;
  unsigned char *__pyx_v_output_image;
  unsigned int __pyx_v_stride;
  unsigned int __pyx_v_src_width;
  unsigned int __pyx_v_src_height;
  unsigned int __pyx_v_dst_width;
  unsigned int __pyx_v_dst_height;
  unsigned int __pyx_v_Ystride;
  unsigned int __pyx_v_Ustride;
  unsigned int __pyx_v_Vstride;
  Py_buffer __pyx_v_py_buf[3];
  int __pyx_v_i;
  PyObject *__pyx_v_min_len = NULL;
  unsigned char *__pyx_v_Ybuf;
  unsigned char *__pyx_v_Ubuf;
  unsigned char *__pyx_v_Vbuf;
  unsigned char __pyx_v_full_range;
  unsigned char __pyx_v_yc;
  unsigned char __pyx_v_uc;
  unsigned char __pyx_v_vc;
  int __pyx_v_ry;
  int __pyx_v_ru;
  int __pyx_v_rv;
  int __pyx_v_gy;
  int __pyx_v_gu;
  int __pyx_v_gv;
  int __pyx_v_by;
  int __pyx_v_bu;
  int __pyx_v_bv;
  unsigned int __pyx_v_workw;
  unsigned int __pyx_v_workh;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_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;
  PyObject *__pyx_t_10 = NULL;
  unsigned int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  PyObject *__pyx_t_14[4];
  unsigned char __pyx_t_15;
  unsigned int __pyx_t_16;
  unsigned int __pyx_t_17;
  unsigned int __pyx_t_18;
  unsigned int __pyx_t_19;
  unsigned int __pyx_t_20;
  unsigned char __pyx_t_21;
  struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper __pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("do_YUV420P_to_RGB", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1127
 *         cdef short Y, U, V
 * 
 *         self.validate_planar3_image(image)             # <<<<<<<<<<<<<<
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_image};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate_planar3_image, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1128
 * 
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()             # <<<<<<<<<<<<<<
 *         input_strides = image.get_rowstride()
 *         log("do_YUV420P_to_RGB(%s) strides=%s", (image, Bpp, Rindex, Gindex, Bindex, Xindex), input_strides)
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_planes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1129
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()             # <<<<<<<<<<<<<<
 *         log("do_YUV420P_to_RGB(%s) strides=%s", (image, Bpp, Rindex, Gindex, Bindex, Xindex), input_strides)
 * 
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_rowstride, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_input_strides = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1130
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()
 *         log("do_YUV420P_to_RGB(%s) strides=%s", (image, Bpp, Rindex, Gindex, Bindex, Xindex), input_strides)             # <<<<<<<<<<<<<<
 * 
 *         #allocate output buffer:
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_From_uint8_t(__pyx_v_Bpp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyLong_From_uint8_t(__pyx_v_Rindex); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyLong_From_uint8_t(__pyx_v_Gindex); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyLong_From_uint8_t(__pyx_v_Bindex); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyLong_From_uint8_t(__pyx_v_Xindex); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_v_image);
  __Pyx_GIVEREF(__pyx_v_image);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_image) != (0)) __PYX_ERR(0, 1130, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 1130, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_6) != (0)) __PYX_ERR(0, 1130, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7) != (0)) __PYX_ERR(0, 1130, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_8);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_8) != (0)) __PYX_ERR(0, 1130, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_9);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_9) != (0)) __PYX_ERR(0, 1130, __pyx_L1_error);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_do_YUV420P_to_RGB_s_strides_s, __pyx_t_10, __pyx_v_input_strides};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1133
 * 
 *         #allocate output buffer:
 *         cdef unsigned char *output_image = <unsigned char*> memalign(self.buffer_size)             # <<<<<<<<<<<<<<
 * 
 *         #copy to local variables:
*/
  __pyx_v_output_image = ((unsigned char *)__pyx_f_4xpra_7buffers_6membuf_memalign(__pyx_v_self->buffer_size));

  /* "xpra/codecs/csc_cython/converter.pyx":1136
 * 
 *         #copy to local variables:
 *         cdef unsigned int stride = self.dst_strides[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height
*/
  __pyx_v_stride = (__pyx_v_self->dst_strides[0]);

  /* "xpra/codecs/csc_cython/converter.pyx":1137
 *         #copy to local variables:
 *         cdef unsigned int stride = self.dst_strides[0]
 *         cdef unsigned int src_width = self.src_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width
*/
  __pyx_t_11 = __pyx_v_self->src_width;
  __pyx_v_src_width = __pyx_t_11;

  /* "xpra/codecs/csc_cython/converter.pyx":1138
 *         cdef unsigned int stride = self.dst_strides[0]
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height             # <<<<<<<<<<<<<<
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height
*/
  __pyx_t_11 = __pyx_v_self->src_height;
  __pyx_v_src_height = __pyx_t_11;

  /* "xpra/codecs/csc_cython/converter.pyx":1139
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int dst_height = self.dst_height
 *         cdef unsigned int Ystride = input_strides[0]
*/
  __pyx_t_11 = __pyx_v_self->dst_width;
  __pyx_v_dst_width = __pyx_t_11;

  /* "xpra/codecs/csc_cython/converter.pyx":1140
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height             # <<<<<<<<<<<<<<
 *         cdef unsigned int Ystride = input_strides[0]
 *         cdef unsigned int Ustride = input_strides[1]
*/
  __pyx_t_11 = __pyx_v_self->dst_height;
  __pyx_v_dst_height = __pyx_t_11;

  /* "xpra/codecs/csc_cython/converter.pyx":1141
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height
 *         cdef unsigned int Ystride = input_strides[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned int Ustride = input_strides[1]
 *         cdef unsigned int Vstride = input_strides[2]
*/
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_11 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_Ystride = __pyx_t_11;

  /* "xpra/codecs/csc_cython/converter.pyx":1142
 *         cdef unsigned int dst_height = self.dst_height
 *         cdef unsigned int Ystride = input_strides[0]
 *         cdef unsigned int Ustride = input_strides[1]             # <<<<<<<<<<<<<<
 *         cdef unsigned int Vstride = input_strides[2]
 *         cdef Py_buffer py_buf[3]
*/
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_11 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_Ustride = __pyx_t_11;

  /* "xpra/codecs/csc_cython/converter.pyx":1143
 *         cdef unsigned int Ystride = input_strides[0]
 *         cdef unsigned int Ustride = input_strides[1]
 *         cdef unsigned int Vstride = input_strides[2]             # <<<<<<<<<<<<<<
 *         cdef Py_buffer py_buf[3]
 *         cdef int i
*/
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_11 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_Vstride = __pyx_t_11;

  /* "xpra/codecs/csc_cython/converter.pyx":1146
 *         cdef Py_buffer py_buf[3]
 *         cdef int i
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
*/
  for (__pyx_t_12 = 0; __pyx_t_12 < 3; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "xpra/codecs/csc_cython/converter.pyx":1147
 *         cdef int i
 *         for i in range(3):
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             min_len = input_strides[i]*image.get_height()
*/
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_planes, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = (PyObject_GetBuffer(__pyx_t_1, (&(__pyx_v_py_buf[__pyx_v_i])), PyBUF_ANY_CONTIGUOUS) != 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(__pyx_t_13)) {

      /* "xpra/codecs/csc_cython/converter.pyx":1148
 *         for i in range(3):
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))             # <<<<<<<<<<<<<<
 *             min_len = input_strides[i]*image.get_height()
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
*/
      __pyx_t_4 = NULL;
      __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_planes, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_failed_to_read_pixel_data_from_s, ((PyObject *)Py_TYPE(__pyx_t_10))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __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(0, 1148, __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(0, 1148, __pyx_L1_error)

      /* "xpra/codecs/csc_cython/converter.pyx":1147
 *         cdef int i
 *         for i in range(3):
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             min_len = input_strides[i]*image.get_height()
*/
    }

    /* "xpra/codecs/csc_cython/converter.pyx":1149
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             min_len = input_strides[i]*image.get_height()             # <<<<<<<<<<<<<<
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 *         cdef unsigned char *Ybuf = <unsigned char *> py_buf[0].buf
*/
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_height, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1149, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_min_len, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":1150
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             min_len = input_strides[i]*image.get_height()
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)             # <<<<<<<<<<<<<<
 *         cdef unsigned char *Ybuf = <unsigned char *> py_buf[0].buf
 *         cdef unsigned char *Ubuf = <unsigned char *> py_buf[1].buf
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_4 = PyLong_FromSsize_t(__pyx_v_py_buf->len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_v_min_len, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1150, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 1150, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_13)) {
        __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_py_buf->len, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_min_len), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_14[0] = __pyx_mstate_global->__pyx_kp_u_buffer_for_Y_plane_is_too_small;
        __pyx_t_14[1] = __pyx_t_2;
        __pyx_t_14[2] = __pyx_mstate_global->__pyx_kp_u_bytes_expected_at_least;
        __pyx_t_14[3] = __pyx_t_4;
        __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_14, 4, 33 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 26 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1150, __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_1, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 1150, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 1150, __pyx_L1_error)
    #endif
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1151
 *             min_len = input_strides[i]*image.get_height()
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 *         cdef unsigned char *Ybuf = <unsigned char *> py_buf[0].buf             # <<<<<<<<<<<<<<
 *         cdef unsigned char *Ubuf = <unsigned char *> py_buf[1].buf
 *         cdef unsigned char *Vbuf = <unsigned char *> py_buf[2].buf
*/
  __pyx_v_Ybuf = ((unsigned char *)(__pyx_v_py_buf[0]).buf);

  /* "xpra/codecs/csc_cython/converter.pyx":1152
 *             assert py_buf.len>=min_len, "buffer for Y plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 *         cdef unsigned char *Ybuf = <unsigned char *> py_buf[0].buf
 *         cdef unsigned char *Ubuf = <unsigned char *> py_buf[1].buf             # <<<<<<<<<<<<<<
 *         cdef unsigned char *Vbuf = <unsigned char *> py_buf[2].buf
 *         cdef unsigned char full_range = self.full_range
*/
  __pyx_v_Ubuf = ((unsigned char *)(__pyx_v_py_buf[1]).buf);

  /* "xpra/codecs/csc_cython/converter.pyx":1153
 *         cdef unsigned char *Ybuf = <unsigned char *> py_buf[0].buf
 *         cdef unsigned char *Ubuf = <unsigned char *> py_buf[1].buf
 *         cdef unsigned char *Vbuf = <unsigned char *> py_buf[2].buf             # <<<<<<<<<<<<<<
 *         cdef unsigned char full_range = self.full_range
 * 
*/
  __pyx_v_Vbuf = ((unsigned char *)(__pyx_v_py_buf[2]).buf);

  /* "xpra/codecs/csc_cython/converter.pyx":1154
 *         cdef unsigned char *Ubuf = <unsigned char *> py_buf[1].buf
 *         cdef unsigned char *Vbuf = <unsigned char *> py_buf[2].buf
 *         cdef unsigned char full_range = self.full_range             # <<<<<<<<<<<<<<
 * 
 *         cdef unsigned char yc = Yc
*/
  __pyx_t_15 = __pyx_v_self->full_range;
  __pyx_v_full_range = __pyx_t_15;

  /* "xpra/codecs/csc_cython/converter.pyx":1156
 *         cdef unsigned char full_range = self.full_range
 * 
 *         cdef unsigned char yc = Yc             # <<<<<<<<<<<<<<
 *         cdef unsigned char uc = Uc
 *         cdef unsigned char vc = Vc
*/
  __pyx_v_yc = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1157
 * 
 *         cdef unsigned char yc = Yc
 *         cdef unsigned char uc = Uc             # <<<<<<<<<<<<<<
 *         cdef unsigned char vc = Vc
 *         cdef int ry = RY, ru = RU, rv = RV
*/
  __pyx_v_uc = 0x80;

  /* "xpra/codecs/csc_cython/converter.pyx":1158
 *         cdef unsigned char yc = Yc
 *         cdef unsigned char uc = Uc
 *         cdef unsigned char vc = Vc             # <<<<<<<<<<<<<<
 *         cdef int ry = RY, ru = RU, rv = RV
 *         cdef int gy = GY, gu = GU, gv = GV
*/
  __pyx_v_vc = 0x80;

  /* "xpra/codecs/csc_cython/converter.pyx":1159
 *         cdef unsigned char uc = Uc
 *         cdef unsigned char vc = Vc
 *         cdef int ry = RY, ru = RU, rv = RV             # <<<<<<<<<<<<<<
 *         cdef int gy = GY, gu = GU, gv = GV
 *         cdef int by = BY, bu = BU, bv = BV
*/
  __pyx_v_ry = 0x10000;
  __pyx_v_ru = 0;
  __pyx_v_rv = 0x1672B;

  /* "xpra/codecs/csc_cython/converter.pyx":1160
 *         cdef unsigned char vc = Vc
 *         cdef int ry = RY, ru = RU, rv = RV
 *         cdef int gy = GY, gu = GU, gv = GV             # <<<<<<<<<<<<<<
 *         cdef int by = BY, bu = BU, bv = BV
 *         if not full_range:
*/
  __pyx_v_gy = 0x10000;
  __pyx_v_gu = -22544;
  __pyx_v_gv = -46793;

  /* "xpra/codecs/csc_cython/converter.pyx":1161
 *         cdef int ry = RY, ru = RU, rv = RV
 *         cdef int gy = GY, gu = GU, gv = GV
 *         cdef int by = BY, bu = BU, bv = BV             # <<<<<<<<<<<<<<
 *         if not full_range:
 *             yc = SYc
*/
  __pyx_v_by = 0x10000;
  __pyx_v_bu = 0x1C51F;
  __pyx_v_bv = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1162
 *         cdef int gy = GY, gu = GU, gv = GV
 *         cdef int by = BY, bu = BU, bv = BV
 *         if not full_range:             # <<<<<<<<<<<<<<
 *             yc = SYc
 *             uc = SUc
*/
  __pyx_t_13 = (!(__pyx_v_full_range != 0));
  if (__pyx_t_13) {

    /* "xpra/codecs/csc_cython/converter.pyx":1163
 *         cdef int by = BY, bu = BU, bv = BV
 *         if not full_range:
 *             yc = SYc             # <<<<<<<<<<<<<<
 *             uc = SUc
 *             vc = SVc
*/
    __pyx_v_yc = 16;

    /* "xpra/codecs/csc_cython/converter.pyx":1164
 *         if not full_range:
 *             yc = SYc
 *             uc = SUc             # <<<<<<<<<<<<<<
 *             vc = SVc
 *             ry = SRY
*/
    __pyx_v_uc = 0x80;

    /* "xpra/codecs/csc_cython/converter.pyx":1165
 *             yc = SYc
 *             uc = SUc
 *             vc = SVc             # <<<<<<<<<<<<<<
 *             ry = SRY
 *             ru = SRU
*/
    __pyx_v_vc = 0x80;

    /* "xpra/codecs/csc_cython/converter.pyx":1166
 *             uc = SUc
 *             vc = SVc
 *             ry = SRY             # <<<<<<<<<<<<<<
 *             ru = SRU
 *             rv = SRV
*/
    __pyx_v_ry = 0x12A15;

    /* "xpra/codecs/csc_cython/converter.pyx":1167
 *             vc = SVc
 *             ry = SRY
 *             ru = SRU             # <<<<<<<<<<<<<<
 *             rv = SRV
 *             gy = SGY
*/
    __pyx_v_ru = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":1168
 *             ry = SRY
 *             ru = SRU
 *             rv = SRV             # <<<<<<<<<<<<<<
 *             gy = SGY
 *             gu = SGU
*/
    __pyx_v_rv = 0x198E0;

    /* "xpra/codecs/csc_cython/converter.pyx":1169
 *             ru = SRU
 *             rv = SRV
 *             gy = SGY             # <<<<<<<<<<<<<<
 *             gu = SGU
 *             gv = SGV
*/
    __pyx_v_gy = 0x12A15;

    /* "xpra/codecs/csc_cython/converter.pyx":1170
 *             rv = SRV
 *             gy = SGY
 *             gu = SGU             # <<<<<<<<<<<<<<
 *             gv = SGV
 *             by = SBY
*/
    __pyx_v_gu = -25664;

    /* "xpra/codecs/csc_cython/converter.pyx":1171
 *             gy = SGY
 *             gu = SGU
 *             gv = SGV             # <<<<<<<<<<<<<<
 *             by = SBY
 *             bu = SBU
*/
    __pyx_v_gv = -53268;

    /* "xpra/codecs/csc_cython/converter.pyx":1172
 *             gu = SGU
 *             gv = SGV
 *             by = SBY             # <<<<<<<<<<<<<<
 *             bu = SBU
 *             bv = SBV
*/
    __pyx_v_by = 0x12A15;

    /* "xpra/codecs/csc_cython/converter.pyx":1173
 *             gv = SGV
 *             by = SBY
 *             bu = SBU             # <<<<<<<<<<<<<<
 *             bv = SBV
 * 
*/
    __pyx_v_bu = 0x203D4;

    /* "xpra/codecs/csc_cython/converter.pyx":1174
 *             by = SBY
 *             bu = SBU
 *             bv = SBV             # <<<<<<<<<<<<<<
 * 
 *         #we process 4 pixels at a time:
*/
    __pyx_v_bv = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":1162
 *         cdef int gy = GY, gu = GU, gv = GV
 *         cdef int by = BY, bu = BU, bv = BV
 *         if not full_range:             # <<<<<<<<<<<<<<
 *             yc = SYc
 *             uc = SUc
*/
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1177
 * 
 *         #we process 4 pixels at a time:
 *         cdef unsigned int workw = roundup(dst_width//2, 2)             # <<<<<<<<<<<<<<
 *         cdef unsigned int workh = roundup(dst_height//2, 2)
 *         #from now on, we can release the gil:
*/
  __pyx_v_workw = __pyx_f_4xpra_6codecs_10csc_cython_9converter_roundup((__pyx_v_dst_width / 2), 2);

  /* "xpra/codecs/csc_cython/converter.pyx":1178
 *         #we process 4 pixels at a time:
 *         cdef unsigned int workw = roundup(dst_width//2, 2)
 *         cdef unsigned int workh = roundup(dst_height//2, 2)             # <<<<<<<<<<<<<<
 *         #from now on, we can release the gil:
 *         with nogil:
*/
  __pyx_v_workh = __pyx_f_4xpra_6codecs_10csc_cython_9converter_roundup((__pyx_v_dst_height / 2), 2);

  /* "xpra/codecs/csc_cython/converter.pyx":1180
 *         cdef unsigned int workh = roundup(dst_height//2, 2)
 *         #from now on, we can release the gil:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             for y in range(workh):
 *                 for x in range(workw):
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "xpra/codecs/csc_cython/converter.pyx":1181
 *         #from now on, we can release the gil:
 *         with nogil:
 *             for y in range(workh):             # <<<<<<<<<<<<<<
 *                 for x in range(workw):
 *                     #assert x*2<=src_width and y*2<=src_height
*/
        __pyx_t_11 = __pyx_v_workh;
        __pyx_t_16 = __pyx_t_11;
        for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
          __pyx_v_y = __pyx_t_17;

          /* "xpra/codecs/csc_cython/converter.pyx":1182
 *         with nogil:
 *             for y in range(workh):
 *                 for x in range(workw):             # <<<<<<<<<<<<<<
 *                     #assert x*2<=src_width and y*2<=src_height
 *                     #read U and V for the next 4 pixels:
*/
          __pyx_t_18 = __pyx_v_workw;
          __pyx_t_19 = __pyx_t_18;
          for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
            __pyx_v_x = __pyx_t_20;

            /* "xpra/codecs/csc_cython/converter.pyx":1185
 *                     #assert x*2<=src_width and y*2<=src_height
 *                     #read U and V for the next 4 pixels:
 *                     sx = x*src_width//dst_width             # <<<<<<<<<<<<<<
 *                     sy = y*src_height//dst_height
 *                     U = Ubuf[sy*Ustride + sx] - uc
*/
            __pyx_v_sx = ((__pyx_v_x * __pyx_v_src_width) / __pyx_v_dst_width);

            /* "xpra/codecs/csc_cython/converter.pyx":1186
 *                     #read U and V for the next 4 pixels:
 *                     sx = x*src_width//dst_width
 *                     sy = y*src_height//dst_height             # <<<<<<<<<<<<<<
 *                     U = Ubuf[sy*Ustride + sx] - uc
 *                     V = Vbuf[sy*Vstride + sx] - vc
*/
            __pyx_v_sy = ((__pyx_v_y * __pyx_v_src_height) / __pyx_v_dst_height);

            /* "xpra/codecs/csc_cython/converter.pyx":1187
 *                     sx = x*src_width//dst_width
 *                     sy = y*src_height//dst_height
 *                     U = Ubuf[sy*Ustride + sx] - uc             # <<<<<<<<<<<<<<
 *                     V = Vbuf[sy*Vstride + sx] - vc
 *                     #now read up to 4 Y values and write an RGBX pixel for each:
*/
            __pyx_v_U = ((__pyx_v_Ubuf[((__pyx_v_sy * __pyx_v_Ustride) + __pyx_v_sx)]) - __pyx_v_uc);

            /* "xpra/codecs/csc_cython/converter.pyx":1188
 *                     sy = y*src_height//dst_height
 *                     U = Ubuf[sy*Ustride + sx] - uc
 *                     V = Vbuf[sy*Vstride + sx] - vc             # <<<<<<<<<<<<<<
 *                     #now read up to 4 Y values and write an RGBX pixel for each:
 *                     for dy in range(2):
*/
            __pyx_v_V = ((__pyx_v_Vbuf[((__pyx_v_sy * __pyx_v_Vstride) + __pyx_v_sx)]) - __pyx_v_vc);

            /* "xpra/codecs/csc_cython/converter.pyx":1190
 *                     V = Vbuf[sy*Vstride + sx] - vc
 *                     #now read up to 4 Y values and write an RGBX pixel for each:
 *                     for dy in range(2):             # <<<<<<<<<<<<<<
 *                         oy = y*2 + dy
 *                         if oy>=dst_height:
*/
            for (__pyx_t_15 = 0; __pyx_t_15 < 2; __pyx_t_15+=1) {
              __pyx_v_dy = __pyx_t_15;

              /* "xpra/codecs/csc_cython/converter.pyx":1191
 *                     #now read up to 4 Y values and write an RGBX pixel for each:
 *                     for dy in range(2):
 *                         oy = y*2 + dy             # <<<<<<<<<<<<<<
 *                         if oy>=dst_height:
 *                             break
*/
              __pyx_v_oy = ((__pyx_v_y * 2) + __pyx_v_dy);

              /* "xpra/codecs/csc_cython/converter.pyx":1192
 *                     for dy in range(2):
 *                         oy = y*2 + dy
 *                         if oy>=dst_height:             # <<<<<<<<<<<<<<
 *                             break
 *                         sy = oy*src_height//dst_height
*/
              __pyx_t_13 = (__pyx_v_oy >= __pyx_v_dst_height);
              if (__pyx_t_13) {

                /* "xpra/codecs/csc_cython/converter.pyx":1193
 *                         oy = y*2 + dy
 *                         if oy>=dst_height:
 *                             break             # <<<<<<<<<<<<<<
 *                         sy = oy*src_height//dst_height
 *                         for dx in range(2):
*/
                goto __pyx_L15_break;

                /* "xpra/codecs/csc_cython/converter.pyx":1192
 *                     for dy in range(2):
 *                         oy = y*2 + dy
 *                         if oy>=dst_height:             # <<<<<<<<<<<<<<
 *                             break
 *                         sy = oy*src_height//dst_height
*/
              }

              /* "xpra/codecs/csc_cython/converter.pyx":1194
 *                         if oy>=dst_height:
 *                             break
 *                         sy = oy*src_height//dst_height             # <<<<<<<<<<<<<<
 *                         for dx in range(2):
 *                             ox = x*2 + dx
*/
              __pyx_v_sy = ((__pyx_v_oy * __pyx_v_src_height) / __pyx_v_dst_height);

              /* "xpra/codecs/csc_cython/converter.pyx":1195
 *                             break
 *                         sy = oy*src_height//dst_height
 *                         for dx in range(2):             # <<<<<<<<<<<<<<
 *                             ox = x*2 + dx
 *                             if ox>=dst_width:
*/
              for (__pyx_t_21 = 0; __pyx_t_21 < 2; __pyx_t_21+=1) {
                __pyx_v_dx = __pyx_t_21;

                /* "xpra/codecs/csc_cython/converter.pyx":1196
 *                         sy = oy*src_height//dst_height
 *                         for dx in range(2):
 *                             ox = x*2 + dx             # <<<<<<<<<<<<<<
 *                             if ox>=dst_width:
 *                                 break
*/
                __pyx_v_ox = ((__pyx_v_x * 2) + __pyx_v_dx);

                /* "xpra/codecs/csc_cython/converter.pyx":1197
 *                         for dx in range(2):
 *                             ox = x*2 + dx
 *                             if ox>=dst_width:             # <<<<<<<<<<<<<<
 *                                 break
 *                             sx = ox*src_width//dst_width
*/
                __pyx_t_13 = (__pyx_v_ox >= __pyx_v_dst_width);
                if (__pyx_t_13) {

                  /* "xpra/codecs/csc_cython/converter.pyx":1198
 *                             ox = x*2 + dx
 *                             if ox>=dst_width:
 *                                 break             # <<<<<<<<<<<<<<
 *                             sx = ox*src_width//dst_width
 *                             Y = Ybuf[sy*Ystride + sx] - yc
*/
                  goto __pyx_L18_break;

                  /* "xpra/codecs/csc_cython/converter.pyx":1197
 *                         for dx in range(2):
 *                             ox = x*2 + dx
 *                             if ox>=dst_width:             # <<<<<<<<<<<<<<
 *                                 break
 *                             sx = ox*src_width//dst_width
*/
                }

                /* "xpra/codecs/csc_cython/converter.pyx":1199
 *                             if ox>=dst_width:
 *                                 break
 *                             sx = ox*src_width//dst_width             # <<<<<<<<<<<<<<
 *                             Y = Ybuf[sy*Ystride + sx] - yc
 *                             o = oy*stride + ox * Bpp
*/
                __pyx_v_sx = ((__pyx_v_ox * __pyx_v_src_width) / __pyx_v_dst_width);

                /* "xpra/codecs/csc_cython/converter.pyx":1200
 *                                 break
 *                             sx = ox*src_width//dst_width
 *                             Y = Ybuf[sy*Ystride + sx] - yc             # <<<<<<<<<<<<<<
 *                             o = oy*stride + ox * Bpp
 *                             output_image[o + Rindex] = clamp(ry * Y + ru * U + rv * V)
*/
                __pyx_v_Y = ((__pyx_v_Ybuf[((__pyx_v_sy * __pyx_v_Ystride) + __pyx_v_sx)]) - __pyx_v_yc);

                /* "xpra/codecs/csc_cython/converter.pyx":1201
 *                             sx = ox*src_width//dst_width
 *                             Y = Ybuf[sy*Ystride + sx] - yc
 *                             o = oy*stride + ox * Bpp             # <<<<<<<<<<<<<<
 *                             output_image[o + Rindex] = clamp(ry * Y + ru * U + rv * V)
 *                             output_image[o + Gindex] = clamp(gy * Y + gu * U + gv * V)
*/
                __pyx_v_o = ((__pyx_v_oy * __pyx_v_stride) + (__pyx_v_ox * __pyx_v_Bpp));

                /* "xpra/codecs/csc_cython/converter.pyx":1202
 *                             Y = Ybuf[sy*Ystride + sx] - yc
 *                             o = oy*stride + ox * Bpp
 *                             output_image[o + Rindex] = clamp(ry * Y + ru * U + rv * V)             # <<<<<<<<<<<<<<
 *                             output_image[o + Gindex] = clamp(gy * Y + gu * U + gv * V)
 *                             output_image[o + Bindex] = clamp(by * Y + bu * U + bv * V)
*/
                (__pyx_v_output_image[(__pyx_v_o + __pyx_v_Rindex)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((__pyx_v_ry * __pyx_v_Y) + (__pyx_v_ru * __pyx_v_U)) + (__pyx_v_rv * __pyx_v_V)));

                /* "xpra/codecs/csc_cython/converter.pyx":1203
 *                             o = oy*stride + ox * Bpp
 *                             output_image[o + Rindex] = clamp(ry * Y + ru * U + rv * V)
 *                             output_image[o + Gindex] = clamp(gy * Y + gu * U + gv * V)             # <<<<<<<<<<<<<<
 *                             output_image[o + Bindex] = clamp(by * Y + bu * U + bv * V)
 *                             if Bpp==4:
*/
                (__pyx_v_output_image[(__pyx_v_o + __pyx_v_Gindex)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((__pyx_v_gy * __pyx_v_Y) + (__pyx_v_gu * __pyx_v_U)) + (__pyx_v_gv * __pyx_v_V)));

                /* "xpra/codecs/csc_cython/converter.pyx":1204
 *                             output_image[o + Rindex] = clamp(ry * Y + ru * U + rv * V)
 *                             output_image[o + Gindex] = clamp(gy * Y + gu * U + gv * V)
 *                             output_image[o + Bindex] = clamp(by * Y + bu * U + bv * V)             # <<<<<<<<<<<<<<
 *                             if Bpp==4:
 *                                 output_image[o + Xindex] = 255
*/
                (__pyx_v_output_image[(__pyx_v_o + __pyx_v_Bindex)]) = __pyx_f_4xpra_6codecs_10csc_cython_9converter_clamp((((__pyx_v_by * __pyx_v_Y) + (__pyx_v_bu * __pyx_v_U)) + (__pyx_v_bv * __pyx_v_V)));

                /* "xpra/codecs/csc_cython/converter.pyx":1205
 *                             output_image[o + Gindex] = clamp(gy * Y + gu * U + gv * V)
 *                             output_image[o + Bindex] = clamp(by * Y + bu * U + bv * V)
 *                             if Bpp==4:             # <<<<<<<<<<<<<<
 *                                 output_image[o + Xindex] = 255
 *         for i in range(3):
*/
                __pyx_t_13 = (__pyx_v_Bpp == 4);
                if (__pyx_t_13) {

                  /* "xpra/codecs/csc_cython/converter.pyx":1206
 *                             output_image[o + Bindex] = clamp(by * Y + bu * U + bv * V)
 *                             if Bpp==4:
 *                                 output_image[o + Xindex] = 255             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])
*/
                  (__pyx_v_output_image[(__pyx_v_o + __pyx_v_Xindex)]) = 0xFF;

                  /* "xpra/codecs/csc_cython/converter.pyx":1205
 *                             output_image[o + Gindex] = clamp(gy * Y + gu * U + gv * V)
 *                             output_image[o + Bindex] = clamp(by * Y + bu * U + bv * V)
 *                             if Bpp==4:             # <<<<<<<<<<<<<<
 *                                 output_image[o + Xindex] = 255
 *         for i in range(3):
*/
                }
              }
              __pyx_L18_break:;
            }
            __pyx_L15_break:;
          }
        }
      }

      /* "xpra/codecs/csc_cython/converter.pyx":1180
 *         cdef unsigned int workh = roundup(dst_height//2, 2)
 *         #from now on, we can release the gil:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             for y in range(workh):
 *                 for x in range(workw):
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1207
 *                             if Bpp==4:
 *                                 output_image[o + Xindex] = 255
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&py_buf[i])
 *         return self.packed_image_wrapper(<char *> output_image, 24)
*/
  for (__pyx_t_12 = 0; __pyx_t_12 < 3; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "xpra/codecs/csc_cython/converter.pyx":1208
 *                                 output_image[o + Xindex] = 255
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])             # <<<<<<<<<<<<<<
 *         return self.packed_image_wrapper(<char *> output_image, 24)
 * 
*/
    PyBuffer_Release((&(__pyx_v_py_buf[__pyx_v_i])));
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1209
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])
 *         return self.packed_image_wrapper(<char *> output_image, 24)             # <<<<<<<<<<<<<<
 * 
 *     def GBRP_to_RGBX(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_22.__pyx_n = 1;
  __pyx_t_22.bpp = 24;
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->packed_image_wrapper(__pyx_v_self, ((char *)__pyx_v_output_image), &__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1115
 *         return self.do_YUV420P_to_RGB(image, 3, BGR_R, BGR_G, BGR_B, 0)
 * 
 *     cdef do_YUV420P_to_RGB(self, image: ImageWrapper,             # <<<<<<<<<<<<<<
 *                            const uint8_t Bpp,
 *                            const uint8_t Rindex,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __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_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.do_YUV420P_to_RGB", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_planes);
  __Pyx_XDECREF(__pyx_v_input_strides);
  __Pyx_XDECREF(__pyx_v_min_len);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1211
 *         return self.packed_image_wrapper(<char *> output_image, 24)
 * 
 *     def GBRP_to_RGBX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_R, RGBX_G, RGBX_B, RGBX_X)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_69GBRP_to_RGBX(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_69GBRP_to_RGBX = {"GBRP_to_RGBX", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_69GBRP_to_RGBX, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_69GBRP_to_RGBX(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GBRP_to_RGBX (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_68GBRP_to_RGBX(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_68GBRP_to_RGBX(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("GBRP_to_RGBX", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1212
 * 
 *     def GBRP_to_RGBX(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_R, RGBX_G, RGBX_B, RGBX_X)             # <<<<<<<<<<<<<<
 * 
 *     def GBRP_to_BGRX(self, image: ImageWrapper) -> CythonImageWrapper:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGBP_to_RGB(__pyx_v_self, __pyx_v_image, 2, 0, 1, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_R, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_B, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1211
 *         return self.packed_image_wrapper(<char *> output_image, 24)
 * 
 *     def GBRP_to_RGBX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_R, RGBX_G, RGBX_B, RGBX_X)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.GBRP_to_RGBX", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1214
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_R, RGBX_G, RGBX_B, RGBX_X)
 * 
 *     def GBRP_to_BGRX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_71GBRP_to_BGRX(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_71GBRP_to_BGRX = {"GBRP_to_BGRX", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_71GBRP_to_BGRX, METH_O, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_71GBRP_to_BGRX(PyObject *__pyx_v_self, PyObject *__pyx_v_image) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GBRP_to_BGRX (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_70GBRP_to_BGRX(((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self), ((PyObject *)__pyx_v_image));

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

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_9Converter_70GBRP_to_BGRX(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image) {
  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("GBRP_to_BGRX", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1215
 * 
 *     def GBRP_to_BGRX(self, image: ImageWrapper) -> CythonImageWrapper:
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_B, RGBX_G, RGBX_R, RGBX_X)             # <<<<<<<<<<<<<<
 * 
 *     cdef do_RGBP_to_RGB(self, image: ImageWrapper,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->do_RGBP_to_RGB(__pyx_v_self, __pyx_v_image, 2, 0, 1, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_B, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_G, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_R, __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1214
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_R, RGBX_G, RGBX_B, RGBX_X)
 * 
 *     def GBRP_to_BGRX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.GBRP_to_BGRX", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1217
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
 *     cdef do_RGBP_to_RGB(self, image: ImageWrapper,             # <<<<<<<<<<<<<<
 *                         const uint8_t Rsrc,
 *                         const uint8_t Gsrc,
*/

static PyObject *__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_RGBP_to_RGB(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *__pyx_v_self, PyObject *__pyx_v_image, uint8_t const __pyx_v_Rsrc, uint8_t const __pyx_v_Gsrc, uint8_t const __pyx_v_Bsrc, uint8_t const __pyx_v_Rdst, uint8_t const __pyx_v_Gdst, uint8_t const __pyx_v_Bdst, uint8_t const __pyx_v_Xdst) {
  unsigned int __pyx_v_x;
  unsigned int __pyx_v_y;
  unsigned int __pyx_v_o;
  unsigned int __pyx_v_sx;
  unsigned int __pyx_v_sy;
  unsigned char *__pyx_v_Gptr;
  unsigned char *__pyx_v_Bptr;
  unsigned char *__pyx_v_Rptr;
  PyObject *__pyx_v_planes = NULL;
  PyObject *__pyx_v_input_strides = NULL;
  unsigned char *__pyx_v_output_image;
  unsigned int __pyx_v_Rstride;
  unsigned int __pyx_v_Gstride;
  unsigned int __pyx_v_Bstride;
  unsigned int __pyx_v_stride;
  unsigned int __pyx_v_src_width;
  unsigned int __pyx_v_src_height;
  unsigned int __pyx_v_dst_width;
  unsigned int __pyx_v_dst_height;
  Py_buffer __pyx_v_py_buf[3];
  int __pyx_v_i;
  PyObject *__pyx_v_min_len = NULL;
  unsigned char *__pyx_v_Gbuf;
  unsigned char *__pyx_v_Bbuf;
  unsigned char *__pyx_v_Rbuf;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_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;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  unsigned int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  PyObject *__pyx_t_16[4];
  unsigned int __pyx_t_17;
  unsigned int __pyx_t_18;
  unsigned int __pyx_t_19;
  unsigned int __pyx_t_20;
  unsigned int __pyx_t_21;
  struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper __pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("do_RGBP_to_RGB", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1232
 *         cdef unsigned char *Rptr
 * 
 *         self.validate_planar3_image(image)             # <<<<<<<<<<<<<<
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_image};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate_planar3_image, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1233
 * 
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()             # <<<<<<<<<<<<<<
 *         input_strides = image.get_rowstride()
 *         log("do_RGBP_to_RGB(%s) strides=%s", (image, Rsrc, Gsrc, Bsrc, Rdst, Gdst, Bdst, Xdst), input_strides)
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_pixels, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_planes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1234
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()             # <<<<<<<<<<<<<<
 *         log("do_RGBP_to_RGB(%s) strides=%s", (image, Rsrc, Gsrc, Bsrc, Rdst, Gdst, Bdst, Xdst), input_strides)
 * 
*/
  __pyx_t_2 = __pyx_v_image;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_rowstride, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_input_strides = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1235
 *         planes = image.get_pixels()
 *         input_strides = image.get_rowstride()
 *         log("do_RGBP_to_RGB(%s) strides=%s", (image, Rsrc, Gsrc, Bsrc, Rdst, Gdst, Bdst, Xdst), input_strides)             # <<<<<<<<<<<<<<
 * 
 *         #allocate output buffer:
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_From_uint8_t(__pyx_v_Rsrc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyLong_From_uint8_t(__pyx_v_Gsrc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyLong_From_uint8_t(__pyx_v_Bsrc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyLong_From_uint8_t(__pyx_v_Rdst); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyLong_From_uint8_t(__pyx_v_Gdst); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyLong_From_uint8_t(__pyx_v_Bdst); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_PyLong_From_uint8_t(__pyx_v_Xdst); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyTuple_New(8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(__pyx_v_image);
  __Pyx_GIVEREF(__pyx_v_image);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_image) != (0)) __PYX_ERR(0, 1235, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 1235, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_6) != (0)) __PYX_ERR(0, 1235, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_7) != (0)) __PYX_ERR(0, 1235, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_8);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_8) != (0)) __PYX_ERR(0, 1235, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_9);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_t_9) != (0)) __PYX_ERR(0, 1235, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_10);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 6, __pyx_t_10) != (0)) __PYX_ERR(0, 1235, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_11);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 7, __pyx_t_11) != (0)) __PYX_ERR(0, 1235, __pyx_L1_error);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_11 = 0;
  __pyx_t_3 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_3 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_do_RGBP_to_RGB_s_strides_s, __pyx_t_12, __pyx_v_input_strides};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1238
 * 
 *         #allocate output buffer:
 *         cdef unsigned char *output_image = <unsigned char*> memalign(self.buffer_size)             # <<<<<<<<<<<<<<
 * 
 *         #copy to local variables:
*/
  __pyx_v_output_image = ((unsigned char *)__pyx_f_4xpra_7buffers_6membuf_memalign(__pyx_v_self->buffer_size));

  /* "xpra/codecs/csc_cython/converter.pyx":1241
 * 
 *         #copy to local variables:
 *         cdef unsigned int Rstride = input_strides[Rsrc]             # <<<<<<<<<<<<<<
 *         cdef unsigned int Gstride = input_strides[Gsrc]
 *         cdef unsigned int Bstride = input_strides[Bsrc]
*/
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, __pyx_v_Rsrc, uint8_t const , 0, __Pyx_PyLong_From_uint8_t, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_13 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_Rstride = __pyx_t_13;

  /* "xpra/codecs/csc_cython/converter.pyx":1242
 *         #copy to local variables:
 *         cdef unsigned int Rstride = input_strides[Rsrc]
 *         cdef unsigned int Gstride = input_strides[Gsrc]             # <<<<<<<<<<<<<<
 *         cdef unsigned int Bstride = input_strides[Bsrc]
 *         cdef unsigned int stride = self.dst_strides[0]
*/
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, __pyx_v_Gsrc, uint8_t const , 0, __Pyx_PyLong_From_uint8_t, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_13 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1242, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_Gstride = __pyx_t_13;

  /* "xpra/codecs/csc_cython/converter.pyx":1243
 *         cdef unsigned int Rstride = input_strides[Rsrc]
 *         cdef unsigned int Gstride = input_strides[Gsrc]
 *         cdef unsigned int Bstride = input_strides[Bsrc]             # <<<<<<<<<<<<<<
 *         cdef unsigned int stride = self.dst_strides[0]
 *         cdef unsigned int src_width = self.src_width
*/
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, __pyx_v_Bsrc, uint8_t const , 0, __Pyx_PyLong_From_uint8_t, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_PyLong_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_13 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_Bstride = __pyx_t_13;

  /* "xpra/codecs/csc_cython/converter.pyx":1244
 *         cdef unsigned int Gstride = input_strides[Gsrc]
 *         cdef unsigned int Bstride = input_strides[Bsrc]
 *         cdef unsigned int stride = self.dst_strides[0]             # <<<<<<<<<<<<<<
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height
*/
  __pyx_v_stride = (__pyx_v_self->dst_strides[0]);

  /* "xpra/codecs/csc_cython/converter.pyx":1245
 *         cdef unsigned int Bstride = input_strides[Bsrc]
 *         cdef unsigned int stride = self.dst_strides[0]
 *         cdef unsigned int src_width = self.src_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width
*/
  __pyx_t_13 = __pyx_v_self->src_width;
  __pyx_v_src_width = __pyx_t_13;

  /* "xpra/codecs/csc_cython/converter.pyx":1246
 *         cdef unsigned int stride = self.dst_strides[0]
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height             # <<<<<<<<<<<<<<
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height
*/
  __pyx_t_13 = __pyx_v_self->src_height;
  __pyx_v_src_height = __pyx_t_13;

  /* "xpra/codecs/csc_cython/converter.pyx":1247
 *         cdef unsigned int src_width = self.src_width
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width             # <<<<<<<<<<<<<<
 *         cdef unsigned int dst_height = self.dst_height
 *         cdef Py_buffer py_buf[3]
*/
  __pyx_t_13 = __pyx_v_self->dst_width;
  __pyx_v_dst_width = __pyx_t_13;

  /* "xpra/codecs/csc_cython/converter.pyx":1248
 *         cdef unsigned int src_height = self.src_height
 *         cdef unsigned int dst_width = self.dst_width
 *         cdef unsigned int dst_height = self.dst_height             # <<<<<<<<<<<<<<
 *         cdef Py_buffer py_buf[3]
 *         cdef int i
*/
  __pyx_t_13 = __pyx_v_self->dst_height;
  __pyx_v_dst_height = __pyx_t_13;

  /* "xpra/codecs/csc_cython/converter.pyx":1251
 *         cdef Py_buffer py_buf[3]
 *         cdef int i
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
*/
  for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "xpra/codecs/csc_cython/converter.pyx":1252
 *         cdef int i
 *         for i in range(3):
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             min_len = input_strides[i]*image.get_height()
*/
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_planes, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_15 = (PyObject_GetBuffer(__pyx_t_1, (&(__pyx_v_py_buf[__pyx_v_i])), PyBUF_ANY_CONTIGUOUS) != 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(__pyx_t_15)) {

      /* "xpra/codecs/csc_cython/converter.pyx":1253
 *         for i in range(3):
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))             # <<<<<<<<<<<<<<
 *             min_len = input_strides[i]*image.get_height()
 *             assert py_buf.len>=min_len, "buffer for G plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
*/
      __pyx_t_4 = NULL;
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_planes, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_failed_to_read_pixel_data_from_s, ((PyObject *)Py_TYPE(__pyx_t_12))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __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(0, 1253, __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(0, 1253, __pyx_L1_error)

      /* "xpra/codecs/csc_cython/converter.pyx":1252
 *         cdef int i
 *         for i in range(3):
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             min_len = input_strides[i]*image.get_height()
*/
    }

    /* "xpra/codecs/csc_cython/converter.pyx":1254
 *             if PyObject_GetBuffer(planes[i], &py_buf[i], PyBUF_ANY_CONTIGUOUS):
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             min_len = input_strides[i]*image.get_height()             # <<<<<<<<<<<<<<
 *             assert py_buf.len>=min_len, "buffer for G plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 *         cdef unsigned char *Gbuf = <unsigned char*> py_buf[Gsrc].buf
*/
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_input_strides, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_v_image;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_height, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_min_len, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "xpra/codecs/csc_cython/converter.pyx":1255
 *                 raise ValueError("failed to read pixel data from %s" % type(planes[i]))
 *             min_len = input_strides[i]*image.get_height()
 *             assert py_buf.len>=min_len, "buffer for G plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)             # <<<<<<<<<<<<<<
 *         cdef unsigned char *Gbuf = <unsigned char*> py_buf[Gsrc].buf
 *         cdef unsigned char *Bbuf = <unsigned char*> py_buf[Bsrc].buf
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_4 = PyLong_FromSsize_t(__pyx_v_py_buf->len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_v_min_len, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1255, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1255, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_15)) {
        __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_py_buf->len, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1255, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_min_len), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1255, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_16[0] = __pyx_mstate_global->__pyx_kp_u_buffer_for_G_plane_is_too_small;
        __pyx_t_16[1] = __pyx_t_2;
        __pyx_t_16[2] = __pyx_mstate_global->__pyx_kp_u_bytes_expected_at_least;
        __pyx_t_16[3] = __pyx_t_4;
        __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_16, 4, 33 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 26 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1255, __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_1, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 1255, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 1255, __pyx_L1_error)
    #endif
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1256
 *             min_len = input_strides[i]*image.get_height()
 *             assert py_buf.len>=min_len, "buffer for G plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 *         cdef unsigned char *Gbuf = <unsigned char*> py_buf[Gsrc].buf             # <<<<<<<<<<<<<<
 *         cdef unsigned char *Bbuf = <unsigned char*> py_buf[Bsrc].buf
 *         cdef unsigned char *Rbuf = <unsigned char*> py_buf[Rsrc].buf
*/
  __pyx_v_Gbuf = ((unsigned char *)(__pyx_v_py_buf[__pyx_v_Gsrc]).buf);

  /* "xpra/codecs/csc_cython/converter.pyx":1257
 *             assert py_buf.len>=min_len, "buffer for G plane is too small: %s bytes, expected at least %s" % (py_buf.len, min_len)
 *         cdef unsigned char *Gbuf = <unsigned char*> py_buf[Gsrc].buf
 *         cdef unsigned char *Bbuf = <unsigned char*> py_buf[Bsrc].buf             # <<<<<<<<<<<<<<
 *         cdef unsigned char *Rbuf = <unsigned char*> py_buf[Rsrc].buf
 * 
*/
  __pyx_v_Bbuf = ((unsigned char *)(__pyx_v_py_buf[__pyx_v_Bsrc]).buf);

  /* "xpra/codecs/csc_cython/converter.pyx":1258
 *         cdef unsigned char *Gbuf = <unsigned char*> py_buf[Gsrc].buf
 *         cdef unsigned char *Bbuf = <unsigned char*> py_buf[Bsrc].buf
 *         cdef unsigned char *Rbuf = <unsigned char*> py_buf[Rsrc].buf             # <<<<<<<<<<<<<<
 * 
 *         #from now on, we can release the gil:
*/
  __pyx_v_Rbuf = ((unsigned char *)(__pyx_v_py_buf[__pyx_v_Rsrc]).buf);

  /* "xpra/codecs/csc_cython/converter.pyx":1261
 * 
 *         #from now on, we can release the gil:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             for y in range(dst_height):
 *                 o = stride*y
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "xpra/codecs/csc_cython/converter.pyx":1262
 *         #from now on, we can release the gil:
 *         with nogil:
 *             for y in range(dst_height):             # <<<<<<<<<<<<<<
 *                 o = stride*y
 *                 sy = y*src_height/dst_height
*/
        __pyx_t_13 = __pyx_v_dst_height;
        __pyx_t_17 = __pyx_t_13;
        for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
          __pyx_v_y = __pyx_t_18;

          /* "xpra/codecs/csc_cython/converter.pyx":1263
 *         with nogil:
 *             for y in range(dst_height):
 *                 o = stride*y             # <<<<<<<<<<<<<<
 *                 sy = y*src_height/dst_height
 *                 Rptr  = Rbuf + (sy * Rstride)
*/
          __pyx_v_o = (__pyx_v_stride * __pyx_v_y);

          /* "xpra/codecs/csc_cython/converter.pyx":1264
 *             for y in range(dst_height):
 *                 o = stride*y
 *                 sy = y*src_height/dst_height             # <<<<<<<<<<<<<<
 *                 Rptr  = Rbuf + (sy * Rstride)
 *                 Gptr  = Gbuf + (sy * Gstride)
*/
          __pyx_v_sy = ((__pyx_v_y * __pyx_v_src_height) / __pyx_v_dst_height);

          /* "xpra/codecs/csc_cython/converter.pyx":1265
 *                 o = stride*y
 *                 sy = y*src_height/dst_height
 *                 Rptr  = Rbuf + (sy * Rstride)             # <<<<<<<<<<<<<<
 *                 Gptr  = Gbuf + (sy * Gstride)
 *                 Bptr  = Bbuf + (sy * Bstride)
*/
          __pyx_v_Rptr = (__pyx_v_Rbuf + (__pyx_v_sy * __pyx_v_Rstride));

          /* "xpra/codecs/csc_cython/converter.pyx":1266
 *                 sy = y*src_height/dst_height
 *                 Rptr  = Rbuf + (sy * Rstride)
 *                 Gptr  = Gbuf + (sy * Gstride)             # <<<<<<<<<<<<<<
 *                 Bptr  = Bbuf + (sy * Bstride)
 *                 for x in range(dst_width):
*/
          __pyx_v_Gptr = (__pyx_v_Gbuf + (__pyx_v_sy * __pyx_v_Gstride));

          /* "xpra/codecs/csc_cython/converter.pyx":1267
 *                 Rptr  = Rbuf + (sy * Rstride)
 *                 Gptr  = Gbuf + (sy * Gstride)
 *                 Bptr  = Bbuf + (sy * Bstride)             # <<<<<<<<<<<<<<
 *                 for x in range(dst_width):
 *                     sx = x*src_width/dst_width
*/
          __pyx_v_Bptr = (__pyx_v_Bbuf + (__pyx_v_sy * __pyx_v_Bstride));

          /* "xpra/codecs/csc_cython/converter.pyx":1268
 *                 Gptr  = Gbuf + (sy * Gstride)
 *                 Bptr  = Bbuf + (sy * Bstride)
 *                 for x in range(dst_width):             # <<<<<<<<<<<<<<
 *                     sx = x*src_width/dst_width
 *                     output_image[o+Rdst] = Rptr[sx]
*/
          __pyx_t_19 = __pyx_v_dst_width;
          __pyx_t_20 = __pyx_t_19;
          for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
            __pyx_v_x = __pyx_t_21;

            /* "xpra/codecs/csc_cython/converter.pyx":1269
 *                 Bptr  = Bbuf + (sy * Bstride)
 *                 for x in range(dst_width):
 *                     sx = x*src_width/dst_width             # <<<<<<<<<<<<<<
 *                     output_image[o+Rdst] = Rptr[sx]
 *                     output_image[o+Gdst] = Gptr[sx]
*/
            __pyx_v_sx = ((__pyx_v_x * __pyx_v_src_width) / __pyx_v_dst_width);

            /* "xpra/codecs/csc_cython/converter.pyx":1270
 *                 for x in range(dst_width):
 *                     sx = x*src_width/dst_width
 *                     output_image[o+Rdst] = Rptr[sx]             # <<<<<<<<<<<<<<
 *                     output_image[o+Gdst] = Gptr[sx]
 *                     output_image[o+Bdst] = Bptr[sx]
*/
            (__pyx_v_output_image[(__pyx_v_o + __pyx_v_Rdst)]) = (__pyx_v_Rptr[__pyx_v_sx]);

            /* "xpra/codecs/csc_cython/converter.pyx":1271
 *                     sx = x*src_width/dst_width
 *                     output_image[o+Rdst] = Rptr[sx]
 *                     output_image[o+Gdst] = Gptr[sx]             # <<<<<<<<<<<<<<
 *                     output_image[o+Bdst] = Bptr[sx]
 *                     output_image[o+Xdst] = 255
*/
            (__pyx_v_output_image[(__pyx_v_o + __pyx_v_Gdst)]) = (__pyx_v_Gptr[__pyx_v_sx]);

            /* "xpra/codecs/csc_cython/converter.pyx":1272
 *                     output_image[o+Rdst] = Rptr[sx]
 *                     output_image[o+Gdst] = Gptr[sx]
 *                     output_image[o+Bdst] = Bptr[sx]             # <<<<<<<<<<<<<<
 *                     output_image[o+Xdst] = 255
 *                     o += 4
*/
            (__pyx_v_output_image[(__pyx_v_o + __pyx_v_Bdst)]) = (__pyx_v_Bptr[__pyx_v_sx]);

            /* "xpra/codecs/csc_cython/converter.pyx":1273
 *                     output_image[o+Gdst] = Gptr[sx]
 *                     output_image[o+Bdst] = Bptr[sx]
 *                     output_image[o+Xdst] = 255             # <<<<<<<<<<<<<<
 *                     o += 4
 *         for i in range(3):
*/
            (__pyx_v_output_image[(__pyx_v_o + __pyx_v_Xdst)]) = 0xFF;

            /* "xpra/codecs/csc_cython/converter.pyx":1274
 *                     output_image[o+Bdst] = Bptr[sx]
 *                     output_image[o+Xdst] = 255
 *                     o += 4             # <<<<<<<<<<<<<<
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])
*/
            __pyx_v_o = (__pyx_v_o + 4);
          }
        }
      }

      /* "xpra/codecs/csc_cython/converter.pyx":1261
 * 
 *         #from now on, we can release the gil:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             for y in range(dst_height):
 *                 o = stride*y
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L8;
        }
        __pyx_L8:;
      }
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1275
 *                     output_image[o+Xdst] = 255
 *                     o += 4
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&py_buf[i])
 *         return self.packed_image_wrapper(<char *> output_image, 24)
*/
  for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "xpra/codecs/csc_cython/converter.pyx":1276
 *                     o += 4
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])             # <<<<<<<<<<<<<<
 *         return self.packed_image_wrapper(<char *> output_image, 24)
 * 
*/
    PyBuffer_Release((&(__pyx_v_py_buf[__pyx_v_i])));
  }

  /* "xpra/codecs/csc_cython/converter.pyx":1277
 *         for i in range(3):
 *             PyBuffer_Release(&py_buf[i])
 *         return self.packed_image_wrapper(<char *> output_image, 24)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_22.__pyx_n = 1;
  __pyx_t_22.bpp = 24;
  __pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter *)__pyx_v_self->__pyx_vtab)->packed_image_wrapper(__pyx_v_self, ((char *)__pyx_v_output_image), &__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "xpra/codecs/csc_cython/converter.pyx":1217
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
 *     cdef do_RGBP_to_RGB(self, image: ImageWrapper,             # <<<<<<<<<<<<<<
 *                         const uint8_t Rsrc,
 *                         const uint8_t Gsrc,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __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_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.Converter.do_RGBP_to_RGB", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_planes);
  __Pyx_XDECREF(__pyx_v_input_strides);
  __Pyx_XDECREF(__pyx_v_min_len);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "xpra/codecs/csc_cython/converter.pyx":1280
 * 
 * 
 * def selftest(full=False):             # <<<<<<<<<<<<<<
 *     from xpra.codecs.checks import testcsc
 *     from xpra.codecs.csc_cython import converter
*/

/* Python wrapper */
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_11selftest(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_cython_9converter_11selftest = {"selftest", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_11selftest, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4xpra_6codecs_10csc_cython_9converter_11selftest(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_full = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("selftest (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_full,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1280, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "selftest", 0) < (0)) __PYX_ERR(0, 1280, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
    }
    __pyx_v_full = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("selftest", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1280, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("xpra.codecs.csc_cython.converter.selftest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4xpra_6codecs_10csc_cython_9converter_10selftest(__pyx_self, __pyx_v_full);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_6codecs_10csc_cython_9converter_10selftest(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_full) {
  PyObject *__pyx_v_testcsc = NULL;
  PyObject *__pyx_v_converter = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("selftest", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":1281
 * 
 * def selftest(full=False):
 *     from xpra.codecs.checks import testcsc             # <<<<<<<<<<<<<<
 *     from xpra.codecs.csc_cython import converter
 *     testcsc(converter, full)
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_testcsc};
    __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_codecs_checks, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1281, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_testcsc};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_1, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      switch (__pyx_t_3) {
        case 0:
        __Pyx_INCREF(__pyx_t_4);
        __pyx_v_testcsc = __pyx_t_4;
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1282
 * def selftest(full=False):
 *     from xpra.codecs.checks import testcsc
 *     from xpra.codecs.csc_cython import converter             # <<<<<<<<<<<<<<
 *     testcsc(converter, full)
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_converter};
    __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1282, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_converter};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_1, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      switch (__pyx_t_3) {
        case 0:
        __Pyx_INCREF(__pyx_t_4);
        __pyx_v_converter = __pyx_t_4;
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1283
 *     from xpra.codecs.checks import testcsc
 *     from xpra.codecs.csc_cython import converter
 *     testcsc(converter, full)             # <<<<<<<<<<<<<<
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF(__pyx_v_testcsc);
  __pyx_t_5 = __pyx_v_testcsc; 
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_converter, __pyx_v_full};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1280
 * 
 * 
 * def selftest(full=False):             # <<<<<<<<<<<<<<
 *     from xpra.codecs.checks import testcsc
 *     from xpra.codecs.csc_cython import converter
*/

  /* 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_AddTraceback("xpra.codecs.csc_cython.converter.selftest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_testcsc);
  __Pyx_XDECREF(__pyx_v_converter);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* #### Code section: module_exttypes ### */
static struct __pyx_vtabstruct_4xpra_6codecs_10csc_cython_9converter_Converter __pyx_vtable_4xpra_6codecs_10csc_cython_9converter_Converter;

static PyObject *__pyx_tp_new_4xpra_6codecs_10csc_cython_9converter_Converter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)o);
  p->__pyx_vtab = __pyx_vtabptr_4xpra_6codecs_10csc_cython_9converter_Converter;
  p->src_format = Py_None; Py_INCREF(Py_None);
  p->dst_format = Py_None; Py_INCREF(Py_None);
  p->convert_image_function = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4xpra_6codecs_10csc_cython_9converter_Converter(PyObject *o) {
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *p = (struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_6codecs_10csc_cython_9converter_Converter) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  if (p->__weakref__) PyObject_ClearWeakRefs(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_11__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->src_format);
  Py_CLEAR(p->dst_format);
  Py_CLEAR(p->convert_image_function);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4xpra_6codecs_10csc_cython_9converter_Converter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *p = (struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->src_format) {
    e = (*v)(p->src_format, a); if (e) return e;
  }
  if (p->dst_format) {
    e = (*v)(p->dst_format, a); if (e) return e;
  }
  if (p->convert_image_function) {
    e = (*v)(p->convert_image_function, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4xpra_6codecs_10csc_cython_9converter_Converter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *p = (struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)o;
  tmp = ((PyObject*)p->src_format);
  p->src_format = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->dst_format);
  p->dst_format = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->convert_image_function);
  p->convert_image_function = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4xpra_6codecs_10csc_cython_9converter_Converter[] = {
  {"init_context", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_1init_context, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"clean", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_3clean, METH_NOARGS, 0},
  {"is_closed", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_5is_closed, METH_NOARGS, 0},
  {"get_info", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_7get_info, METH_NOARGS, 0},
  {"get_src_width", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_13get_src_width, METH_NOARGS, 0},
  {"get_src_height", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_15get_src_height, METH_NOARGS, 0},
  {"get_src_format", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_17get_src_format, METH_NOARGS, 0},
  {"get_dst_width", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_19get_dst_width, METH_NOARGS, 0},
  {"get_dst_height", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_21get_dst_height, METH_NOARGS, 0},
  {"get_dst_format", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_23get_dst_format, METH_NOARGS, 0},
  {"get_type", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_25get_type, METH_NOARGS, 0},
  {"convert_image", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_27convert_image, METH_O, 0},
  {"r210_to_YUV420P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_29r210_to_YUV420P, METH_O, 0},
  {"BGR_to_YUV420P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_31BGR_to_YUV420P, METH_O, 0},
  {"RGB_to_YUV420P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_33RGB_to_YUV420P, METH_O, 0},
  {"BGRX_to_YUV420P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_35BGRX_to_YUV420P, METH_O, 0},
  {"RGBX_to_YUV420P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_37RGBX_to_YUV420P, METH_O, 0},
  {"BGR_to_YUV444P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_39BGR_to_YUV444P, METH_O, 0},
  {"RGB_to_YUV444P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_41RGB_to_YUV444P, METH_O, 0},
  {"BGRX_to_YUV444P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_43BGRX_to_YUV444P, METH_O, 0},
  {"RGBX_to_YUV444P", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_45RGBX_to_YUV444P, METH_O, 0},
  {"validate_rgb_image", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_47validate_rgb_image, METH_O, 0},
  {"r210_to_YUV444P10", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_49r210_to_YUV444P10, METH_O, 0},
  {"YUV444P10_to_r210", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_51YUV444P10_to_r210, METH_O, 0},
  {"YUV444P_to_RGB", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_53YUV444P_to_RGB, METH_O, 0},
  {"r210_to_BGR48", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_55r210_to_BGR48, METH_O, 0},
  {"validate_planar3_image", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_57validate_planar3_image, METH_O, 0},
  {"GBRP10_to_r210", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_59GBRP10_to_r210, METH_O, 0},
  {"YUV420P_to_RGBX", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_61YUV420P_to_RGBX, METH_O, 0},
  {"YUV420P_to_RGB", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_63YUV420P_to_RGB, METH_O, 0},
  {"YUV420P_to_BGRX", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_65YUV420P_to_BGRX, METH_O, 0},
  {"YUV420P_to_BGR", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_67YUV420P_to_BGR, METH_O, 0},
  {"GBRP_to_RGBX", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_69GBRP_to_RGBX, METH_O, 0},
  {"GBRP_to_BGRX", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_71GBRP_to_BGRX, METH_O, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyMemberDef __pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter_members[] = {
  #if !CYTHON_USE_TYPE_SLOTS
  {"__weaklistoffset__", T_PYSSIZET, offsetof(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter, __weakref__), READONLY, 0},
  #endif
  {0, 0, 0, 0, 0}
};
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
#if defined(__GNUC__) || defined(__clang__)
#warning "xpra/codecs/csc_cython/converter.pyx:462:16: : __weakref__ is unsupported in the Limited API when running on Python <3.9."
#elif defined(_MSC_VER)
#pragma message("xpra/codecs/csc_cython/converter.pyx:462:16: : __weakref__ is unsupported in the Limited API when running on Python <3.9.")
#endif
#endif
static PyType_Slot __pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_6codecs_10csc_cython_9converter_Converter},
  {Py_tp_repr, (void *)__pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_9__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_6codecs_10csc_cython_9converter_Converter},
  {Py_tp_clear, (void *)__pyx_tp_clear_4xpra_6codecs_10csc_cython_9converter_Converter},
  {Py_tp_methods, (void *)__pyx_methods_4xpra_6codecs_10csc_cython_9converter_Converter},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_6codecs_10csc_cython_9converter_Converter},
  {Py_tp_members, (void*)__pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter_members},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter_spec = {
  "xpra.codecs.csc_cython.converter.Converter",
  sizeof(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.codecs.csc_cython.converter.""Converter", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_6codecs_10csc_cython_9converter_Converter, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4xpra_6codecs_10csc_cython_9converter_9Converter_9__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_4xpra_6codecs_10csc_cython_9converter_Converter, /*tp_traverse*/
  __pyx_tp_clear_4xpra_6codecs_10csc_cython_9converter_Converter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4xpra_6codecs_10csc_cython_9converter_Converter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_6codecs_10csc_cython_9converter_Converter, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context, sizeof(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context[--__pyx_mstate_global->__pyx_freecount_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context(PyObject *o) {
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *p = (struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_dst_format);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_src_format);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context, sizeof(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context))))
  {
    __pyx_mstate_global->__pyx_freelist_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context[__pyx_mstate_global->__pyx_freecount_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context++] = ((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *p = (struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *p = (struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context},
  {Py_tp_clear, (void *)__pyx_tp_clear_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context},
  {Py_tp_new, (void *)__pyx_tp_new_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context},
  {0, 0},
};
static PyType_Spec __pyx_type_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context_spec = {
  "xpra.codecs.csc_cython.converter.__pyx_scope_struct__init_context",
  sizeof(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context_slots,
};
#else

static PyTypeObject __pyx_type_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context = {
  PyVarObject_HEAD_INIT(0, 0)
  "xpra.codecs.csc_cython.converter.""__pyx_scope_struct__init_context", /*tp_name*/
  sizeof(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*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_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context, /*tp_traverse*/
  __pyx_tp_clear_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};
/* #### Code section: initfunc_declarations ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_shared_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
/* #### Code section: init_module ### */

static int __Pyx_modinit_shared_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_shared_function_import_code", 0);
  /*--- Shared function import code ---*/
  {
    __pyx_t_1 = PyImport_ImportModule("xpra.cyshared"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_PyObject_name_PyObject);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 904;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__Pyx__Import, (void (**)(void))&__Pyx_PyUnicode_Join, (void (**)(void))&__Pyx_ParseKeywordsTuple, (void (**)(void))&__Pyx_ParseKeywordDictToDict, (void (**)(void))&__Pyx_ParseKeywordDict, (void (**)(void))&__Pyx__ArgTypeTest, (void (**)(void))&__Pyx_Raise, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_4(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __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_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  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_4xpra_6codecs_10csc_cython_9converter_Converter = &__pyx_vtable_4xpra_6codecs_10csc_cython_9converter_Converter;
  __pyx_vtable_4xpra_6codecs_10csc_cython_9converter_Converter.do_RGB_to_YUV420P = (PyObject *(*)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, PyObject *, uint8_t const , uint8_t const , uint8_t const , uint8_t const ))__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_RGB_to_YUV420P;
  __pyx_vtable_4xpra_6codecs_10csc_cython_9converter_Converter.do_RGB_to_YUV444P = (PyObject *(*)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, PyObject *, uint8_t const , uint8_t const , uint8_t const , uint8_t const ))__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_RGB_to_YUV444P;
  __pyx_vtable_4xpra_6codecs_10csc_cython_9converter_Converter.planar3_image_wrapper = (PyObject *(*)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, void *, struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_planar3_image_wrapper *__pyx_optional_args))__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_planar3_image_wrapper;
  __pyx_vtable_4xpra_6codecs_10csc_cython_9converter_Converter.packed_image_wrapper = (PyObject *(*)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, char *, struct __pyx_opt_args_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper *__pyx_optional_args))__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_packed_image_wrapper;
  __pyx_vtable_4xpra_6codecs_10csc_cython_9converter_Converter.do_YUV420P_to_RGB = (PyObject *(*)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, PyObject *, uint8_t const , uint8_t const , uint8_t const , uint8_t const , uint8_t const ))__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_YUV420P_to_RGB;
  __pyx_vtable_4xpra_6codecs_10csc_cython_9converter_Converter.do_RGBP_to_RGB = (PyObject *(*)(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter *, PyObject *, uint8_t const , uint8_t const , uint8_t const , uint8_t const , uint8_t const , uint8_t const , uint8_t const ))__pyx_f_4xpra_6codecs_10csc_cython_9converter_9Converter_do_RGBP_to_RGB;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter)) __PYX_ERR(0, 444, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter_spec, __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter) < (0)) __PYX_ERR(0, 444, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter = &__pyx_type_4xpra_6codecs_10csc_cython_9converter_Converter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter) < (0)) __PYX_ERR(0, 444, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_vtabptr_4xpra_6codecs_10csc_cython_9converter_Converter) < (0)) __PYX_ERR(0, 444, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter) < (0)) __PYX_ERR(0, 444, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Converter, (PyObject *) __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter) < (0)) __PYX_ERR(0, 444, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SLOTS
  if (__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter->tp_weaklistoffset == 0) __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter->tp_weaklistoffset = offsetof(struct __pyx_obj_4xpra_6codecs_10csc_cython_9converter_Converter, __weakref__);
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context)) __PYX_ERR(0, 464, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context_spec, __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context = &__pyx_type_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context->tp_dictoffset && __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter___pyx_scope_struct__init_context->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  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("xpra.buffers.membuf"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4xpra_7buffers_6membuf_MemBuf = __Pyx_ImportType_3_2_4(__pyx_t_1, "xpra.buffers.membuf", "MemBuf",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf),
  #else
  sizeof(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_4); if (!__pyx_mstate->__pyx_ptype_4xpra_7buffers_6membuf_MemBuf) __PYX_ERR(1, 22, __pyx_L1_error)
  __pyx_vtabptr_4xpra_7buffers_6membuf_MemBuf = (struct __pyx_vtabstruct_4xpra_7buffers_6membuf_MemBuf*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4xpra_7buffers_6membuf_MemBuf); if (unlikely(!__pyx_vtabptr_4xpra_7buffers_6membuf_MemBuf)) __PYX_ERR(1, 22, __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(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  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("xpra.buffers.membuf"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_PyObject_void_void_void);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 52;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4xpra_7buffers_6membuf_buffer_context, (void (**)(void))&__pyx_f_4xpra_7buffers_6membuf_memfree, (void (**)(void))&__pyx_f_4xpra_7buffers_6membuf_memalign, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_4(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __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;
}

#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_converter(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_converter},
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE},
  #endif
  #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  #endif
  {0, NULL}
};
#endif

#ifdef __cplusplus
namespace {
  struct PyModuleDef __pyx_moduledef =
  #else
  static struct PyModuleDef __pyx_moduledef =
  #endif
  {
      PyModuleDef_HEAD_INIT,
      "converter",
      0, /* m_doc */
    #if CYTHON_USE_MODULE_STATE
      sizeof(__pyx_mstatetype), /* m_size */
    #else
      (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
    #endif
      __pyx_methods /* m_methods */,
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      __pyx_moduledef_slots, /* m_slots */
    #else
      NULL, /* m_reload */
    #endif
    #if CYTHON_USE_MODULE_STATE
      __pyx_m_traverse, /* m_traverse */
      __pyx_m_clear, /* m_clear */
      NULL /* m_free */
    #else
      NULL, /* m_traverse */
      NULL, /* m_clear */
      NULL /* m_free */
    #endif
  };
  #ifdef __cplusplus
} /* anonymous namespace */
#endif

/* PyModInitFuncType */
#ifndef CYTHON_NO_PYINIT_EXPORT
  #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#else
  #ifdef __cplusplus
  #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  #else
  #define __Pyx_PyMODINIT_FUNC PyObject *
  #endif
#endif

__Pyx_PyMODINIT_FUNC PyInit_converter(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_converter(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
/* ModuleCreationPEP489 */
#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
    {
        PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
        if (!module) {
            PyErr_Clear(); // just try the 3.8-3.12 version
            module = PyImport_ImportModule("_xxsubinterpreters");
            if (!module) goto bad;
        }
        PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
        Py_DECREF(module);
        if (!current) goto bad;
        if (PyTuple_Check(current)) {
            PyObject *new_current = PySequence_GetItem(current, 0);
            Py_DECREF(current);
            current = new_current;
            if (!new_current) goto bad;
        }
        long long as_c_int = PyLong_AsLongLong(current);
        Py_DECREF(current);
        return as_c_int;
    }
  bad:
    PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
    return -1;
}
#endif
#if !CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    static PY_INT64_T main_interpreter_id = -1;
#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
    PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_GRAAL
    PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
    PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
#elif CYTHON_COMPILING_IN_LIMITED_API
    PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
#else
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
#endif
    if (unlikely(current_id == -1)) {
        return -1;
    }
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return 0;
    } else if (unlikely(main_interpreter_id != current_id)) {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
#endif
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, PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    CYTHON_UNUSED_VAR(def);
    #if !CYTHON_USE_MODULE_STATE
    if (__Pyx_check_single_interpreter())
        return NULL;
    #endif
    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_converter(PyObject *__pyx_pyinit_module)
#endif
{
  int stringtab_initialized = 0;
  #if CYTHON_USE_MODULE_STATE
  int pystate_addmodule_run = 0;
  #endif
  __pyx_mstatetype *__pyx_mstate = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  uint8_t __pyx_t_6;
  uint8_t __pyx_t_7;
  uint8_t __pyx_t_8;
  uint8_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  size_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_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'converter' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #else
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_t_1 = __pyx_pyinit_module;
  Py_INCREF(__pyx_t_1);
  #else
  __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #if CYTHON_USE_MODULE_STATE
  {
    int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
    __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "converter" pseudovariable */
    if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    pystate_addmodule_run = 1;
  }
  #else
  __pyx_m = __pyx_t_1;
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
  #endif
  __pyx_mstate = __pyx_mstate_global;
  CYTHON_UNUSED_VAR(__pyx_t_1);
  __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_mstate->__pyx_d);
  __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /* ImportRefnannyAPI */
  #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("PyInit_converter", 0);
  __Pyx_init_runtime_version();
  if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Library function declarations ---*/
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  stringtab_initialized = 1;
  if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__pyx_module_is_main_xpra__codecs__csc_cython__converter) {
    if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "xpra.codecs.csc_cython.converter")) {
      if (unlikely((PyDict_SetItemString(modules, "xpra.codecs.csc_cython.converter", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  (void)__Pyx_modinit_function_export_code(__pyx_mstate);
  if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_shared_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Execution code ---*/

  /* "xpra/codecs/csc_cython/converter.pyx":9
 * #cython: boundscheck=False, wraparound=False, initializedcheck=False, cdivision=True, always_allow_keywords=False
 * 
 * import os             # <<<<<<<<<<<<<<
 * import sys
 * import time
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_os, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_os, __pyx_t_2) < (0)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":10
 * 
 * import os
 * import sys             # <<<<<<<<<<<<<<
 * import time
 * from typing import Any, Tuple, List, Dict
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_sys, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sys, __pyx_t_2) < (0)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":11
 * import os
 * import sys
 * import time             # <<<<<<<<<<<<<<
 * from typing import Any, Tuple, List, Dict
 * from collections.abc import Sequence
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_time, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_time, __pyx_t_2) < (0)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":12
 * import sys
 * import time
 * from typing import Any, Tuple, List, Dict             # <<<<<<<<<<<<<<
 * from collections.abc import Sequence
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Any,__pyx_mstate_global->__pyx_n_u_Tuple,__pyx_mstate_global->__pyx_n_u_List,__pyx_mstate_global->__pyx_n_u_Dict};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_imported_names, 4, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Any,__pyx_mstate_global->__pyx_n_u_Tuple,__pyx_mstate_global->__pyx_n_u_List,__pyx_mstate_global->__pyx_n_u_Dict};
    for (__pyx_t_3=0; __pyx_t_3 < 4; __pyx_t_3++) {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 12, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 12, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":13
 * import time
 * from typing import Any, Tuple, List, Dict
 * from collections.abc import Sequence             # <<<<<<<<<<<<<<
 * 
 * from xpra.util.objects import typedict
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Sequence};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections_abc, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Sequence};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":15
 * from collections.abc import Sequence
 * 
 * from xpra.util.objects import typedict             # <<<<<<<<<<<<<<
 * from xpra.codecs.constants import CSCSpec, get_subsampling_divs
 * from xpra.codecs.image import ImageWrapper
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_typedict};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_util_objects, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_typedict};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":16
 * 
 * from xpra.util.objects import typedict
 * from xpra.codecs.constants import CSCSpec, get_subsampling_divs             # <<<<<<<<<<<<<<
 * from xpra.codecs.image import ImageWrapper
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_CSCSpec,__pyx_mstate_global->__pyx_n_u_get_subsampling_divs};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_codecs_constants, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_CSCSpec,__pyx_mstate_global->__pyx_n_u_get_subsampling_divs};
    for (__pyx_t_3=0; __pyx_t_3 < 2; __pyx_t_3++) {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":17
 * from xpra.util.objects import typedict
 * from xpra.codecs.constants import CSCSpec, get_subsampling_divs
 * from xpra.codecs.image import ImageWrapper             # <<<<<<<<<<<<<<
 * 
 * from xpra.log import Logger
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_ImageWrapper};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_codecs_image, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_ImageWrapper};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":19
 * from xpra.codecs.image import ImageWrapper
 * 
 * from xpra.log import Logger             # <<<<<<<<<<<<<<
 * log = Logger("csc", "cython")
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Logger};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_xpra_log, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Logger};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":20
 * 
 * from xpra.log import Logger
 * log = Logger("csc", "cython")             # <<<<<<<<<<<<<<
 * 
 * from libc.stdint cimport uint8_t, uintptr_t # pylint: disable=syntax-error
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[5], NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_log, __pyx_t_4) < (0)) __PYX_ERR(0, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":44
 * cdef uint8_t BGR_R, BGR_G, BGR_B
 * 
 * if sys.byteorder=="little":             # <<<<<<<<<<<<<<
 *     BGRX_B, BGRX_G, BGRX_R, BGRX_X = (0, 1, 2, 3)
 *     RGBX_R, RGBX_G, RGBX_B, RGBX_X = (0, 1, 2, 3)
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_byteorder); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {

    /* "xpra/codecs/csc_cython/converter.pyx":45
 * 
 * if sys.byteorder=="little":
 *     BGRX_B, BGRX_G, BGRX_R, BGRX_X = (0, 1, 2, 3)             # <<<<<<<<<<<<<<
 *     RGBX_R, RGBX_G, RGBX_B, RGBX_X = (0, 1, 2, 3)
 *     BGR_R, BGR_G, BGR_B = (2, 1, 0)
*/
    __pyx_t_6 = 0;
    __pyx_t_7 = 1;
    __pyx_t_8 = 2;
    __pyx_t_9 = 3;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_B = __pyx_t_6;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_G = __pyx_t_7;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_R = __pyx_t_8;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_X = __pyx_t_9;

    /* "xpra/codecs/csc_cython/converter.pyx":46
 * if sys.byteorder=="little":
 *     BGRX_B, BGRX_G, BGRX_R, BGRX_X = (0, 1, 2, 3)
 *     RGBX_R, RGBX_G, RGBX_B, RGBX_X = (0, 1, 2, 3)             # <<<<<<<<<<<<<<
 *     BGR_R, BGR_G, BGR_B = (2, 1, 0)
 *     RGB_R, RGB_G, RGB_B = (0, 1, 2)
*/
    __pyx_t_9 = 0;
    __pyx_t_8 = 1;
    __pyx_t_7 = 2;
    __pyx_t_6 = 3;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_R = __pyx_t_9;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_G = __pyx_t_8;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_B = __pyx_t_7;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_X = __pyx_t_6;

    /* "xpra/codecs/csc_cython/converter.pyx":47
 *     BGRX_B, BGRX_G, BGRX_R, BGRX_X = (0, 1, 2, 3)
 *     RGBX_R, RGBX_G, RGBX_B, RGBX_X = (0, 1, 2, 3)
 *     BGR_R, BGR_G, BGR_B = (2, 1, 0)             # <<<<<<<<<<<<<<
 *     RGB_R, RGB_G, RGB_B = (0, 1, 2)
 * else:
*/
    __pyx_t_6 = 2;
    __pyx_t_7 = 1;
    __pyx_t_8 = 0;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_R = __pyx_t_6;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_G = __pyx_t_7;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_B = __pyx_t_8;

    /* "xpra/codecs/csc_cython/converter.pyx":48
 *     RGBX_R, RGBX_G, RGBX_B, RGBX_X = (0, 1, 2, 3)
 *     BGR_R, BGR_G, BGR_B = (2, 1, 0)
 *     RGB_R, RGB_G, RGB_B = (0, 1, 2)             # <<<<<<<<<<<<<<
 * else:
 *     BGRX_B, BGRX_G, BGRX_R, BGRX_X = (0, 1, 2, 3)
*/
    __pyx_t_8 = 0;
    __pyx_t_7 = 1;
    __pyx_t_6 = 2;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_R = __pyx_t_8;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_G = __pyx_t_7;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_B = __pyx_t_6;

    /* "xpra/codecs/csc_cython/converter.pyx":44
 * cdef uint8_t BGR_R, BGR_G, BGR_B
 * 
 * if sys.byteorder=="little":             # <<<<<<<<<<<<<<
 *     BGRX_B, BGRX_G, BGRX_R, BGRX_X = (0, 1, 2, 3)
 *     RGBX_R, RGBX_G, RGBX_B, RGBX_X = (0, 1, 2, 3)
*/
    goto __pyx_L2;
  }

  /* "xpra/codecs/csc_cython/converter.pyx":50
 *     RGB_R, RGB_G, RGB_B = (0, 1, 2)
 * else:
 *     BGRX_B, BGRX_G, BGRX_R, BGRX_X = (0, 1, 2, 3)             # <<<<<<<<<<<<<<
 *     RGBX_R, RGBX_G, RGBX_B, RGBX_X = (0, 1, 2, 3)
 *     BGR_R, BGR_G, BGR_B = (0, 1, 2)
*/
  /*else*/ {
    __pyx_t_6 = 0;
    __pyx_t_7 = 1;
    __pyx_t_8 = 2;
    __pyx_t_9 = 3;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_B = __pyx_t_6;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_G = __pyx_t_7;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_R = __pyx_t_8;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_X = __pyx_t_9;

    /* "xpra/codecs/csc_cython/converter.pyx":51
 * else:
 *     BGRX_B, BGRX_G, BGRX_R, BGRX_X = (0, 1, 2, 3)
 *     RGBX_R, RGBX_G, RGBX_B, RGBX_X = (0, 1, 2, 3)             # <<<<<<<<<<<<<<
 *     BGR_R, BGR_G, BGR_B = (0, 1, 2)
 *     RGB_R, RGB_G, RGB_B = (2, 1, 0)
*/
    __pyx_t_9 = 0;
    __pyx_t_8 = 1;
    __pyx_t_7 = 2;
    __pyx_t_6 = 3;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_R = __pyx_t_9;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_G = __pyx_t_8;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_B = __pyx_t_7;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_X = __pyx_t_6;

    /* "xpra/codecs/csc_cython/converter.pyx":52
 *     BGRX_B, BGRX_G, BGRX_R, BGRX_X = (0, 1, 2, 3)
 *     RGBX_R, RGBX_G, RGBX_B, RGBX_X = (0, 1, 2, 3)
 *     BGR_R, BGR_G, BGR_B = (0, 1, 2)             # <<<<<<<<<<<<<<
 *     RGB_R, RGB_G, RGB_B = (2, 1, 0)
 * 
*/
    __pyx_t_6 = 0;
    __pyx_t_7 = 1;
    __pyx_t_8 = 2;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_R = __pyx_t_6;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_G = __pyx_t_7;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_B = __pyx_t_8;

    /* "xpra/codecs/csc_cython/converter.pyx":53
 *     RGBX_R, RGBX_G, RGBX_B, RGBX_X = (0, 1, 2, 3)
 *     BGR_R, BGR_G, BGR_B = (0, 1, 2)
 *     RGB_R, RGB_G, RGB_B = (2, 1, 0)             # <<<<<<<<<<<<<<
 * 
 * log("csc_cython: %s endian:", sys.byteorder)
*/
    __pyx_t_8 = 2;
    __pyx_t_7 = 1;
    __pyx_t_6 = 0;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_R = __pyx_t_8;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_G = __pyx_t_7;
    __pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_B = __pyx_t_6;
  }
  __pyx_L2:;

  /* "xpra/codecs/csc_cython/converter.pyx":55
 *     RGB_R, RGB_G, RGB_B = (2, 1, 0)
 * 
 * log("csc_cython: %s endian:", sys.byteorder)             # <<<<<<<<<<<<<<
 * log("csc_cython: byteorder(BGRX)=%s", (BGRX_B, BGRX_G, BGRX_R, BGRX_X))
 * log("csc_cython: byteorder(RGBX)=%s", (RGBX_R, RGBX_G, RGBX_B, RGBX_X))
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_byteorder); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_csc_cython_s_endian, __pyx_t_12};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":56
 * 
 * log("csc_cython: %s endian:", sys.byteorder)
 * log("csc_cython: byteorder(BGRX)=%s", (BGRX_B, BGRX_G, BGRX_R, BGRX_X))             # <<<<<<<<<<<<<<
 * log("csc_cython: byteorder(RGBX)=%s", (RGBX_R, RGBX_G, RGBX_B, RGBX_X))
 * log("csc_cython: byteorder(RGB)=%s", (RGB_R, RGB_G, RGB_B))
*/
  __pyx_t_10 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_4 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_B); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_G); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_14 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_R); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_BGRX_X); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_Pack(4, __pyx_t_4, __pyx_t_11, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_csc_cython_byteorder_BGRX_s, __pyx_t_16};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":57
 * log("csc_cython: %s endian:", sys.byteorder)
 * log("csc_cython: byteorder(BGRX)=%s", (BGRX_B, BGRX_G, BGRX_R, BGRX_X))
 * log("csc_cython: byteorder(RGBX)=%s", (RGBX_R, RGBX_G, RGBX_B, RGBX_X))             # <<<<<<<<<<<<<<
 * log("csc_cython: byteorder(RGB)=%s", (RGB_R, RGB_G, RGB_B))
 * log("csc_cython: byteorder(BGR)=%s", (BGR_R, BGR_G, BGR_B))
*/
  __pyx_t_12 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_10 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_R); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_15 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_G); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_14 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_B); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_11 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_RGBX_X); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_4 = PyTuple_Pack(4, __pyx_t_10, __pyx_t_15, __pyx_t_14, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_csc_cython_byteorder_RGBX_s, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_16, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":58
 * log("csc_cython: byteorder(BGRX)=%s", (BGRX_B, BGRX_G, BGRX_R, BGRX_X))
 * log("csc_cython: byteorder(RGBX)=%s", (RGBX_R, RGBX_G, RGBX_B, RGBX_X))
 * log("csc_cython: byteorder(RGB)=%s", (RGB_R, RGB_G, RGB_B))             # <<<<<<<<<<<<<<
 * log("csc_cython: byteorder(BGR)=%s", (BGR_R, BGR_G, BGR_B))
 * 
*/
  __pyx_t_16 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_R); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_G); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_14 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_RGB_B); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = PyTuple_Pack(3, __pyx_t_12, __pyx_t_11, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_16, __pyx_mstate_global->__pyx_kp_u_csc_cython_byteorder_RGB_s, __pyx_t_15};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":59
 * log("csc_cython: byteorder(RGBX)=%s", (RGBX_R, RGBX_G, RGBX_B, RGBX_X))
 * log("csc_cython: byteorder(RGB)=%s", (RGB_R, RGB_G, RGB_B))
 * log("csc_cython: byteorder(BGR)=%s", (BGR_R, BGR_G, BGR_B))             # <<<<<<<<<<<<<<
 * 
 * #COLORSPACES = {"BGRX" : ["YUV420P"], "YUV420P" : ["RGB", "BGR", "RGBX", "BGRX"], "GBRP" : ["RGBX", "BGRX"] }
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_R); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_14 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_G); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_11 = __Pyx_PyLong_From_uint8_t(__pyx_v_4xpra_6codecs_10csc_cython_9converter_BGR_B); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyTuple_Pack(3, __pyx_t_16, __pyx_t_14, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_csc_cython_byteorder_BGR_s, __pyx_t_12};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":64
 * 
 * 
 * def get_CS(in_cs, valid_options) -> Sequence[str]:             # <<<<<<<<<<<<<<
 *     v = os.environ.get("XPRA_CSC_CYTHON_%s_COLORSPACES" % in_cs)
 *     if v is None:
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Sequence_str) < (0)) __PYX_ERR(0, 64, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_1get_CS, 0, __pyx_mstate_global->__pyx_n_u_get_CS, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_CS, __pyx_t_15) < (0)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":81
 * 
 * COLORSPACES: Dict[str, Sequence[str]] = {
 *     "BGRX"       : get_CS("BGRX",    ["YUV420P", "YUV444P"]),             # <<<<<<<<<<<<<<
 *     "RGBX"       : get_CS("RGBX",    ["YUV420P", "YUV444P"]),
 *     "BGR"        : get_CS("BGR",     ["YUV420P", "YUV444P"]),
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(10); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_12 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_CS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_YUV420P, __pyx_mstate_global->__pyx_n_u_YUV444P); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_mstate_global->__pyx_n_u_BGRX, __pyx_t_11};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_BGRX, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":82
 * COLORSPACES: Dict[str, Sequence[str]] = {
 *     "BGRX"       : get_CS("BGRX",    ["YUV420P", "YUV444P"]),
 *     "RGBX"       : get_CS("RGBX",    ["YUV420P", "YUV444P"]),             # <<<<<<<<<<<<<<
 *     "BGR"        : get_CS("BGR",     ["YUV420P", "YUV444P"]),
 *     "RGB"        : get_CS("RGB",     ["YUV420P", "YUV444P"]),
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_get_CS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_YUV420P, __pyx_mstate_global->__pyx_n_u_YUV444P); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RGBX, __pyx_t_12};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_RGBX, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":83
 *     "BGRX"       : get_CS("BGRX",    ["YUV420P", "YUV444P"]),
 *     "RGBX"       : get_CS("RGBX",    ["YUV420P", "YUV444P"]),
 *     "BGR"        : get_CS("BGR",     ["YUV420P", "YUV444P"]),             # <<<<<<<<<<<<<<
 *     "RGB"        : get_CS("RGB",     ["YUV420P", "YUV444P"]),
 *     "YUV420P"    : get_CS("YUV420P", ["RGB", "BGR", "RGBX", "BGRX"]),
*/
  __pyx_t_11 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_get_CS); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_4 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_YUV420P, __pyx_mstate_global->__pyx_n_u_YUV444P); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_mstate_global->__pyx_n_u_BGR, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_BGR, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":84
 *     "RGBX"       : get_CS("RGBX",    ["YUV420P", "YUV444P"]),
 *     "BGR"        : get_CS("BGR",     ["YUV420P", "YUV444P"]),
 *     "RGB"        : get_CS("RGB",     ["YUV420P", "YUV444P"]),             # <<<<<<<<<<<<<<
 *     "YUV420P"    : get_CS("YUV420P", ["RGB", "BGR", "RGBX", "BGRX"]),
 *     "GBRP"       : get_CS("GBRP",    ["RGBX", "BGRX"]),
*/
  __pyx_t_12 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_CS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_YUV420P, __pyx_mstate_global->__pyx_n_u_YUV444P); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_mstate_global->__pyx_n_u_RGB, __pyx_t_11};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_RGB, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":85
 *     "BGR"        : get_CS("BGR",     ["YUV420P", "YUV444P"]),
 *     "RGB"        : get_CS("RGB",     ["YUV420P", "YUV444P"]),
 *     "YUV420P"    : get_CS("YUV420P", ["RGB", "BGR", "RGBX", "BGRX"]),             # <<<<<<<<<<<<<<
 *     "GBRP"       : get_CS("GBRP",    ["RGBX", "BGRX"]),
 *     "r210"       : get_CS("r210",    ["YUV420P", "BGR48", "YUV444P10"]),
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_get_CS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyList_Pack(4, __pyx_mstate_global->__pyx_n_u_RGB, __pyx_mstate_global->__pyx_n_u_BGR, __pyx_mstate_global->__pyx_n_u_RGBX, __pyx_mstate_global->__pyx_n_u_BGRX); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_YUV420P, __pyx_t_12};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_YUV420P, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":86
 *     "RGB"        : get_CS("RGB",     ["YUV420P", "YUV444P"]),
 *     "YUV420P"    : get_CS("YUV420P", ["RGB", "BGR", "RGBX", "BGRX"]),
 *     "GBRP"       : get_CS("GBRP",    ["RGBX", "BGRX"]),             # <<<<<<<<<<<<<<
 *     "r210"       : get_CS("r210",    ["YUV420P", "BGR48", "YUV444P10"]),
 *     "YUV444P10"  : get_CS("YUV444P10", ["r210"]),
*/
  __pyx_t_11 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_get_CS); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_4 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_RGBX, __pyx_mstate_global->__pyx_n_u_BGRX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_mstate_global->__pyx_n_u_GBRP, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_GBRP, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":87
 *     "YUV420P"    : get_CS("YUV420P", ["RGB", "BGR", "RGBX", "BGRX"]),
 *     "GBRP"       : get_CS("GBRP",    ["RGBX", "BGRX"]),
 *     "r210"       : get_CS("r210",    ["YUV420P", "BGR48", "YUV444P10"]),             # <<<<<<<<<<<<<<
 *     "YUV444P10"  : get_CS("YUV444P10", ["r210"]),
 *     "YUV444P"    : get_CS("YUV444P",  ["BGRX", "RGBX"]),
*/
  __pyx_t_12 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_CS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyList_Pack(3, __pyx_mstate_global->__pyx_n_u_YUV420P, __pyx_mstate_global->__pyx_n_u_BGR48, __pyx_mstate_global->__pyx_n_u_YUV444P10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_mstate_global->__pyx_n_u_r210, __pyx_t_11};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_r210, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":88
 *     "GBRP"       : get_CS("GBRP",    ["RGBX", "BGRX"]),
 *     "r210"       : get_CS("r210",    ["YUV420P", "BGR48", "YUV444P10"]),
 *     "YUV444P10"  : get_CS("YUV444P10", ["r210"]),             # <<<<<<<<<<<<<<
 *     "YUV444P"    : get_CS("YUV444P",  ["BGRX", "RGBX"]),
 *     "GBRP10"     : get_CS("GBRP10",  ["r210", ]),
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_get_CS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_r210); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_YUV444P10, __pyx_t_12};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_YUV444P10, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":89
 *     "r210"       : get_CS("r210",    ["YUV420P", "BGR48", "YUV444P10"]),
 *     "YUV444P10"  : get_CS("YUV444P10", ["r210"]),
 *     "YUV444P"    : get_CS("YUV444P",  ["BGRX", "RGBX"]),             # <<<<<<<<<<<<<<
 *     "GBRP10"     : get_CS("GBRP10",  ["r210", ]),
 * }
*/
  __pyx_t_11 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_get_CS); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_4 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_BGRX, __pyx_mstate_global->__pyx_n_u_RGBX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_mstate_global->__pyx_n_u_YUV444P, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_YUV444P, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":90
 *     "YUV444P10"  : get_CS("YUV444P10", ["r210"]),
 *     "YUV444P"    : get_CS("YUV444P",  ["BGRX", "RGBX"]),
 *     "GBRP10"     : get_CS("GBRP10",  ["r210", ]),             # <<<<<<<<<<<<<<
 * }
 * 
*/
  __pyx_t_12 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_CS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_r210); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_mstate_global->__pyx_n_u_GBRP10, __pyx_t_11};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_GBRP10, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_COLORSPACES, __pyx_t_15) < (0)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":94
 * 
 * 
 * def get_type() -> str:             # <<<<<<<<<<<<<<
 *     return "cython"
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 94, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_3get_type, 0, __pyx_mstate_global->__pyx_n_u_get_type, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_type, __pyx_t_2) < (0)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":98
 * 
 * 
 * def get_version() -> Tuple[int, int]:             # <<<<<<<<<<<<<<
 *     return (4, 2)
 * 
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Tuple_int_int) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_5get_version, 0, __pyx_mstate_global->__pyx_n_u_get_version, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_version, __pyx_t_15) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":102
 * 
 * 
 * def get_info() -> Dict[str, Any]:             # <<<<<<<<<<<<<<
 *     return {
 *         "version"   : get_version(),
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Dict_str_Any) < (0)) __PYX_ERR(0, 102, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_7get_info, 0, __pyx_mstate_global->__pyx_n_u_get_info, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_info, __pyx_t_2) < (0)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":108
 * 
 * 
 * def get_specs() -> Sequence[CSCSpec]:             # <<<<<<<<<<<<<<
 *     specs: Sequence[CSCSpec] = []
 *     for in_cs, out_css in COLORSPACES.items():
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Sequence_CSCSpec) < (0)) __PYX_ERR(0, 108, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9get_specs, 0, __pyx_mstate_global->__pyx_n_u_get_specs, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_specs, __pyx_t_15) < (0)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":133
 * 
 * 
 * class CythonImageWrapper(ImageWrapper):             # <<<<<<<<<<<<<<
 * 
 *     def free(self) -> None:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_ImageWrapper); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_2 = PyTuple_Pack(1, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PEP560_update_bases(__pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_15, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, (PyObject *) NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (__pyx_t_15 != __pyx_t_2) {
    if (unlikely((PyDict_SetItemString(__pyx_t_11, "__orig_bases__", __pyx_t_2) < 0))) __PYX_ERR(0, 133, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "xpra/codecs/csc_cython/converter.pyx":135
 * class CythonImageWrapper(ImageWrapper):
 * 
 *     def free(self) -> None:             # <<<<<<<<<<<<<<
 *         log("CythonImageWrapper.free() cython_buffer=%#x", <uintptr_t> self.cython_buffer)
 *         super().free()
*/
  __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (PyDict_SetItem(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 135, __pyx_L1_error)
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_1free, 0, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper_free, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  PyList_Append(__pyx_t_2, __pyx_t_14);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_14, __pyx_t_12);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_free, __pyx_t_14) < (0)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":143
 *             memfree(<void *> (<uintptr_t> cb))
 * 
 *     def _cn(self):             # <<<<<<<<<<<<<<
 *         return "CythonImageWrapper"
 * 
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_18CythonImageWrapper_3_cn, 0, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper__cn, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_cn, __pyx_t_14) < (0)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":133
 * 
 * 
 * class CythonImageWrapper(ImageWrapper):             # <<<<<<<<<<<<<<
 * 
 *     def free(self) -> None:
*/
  __pyx_t_14 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper, __pyx_t_15, __pyx_t_11, NULL, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_2, __pyx_t_14) < (0)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper, __pyx_t_14) < (0)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":464
 *     cdef object __weakref__
 * 
 *     def init_context(self, int src_width, int src_height, src_format: str,             # <<<<<<<<<<<<<<
 *                            int dst_width, int dst_height, dst_format: str, options: typedict) -> None:
 *         cdef int i
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_src_format, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_dst_format, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_options, __pyx_mstate_global->__pyx_n_u_typedict) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_1init_context, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_init_context, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_init_context, __pyx_t_4) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":588
 *             raise ValueError("BUG: src_format=%s, dst_format=%s", src_format, dst_format)
 * 
 *     def clean(self) -> None:             # <<<<<<<<<<<<<<
 *         # overzealous clean is cheap!
 *         cdef int i                          #
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 588, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_3clean, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_clean, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_clean, __pyx_t_15) < (0)) __PYX_ERR(0, 588, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":606
 *         self.buffer_size = 0
 * 
 *     def is_closed(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.convert_image_function is None
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 606, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_5is_closed, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_is_closed, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_is_closed, __pyx_t_4) < (0)) __PYX_ERR(0, 606, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":609
 *         return self.convert_image_function is None
 * 
 *     def get_info(self) -> Dict[str,Any]:             # <<<<<<<<<<<<<<
 *         info = {
 *                 "frames"    : self.frames,
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Dict_str_Any) < (0)) __PYX_ERR(0, 609, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_7get_info, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_get_info, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_get_info, __pyx_t_15) < (0)) __PYX_ERR(0, 609, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":634
 *         self.clean()
 * 
 *     def get_src_width(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.src_width
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 634, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_13get_src_width, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_get_src_width, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_get_src_width, __pyx_t_4) < (0)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":637
 *         return self.src_width
 * 
 *     def get_src_height(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.src_height
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 637, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_15get_src_height, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_get_src_height, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_get_src_height, __pyx_t_15) < (0)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":640
 *         return self.src_height
 * 
 *     def get_src_format(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.src_format
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 640, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_17get_src_format, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_get_src_format, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_get_src_format, __pyx_t_4) < (0)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":643
 *         return self.src_format
 * 
 *     def get_dst_width(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.dst_width
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 643, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_19get_dst_width, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_get_dst_width, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_get_dst_width, __pyx_t_15) < (0)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":646
 *         return self.dst_width
 * 
 *     def get_dst_height(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.dst_height
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 646, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_21get_dst_height, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_get_dst_height, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_get_dst_height, __pyx_t_4) < (0)) __PYX_ERR(0, 646, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":649
 *         return self.dst_height
 * 
 *     def get_dst_format(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.dst_format
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 649, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_23get_dst_format, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_get_dst_format, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_get_dst_format, __pyx_t_15) < (0)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":652
 *         return self.dst_format
 * 
 *     def get_type(self) -> str:             # <<<<<<<<<<<<<<
 *         return "cython"
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 652, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_25get_type, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_get_type, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_get_type, __pyx_t_4) < (0)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":656
 * 
 * 
 *     def convert_image(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         cdef double start = time.time()
 *         fn = self.convert_image_function
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 656, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 656, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_27convert_image, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_convert_image, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_convert_image, __pyx_t_15) < (0)) __PYX_ERR(0, 656, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":667
 * 
 * 
 *     def r210_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 4, 0, 0, 0)
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 667, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 667, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_29r210_to_YUV420P, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_r210_to_YUV420P, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_r210_to_YUV420P, __pyx_t_4) < (0)) __PYX_ERR(0, 667, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":670
 *         return self.do_RGB_to_YUV420P(image, 4, 0, 0, 0)
 * 
 *     def BGR_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 670, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 670, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_31BGR_to_YUV420P, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_BGR_to_YUV420P, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_BGR_to_YUV420P, __pyx_t_15) < (0)) __PYX_ERR(0, 670, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":673
 *         return self.do_RGB_to_YUV420P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
 *     def RGB_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 673, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 673, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_33RGB_to_YUV420P, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_RGB_to_YUV420P, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_RGB_to_YUV420P, __pyx_t_4) < (0)) __PYX_ERR(0, 673, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":676
 *         return self.do_RGB_to_YUV420P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
 *     def BGRX_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 676, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 676, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_35BGRX_to_YUV420P, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_BGRX_to_YUV420P, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_BGRX_to_YUV420P, __pyx_t_15) < (0)) __PYX_ERR(0, 676, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":679
 *         return self.do_RGB_to_YUV420P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
 *     def RGBX_to_YUV420P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV420P(image, 4, RGBX_B, RGBX_G, RGBX_R)
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 679, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 679, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_37RGBX_to_YUV420P, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_RGBX_to_YUV420P, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_RGBX_to_YUV420P, __pyx_t_4) < (0)) __PYX_ERR(0, 679, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":804
 *         return self.planar3_image_wrapper(<void *> output_image)
 * 
 *     def BGR_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 804, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 804, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_39BGR_to_YUV444P, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_BGR_to_YUV444P, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_BGR_to_YUV444P, __pyx_t_15) < (0)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":807
 *         return self.do_RGB_to_YUV444P(image, 3, BGR_R, BGR_G, BGR_B)
 * 
 *     def RGB_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 807, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 807, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_41RGB_to_YUV444P, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_RGB_to_YUV444P, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_RGB_to_YUV444P, __pyx_t_4) < (0)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":810
 *         return self.do_RGB_to_YUV444P(image, 3, RGB_B, RGB_G, RGB_R)
 * 
 *     def BGRX_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 810, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 810, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_43BGRX_to_YUV444P, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_BGRX_to_YUV444P, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_BGRX_to_YUV444P, __pyx_t_15) < (0)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":813
 *         return self.do_RGB_to_YUV444P(image, 4, BGRX_R, BGRX_G, BGRX_B)
 * 
 *     def RGBX_to_YUV444P(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGB_to_YUV444P(image, 4, RGBX_B, RGBX_G, RGBX_R)
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 813, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 813, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_45RGBX_to_YUV444P, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_RGBX_to_YUV444P, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_RGBX_to_YUV444P, __pyx_t_4) < (0)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":888
 *         return out_image
 * 
 *     def validate_rgb_image(self, image: ImageWrapper) -> None:             # <<<<<<<<<<<<<<
 *         assert image.get_planes()==ImageWrapper.PACKED, "invalid input format: %s planes" % image.get_planes()
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 888, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 888, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_47validate_rgb_image, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_validate_rgb_image, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_validate_rgb_image, __pyx_t_15) < (0)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":894
 *         assert image.get_pixels(), "failed to get pixels from %s" % image
 * 
 *     def r210_to_YUV444P10(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 894, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 894, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_49r210_to_YUV444P10, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_r210_to_YUV444P10, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_r210_to_YUV444P10, __pyx_t_4) < (0)) __PYX_ERR(0, 894, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":926
 *         return self.planar3_image_wrapper(output_image)
 * 
 *     def YUV444P10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 926, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 926, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_51YUV444P10_to_r210, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_YUV444P10_to_r210, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_YUV444P10_to_r210, __pyx_t_15) < (0)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":967
 *         return self.packed_image_wrapper(output_image, 30)
 * 
 *     def YUV444P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_planar3_image(image)
 *         planes = image.get_pixels()
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 967, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 967, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_53YUV444P_to_RGB, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_YUV444P_to_RGB, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_YUV444P_to_RGB, __pyx_t_4) < (0)) __PYX_ERR(0, 967, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1027
 *         return self.packed_image_wrapper(output_image, 30)
 * 
 *     def r210_to_BGR48(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_rgb_image(image)
 *         pixels = image.get_pixels()
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 1027, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 1027, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_55r210_to_BGR48, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_r210_to_BGR48, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_r210_to_BGR48, __pyx_t_15) < (0)) __PYX_ERR(0, 1027, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1059
 *         return out_image
 * 
 *     def validate_planar3_image(self, image: ImageWrapper) -> None:             # <<<<<<<<<<<<<<
 *         assert image.get_planes()==ImageWrapper.PLANAR_3, "invalid input format: %s planes" % image.get_planes()
 *         assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 1059, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_57validate_planar3_image, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_validate_planar3_image, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_validate_planar3_image, __pyx_t_4) < (0)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1065
 *         assert image.get_pixels(), "failed to get pixels from %s" % image
 * 
 *     def GBRP10_to_r210(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         self.validate_planar3_image(image)
 *         pixels = image.get_pixels()
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 1065, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 1065, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_59GBRP10_to_r210, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_GBRP10_to_r210, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_GBRP10_to_r210, __pyx_t_15) < (0)) __PYX_ERR(0, 1065, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1103
 *         return self.packed_image_wrapper(<char *> r210, 30)
 * 
 *     def YUV420P_to_RGBX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 4, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 1103, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 1103, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_61YUV420P_to_RGBX, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_YUV420P_to_RGBX, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_YUV420P_to_RGBX, __pyx_t_4) < (0)) __PYX_ERR(0, 1103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1106
 *         return self.do_YUV420P_to_RGB(image, 4, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
 *     def YUV420P_to_RGB(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 3, RGB_B, RGB_G, RGB_R, 0)
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 1106, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_63YUV420P_to_RGB, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_YUV420P_to_RGB, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_YUV420P_to_RGB, __pyx_t_15) < (0)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1109
 *         return self.do_YUV420P_to_RGB(image, 3, RGB_B, RGB_G, RGB_R, 0)
 * 
 *     def YUV420P_to_BGRX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 4, BGRX_R, BGRX_G, BGRX_B, BGRX_X)
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 1109, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 1109, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_65YUV420P_to_BGRX, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_YUV420P_to_BGRX, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_YUV420P_to_BGRX, __pyx_t_4) < (0)) __PYX_ERR(0, 1109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1112
 *         return self.do_YUV420P_to_RGB(image, 4, BGRX_R, BGRX_G, BGRX_B, BGRX_X)
 * 
 *     def YUV420P_to_BGR(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_YUV420P_to_RGB(image, 3, BGR_R, BGR_G, BGR_B, 0)
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 1112, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 1112, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_67YUV420P_to_BGR, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_YUV420P_to_BGR, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_YUV420P_to_BGR, __pyx_t_15) < (0)) __PYX_ERR(0, 1112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1211
 *         return self.packed_image_wrapper(<char *> output_image, 24)
 * 
 *     def GBRP_to_RGBX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_R, RGBX_G, RGBX_B, RGBX_X)
 * 
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 1211, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_69GBRP_to_RGBX, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_GBRP_to_RGBX, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_15);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_GBRP_to_RGBX, __pyx_t_4) < (0)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1214
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_R, RGBX_G, RGBX_B, RGBX_X)
 * 
 *     def GBRP_to_BGRX(self, image: ImageWrapper) -> CythonImageWrapper:             # <<<<<<<<<<<<<<
 *         return self.do_RGBP_to_RGB(image, 2, 0, 1, RGBX_B, RGBX_G, RGBX_R, RGBX_X)
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_n_u_ImageWrapper) < (0)) __PYX_ERR(0, 1214, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_CythonImageWrapper) < (0)) __PYX_ERR(0, 1214, __pyx_L1_error)
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_9Converter_71GBRP_to_BGRX, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Converter_GBRP_to_BGRX, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_15, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_4xpra_6codecs_10csc_cython_9converter_Converter, __pyx_mstate_global->__pyx_n_u_GBRP_to_BGRX, __pyx_t_15) < (0)) __PYX_ERR(0, 1214, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1280
 * 
 * 
 * def selftest(full=False):             # <<<<<<<<<<<<<<
 *     from xpra.codecs.checks import testcsc
 *     from xpra.codecs.csc_cython import converter
*/
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4xpra_6codecs_10csc_cython_9converter_11selftest, 0, __pyx_mstate_global->__pyx_n_u_selftest, NULL, __pyx_mstate_global->__pyx_n_u_xpra_codecs_csc_cython_converter, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44])); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_15);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_15, __pyx_mstate_global->__pyx_tuple[6]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_selftest, __pyx_t_15) < (0)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "xpra/codecs/csc_cython/converter.pyx":1
 * # This file is part of Xpra.             # <<<<<<<<<<<<<<
 * # Copyright (C) 2013 Arthur Huillet
 * # Copyright (C) 2012 Antoine Martin <antoine@xpra.org>
*/
  __pyx_t_15 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_15) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  if (__pyx_m) {
    if (__pyx_mstate->__pyx_d && stringtab_initialized) {
      __Pyx_AddTraceback("init xpra.codecs.csc_cython.converter", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    #if !CYTHON_USE_MODULE_STATE
    Py_CLEAR(__pyx_m);
    #else
    Py_DECREF(__pyx_m);
    if (pystate_addmodule_run) {
      PyObject *tp, *value, *tb;
      PyErr_Fetch(&tp, &value, &tb);
      PyState_RemoveModule(&__pyx_moduledef);
      PyErr_Restore(tp, value, tb);
    }
    #endif
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init xpra.codecs.csc_cython.converter");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #else
  return __pyx_m;
  #endif
}
/* #### Code section: pystring_table ### */
/* #### Code section: cached_builtins ### */

static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_super); if (!__pyx_builtin_super) __PYX_ERR(0, 137, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 494, __pyx_L1_error)

  /* Cached unbound methods */
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cached_constants ### */

static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "xpra/codecs/csc_cython/converter.pyx":99
 * 
 * def get_version() -> Tuple[int, int]:
 *     return (4, 2)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_4, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);

  /* "xpra/codecs/csc_cython/converter.pyx":477
 *         self.src_format = src_format
 *         self.dst_format = dst_format
 *         self.full_range = options.boolget("full-range", True)             # <<<<<<<<<<<<<<
 * 
 *         self.time = 0
*/
  __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u_full_range, Py_True); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);

  /* "xpra/codecs/csc_cython/converter.pyx":491
 *             assert src_width==dst_width and src_height==dst_height, "scaling is not supported for %s to %s" % (src_format, dst_format)
 * 
 *         def allocate_yuv(fmt="YUV420P", Bpp=1) -> None:             # <<<<<<<<<<<<<<
 *             divs = get_subsampling_divs(fmt)
 *             assert divs, "invalid pixel format '%s'" % fmt
*/
  __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, ((PyObject*)__pyx_mstate_global->__pyx_n_u_YUV420P), ((PyObject*)__pyx_mstate_global->__pyx_int_1)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);

  /* "xpra/codecs/csc_cython/converter.pyx":510
 *                 )
 * 
 *         def allocate_rgb(Bpp=4) -> None:             # <<<<<<<<<<<<<<
 *             self.dst_strides[0] = roundup(self.dst_width*Bpp, STRIDE_ROUNDUP)
 *             self.dst_sizes[0] = self.dst_strides[0] * self.dst_height
*/
  __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(1, ((PyObject*)__pyx_mstate_global->__pyx_int_4)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);

  /* "xpra/codecs/csc_cython/converter.pyx":850
 *         cdef const unsigned char *input_image
 *         cdef uintptr_t buf
 *         with buffer_context(pixels) as bc:             # <<<<<<<<<<<<<<
 *             input_image = <const unsigned char *> (<uintptr_t> int(bc))
 *             # buf_size = len(bc)
*/
  __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);

  /* "xpra/codecs/csc_cython/converter.pyx":20
 * 
 * from xpra.log import Logger
 * log = Logger("csc", "cython")             # <<<<<<<<<<<<<<
 * 
 * from libc.stdint cimport uint8_t, uintptr_t # pylint: disable=syntax-error
*/
  __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_csc, __pyx_mstate_global->__pyx_n_u_cython); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);

  /* "xpra/codecs/csc_cython/converter.pyx":1280
 * 
 * 
 * def selftest(full=False):             # <<<<<<<<<<<<<<
 *     from xpra.codecs.checks import testcsc
 *     from xpra.codecs.csc_cython import converter
*/
  __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(1, ((PyObject*)Py_False)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]);
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_tuple;
    for (Py_ssize_t i=0; i<7; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}
/* #### Code section: init_constants ### */

static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  {
    const struct { const unsigned int length: 11; } index[] = {{1},{33},{43},{14},{4},{17},{13},{15},{30},{32},{29},{1},{0},{1},{3},{1},{1},{55},{57},{33},{33},{26},{11},{35},{30},{29},{30},{29},{22},{7},{29},{58},{58},{32},{6},{31},{28},{33},{5},{10},{2},{39},{58},{22},{21},{26},{31},{27},{25},{9},{13},{24},{17},{38},{42},{14},{29},{4},{23},{36},{3},{3},{5},{4},{15},{15},{14},{14},{3},{11},{7},{9},{25},{25},{24},{24},{24},{22},{22},{25},{25},{24},{24},{24},{25},{24},{25},{27},{24},{15},{23},{24},{24},{23},{18},{24},{24},{23},{18},{22},{19},{23},{25},{27},{32},{28},{18},{22},{23},{4},{3},{4},{6},{14},{12},{12},{12},{4},{6},{4},{6},{8},{20},{3},{4},{15},{15},{14},{14},{8},{5},{1},{7},{1},{7},{1},{3},{7},{14},{15},{14},{15},{7},{9},{17},{14},{10},{7},{12},{12},{17},{18},{2},{5},{4},{7},{3},{9},{9},{2},{5},{18},{3},{11},{10},{15},{13},{9},{2},{3},{6},{13},{3},{4},{7},{10},{10},{10},{9},{7},{9},{9},{12},{7},{8},{3},{2},{6},{4},{4},{10},{8},{6},{3},{6},{14},{14},{13},{10},{8},{10},{10},{13},{9},{14},{14},{13},{20},{8},{11},{9},{1},{6},{11},{1},{5},{5},{4},{12},{34},{34},{39},{16},{12},{13},{3},{9},{13},{14},{5},{4},{6},{3},{8},{5},{5},{13},{5},{7},{5},{10},{15},{8},{7},{2},{6},{7},{18},{12},{6},{17},{6},{3},{11},{6},{14},{7},{12},{1},{4},{13},{15},{17},{6},{4},{8},{14},{12},{10},{10},{5},{5},{5},{10},{10},{10},{9},{5},{3},{6},{5},{3},{8},{7},{4},{13},{8},{6},{1},{13},{22},{18},{6},{7},{1},{4},{5},{10},{1},{4},{18},{21},{22},{32},{17},{8},{17},{4},{1046},{83},{10},{31},{106},{175},{17},{33},{81},{208},{567},{399},{28},{30},{28},{30},{28},{386},{285},{120},{121},{7},{880},{29},{12},{120},{63},{181},{15},{10},{312},{122},{12},{12}};
    #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (4179 bytes) */
const char* const cstring = "(\265/\375`T%M\202\000:\230\240 H\340\260l\0030\314#\014\314\216k<\221\347cv\\\013\263\343Z\270\026f#\014\373X\230A2#B\t\306\312\010S\222\304D\177#\241\253H\177\203%b\261z\217\363\010q >\304\316\352\25059O\241\305X\3311\222\021\347\001\350\001\375\001Y\024o\330\314\342\210\222\242\250s%\251\307q\224\341\225>\321r\323\214X\226n\321\034ec>\361h\242\250L\245\225\322d\243\254L\321r<u\032\213\350\2515>qbfFFf\226_0\242\215.F\024Q\304\027\010\003\212\210i\351\020\"\3154\032*b\353R\3049\212+\224\024\223Y\243\346(\352|\323mtv\226\242x\216/\226\227\333\315Fw\223\240\307L\242\243\004\234\336lNu\243'\355\034\265\266\315X\253\322GSRi\235\244\337\354\224\2515h\372\325F]\332l\252\315v*\267\212\3266Y\326|+\273F+s\355+Q;Eo7U\177:\363DO_\036\361M\247\250\211\216\037Y\2328w\226&]2\215\264L;q\032\3014\325\031\336\230\374H\234S\033\232\316>mf\233\362\366\355L\373J<C\277}f\333\211\246e\356\314gVo\250\230\t'd6eX\227\344\312\211K\362\314\237.\231\310\2002\361za9\245\231L\321\025]\3326y\237\350(\356\362,w\232s'\352Z\235\304Q\2178\233\337\306\037\231\267M\316['\373N|+6\375\241\350\376t\371\345\023\233\267\357\345\373\364)\247\352\276|Sj\361C\225\245\223\214\226\212y\343\0215M\274a\365E\370X^^:\223\345\207\322\245\323\004\326I*\242[\234\300\212i\265Z32'`\035\\`\014\354EB\004\t\227\250K\"\014\t\017\261\023.Q\004_1&V|\252}\226)\262ySc+V\214\371\006s\301\\)\362xf\025\227a\371DaV\350N\360S\245[\247\330c\331bSR\312\220\346\331L\225\211\343\207:\345\234\316Vi\276\335pZ\"\323\260\355\303\211\326\266\316\2655\371\251t)\303\306\266\024\235\211c\252\277\225\027\031\026U\236\036\316c`a\360\007\334\201H\245\277\270\002\\X\233\363.\317\200\035\273\200\336\302GD5\177\201-\320?\227\203\352\227\350%\321\313\351!\234\303C\326\020\250\307bY\360\006\035=\016\207\215\270^CB/\310G:^\234\177\371\034\353b\031t\0059\274\202\330\201:\213\025\344\363\202\253\350\363\262\330\231\016\201\277\330\r\330}</\216?\360\274\254\365c\343\263x#\236\331\222B\277\302\356\356\200\307V\220\216\227\263\342v\010\334\220\253\302\213dl""\310\256\364\315\021\214Z\322\263\370\017\317\361\"\272\247\247\360\021'\200[\220\226\323\272`Il\2105u\031\016r\320\332!\302\027|>\214\027\377\005\372\321\226\017je\036\004\353a]p\026na\375\000\275\254^\362\371\254]\001\317;Z=6\276\211m\331\266q\372\262.\361K\347\030-\005\321\230&S\264F\227Cd\235b\020by\312|\020\265\212e\233,\321\334\006j\217\330&\357\330Y\203\2364\247\212\236\264\362K\325\320hQ\2437\361dE\nZ\212?M\326\320l\240R\\\033\277\026\314%S\3334U\3249\335\247\372\245R\033(3\347\304o\213Z\324\266\362S\235R\037\t]\214N\3571\273\220\241+s\265O\2745\315\230k\343jecs\246\270\246Fg5Gj\233(\232x\243z\324iu\247x\353\333M5U<\313\244\336:\357\231\231\365\231\252;\247\251\016\2538\031\3369\321F\227S|\313\351\355v#o\"\252\321\033j\303\247\316hj\252$zf\263\206w\256\251\2116\"\r5\263\271wij]\246\321\266\274\313<\303Z\254mq\213+\r\332\304\260\322cI\243\261M\254i\361f\303Z\246j=\201uKe\264S\025u\266\341tv\316\266m&\332\210\033\247\331\246\236\0018\036\nW\344\302\223|\310\263L\357\311\364bvezgd\276L\354\307\302\037\343\201\274\017^\314\005\335\017W\303\n7A\305\364M\274\017\307\375\264\037\354)\224~\311\363C\227\206\333\032?\200\326\303^\342\264&\337\367\216\274\013\013\352\221L$\001\035\257G\250\327i\351\270\\\035\260\003v8ll\324\230\241~u\377m~\223\345k\022/C\022}\021\350\r\331\023v\304\272t\020OY\t\204x7m\253\035\265'\177B\362C\026dS\275\023\362\025\017~\203\236\377\204\371*\267\343\312\332\2605\340[R\220\307\000}\014\234w\020\316x\310{\230\027\362V\334\335\342\026\204\367x\034+\241\364\232\224^\220U\2254\257\245u\353\300\253\350`'u\364^\341\277q[\356\310%\200\202zS\250\227\343'\240^\023%~\211\231?\003\373\033\005\273(.\013?\302Ii=Z\032\335\007t\031\277\320\273\321}\235\376\332\366m\247\257\023q\n`\007\217\316\3623l\004\220\037 \006\373\260\327w\341\261x\333}\271\035F\237\323]\254\t:\336P\033\363`\310\212B}\204\340\217\340j\202\025w\330\031\340\330\000\325\000O08m\213gy\025\026\205\353\255\027wR/\001}\t6B\000\256\000\354\241O!}\222\347\207Z\223_p2=\212\tIG\017\273\252V""\317\330\232\216\273\211\350M\000BbU\333P;z\025\233\372\370\270\036\202\263\370\310\001\034\177\361\223O\217\323\356\026\206U\273\251\207\343a\036\010\327\343\342Z\033_\241\364M86\004\324\030\361\026\270\034\232\247\000\303\3255\244\323\254 k\350\003\372\2405D\270~`9\254\t\350\363\216\322^\352$w\360yq;\274c\t\255\261\235\201\317\033\366\000\276U\362Kx*\256J\253\342\001x\030[\302V\350\243\276a\365($\237\304\3631\213\302B\370\370{\207\2003\010\254u\367\217\223H\301\255!\236\017\243ma2\324U\270\241\273\322\362\036\024+H\210\304eFN\\\000(\322\036\210\327\242e'\220^\n\330\267\271$\023L\3458\374)\257\304\223I\321h\234.b\245\241x\205\025@\312\202\3171%\370\274\001X\026\013\200=\201.\270\356\352\244\025&\276\211\231\177\"\305\365pG\224\330\016+\202{8n-\341\016\322ci\215\250\217B\237\263ku\274\034\"f\037\341]\270;yah/x\306?\256\374\027a\233A\365U\256\035h\005\331\370\034\237\303\363\206;\00340O\345\2624\370 O\365B\254\315\206\270YC:z'\234A\210dW\035/\310?z!\217\346\326\332\332\213\221\357x\027\013F\274\016\317E\213\322\276x\222\224\320\237x\0216\026\366\021\234\352\370\241\2207\000\275 Bx\272\206\030\270\020\263\341o(}\260\247\270\210\213\217\204\372\253\257p\006\242^\350\001\310\213O\024|\005\242\327G\010\n\361iC\274\351\304\311\365\302\016\304\261q@\304\244\306\310\023`\037p\221\336\250/\370T\030\201\253\207\225\202n\032q\230\020\037a\276\200\261\206\200^:..\235\016\03587:\n\277A\212\227##\006\356\343Z\374\026\251\277\202\227\310\\\\@\032\276\002\013\341\363q \037\354\r\340\n@\343\016\005\257!\336\t`\3556\270\373\330\2454\006\264\235V%\344\343\225\264\236v\235\215\017\272$.K\311\337/n\376\r\355\323d_\326\3721jr?\227\376\224\374\344\3117A\330\360\307*\276\n\024\037\205\312\327y\204\370X8\375\223\347\2438\374\004\323\206`z9\272\247\202\360\206\355\007\337\202\360\342`\260\022 |\370q\344*\020\333\322I\237^\013\361\213,>\213\230\277\2420\372#\266u\302\274\023\246v\005lO\026\204E\201\"n\254\005\333\224'#\224\274\244\222T\311\013\343\211x\034\036\014\326\312`1\200za\314\017\203""\312\250\222\243\2203\206hdDR\220$\351B \014\t\007\243<\0176}\022\262\230\245\230aF\031EDDDDDDD2\n\222$I\007T<_\370@A7\234\n\277\344\355\327\037EC\325\220\177^\264\221;q\245\362N\265\333\023v\322$QB\263\316\375<\267O\364,[i\301\003hF\332\226\306\204=\023\t\324\227\374\030\324[\361Nh>\363ro\226\272P\307\200\312R\337\347\002\2376:M\3273\275:\316&\206\240w(\370R\260\255\314\236n\3477\352;\206\273\007\014\252\351\211~HN\263\354u>\325\027^i4\021\300\272^\032\177\234\325!\260H\000\311H\337X\337\310@\353}\310\036GAFLF\361\213\213\320\227\317\205\017\016}D&\263\367\025\327\322\\/\337\212\313\024.\352\255G\017:v\201\025\362\372\366\335,\206\212\231y\224v\207/5&\314Kpd\300\265\243C\030\243\245\027TpI\272]\344'\n\036\020}Q\240\344\305\211L\234\330\"\271\261\224\374\341\034v\320Hq\234\314\201\377\3236Q\222\0300\315\034h\377\270\254\263\255\022\017%\014\031V\346\003\013\371\263i0\230U\027>\002\305i\037I7\342\206m\231X%@\273\233\020l\024\014\353\020y\037\312\252N5\222 \177\214\354\350\3401f\0201\007\341\033j\310V\270u\037o:\206_\254JO\255G\226\370\204(\313\371\233\304\223\354\351\321<Q#\322j\341\215\335\301<z\302\222\2612\235\363U\235\336[N\217\355O\234\030r\330\020S\205c=\375\035\234\316\020\224\"5\000BV\032\001 J\310/\030\213\230\255I 4C\371\215\331\025\337\232[7\023\307V%\224\333R\225\0042x)\252\245\334ORu\031}\"\031\227\2335P%\311r\357\300\330\200\351\3641\302u\324\260\213M8(\365lO\024C\343\255+^\241\243\356hV\341g\330\347e\350\204\013i\264\245v\232i,I5\206.*#-\254\353\004\244Ix:4C{\370\373\353\356\214\350\201d\030\313T3.0D\002C\264\016$\240\267\270\014\265\002x_1\346KO\314\t\272\337\2540\206\267m\230\311^G\303\315S;\266\000g\250\331&\206U(\354qd=/C9\324{A\005V\341!jUR\341@$\255\200\301a4\205\252\002\004\003i\220\222-=k\366K\330\362\344\352\332\376LN\013P\333V[BH\201\265$Y#\353YlCN\276\357kH\033b\372\320\355\277\000\022~\312\024R]\370rLnE\310\335T\230\211\030S\024\360\013\262\247\227\026;\177\033WC\200)\347\001Q\326\307Y\213\267$<V\267\202\227\315z\345\310\351\317;\365Z\002#""\300\025\026\352<\340O(\340+#\n\003-\330e\247.\010:\332\337\220\253\214:&\210G\212\037\202]f\254\301\240\212\334CN\223\204\020\273\332\3009\332\033\342\001\232(\326\347N:{\272\364U\320\002\343\303v\243\252A\300\324\332\264p\226\233\246\010A\304\357L\342\2531\222\266w^[\306d\230|\240\237\263\371\034\317\336\034\360\242\343h\005|\357\351\254A\267\306R\010\216U\0226\314\217]\276\231\000{\2263\021\242LNo\372%f\nr\231`c\001=0n\177\312a+Q\227s\322#\353\306\352\267\333\251\013\024**\025\312\237\355)\255\214m\205\300\261\366\306\332I\2372\234DufH\031Ij\rC\003\252\031[e\343\356'P\360[\377vo\"\345\200\354@\210\"\210\300\022\363n^W\353\365\230a\346b\364\300\342\341\362\330\"\2637\330k\030\035\355\352\3540Q\035\210Z\347\250\243\214\340\362R\321\024\274?\262D~\014,\352\333ah\006\242\262\013\361\361\363\302\201VF~)Iq\271GE\014\2435\227\017\233[\273$*\365\3505J\310p\n\366+\347\311'\253\230\252\330\020w.\026\244^`\257_4;\006\016#\267\021d\276\016[\356px\312\366\t\034-\256b\235\025\331\316w\331\264\272\007!\302\320^\026\252\342\270\356[\016\352\250\245xmTA\305\211\317\020\034\215\033\001\014c\265@\303;\301\367e\023;\025\347\323\332\272\260\370\302\273\360)\"\322 \204u\347\210>33&ou\373\261\370\302\210\340\261\0374\301\241\364\340_M\021\350\007=\027\014f\343\244w\242\304pvxW\323\252\257\354\342\263O\n\237\377\005\0338Ha\307\014a\"\240\365\213\320\201\206\354Tz\362:+M\021\2079\334\261\366\340\310( 9\211\202RA\261\024)\030V\313|\266~\021\330\337|m'eQ\200\007\005\335\2262\361.\245\262\316\014\244#\030\004\237\273\001\204\241+\234\017+\351\263EU6\265Z\025@$\371\025\201&\325\216\240h5r\264\364:\364&\353>\350!\206I\253T@\343`\320\022\013\r#\030\232\310\204b\247\3515\2147\027Q]\334/\034\356`\210h\257\227\372\2142\300H\355\235\265\276\251Q\250\211\323\203\2228\260:Jb\002wS\362\355\251@7\264/\215P>eFyQ\274otR\247W\030\361\210\220$\275\275\316B\253\321\027-\247X\016\215\271f\354\272\220\2122\010\265S.S9\224\210\n=\343L\275\345\010\007\255\310\270'\367:\352.\233\206\322\307\362lZ\022\221\337""\333\355\356\013 ;h&w\200UW\261\351\013\261\246\021\000\n\003\263\355NTA\003\204sN \321\221\352\205\206\320\354$<Ma\246\013\343\343h[\271\216\273\203\225\030\257\033\016\274\254\006%\r\345\036\027\016\362\267\242\020\377\345/\024\312\352\335#s%\024\334\343\377\214\226\347\335S\224S\235\002\344\031a}xU1BY\245\256g\253Zt\033\267>\3066\325*8\273\334\r^-(\032\273\347\323k\335\177\033\027\224\301|M\374\360W2\232\353\023\2338})\232\261G-8\343\3468B\234\027\305>\n\374P\2242\242LJ)\273\337\304\312\n\236q\322RFdY\020*\221\241Q\320`\317\240\032\r\320\3041\035c;II1\315\006\260\001\024\323\276z\355v\24190DE\322\245\007|5\002\243\030\312\032\364\324\206h'\022\301\031\230\204\252+\026\375\341\375\000\010\236\035\374\227\004d\222L\036\324\306\355~m\353\305\t\017B\3172/\010\314\220r\001\000\225\\7\035X\2161[\373\003\334\247\314\320m\356Uc\253\335\330\213\355\355x\033\267\325\327f\340\344DY{o\000\237/8\212b\221\245\206\r\366/\200e\021\333\216P\256\261\177\322\t)\330\001\266mF\224\232\004e\352\301i\n\206\215\310\261\233\277\272%\001\237\200\202=x\n[\336\230\022\322\n\022\211\240d0\371\026\224ts\023495\227bJB\313\\\205\206\330\2458\237\236\260\335\016KI\361(u\256d\005\tO*\236}C\274VAEy%*8\317z\321\326\n\355\205\322\364C\364\214TF\306\202\263\002\213\227\240\257-N\243\226\231x\317|nW\242\352/\333\314\034\2633\016\022\233\023\000\207M\336\323\205\266\344\305!v\017=\321[\272\250/`\301\357r\322\033\357\243?\320m\257\n\317q\304\260Y\223!\226q\000\307\252\240\227?#\351\002\372\031=\306\330\234W\202V\310wb\200P\000o\244\350<\343\342\032\356\205n\025\254\333\323\307V7\007\225.\355{\274mRs\340_\264\022\005k\264\357\227\233837~\244\016`\267\366\035M\251PIa\254,\324\231\312f\220\t\257\345s\020A4%\314\354I\360\030\274T[\022\237\361\020\325L\350\214\277' \006\350\3357\374\374\246N\032\200\027\036\032\243\254\\\020\225\2761\333\013\261\022e0mZ\267\224\206\210\221\264";
    PyObject *data = __Pyx_DecompressString(cstring, 4179, 3);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (4358 bytes) */
const char* const cstring = "BZh91AY&SY\234,\245}\000\003\227\177\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\300@@@@@@@@@@@@\000@\000`\021\\\3374\254\367Np\236\333\336\347n\367\275\3575\315\333n\267-\263\255\335u\260\342wj5\271\211b\304\231\340(\000R\361t%\010\212D\364\323P1\345Ljz16\2234\322a\215\014\2114M6A\231\024\3644=L&S\312\0035\r6\211\266\221\251\231\032\201$\223@d\0045T\377L\320A\251\251\351\352\223\364S\365O\324\207\222h2\000\000h\375Pz\200\3200\206\203@\006\200\000%\021\223HF\211=\rSO\325?T\375Hx\223\324\365\007\202\236\220\3652\000\001\240\000\000\000\000\000\310= 4\001\"\"\010\320F\224\332\236D\036\211\264\2314\r\014\2154z\217Q\240\003C@i\240\032\000\r\r\0004\r\r\250 \323\023\002\014\000M4\323L\000F\00212`\023\000\001\030F\000\001\030\0012d\302b\004\211&\200\246\320\323S\022d\323\323E<\324i\265\024\362\232i\350\207\250\033P\000\000\000\000\00044\001\240\032\007\374\006l/\312>\003\021\270\213E\330t=\377\242\024\212c\334%T\350\376_\312\027I\177I\037\331\376t\326\341\0167\002\300\240\333\030\354\260\2415d\252\221\026\362\274\3178\363\375\r\313\224i\250\205}\335\304bF6\302\n\257\372\221\377\231jC2\003\013\221:\235\023\217O\240\350\346\005\242\212\252\232\242\251\315Z\"\346\230\304\330 m$6\330+\207\r(\210\006\300\212\225\250\231\241[\251\n\226:):\262V\027\205\204\346\323\022\302\303\030`\333\000m\003i66$\3306#\022\201\240\335ML\005j\276\313\202\201]\244\271+\021\377\246\257\277)z\332\023@\306\204\330\014\030\323W\242\025\210Y\232c\006\3218\206\333\204HEX\224\201!(\234\250\312,Yt\214\325\234e\231\302h\210C\244\250\023\257 \324\302\200(\257y\300\205\242\255\026@o-\274\260\276fd\031\306\213\232\030W\322R\255/P @\204\342\252\014\004\024^ZWz\025\201ae\361.\245\303\005\035\201\031z\322\214\263\023\306!\205(\036\224\311\237_b\te\036Xd\312^C\203\273a\036\301\323d\271/\n]\005\244\032\230j\205Z\220\023AZ\332\231IX\032B\272\303\317\337?\337W\363\237\031\003:,\250\343\205\302\373\374\017\342%6\330\224*\005\257\315\265\325\001\025\322\213n\001B?6\007S\232\025\tG\023\261\201""\345<%\303\322\207:mbt\"\205N%.\013\220\2744\270\253\344-\211\350\336I\t\226\254\2443\325\3663\365\262\317\321w\311_\006Q\2667G\257q\252\320\256z/\216^\337B]}\300\364\327N\343\274\272\205\325\277\276\035j\203\255]:b\351\215\005U\224\262\"(\032\212ke4\003\224\256\034\2364Hq\221R\026\365)\203\350\301u\242\205K\255\322\310\260\222\242\242\240\272\252O\016\025,\370\n)^\221\233\013\003\321\373\327\013\006/C\273\231\013)zFx\236\311\310\0341\357\2305\260\244\033\037\216\2140\303]\313\335i\231\265\316\023\343\257 \315i\240Z\t2\272~\355a\030\307Y\201\354\371=/M\314\177\217\316p\303\314:w&n\247Hu\362\023\014\366\362\353\326r\214\335\257Xj\323\322{<0\317\333\223\314Q\036Ct@\321\260\016/\336~\2721\321\206\006\234\213*p^\304\365B\021\272\315]}H\340\273^\337\020b\254\2477\026\032D\315\014/%\332\025\312k\271w\343\201\036\222\232\025\021Q\206D\224lJ\227\204t\316Y\213x\276Xon\262\261*\265M\210u0\225\377\2153\274\3649\317\361HH!\231>.\0071\227\001W\232\3655\266^g\341K\215\010b\r\247\213\033\365\370*Lm\240h\376\361\037w\302\247\322\035\324\264\027\360R\343\n\333-\231J-v\235l\326\266\333aR\307-\314)\207\006\203m\010t\242'RYT\251\352\240{\327f\355l+\001\224\210/\251\210\347~H\010b\0047\224Y\300\213\212\326\tY\322l\262\305`XP\264g*\310>\344\365\314n[}5!M%\323^\250a\343\315g\245y}p\361l\351\033\243\213\211$\t<\035g\304\276ZVk\357\321m\246\232\224\364\323\320\253\n\002\276\\\014\271\330\341\203\207\264\032<\315i\302\353\373^\356\247\364\367/W\360\327\350\357\355f\004\312\206]$\014\271\223aE\343D\017\016\344,\374\274\360\214\345U\031\247B\203}`\267\270fg\216\347\303\200\333\327\3359\210n\344\215f \335\3236\\\207\014\370\267\206\247?I2.wq\275\256\030U\231r\035\256P\301-\273*\366\233\323\3010\344a\271\317ve\327#\346\203\337\311\353\213\366l\350\3507\032\317&k\251o/\275\317\002\010\204\003\211\315\315\373\376\301x\024\035\252l>C\310\036o\002\237\260\352\350Kc\356sl\224C\350\220\203\240H\325\253\326\304\330\025uJq\013\302\030\232n\206n?! \2010\025\246\227\350k\351\304AP\221w[[\371\026\370\025@""\256<g\343\3125\201\032\030\255\316k\367\253]\215\266vE\264\226\333m\266\335=\274\353Z\225r\242\033\253l\215\344\0210\331\032\024>\262\376_\032P\323Lca\263\021V\201\201\374.Fl\332C\221\032\205\310z;:G\315e\225\216\242,\202\025r\222r\262\021&*_qZ\367(\226dY\232\346j\314\250{:\316\331Q\021\021@7\246\232E\351\034\354\023\364f\274XZ\263\257d\2557?c-\305\200H\304\2738L\265iJ\032\224uE\037%\227\222\260\216o1\326w\276\276%\3068\336\257\274\277\037\273\345#\223e\331\322\021\234/\353\272\345\256\375\352h\021ea\r|\010\321U\344\270\223T\252\221:s\326\252\312\306\333z\234-I\022\024R\327\350''>\230\203uEt4\3135\246\rk\365\214\200\372\031\270\365\310\370\353\275rl|<\333)\244M\312\331\177H(j#\017\2657\275\026\377y\333\\\177\255b\256@\211\255B\372\270\2177${t\034=\227\367'\252^TH\n\204\243\030\001H\221\343_\271\204\212\2555{\214\2748(\375\203tj\257%\340\\J\223\256d\2224\030\255cc\335\251\205Dn\362\353\030\250\206\\\362\3322\021\241\252\320lc\201\303L\311l\350\346A\0218\250h\223\335\035\215\337H(\310\324\024ir\361\265\005\252Q\014(x\243\240\355[(q\230Q\3215\000k3\255\004\313\255\354[\320\035\235\336\343n(\210\206\324I\267&\344\213\355\271\210\r\240{\236\3033=\177u\3341\247\355\334\247\300\r\216\253\006\237%3\032\246\262\262\215 \033F\3175\372\201=\313\3759y\364\335T]1:\240\013n\022\272\217\263T\372\2070\246\257h\216TVh\363\3279\2455\333VbXf\303&\331\332\305\314\306fcFi'I9&\3770\333D6\367\203s\230\207\001\t\3036\216^\354\222\266:H\234\351k\325\006\266n\351$J\242W\222\023\276\374X\314\333|\227\350m\344\276\327\320HM0x\362\227\243}q\214\235\216!\207\0338E\302\214t\372f\\L\375\021\220G(\020\324\005\n\030\272\350\334N\245Rk=\371\232\333\2154\330\351\235\223\220k\335+\251G\361\262\345Y\031$\004\350I\361\323L\250\331\002\257\205J\334\210zY\355\271<\006\201fd!\331\221A5A\216\230N\315\\\332\365\357\272\344\333\03228\033\3120\211d\200\324\320\333\001\231\231J\030J\336\365\036wl\335Xxu\023\342\237W\226\212%\265J\02634\215`\213zqB\307\024\232\251\006\265\227\352\032$\2323M\362m&\277\\I(|\251m]J""\325'l\226QtB\0139q\023~\352b^;\243\250K\004\026\220\231u\312\374D\223\331\316\030TR{I\ti%\261\024\242Hi\337KQ\225\346\373\262\245\222\213D's_\263\234\351\342\363\003\006\221|\2500\\\222'\302\263*\221\206oh\2573\004\320\0301\215\001'\004\342Re\216\323\306\203\251x\250\210\r|\013(ME\001\221\223>I\253RZk=\306LSvP0i\264\225\356\034Ed\323\321\241\315\342\344>?)lj\344\300\210\331\325J\022\372\271-\320\257A #?x\272fq\272x\034\227:\332\2131\315\004\"\232\263\010\240m\230\331~NG\r\362\304]\224\266\210t78\225\026\345\362p+8\304O*\205\267\250\222T\023\351\351\026=>\037>\323n(b\323\254\223\r.\0248\032A\254C\260\263\346$m\315\360H`\363\255I6\215\000.\261\017\210FR\216|\234E\006`\342k)Gv[\\\364Cy;F\222Cl\201\325,f\344\352\222150rV8;C\320u\207s\223\232x\251\0314\007\242\017\272\2558}[\376_\203\021O\212\241\030\212\324,P\227@\274\256\0349\371\362\323I`\354\341\260O\200\251\271]\265\221\215\340>\2422.\376\0175OC\354\031\305:\262\305\305WX\205k\271\216\370\261\246M\300\272\231\375\225b\263\222\244ZTQRj\262\000\321\253Hi\324n\247\334\177\254\205\242\324\217\360\206-7\342\240\352J\030e\236\326\004\010\3302\\\302Q\355\224S\206\315\017\\6\027[\267L\244\236\331\344\221\372\346s\"\006\006\274\"X\314|2%V\n\030f\271\301\226av\n\323R\325\334\316\024X\352\350\232\271Bk;P\245\024?\210\322\244\240\242\322\323\035\346%b\031V\266\221c\240^\302Y\022\224F;\221\004\245D\010\202\310<Sg\036n/\004\340\026\247\213\017BBSbc\020\332\025\315\035\263_L\365\240\354\310\201\341+\273#\300\037\346\214\312\261^s\2416gNV\340Q\315L\023\020\332\017~$\233\023\"\255\001\274\3458\005\264\343C\324I\"\303\004o@\316\251N\335\222\240\312a\0038*()]\366\032\336\242\304/\326C\224,\315\331Ih\206\010\236\024v\252\223E\\\364L\364Z\214t\256\377\234\212U7\001:g\310e\305\244\306Oc\305\363<\313\312\036?\022<&\345\3048\205\2269\032\365\271=\\\337|[1|L\227AT\310j\220\311c\276n\254P\226\365\203\021\031\201\301\203\222Ab5a\343o\201\245\337\017}G\202\244A\221\250\007tV~O\230\211\242\220\305\3113T\305\335T\204$\277\262(\240E\245\210f@T""\221\315G=\307Y2\273\272\343*\2552h\266!\203\006\222\007-\241'\315\310\007i#\217g/9\306z\376U\321\240\206\230P4\215\327\261\222\033R!\245W|S(\243\007\002+QC\222M\370\273\234\275zVEc5Y\256\330\310\"\213Y\021$8e\226\305D\325E\256\312Z*/\240i\010\330\325\334\316U\223\231R\007\205\333v\231\344V]|i\214Q\033\237n\211\257\214\344\3540\303\354\265\224\200@}h\316\301-E\262\302E\034\322\362\234\036\207\305\370\331<m\315\005\0221\317g\016\023\221\222\261\307\222\243=\236q\321\316vo\016@\367\346c^\376\2528\230B\thm!\201\274\036\223\210)\242\032\036\235&\272\221e\326\204\334\241\271T\327w\003!\271\255\321\005\227\306\362\267\020&PR\r\247\214\230.r1\024\241\013\253r\236-\210\311C\2115\230\213\330\214x\2021\363\"HA\221\220e9\350K=\265\3327\323\264!\205\210\013 \3022A\242\003\201\034\266\251\300\023\005t,\007\262\0213^\330\266k\356\226j\345j\215\222h T\326w\373\022\342n\\w\255\306\361L\2211\275n\342\253\366\203\223\013\212\r\227r\204\332\271y\004\360\224\331\r\024x\323'SN\341\023\014\273\034\216e\226p\\\026\215P\346\333\230\016\034\031\236\315\230\356p\245e\221\235i\262\344\010\245\236\221\275\326S\273\022L\305s\363\364\205Gt0h\302F\346\213\363\235\244\312ev\273\215E_Q\201\3127\253\275\240PS\256\347\203\364`\340-\257\242\216\324$\315\263{\200\201\"\346\030\035O\004\270\240\361\003\007\"z\246\220\033b\3476\324r\360\345\322\2059\2648\034x\231\033\211\246\016Z\316o\202Ut\252\270\372wQlf\263\r\367'\362_\032\267\233\371\244u\254\016w\313t\035\006\323A\016\032\027\243\001\267\367\363y\235\001u\3544\275\"\022\016[\021,\226\226\207\317\016\360l`\272I\223\214=P?\201-$j\222\345*\233J\233\252\345\024'l\213\374\212s\324FS\017g\276\303 \231[\306\332\335w\323\205\300B\205}3\355\003mT\005\024=\002M\006V\322\273`\273\370\206\332\024\201t\314VAR\365\233\372\337a\312\367\277\334\013\252\002\365\343O\013\373\3340\301\200|\017\333\340\341L W\244\303\005\216(\323I\307\311B\023rjy\265\304\365\240\247\213\254Y\200g\343\242\243\316\024\266\304\3031~8\243\314f\335z!\010\364\354C\3622\275l\235n\302\235\204p""\221\0038b'\017\364\033j\036X\212:q\253\225\025\221\333c\340\203/s\t6\004ZBS#\030\034T\177\242\264\036\257iL;\225$\034\206N\t\003~\003\307$\014A\335R\005M\311\010?\r\270\223\277 \2266I\032\207+\242\351\376\272s\327nw\357h\036\323[Rm\315\001\335\304$#\221:\271+\356\205\344|Ani+\252\240\311\177Mb\244Rw\200\344A&L\010\350\021Y\213\200\276\017J\223\343a\243\247!\033\006\016>qq>\200@\245\037\001\033\220\367\027&\002\371\350\231\312>\275FA\316\211\366\324\241\207\303\354\250n+,\362j\202\375dZ\212R}\277nz\224\033@\211\305*>\312ib\305>\253\225A\320\032\224\220\364\324\256=\034#\225R\312\300U\336#\245Z\262\357$\013N\272Y\335H\332\262\274\252\220\302\360X\356\350P\215jX,\317Z\023\322\232\243\231{\275\024\0131g\016\266\305\"\210\351&m2\225\026\266\307<k\335UK\363\233b\211f\323\306\205\356\010!\2442\244S\373!\022s\025\227YB\231\\\222V\242Y\211\023=I!}B\037$'\031\311D\260h#hF\332\022\334\363\0228\360\n\221\031L\352\232\266V\022\264\2255s\323\337\344\311\257\223\237$c\260\333>\267\206\372>g\212:\257z\301_\325\265\301\263\305N(\247\241\237\237j\203\232}\r\233X\364I\3501;\031gqN\305\034\365\257\211\253\302\330i\324\300,\032\223\253\017\031\261\036\231\272\206\020N\2334\356M\\\300\31420uS/\013\264\243L0r\364s&\254\334\003-2\360\207\023;x\023z\346\325\374\301o/\313\355\031\235\352\2727\3112\375\221\216\225t/\213\356\215\342\335R\275/O\366+\273=\001\21342\276v\344\247\323)\351m\0039\256\236\267\n\347B\304\245\266\\\302=14|\213\350\025\341\256\215v\206\372\224\276#>_\201\007\2479\325\341\316\342\263\021\332\004\264\321\343HW\363\234\027\236I\246\231\346\207C\367\352]q\350\3647\274i<\351O\327\252\226\347\321\"\026\350sKL\327<u]h\223a1\325%\247\001\220\231\251\230&\372\034\023K\006\266\231T\345\247))\205\242\357\234\206\354\326\371\371\241\262\266\r\236\333Q\342\354{\270\337\305%\314L\370n\007]]\247iY\232v\256\312E]6\035\034U\025!\370(\2538i\255\253Ej3\316\222\024Z)\270\331u}\"\352c\025\261`0\242\331.\322\241)\340/4\030\212\227#\244VZ\333%\223\036\261\032nQ7\242V\327\223BJ\306\031N\300""\266\352\023\260\262\265xT\255&\2042E\006\224C(1\300t\033n\245\327+\253tm@r\355t1\027T\211W\n\013\335\247\332\023\016AL\346\360x\237CR5\206D$\252\350k\220\310\300\364L\321\256\246\273\223mM\337t\262\352\251\376\306|\366<\225d\221\206\237\026\013\377\354\310\337q\353\233\r8\226d\310\342(V?\361w$S\205\t\t\302\312W\320";
    PyObject *data = __Pyx_DecompressString(cstring, 4358, 2);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (4195 bytes) */
const char* const cstring = "x\332\305X\313{\323\326\266\217S\027Lk\016\tI\010\257\2662\211\211\023BJ\022\0039\241==Nx\234\002\2058\017\336\240\312\262\354\230\330\222-\311I\014\364\234\016=\364PC\r5\324PC\r=\334C\r\375'\360'\334\265\266d[\262\035J\357\351\375\356\367%\322\326Z\373\261\236\277\265\266\347\327v\356\2552\212\314\2639I.q\352\217qe\236\311*j\367s\275\246\356J\342\317%./<\225\271rY\220\027r\262 $f\031\236r\330L5\227\023\344\037\343S\207\267\013\274\372RQ\345y&%\326^?\222DaK\250T\005\221\027^\256o\255o\225\005\376u\207\000\323^oW\313E\341eAT\347\031x\274~\266\261\231ba\"\273\376|\373_\217\037\261q\205]\177\374\360\361\346\326Fj\375\316\326\363\235'\311drc\361\032\253J\254\274\264x-\021Wf\031\330\246\220\025\024\220\323\343#w\363\336Z\017s\226a\2562\013?q\305\242\304s\252\300\312\371L\"^\230e\\\331Y\245\360Nhk\316t>\334\3450\354,\253U\367\023\310\031\264\024\007\212o\035\216\3359\014\330\222\271\307\224\213\234(0\005\205Q%\211QJ\260\351*\343\233\360|\340\004&SS\005\330S8\004\353\251B\226\341T\246(p &\257\360\254\353\201Dw\270\260.\211\373\202\254\202\223\nbAeyIT\205C5\256t\247\254\322-%9+\310\211\265{\233\317f\177\374\004\367h&\330\370\331'\271\275\314\270\302\010b\266\300\211\253\331\202\302e\212B\226:\352\010\207\271L\344\241_\227\256mxv\367\377\317B\324\224\253j\217\315\203+!\"\376\314J\357\260\3012\t\"\212-\210\373\005Y\022K\202\2502\022\330\032\271\324\201q\005\225\314q\005P\r\\\310\344\005\225)\027\016\205\242\302\344d\251\024\340\311\002\227u\231L\226S\271\366\004\272O\256Z,^\22591/\344y*\246\027\0303qe\246':\342\0057>\n\342>W,d\031^*J\262R\346xa\220hLB\022\2135F\251\226\313\222\254R\322l{e\001\363\233\331\025\n\371]u\225\tR\017\nYu\327G\2442u\217\352\345\270\310A\017\244\202w\244\223\252\352Q+]S\270+\251\242\005\317\332Y&Q\202H.UK\250z\251\000\212\253\374.\254cd\351\300s\rdI\242T\205\224\310\200\332`()\307 >\240\023!\204\223+\324\215\203\034\336\236\325\201\226#g\306\251\331\367\230\370\302b\256\244(<\010-\346Q\"QR\333\006\005Y\321\326\350\336\252\330\245!\244x\212\035\226e""\356{^\312\n\274\362}75\200\322\316\331r\355\020\220\023\204\246rcv\342\277/\013\374\237 1|\006\231~^\271\354CO\017\177;\360\320\305\211\236\023\0063`\277\000\343\250\005\003\347\337[\333\364\301v\220\3569\351Y?\025\001\246K\305\257\201\207\372\031\201S\203\3601\220\036\230\357K}\020\350(\372\263\201\014\330\363(z\317\202@\005\353c\365\355\305\003\326\213\276Ow\304\322\274\354\222\001i\330n\315\356\247\273i\335O\247\211\035$\027\304\234\024\244t{\203~\372\240\215\221>`c\265V\026\006\027'\037Ua\371\242\244\010\331.)\220\310\375\344>\357\366\245t\227E\221\006\2538\242\022'/\367Z\261\303\207\346\300\343\365\265>\003\232!\226\027\217h\221\260\035\202h\306\200vS \230\010\376\360\367\007\275\177\237\207\005E}(\345\363\202\214\335\024d\362\203;\2677\036\246\036\2456\331e\226\335\250\035\302?\036\303>\002Cn\n\271Mz\336\263\236l\351\311\221`f\004\363\241\335\237\321\326lg\307E\300'O\334\367s\230\344\255\nfEO\216\0043\240'\037\274\203:\016\352\313\212`.\300\227\007\303\317\335\267\277\207\3637f\234\242`j\210\022\353\3013\247\324D\276 A\322\310Py\nP\2102|&/'W2\222T\304\177\010K\350\277:M\013\317\211t\251\300gh\332\361\260\211\000\t\301\2522\324\252\014\307\357\201\253)zC\224\302i\356\020\343\032*\032\254R\013\222\250,p\031>\220\245\035p\347\261\033r\021?\3208g\013\373\360\247\260lV\342Y_\032w\023\027G\256\356\235\244\025\212\\\031\362\204e\241\013\201&\024^\325\222 \203%\240;a\333\245\337\353T\200{\010\331\306\346JjN\314\311\\IP0:\261\315\300\177\226\266\032\300\256\212p~>#\227\027\257\201e0g\327\267\202\310\022\304\223\000\212\340G\227\214(\202o\267\375\241#\332\t\340\250S\267)X\200\361\224 \312\004\261%\200(\364\243\232Q\270R\031\035\314\242\335\332\330\202o\320[\001'\340\220\316\337u\367p\237l\211S\366\n\324'\340S^A\031\3750\344\037/\374\200qUT\376\261\340\217\266?\230\0011x\304\214\336\310\244\035\006\333\355\203\334o\327*\3761\310\250v0\221\305Q;\224a\254\356b\023\311*\\N(\250BI\331\023jJ\261\240\252E\241(\345Y\320\026\264\204\347!\273\213\217\003\030\013*G\003\027\206""\300\333\305GQ\020\361\205\\)[-B\030\300H\2260\254\344\202\240\340\247\010\001\303\262R\231\206\267\244H(\271\367T\334\216\316\247I\233B\315\354z\337}\262e\274+a6d\335P(\227a\367\262,\2249\031\266/\3270\033\360}\310\356\253\330\370\261l\245\n\306Rk\356\300\225BF|\010\224\204\236B\320\007\377\262\240VeQ\021\2129\374\207VYU :\374q\217\337\356\3560\312\n9\256Z\3049\3252\250\005\2631@\341\001\251\0071\247v\303\264\033\2428\362\374\325\016TE\345\240\301Ve\217\\\005\345\225\032\350\213\347\273O\300\002\265\000\036\221T\256\310\342\210-)\030\306Y\000sxC\220\354\323z\3246\374\340\342\325_\262\200R\025\024/\021\016\0168Y\244\002\321\007\315\200\303C\310\032lD\027\334Ft\201\337\025\370=%@\201\363TNT\203\304N\277:\230\272\320\001:?\237\312D\t\020\224\364\r\341[\\\2202o\001/\225\032\210\262Q{L?\230\271Dw\210\376\230g\272\337T\"f\256Pr{j\352/\005'\260\n^\273Y\274\023\213l?\273\275\276\035A~\032\004<\032\233\376\364\000\313\367\205\342\354P\233\333\225en\216qM\0328\215\222 >\252\370\323\205\217.\203\257\213*\013\211$\346\325]\312\332Y\337J2\230\201\374.'\317\016\301a>=\367\016\262\0019\031O\321\275\203\356\241m^\233\311\311y\252\337\313\327~.\356\264\344'\270\033\270\223:\362A\225`\313\222\302\302\036J\037c\357\300%\273\307\240\270s\014\026\005\214?\326\265\036\232\252\220\027%H\331\252\270'J\007\242\267\352\217\024\373\353\205?R\312\377N\224\377_\263A^\340\376\333\000\004m\022\202\202\177\363vr\340\236\302!\307\253\263C\373R!\353\333\304]\321\243\222\237\240f\002\271\305U\0250\232\333M\262?\323\034\032j\367\226;b\0013\231\275\017\245\262M\344dEx \324\016\240iRh\2338\200\201=\351\266\204\317#\230\355\363Rr\036\265\335\006H\364H\233\034\334\375\007\242\202\253)\223\240\317\366\327\\\302\365\305\354\220\367\203\234W~\207JB\t\333\034|\003J\346E2t\272\021s\302_\327\027IdJ_t\242c\215\277kk\332[#l\33473V\224\334\226\210\364\236\274\377@\"\347\264\3638a\244\021\325R\332\216>c\214\032\323\306[+dMX\034\222\277\322b\332u=\254?4C\346\230\271ff\255\030\222Oi\252\276j\244\215\014\220\307\315W""\366\250\r\344S\365J#\344\214L4\266\265ou\325X5\3230}\332*6c\315E24\326Xt\302\337i\025'\034\251\037\257\277\327\256\350O\214E'2\336H9\221\211\306\033\220\"\022\255\337op\270\317>lqV\277`\254\033\373\346\246YqF.j)gt\262\241h1wL\347li\241\326\3107\332\033c\261\025\035mLj!mR\0179\343q\375)\231\377\247\r#F\377\332\270e\356\202&\343\027\265\333\3721\2357.\230\353\346\276\265e\037\263)\361\236\276\002B\214\177\253\301\327w\332\007\343\007\263\322\242v\013_\320@\240Su\225\214]1\226\r\216\204/\221K\313\246Kk\374\244\307\364\233\306\224\261e~a\256X+\366\n(\030\236\"SI\023\224\301\243\276\324\323N\344d}\2731\212Z\255\325\271z\305\211|\253e\365\270.\203\211cN\004\017\211\"\345\262\0212\350\254\237\033i|=hT\360\220Jw\303(\211\202\335@\265\310hc\242\261\247\303\354\311FU{\324\331\346\206\231\007\225B\366\271f\354\343\261\241\023\227I\374\246yhU\354\260}\277\3115+-zr\314i\277f\364\252\361\310\242\003\0255\266B\255\210\353\351%mS\253\300\026\177\273\250-j\017\364\nD\016\031\2333\346M\336\032\265\250\207\253\215\307\340\251\2113\316\370e\235\323\017\214\034\330S\261\346m\2565r\211\032\3452\230d\331,B<\270\326K\200z\347\314\031k\224\204\247\311\364u3M\365\201\250\324S>}\316j_\242\037=}\256\032O\315\024j2\245O\353\234\0031\234\324+\356\367\254\261b.\232\267\255\220K\375\000\037\260O\002\";\3651:t\342d\375\016l\311\201\t\243g\340U\325~\241\326\216\236\"\247b\372(\265\3658\204m\316L\231\333\326\2503r\246\361V\017\221\330\035{\323V\233\213\315\273ds\213lm\273\241\374%\231\270j<\201\003\326L\016\267\203\231\372i\220\373\016\004Q\ns\352\2066\016\366\252\221D\211\224\024\242\324H\355]\213\206\307--\243\037\327\025\310\244=\353\264E\265\272\016)S\301}]n\210\232\020ms\321|c/\333\034\034\277\014\276R\311\326\023\362\344)y\372\314\231\275f\206\234\3319gv\231*\374\225\035\263\223\366;\222\336\004\031\201\336\372\2577\360\t32\255\247\364W\346\267\226B')\220\261\311\246\342\031#>o\244\234\370e'\376\275Q1\303\346}\213\263T{\265\231nr@m\375\357\227b\260w\274\005I\255\245\265\034\354\225\366\005""\316\267f\345\363\302\2467\300\177\003\007\247}\001\216{\376\006Glj2\300\312m\363\244\225\2662\366\260=O\036\211D\224\220\375N;\rA\017R\364}\250\215U\220-\243\017\353sF\312H\323@$\227\226\314\204\025\263\222\326\273\346(\244\335W\201\330\373\263\341\006p\335\270\256E\365\273F\314X2\322Nt\234\214O{_;\346%j8\205\254\025I\021\200[%j\225T!\332\376\363qh\350\237\303\251ax\245\206\327\361\265>|{\270\325\211\266\321\323\316\010Z\354\241y\014\"xz\006\362y\032b\242E\321$j\3345c\016\203\345\201A/\375\2613\316\231\227\255P\327\035\224\036\327\323z\036`\360\270y`q\237\340\345\3554\t\307I\374\006\010\022\344F\254\210\035\372\004/\322<\212\2138\003g\316\220\231\025t\360\037\242\3125\220\244\362\371\250\362\177\000'\013t&\026\264\317\206\023\277/\021q?\230\377\260\307\354\224\275\335\034k\246\232\333$\275M\266w\310\316\023gf\301\340\234\231\2043\263h\216\232\323\346[(\007\343\366\213f\205l\244[Q\204\346\037\214\177\323\"1no5C\315\361\346\026p\000\014\234\2519\320hj\332\231\272\n\232d\3159+em\333\347A\372\324\347&\250\317\003\275uj\326\2300D+\345y`\325\232\241\302?or\256\335\023\020\341I\003\352]\214\304n@\321X \033\200N\000`o\310\033\226\260\277\376yF+2\255\3376\242n\372\017\032\006\252\333\351\306\274\306\203#{J\033X\004j>\017\rO\312\271\362\275\361\001\262\274\342\\I\232?[i\347\312|\213:B\241\345?\344\314\\\001\204Q\001\344g\256\231' \006\300\005\256yf1TH8A\022\177\007r\004\367\177\000\350s\032\034Q#+/\310\213W\344\025G8\310\351\222\313\275O!fZ/\222%\320$K\262\200L2\221\367\311\376\201\177yR\377\215$3$\223'y\227\373\216\274{\337\236\240\222\2515\373\222\235\"C\000\313\330i\r\327\023\215\351\006G&W\254a\250\340\341\343\277\313\365\261z\212v\030\370\245\326\027\2751\355\317\"\365c\320\253\3547\322\320\207\201\317\226\353<t0\321\263\332q\364k\213\032)E& \250A~\2648nQ!\221+\306M\323m8\177Oy\315\313]h\260\356Bp\202\212\031\254\212\357\265)\3555\231\373\225\374\n\032WH\005d\377\r\020\353\337\241\016p9\336\254\227\020W\337\220\033\220\0055\340\274\013\335\301\tw\206\357\342\353\356""\360\275a\032L\240Bt\262\361\001\214\371\036\272\217\"\2264\210\326_4\332I=\2026\261\357\253\3675\243\237\005\017-`\363\023\255\377\253\221\362\332O\014L_\332\267\033\343X\273\031\276\351\016#\320m\236\323c-\354\257q\311y\355;\343+3\366\3612\016\241\245\376\370\267\241\023\321\372\255FVK@\224\317\230\223\000ea\373\001\326gj\267\250\253k\232\266\263\370\032\203\"\003\315\2273~\226\234]\202\004\346\234\211\357\300\337\243\177\206\320\032\277\240\255\352\233\272\177\227\321\213\332\272V\371\213\2179\257\315\351)\022\377\211\374\264\201\370\322\306\275[\220\006''\0332\364\341a\375>^\016\234\3507p*\004P\010|\021\035!#s\320\024qGO\272\010\350\3223\355\242\276m\2347\227 \211?\261\327y\375:\230\377\222y\317Z\266\3366\207\233\261OM>\007I\366\326\0346c\237\3361\251\277\007mw\255];\337\004\014\305Yc\324\210Q\257?pF\240L/\000f\306\234\321\013\320;\247?Ah\215L6\336!\336\373\346t\254\360\300P\341\032\261\330jK\322\267\377\200\325-\000\2579-E\276Y\263\347\233\334\357'\353i'|\202\234\300z\216o,\366\230\217x\235 C\023p\265\010G\353\353\230\230\363d\376G+\035\004\244\367d\025\320\010\002\223'|\273\037\372\213\001)|\306\205\024(\003\267\254\037\260<\342\005i\023\001\245sS\372\272\276TO\3279\352\n\250\257X\024\027A\212\"\342\350y\314\333\023\316\210\333\342}\342\20553Y\247\251\033\"\2431}\034\013\326\021\244\003Hr\031\312\356\266>\001\220N\013B\274Q\321\302\332Cc\330\210\323\236\365\027\373\264}\235\026\314\347\344\3113\362\014\354\364\332\333hZ_\327+p\363\270\013\201\227\362h\t\343\013c\321\360@\320\275\206\177\351D\316`5\364t@\006\\\273)\\\320\373\025\270\312\010\321\006\200\234\273\356v\007#\215/\0327\265Y\332\316@r\345i$5\036B\3070\001\255O\332\310\323\253\365\034\224\322\235f\274)\2234m\370a\312}\215\323\252^\251\333\002\304\237\201\233\371\264]\"[ 9@\366\313\226\007]\023\032\347t\206YZ\207\227!\025\335\026]\001\207\335nF\275\306\342\363\246\265\274\037\005\340:\r\267v\331\0347_\300\005\364\013{\t:\225\213\300\207;\211\357\007\202\035m\032\004\030\235h\274\200\272\022\006y\301""\026f\022\312\350\252\235\266)\343\025T\345i=\013WO\016\310I\353\0036$$<\331\250\270\000\375\371H\337\205\366@?\323\007\354\327\241q\361Y\007\273\231\313:]\363X\203\333=\376rA\357\0020f\364\2207\376\037/\313\3246";
    PyObject *data = __Pyx_DecompressString(cstring, 4195, 1);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #else /* compression: none (9812 bytes) */
const char* const bytes = ",BUG: src_format=%s, dst_format=%sCythonImageWrapper.free() cython_buffer=%#xDict[str, Any]NoneSequence[CSCSpec]Sequence[str]Tuple[int, int]XPRA_CSC_CYTHON_%s_COLORSPACESYUV444P10_to_r210(%s) strides=%sYUV444P_to_RGB(%s) strides=%s)  - .?allocate_rgb(%i) buffer_size=%s, dst size=%s, stride=%sallocate_yuv(%s, %i) buffer_size=%s, sizes=%s, strides=%sbuffer for G plane is too small: buffer for Y plane is too small:  bytes, expected at least csc_cython(csc_cython.Converter.init_context%scsc_cython: byteorder(BGRX)=%scsc_cython: byteorder(BGR)=%scsc_cython: byteorder(RGBX)=%scsc_cython: byteorder(RGB)=%scsc_cython: %s endian:disabledo_RGBP_to_RGB(%s) strides=%sdo_RGB_to_YUV420P(%s, %i, %i, %i, %i) input=%s, strides=%sdo_RGB_to_YUV444P(%s, %i, %i, %i, %i) input=%s, strides=%sdo_YUV420P_to_RGB(%s) strides=%senableenvironment override for %s: %sfailed to get pixels from %sfailed to read pixel data from %s for full-rangegcinput plane '%s' is too small: %i bytesinvalid colorspace override for %s: %s (only supports: %s)invalid image height: invalid image width: invalid input colorspace: invalid input format: %s planesinvalid output colorspace: invalid pixel format '%s'isenabled (minimum is mismatch in rowstrides:  (must be one of r210_to_BGR48(%s) input=%s, strides=%sr210_to_YUV444P10(%s) input=%s, strides=%s%s took %.1fmsscaling is not supported for  to unsupported dst format xpra/codecs/csc_cython/converter.pyxAnyBGRBGR48BGRXBGRX_to_YUV420PBGRX_to_YUV444PBGR_to_YUV420PBGR_to_YUV444PBppCOLORSPACESCSCSpecConverterConverter.BGRX_to_YUV420PConverter.BGRX_to_YUV444PConverter.BGR_to_YUV420PConverter.BGR_to_YUV444PConverter.GBRP10_to_r210Converter.GBRP_to_BGRXConverter.GBRP_to_RGBXConverter.RGBX_to_YUV420PConverter.RGBX_to_YUV444PConverter.RGB_to_YUV420PConverter.RGB_to_YUV444PConverter.YUV420P_to_BGRConverter.YUV420P_to_BGRXConverter.YUV420P_to_RGBConverter.YUV420P_to_RGBXConverter.YUV444P10_to_r210Converter.YUV444P_to_RGBConverter.cleanConverter.convert_imageConverter.get_dst_for""matConverter.get_dst_heightConverter.get_dst_widthConverter.get_infoConverter.get_src_formatConverter.get_src_heightConverter.get_src_widthConverter.get_typeConverter.init_contextConverter.is_closedConverter.r210_to_BGR48Converter.r210_to_YUV420PConverter.r210_to_YUV444P10Converter.validate_planar3_imageConverter.validate_rgb_imageCythonImageWrapperCythonImageWrapper._cnCythonImageWrapper.freeDictGBRGBRPGBRP10GBRP10_to_r210GBRP_to_BGRXGBRP_to_RGBXImageWrapperListLoggerNonePACKEDPLANAR_3__Pyx_PyDict_NextRefRGBRGBXRGBX_to_YUV420PRGBX_to_YUV444PRGB_to_YUV420PRGB_to_YUV444PSequenceTupleUUstrideVVstrideYYUVYUV420PYUV420P_to_BGRYUV420P_to_BGRXYUV420P_to_RGBYUV420P_to_RGBXYUV444PYUV444P10YUV444P10_to_r210YUV444P_to_RGBYUVstridesYstrideallocate_rgballocate_yuvassert_no_scalingasyncio.coroutinesbcbgr48boolboolgetbufbyteordercan_scalecbcleancline_in_traceback_cncodec_classcodec_typecollections.abcconvert_imageconvertercscsccythoncython_bufferdivdivs__doc__dst_formatdst_heightdst_stridedst_widthelapsed__enter__enumerateenv_overrideenviron__exit__fmtfnframesfreefullfull_range__func__gbrp10getget_CSget_dst_formatget_dst_heightget_dst_widthget_heightget_infoget_pixelsget_planesget_rowstrideget_specsget_src_formatget_src_heightget_src_widthget_subsampling_divsget_typeget_versionget_widthhheightheight_maskiimagein_csinfoinit_contextinit_context.<locals>.allocate_rgbinit_context.<locals>.allocate_yuvinit_context.<locals>.assert_no_scalinginput_colorspaceinput_strideinput_stridesintis_closed_is_coroutineis_thread_safeitemskeyslittlelog__main__max_hmax_w__metaclass__min_hmin_lenmin_w__module____mro_entries____name__optionsosout_csout_cssoutput_colorspacesoutput_imagepixelspixels_per_secondplanespps__prepare__py_buf__pyx_vtable__quality__qualname__rr210r210_to_BGR48r210_to_YUV420Pr210_to_YUV444P10returnselfselftestset_full_range__set_name__setdefaultsetup_costspecsspeedsplitsrc_formatsrc_heightsrc_stridesrc_widthstartstrstridesupersys__test__testcsctimetotal_time_mstypedicttypingvvalid""_optionsvalidate_planar3_imagevalidate_rgb_imagevaluesversionwwarnwidthwidth_maskxxdivxpra.codecs.checksxpra.codecs.constantsxpra.codecs.csc_cythonxpra.codecs.csc_cython.converterxpra.codecs.imagexpra.logxpra.util.objectsydivPyObject *(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level)\000PyObject*(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char)\000int(PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs)\000int(PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name)\000int(PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs)\000int(PyObject *obj, PyTypeObject *type, const char *name, int exact)\000void(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause)\000__Pyx__Import\000__Pyx_PyUnicode_Join\000__Pyx_ParseKeywordsTuple\000__Pyx_ParseKeywordDictToDict\000__Pyx_ParseKeywordDict\000__Pyx__ArgTypeTest\000__Pyx_RaisePyObject *(PyObject *)\000void (void *)\000void *(size_t)\000buffer_context\000memfree\000memalign\320\000\022\220!\330\004\013\2101\320\010#\2401\330\014\023\2209\230B\230j\250\004\250J\260b\270\014\320Do\320o{\320{|\320\010\031\230\032\2401\330\014\020\220\014\230A\230U\240'\250\021\250$\250j\270\001\270\025\270a\330\014\020\220\n\230!\2305\240\004\240L\260\001\260\023\260B\260d\270!\330\014\020\220\017\230t\240:\250Q\250b\260\001\260\024\260\\\300\021\300!\330\014\017\210q\220\001\330\020\025\220T\230\036\240t\250:\260Q\260d\270$\270l\310!\3101\320\000\023\2201\330\004\037\230q\330\004\010\210\007\210{\230+\240V\2501\330\010\024\220A\330\010\025\220^\2401\330\010\014\210J\220a""\330\014\017\210v\220T\230\030\240\033\250C\250v\260R\260q\330\020\034\230A\330\021\027\220s\230!\330\020\034\230A\330\014\017\210v\220S\230\001\340\020\035\230^\2501\340\014\021\220\027\230\001\230\027\240\001\330\024%\240W\320,@\300\001\330\024 \240\013\250;\260h\270a\330\024\034\230D\240\006\240c\250\033\260C\260v\270S\300\006\300a\330\024\034\230G\2408\2501\330\024\036\230a\330\024\037\230|\250<\260q\340\004\013\2101\320\004\033\2301\330\010\017\210t\320\023+\2503\250a\320\004\"\320\"3\2601\330\010\017\210t\220?\240!\2407\250#\250S\260\003\2608\2708\3008\3101\320\004#\320#4\260A\330\010\034\230D\240\005\240Q\330\010\r\210T\220\021\330\010\014\210B\210a\210q\330\010\036\230d\240%\240r\250\021\250!\330\010\013\2101\320\014\036\230d\240&\250\001\250\021\330\010\014\210I\220Q\330\010\014\210K\220q\330\010\017\210q\320\004#\320#4\260A\330\010\014\320\014\037\230q\240\001\330\010\021\220\025\220k\240\021\330\010\027\220u\230N\250!\330\010\013\2101\320\0146\260g\270S\300\001\300\031\310!\360\006\000\t&\320%7\260x\270q\300\004\300J\310a\310q\340\010\036\230d\240!\330\010\036\230d\240!\330\010'\240u\250N\270!\330\010'\240t\250<\260q\270\001\340\010\020\220\n\230!\2302\230R\230q\360\006\000\016\034\2301\230K\240q\330\014\023\320\023*\250,\260c\270\021\270!\330\014\017\210u\220O\2401\330\025\026\330\024&\240a\240w\250f\260C\260s\270,\300a\340\020\"\240!\2407\250&\260\003\2603\260l\300!\330\010\017\210t\320\023(\250\001\250\031\260'\270\021\320\004$\320$5\260Q\330\010\014\320\014#\2401\240A\330\010\021\220\025\220k\240\021\330\010\030\230\005\230^\2501\330\010\013\2101\320\014-\250W\260A\360\006\000\t#\240$\240a\330\010#\2404\240q\360\006\000\t#\240)\2508\2601\260D\270\001\330\010#\2404\240|\2601\260A\330\010(\250\004\250A\360\014\000\t\r\210E\220\025\220a\220q\330\014\026\220a\220u\230M\250\021\250!\330\014\017\320\017!\240\021\240&\250\001\250\024\250Q\250f\260A\260T\270\021\330\020\026\220j\240\001\320!E\300R\300t\3101\310F\320RS\320ST\330\014\017\210q\220\005\320\025-""\250V\2601\260B\260a\330\014\026\220j\240\001\240\022\2401\240E\250\033\260A\330\014\023\2206\230\024\230R\230y\320(m\320ms\320sy\320yz\340\010\017\210t\220;\230b\240\007\240s\250$\250k\270\022\2701\330\010\013\2105\220\017\230q\330\014\017\210t\220;\230b\240\001\330\025\026\330\024(\250\001\250\034\260^\3003\300a\300t\3103\310a\310t\320SV\320VW\320WX\330)0\260\001\330)*\330)3\2601\260D\270\n\300!\3004\300z\320QR\320RS\330)*\340\025\026\330\024(\250\001\250\034\260^\3003\300a\300t\3103\310a\310t\320SV\320VW\320WX\330)0\260\001\330)*\330)3\2601\260D\270\n\300!\3004\300z\320QR\320RS\330)*\340\014\017\210t\220;\230b\240\001\330\020$\240A\240\\\260\036\270s\300!\3004\300s\310!\3104\310s\320RS\320ST\330%,\250A\330%&\330%/\250q\260\004\260J\270a\270t\300:\310Q\310a\330%&\340\020$\240A\240\\\260\036\270s\300!\3004\300s\310!\3104\310s\320RS\320ST\330%,\250A\330%&\330%/\250q\260\004\260J\270a\270t\300:\310Q\310a\330%&\330\010\014\210E\220\025\220a\220q\330\014\034\230A\230Q\230f\240A\240Q\330\010\017\210t\320\023(\250\001\250\036\260q\320\004$\320$5\260Q\330\010\014\320\014#\2401\240A\330\010\021\220\025\220k\240\021\330\010\030\230\005\230^\2501\330\010\036\230d\240!\330\010\036\230d\240!\330\010'\240}\260A\260Q\330\010'\240t\250<\260q\270\001\330\010\017\210}\230A\230R\230r\240\033\250D\260\r\270Q\270b\300\002\300,\320Nn\320no\330\010\017\210z\230\022\2301\230A\230Q\330\010\017\210z\230\022\2301\230A\230Q\330\010\017\210t\220:\230Q\230b\240\002\240*\250A\250Q\360\006\000\t#\320\"2\260(\270!\2704\270z\310\021\310!\360\n\000\t\r\210E\220\025\220a\220q\330\014\017\320\017!\240\021\240&\250\001\250\024\250Q\250f\260A\260T\270\021\330\020\026\220j\240\001\320!E\300R\300t\3101\310F\320RS\320ST\330\014\022\220!\2205\230\014\240F\250!\2502\250Q\330\014\024\320\024$\240F\250!\2502\250U\260\"\260J\270a\270s\320Bl\320lo\320ot\320tu\320uy\320y\177\360\000\000@\002A\002\360\000\000A\002C\002\360\000\000C\002D\002\340\010\013\2105\220\017\230q\330\021\022\330\020#\2401\240L\260\006\260a""\330$'\240q\330$0\260\001\340\014\037\230q\240\014\250F\260!\330 #\2401\330 ,\250A\330\010\014\210E\220\025\220a\220q\330\014\034\230A\230Q\230f\240A\240Q\330\010\017\210t\320\023(\250\001\250\031\260&\270\001\320\004$\320$5\260Q\330\010\017\210t\320\023%\240Q\240g\250S\260\007\260w\270a\320\004$\320$5\260Q\330\010\017\210t\320\023%\240Q\240g\250S\260\007\260w\270g\300Q\320\004%\320%6\260a\330\010\017\210t\320\023%\240Q\240g\250S\260\010\270\010\300\001\320\004%\320%6\260a\330\010\017\210t\320\023%\240Q\240g\250S\260\010\270\010\300\010\310\001\320\004%\320%6\260a\330\010\017\210t\320\023%\240Q\240g\250S\260\003\2603\260a\320\004'\320'8\270\001\330\010\014\320\014#\2401\240A\330\010\021\220\025\220k\240\021\330\010\030\230\005\230^\2501\330\010\013\2101\320\0140\260\007\260q\360\006\000\t#\240$\240a\330\010#\2404\240q\360\006\000\t#\240)\2508\2601\260D\270\001\330\010#\2404\240|\2601\260A\360\014\000\t\r\210E\220\025\220a\220q\330\014\026\220a\220u\230M\250\021\250!\330\014\017\320\017!\240\021\240&\250\001\250\024\250Q\250f\260A\260T\270\021\330\020\026\220j\240\001\320!E\300R\300t\3101\310F\320RS\320ST\330\014\017\210q\220\005\320\025.\250f\260A\260R\260q\330\014\026\220j\240\001\240\022\2401\240E\250\033\260A\330\014\023\2206\230\024\230R\230y\320(m\320ms\320sy\320yz\340\010\013\2105\220\017\230q\330\021\022\330\020&\240a\240|\260>\300\023\300A\300T\310\023\310A\310T\320QT\320TU\320UV\330'.\250a\330'(\330'1\260\021\260$\260j\300\001\300\024\300Z\310q\320PQ\340\014\"\240!\240<\250~\270S\300\001\300\024\300S\310\001\310\024\310S\320PQ\320QR\330#*\250!\330#$\330#-\250Q\250d\260*\270A\270T\300\032\3101\310A\330\010\014\210E\220\025\220a\220q\330\014\034\230A\230Q\230f\240A\240Q\330\010\017\210t\320\023(\250\001\250\036\260q\320\004'\320'8\270\001\330\010\014\320\014\037\230q\240\001\330\010\021\220\025\220k\240\021\330\010)\250\025\250n\270A\330\010\013\2101\320\014:\270'\300\023\300A\300Y\310a\360\006\000\t#\240(\250!\2504\250q\330\010!\320!6\260l\300.\320PR\320RV""\320V^\320^_\320_`\330\010!\320!6\260l\300.\320PR\320RV\320V^\320^_\320_`\330\010!\320!6\260l\300.\320PR\320RV\320V^\320^_\320_`\340\010$\240D\250\014\260A\260Q\330\010$\240D\250\014\260A\260Q\330\010$\240D\250\014\260A\260Q\360\006\000\016\034\2301\230K\240q\330\014\022\220,\230c\240\021\240!\330\014\017\210u\220O\2401\330\025\026\330\024*\250!\2503\250c\260\023\260A\330+/\250|\2704\270q\330+4\260I\270Q\330+,\340\020&\240a\240s\250#\250S\260\001\330'+\250<\260t\2701\330'0\260\t\270\021\330'(\330\010\017\210t\320\023)\250\021\250!\320\004(\320(9\270\021\330\010\017\210u\220K\230r\240\022\240<\250y\3208Z\320Z\\\320\\a\320al\320lm\330\010\017\210u\220J\230b\240\002\240$\240l\3202_\320_d\320dn\320nr\320rv\320vw\330\010\017\210u\220K\230r\240\022\2404\240}\3204b\320bg\320gr\320rv\320vz\320z{\330\010\017\210u\220K\230t\320#B\300\"\300A\320\000$\240A\330\004\010\210\002\210(\220$\220a\320\0278\270\002\270!\330\004\007\200r\210\023\210A\330\010\017\210q\330\004\007\200t\2101\330\010\017\210q\330\004\023\2201\330\004\010\210\006\210a\210v\220Q\220a\330\010\013\2103\210c\220\021\330\014\030\230\007\230q\240\001\340\014\017\210u\220A\320\025S\320SZ\320Z^\320^_\330\004\007\200q\320\010+\2507\260!\330\004\013\2101\200A\330\010\017\210q\320\004F\300a\330FT\320Ta\320ab\340\010\017\210{\230#\230]\320*`\320`l\320lq\320qr\320r}\360\000\000~\001C\002\360\000\000C\002D\002\330\010\017\210{\230#\230[\250\001\250\035\3206m\320my\360\000\000z\001E\002\360\000\000E\002F\002\360\000\000F\002G\002\330\010\013\2101\210A\330\014\027\220|\240<\250{\270,\300l\320RS\330\010\014\210M\230\021\330\010\014\210N\230!\330\010\014\210M\230\021\330\010\014\210N\230!\330\010\014\210N\230!\330\010\014\210N\230!\330\010\014\210N\230'\240\030\250\021\250.\270\001\340\010\014\210H\220A\330\010\014\210J\220a\360\006\000\t\r\210E\220\025\220a\220q\330\014\020\220\014\230A\230U\240!\330\014\020\220\n\230!\2307\240!\330\014\020\220\010\230\001\230\031\240!\340\010#\2401\360\006\000\t\032\230\037\250\n\260!\360&""\000\t\032\230\032\2401\360\016\000\t\014\210;\220d\230(\240(\250'\260\027\270\010\300\004\300K\310t\320S^\320^_\330\014\017\210{\230#\230Q\330\020\034\230A\230Q\330\020\023\220:\230R\230q\330\024\030\320\0302\260$\260a\330\025\037\230r\240\021\330\024\030\320\0302\260$\260a\330\025\037\230r\240\021\330\024\030\320\0302\260$\260a\330\025\037\230r\240\021\330\024\030\320\0302\260$\260a\340\024\033\230:\240R\240q\330\024\030\320\0302\260$\260a\330\021\034\230C\230q\330\020\034\230A\230Q\330\020\023\220:\230R\230q\330\024\030\320\0302\260$\260a\330\025\037\230r\240\021\330\024\030\320\0302\260$\260a\330\025\037\230r\240\021\330\024\030\320\0302\260$\260a\330\025\037\230r\240\021\330\024\030\320\0302\260$\260a\340\024\032\230*\240A\320%?\320?P\320PQ\340\020\026\220j\240\001\320!;\2701\330\r\027\220r\230\027\240\004\240J\250b\260\001\330\014\035\230Q\330\014\030\230\001\230\021\330\014\020\320\020*\250$\250a\330\r\027\220r\230\027\240\004\240J\250b\260\001\330\014\035\230Q\330\014\030\230\001\230\034\240Q\330\014\020\320\020*\250$\250a\330\r\027\220r\230\034\240T\250\032\2602\260Q\330\014\035\230Q\330\014\030\230\001\230\021\330\014\020\320\020*\250$\250a\330\r\027\220r\230\032\2405\250\n\260\"\260G\2703\270j\310\002\310!\330\014\035\230Q\330\014\030\230\001\230\021\330\014\020\320\020*\250$\250a\330\r\027\220r\230\031\240$\240j\260\002\260!\330\014\035\230Q\330\014\030\230\001\230\021\330\014\020\320\020*\250$\250a\330\r\027\220r\230\032\2404\240{\260$\260h\270h\300g\310Q\340\014\030\230\001\230\023\230A\230Q\330\014\017\210z\230\022\2301\330\020\024\320\024.\250d\260!\330\021\033\2302\230Q\330\020\024\320\024.\250d\260!\330\021\033\2302\230Q\330\020\024\320\024.\250d\260!\340\020\027\220z\240\022\2401\330\020\024\320\024.\250d\260!\330\r\027\220r\230\027\240\004\240K\250t\2608\2701\340\014\030\230\001\230\021\330\014\017\210z\230\022\2301\330\020\024\320\024.\250d\260!\340\020\027\220z\240\022\2401\330\020\024\320\024.\250d\260!\340\014\022\220*\230A\320\035B\300,\310a""\200\r\210Q\330\004\t\320\t#\2401\330\004\t\320\t'\240q\330\004\013\2101\210K\220q\320\000\025\220Q\330\004\014\210C\210q\320\004,\320,=\270Q\330\010\017\210u\220K\230r\240\022\240<\250{\320:\\\320\\^\320^c\320cn\320no\330\010\017\210u\220J\230b\240\002\240$\240l\3202_\320_d\320dn\320nr\320rv\320vw\330\010\017\210u\220K\230r\240\022\2404\240}\3204b\320bg\320gr\320rv\320vz\320z{\330\010\017\210u\220K\230t\320#B\300\"\300A\320\004\026\220a\330\010\013\2101\320\014;\270<\300t\3101\330\010\r\210R\210u\220A\330\010\r\210T\220\021\330\010\013\2102\210Q\210a\330\014\020\320\020!\240\021\330\014\023\2201\220J\230l\250!\320\004\032\230!\330\010\t\330\020\036\230d\240!\330\020\036\230d\240!\330\020\036\230d\240!\330\020\036\230d\240!\330\020\036\230d\240!\340\010\013\2104\210q\330\014\020\220\001\320\021!\240\024\240Q\330\010\013\2104\210q\330\014\020\220\001\320\021!\240\024\240Q\330\010\013\2104\210w\220a\220r\230\024\230T\240\025\240a\240q\330\014\022\220%\220q\230\004\230L\250\002\250%\250q\260\004\260M\300\022\3005\310\001\310\024\310Y\320VX\320X\\\320\\]\330\014\020\220\001\320\021$\240C\240q\250\004\250F\260\"\260A\330\014\020\220\001\320\021(\250\003\2501\250A\330\010\017\210q\320\000\022\220!\330\004\005\330\010\026\220k\240\021\320\004\032\230!\330\010\017\210q\320\010\031\230\037\250\n\260!\330\014\023\320\023'\240q\250\001\330\014\023\2206\320\0315\260R\260q\330\014\020\220\003\2207\230)\2401\240A\330\020\026\220g\230Q\330\020\024\220L\240\001\240\025\240g\250Q\250g\260Q\260d\270*\300A\300U\310%\310r\320QW\320WX\330\020\024\220J\230a\230u\240D\250\014\260A\260S\270\002\270'\300\021\300$\300m\320SX\320XZ\320Z[\340\014\020\220\010\230\001\230\025\230a\330\014\020\220\010\230\001\230\025\230d\240(\250!\2503\250b\260\004\260J\270a\270s\300\"\300D\310\014\320TU\320UV\330\014\020\220\010\230\001\230\025\230d\240(\250!\2503\250b\260\004\260J\270a\270s\300\"\300D\310\014\320TU\320UV\340\014\020\220\017\230t\2408\2501\250C\250r\260\024\260Z\270q\300\003\3002\300T\310\034""\320UV\320VW\330\014\017\210q\220\001\330\020\025\220U\230$\230a\330\021\025\220Z\230q\240\004\240D\250\n\260!\2604\260t\270:\300Q\300a\330\021\025\220\\\240\021\240$\240d\250,\260a\260t\2704\270|\3101\310A\320\004\027\220q\360\006\000\t\r\210M\230\021\330\010\014\210N\230!\330\010\014\210M\230\021\330\010\014\210N\230!\330\010\014\210N\230!\330\010\014\210N\230!\330\010\014\210H\220A\330\010\014\210J\220a\330\010\014\210E\220\025\220a\220q\330\014\020\220\014\230A\230U\240!\330\014\020\220\n\230!\2305\240\001\330\014\020\220\010\230\001\230\025\230a\330\010\014\320\014&\240a\330\010\014\210O\2301\320\004\037\230q\330\010\017\210t\2201\320\004 \240\001\330\010\017\210t\2201";
    PyObject *data = NULL;
    CYTHON_UNUSED_VAR(__Pyx_DecompressString);
    #endif
    PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
    Py_ssize_t pos = 0;
    for (int i = 0; i < 308; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
      if (likely(string) && i >= 60) PyUnicode_InternInPlace(&string);
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
      stringtab[i] = string;
      pos += bytes_length;
    }
    for (int i = 308; i < 342; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
      stringtab[i] = string;
      pos += bytes_length;
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    Py_XDECREF(data);
    for (Py_ssize_t i = 0; i < 342; i++) {
      if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    #if CYTHON_IMMORTAL_CONSTANTS
    {
      PyObject **table = stringtab + 308;
      for (Py_ssize_t i=0; i<34; ++i) {
        #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
        #if PY_VERSION_HEX < 0x030E0000
        if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
        #else
        if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
        #endif
        {
          Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
        }
        #else
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
        #endif
      }
    }
    #endif
  }
  {
    PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0;
    int8_t const cint_constants_1[] = {0,1,2,3,4,6,50};
    int16_t const cint_constants_2[] = {16384};
    for (int i = 0; i < 8; i++) {
      numbertab[i] = PyLong_FromLong((i < 7 ? cint_constants_1[i - 0] : cint_constants_2[i - 7]));
      if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_number_tab;
    for (Py_ssize_t i=0; i<8; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_codeobjects ### */
typedef struct {
    unsigned int argcount : 4;
    unsigned int num_posonly_args : 1;
    unsigned int num_kwonly_args : 1;
    unsigned int nlocals : 4;
    unsigned int flags : 10;
    unsigned int first_line : 11;
} __Pyx_PyCode_New_function_description;
/* NewCodeObj.proto */
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
);


static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  PyObject* tuple_dedup_map = PyDict_New();
  if (unlikely(!tuple_dedup_map)) return -1;
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 488};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_assert_no_scaling, __pyx_mstate->__pyx_kp_b_iso88591_1_9Bj_Jb_Doo, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 491};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_fmt, __pyx_mstate->__pyx_n_u_Bpp, __pyx_mstate->__pyx_n_u_divs, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_div, __pyx_mstate->__pyx_n_u_xdiv, __pyx_mstate->__pyx_n_u_ydiv};
    __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_allocate_yuv, __pyx_mstate->__pyx_kp_b_iso88591_q_6_5Rq_7_1A_gQ_L_gQgQd_AU_rQWW, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 510};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_Bpp};
    __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_allocate_rgb, __pyx_mstate->__pyx_kp_b_iso88591_1_AU_j_a_5_L_Bd_t_Qb_q_T_t_Qd_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 64};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_in_cs, __pyx_mstate->__pyx_n_u_valid_options, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_env_override, __pyx_mstate->__pyx_n_u_cs};
    __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_CS, __pyx_mstate->__pyx_kp_b_iso88591_A_a_8_r_A_q_t1_q_1_avQa_3c_q_uA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 94};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_type, __pyx_mstate->__pyx_kp_b_iso88591_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 98};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_version, __pyx_mstate->__pyx_kp_b_iso88591_Q_Cq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 102};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_info, __pyx_mstate->__pyx_kp_b_iso88591_k, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 108};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_specs, __pyx_mstate->__pyx_n_u_in_cs, __pyx_mstate->__pyx_n_u_out_css, __pyx_mstate->__pyx_n_u_can_scale, __pyx_mstate->__pyx_n_u_width_mask, __pyx_mstate->__pyx_n_u_height_mask, __pyx_mstate->__pyx_n_u_out_cs};
    __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_specs, __pyx_mstate->__pyx_kp_b_iso88591_1_q_V1_A_1_Ja_vT_CvRq_A_s_A_vS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 135};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_cb};
    __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_free, __pyx_mstate->__pyx_kp_b_iso88591_a_1_t1_RuA_T_2Qa_1Jl, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 143};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_cn, __pyx_mstate->__pyx_kp_b_iso88591_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {8, 0, 0, 15, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 464};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_src_width, __pyx_mstate->__pyx_n_u_src_height, __pyx_mstate->__pyx_n_u_src_format, __pyx_mstate->__pyx_n_u_dst_width, __pyx_mstate->__pyx_n_u_dst_height, __pyx_mstate->__pyx_n_u_dst_format, __pyx_mstate->__pyx_n_u_options, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_assert_no_scaling, __pyx_mstate->__pyx_n_u_assert_no_scaling, __pyx_mstate->__pyx_n_u_allocate_yuv, __pyx_mstate->__pyx_n_u_allocate_yuv, __pyx_mstate->__pyx_n_u_allocate_rgb, __pyx_mstate->__pyx_n_u_allocate_rgb};
    __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_init_context, __pyx_mstate->__pyx_kp_b_iso88591_FaFTTaab_llqqrr_C_C_D_6mmy_z_E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 588};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_clean, __pyx_mstate->__pyx_kp_b_iso88591_q_M_N_M_N_N_N_HA_Ja_E_aq_AU_5_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 606};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_is_closed, __pyx_mstate->__pyx_kp_b_iso88591_1_t_3a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 609};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_pps};
    __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_info, __pyx_mstate->__pyx_kp_b_iso88591_d_d_d_d_d_4q_Q_4q_Q_4war_T_aq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 634};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_src_width, __pyx_mstate->__pyx_kp_b_iso88591_q_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 637};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_src_height, __pyx_mstate->__pyx_kp_b_iso88591_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 640};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_src_format, __pyx_mstate->__pyx_kp_b_iso88591_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 643};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_dst_width, __pyx_mstate->__pyx_kp_b_iso88591_q_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 646};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_dst_height, __pyx_mstate->__pyx_kp_b_iso88591_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 649};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_dst_format, __pyx_mstate->__pyx_kp_b_iso88591_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 652};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_get_type, __pyx_mstate->__pyx_kp_b_iso88591_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 656};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_fn, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_elapsed};
    __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_convert_image, __pyx_mstate->__pyx_kp_b_iso88591_4A_D_Q_T_Baq_d_r_1_d_IQ_Kq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 667};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_r210_to_YUV420P, __pyx_mstate->__pyx_kp_b_iso88591_6a_t_QgS_3a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 670};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_BGR_to_YUV420P, __pyx_mstate->__pyx_kp_b_iso88591_5Q_t_QgS_wa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 673};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_RGB_to_YUV420P, __pyx_mstate->__pyx_kp_b_iso88591_5Q_t_QgS_wa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 676};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_BGRX_to_YUV420P, __pyx_mstate->__pyx_kp_b_iso88591_6a_t_QgS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 679};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_RGBX_to_YUV420P, __pyx_mstate->__pyx_kp_b_iso88591_6a_t_QgS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 804};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_BGR_to_YUV444P, __pyx_mstate->__pyx_kp_b_iso88591_5Q_t_QgS_wa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 807};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_RGB_to_YUV444P, __pyx_mstate->__pyx_kp_b_iso88591_5Q_t_QgS_wa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 810};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_BGRX_to_YUV444P, __pyx_mstate->__pyx_kp_b_iso88591_6a_t_QgS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 813};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_RGBX_to_YUV444P, __pyx_mstate->__pyx_kp_b_iso88591_6a_t_QgS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 888};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_validate_rgb_image, __pyx_mstate->__pyx_kp_b_iso88591_9_uKr_y8ZZ_aallm_uJb_l2__ddnnrr, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 894};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_pixels, __pyx_mstate->__pyx_n_u_input_stride, __pyx_mstate->__pyx_n_u_output_image, __pyx_mstate->__pyx_n_u_Y, __pyx_mstate->__pyx_n_u_U, __pyx_mstate->__pyx_n_u_V, __pyx_mstate->__pyx_n_u_Ystride, __pyx_mstate->__pyx_n_u_Ustride, __pyx_mstate->__pyx_n_u_Vstride, __pyx_mstate->__pyx_n_u_buf, __pyx_mstate->__pyx_n_u_bc};
    __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_r210_to_YUV444P10, __pyx_mstate->__pyx_kp_b_iso88591_8_q_k_nA_1_AYa_4q_6l_PRRVV____6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 926};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_planes, __pyx_mstate->__pyx_n_u_input_strides, __pyx_mstate->__pyx_n_u_width, __pyx_mstate->__pyx_n_u_height, __pyx_mstate->__pyx_n_u_output_image, __pyx_mstate->__pyx_n_u_stride, __pyx_mstate->__pyx_n_u_YUVstrides, __pyx_mstate->__pyx_n_u_py_buf, __pyx_mstate->__pyx_n_u_YUV, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_min_len};
    __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_YUV444P10_to_r210, __pyx_mstate->__pyx_kp_b_iso88591_8_1A_k_1_1_0_q_a_4q_81D_4_1A_E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 967};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_planes, __pyx_mstate->__pyx_n_u_input_strides, __pyx_mstate->__pyx_n_u_width, __pyx_mstate->__pyx_n_u_height, __pyx_mstate->__pyx_n_u_output_image, __pyx_mstate->__pyx_n_u_stride, __pyx_mstate->__pyx_n_u_full_range_2, __pyx_mstate->__pyx_n_u_YUVstrides, __pyx_mstate->__pyx_n_u_py_buf, __pyx_mstate->__pyx_n_u_YUV, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_min_len};
    __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_YUV444P_to_RGB, __pyx_mstate->__pyx_kp_b_iso88591_5Q_1A_k_1_1_WA_a_4q_81D_4_1A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1027};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_pixels, __pyx_mstate->__pyx_n_u_input_stride, __pyx_mstate->__pyx_n_u_bgr48, __pyx_mstate->__pyx_n_u_w, __pyx_mstate->__pyx_n_u_h, __pyx_mstate->__pyx_n_u_src_stride, __pyx_mstate->__pyx_n_u_dst_stride, __pyx_mstate->__pyx_n_u_r210, __pyx_mstate->__pyx_n_u_bc};
    __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_r210_to_BGR48, __pyx_mstate->__pyx_kp_b_iso88591_4A_q_k_uN_1_6gS_7xq_Jaq_d_d_uN, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1059};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_validate_planar3_image, __pyx_mstate->__pyx_kp_b_iso88591_Q_uKr_ccnno_uJb_l2__ddnnrrvvw_u, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1065};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_pixels, __pyx_mstate->__pyx_n_u_input_strides, __pyx_mstate->__pyx_n_u_w, __pyx_mstate->__pyx_n_u_h, __pyx_mstate->__pyx_n_u_src_stride, __pyx_mstate->__pyx_n_u_dst_stride, __pyx_mstate->__pyx_n_u_r210, __pyx_mstate->__pyx_n_u_gbrp10, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_py_buf};
    __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_GBRP10_to_r210, __pyx_mstate->__pyx_kp_b_iso88591_5Q_1A_k_1_d_d_AQ_t_q_ARr_D_Qb_N, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1103};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_YUV420P_to_RGBX, __pyx_mstate->__pyx_kp_b_iso88591_6a_t_QgS_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1106};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_YUV420P_to_RGB, __pyx_mstate->__pyx_kp_b_iso88591_5Q_t_QgS_wgQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1109};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_YUV420P_to_BGRX, __pyx_mstate->__pyx_kp_b_iso88591_6a_t_QgS_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1112};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_YUV420P_to_BGR, __pyx_mstate->__pyx_kp_b_iso88591_5Q_t_QgS_wgQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1211};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[42] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_GBRP_to_RGBX, __pyx_mstate->__pyx_kp_b_iso88591_31_t_7_S_8881, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[42])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1214};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_image};
    __pyx_mstate_global->__pyx_codeobj_tab[43] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_GBRP_to_BGRX, __pyx_mstate->__pyx_kp_b_iso88591_31_t_7_S_8881, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[43])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1280};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_full, __pyx_mstate->__pyx_n_u_testcsc, __pyx_mstate->__pyx_n_u_converter};
    __pyx_mstate_global->__pyx_codeobj_tab[44] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_xpra_codecs_csc_cython_converter_2, __pyx_mstate->__pyx_n_u_selftest, __pyx_mstate->__pyx_kp_b_iso88591_Q_1_q_1Kq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[44])) goto bad;
  }
  Py_DECREF(tuple_dedup_map);
  return 0;
  bad:
  Py_DECREF(tuple_dedup_map);
  return -1;
}
/* #### Code section: init_globals ### */

static int __Pyx_InitGlobals(void) {
  /* PythonCompatibility.init */
  if (likely(__Pyx_init_co_variables() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* AssertionsEnabled.init */
  if (likely(__Pyx_init_assertions_enabled() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CommonTypesMetaclass.init */
  if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CachedMethodType.init */
  #if CYTHON_COMPILING_IN_LIMITED_API
  {
      PyObject *typesModule=NULL;
      typesModule = PyImport_ImportModule("types");
      if (typesModule) {
          __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
          Py_DECREF(typesModule);
      }
  } // error handling follows
  #endif
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CythonFunctionShared.init */
  if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cleanup_globals ### */
/* #### Code section: cleanup_module ### */
/* #### Code section: main_method ### */
/* #### Code section: utility_code_pragmas ### */
#ifdef _MSC_VER
#pragma warning( push )
/* Warning 4127: conditional expression is constant
 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
 * compile-time, so this warning is not useful
 */
#pragma warning( disable : 4127 )
#endif



/* #### Code section: utility_code_def ### */

/* --- 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

/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
#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);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    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) {
    int result;
    PyObject *exc_type;
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *current_exception = tstate->current_exception;
    if (unlikely(!current_exception)) return 0;
    exc_type = (PyObject*) Py_TYPE(current_exception);
    if (exc_type == err) return 1;
#else
    exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
#endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(exc_type);
    #endif
    if (unlikely(PyTuple_Check(err))) {
        result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    } else {
        result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
    }
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(exc_type);
    #endif
    return result;
}
#endif

/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *tmp_value;
    assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
    if (value) {
        #if CYTHON_COMPILING_IN_CPYTHON
        if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
        #endif
            PyException_SetTraceback(value, tb);
    }
    tmp_value = tstate->current_exception;
    tstate->current_exception = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
#else
    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);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject* exc_value;
    exc_value = tstate->current_exception;
    tstate->current_exception = 0;
    *value = exc_value;
    *type = NULL;
    *tb = NULL;
    if (exc_value) {
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        #if CYTHON_COMPILING_IN_CPYTHON
        *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
        Py_XINCREF(*tb);
        #else
        *tb = PyException_GetTraceback(exc_value);
        #endif
    }
#else
    *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
}
#endif

/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
#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);
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
    return result;
#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
    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;
#endif
}

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
    if (unlikely(!result) && !PyErr_Occurred()) {
        PyErr_Format(PyExc_NameError,
            "name '%U' is not defined", name);
    }
    return result;
}

/* TupleAndListFromArray (used by fastcall) */
#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    Py_ssize_t i;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    for (i = 0; i < n; i++) {
        if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
            Py_DECREF(res);
            return NULL;
        }
        Py_INCREF(src[i]);
    }
    return res;
}
#elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
    return res;
}
static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return PyList_New(0);
    }
    res = PyList_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
    return res;
}
#endif

/* BytesEquals (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
        !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
    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_VERSION_HEX < 0x030B0000)
            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 (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    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 (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length, length2;
        int kind;
        void *data1, *data2;
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        #endif
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length < 0)) return -1;
        #endif
        length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length2 < 0)) return -1;
        #endif
        if (length != length2) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
            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));
            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_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    return (equals == Py_EQ);
return_ne:
    return (equals == Py_NE);
#endif
}

/* fastcall */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
{
    Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(n == -1)) return NULL;
    #endif
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        if (s == namei) return kwvalues[i];
    }
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
        if (unlikely(eq != 0)) {
            if (unlikely(eq < 0)) return NULL;
            return kwvalues[i];
        }
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
    Py_ssize_t i, nkwargs;
    PyObject *dict;
#if !CYTHON_ASSUME_SAFE_SIZE
    nkwargs = PyTuple_Size(kwnames);
    if (unlikely(nkwargs < 0)) return NULL;
#else
    nkwargs = PyTuple_GET_SIZE(kwnames);
#endif
    dict = PyDict_New();
    if (unlikely(!dict))
        return NULL;
    for (i=0; i<nkwargs; i++) {
#if !CYTHON_ASSUME_SAFE_MACROS
        PyObject *key = PyTuple_GetItem(kwnames, i);
        if (!key) goto bad;
#else
        PyObject *key = PyTuple_GET_ITEM(kwnames, i);
#endif
        if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
            goto bad;
    }
    return dict;
bad:
    Py_DECREF(dict);
    return NULL;
}
#endif
#endif

/* ParseKeywords */
static int __Pyx_ParseKeywords(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
        return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
    else if (kwds2)
        return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
    else
        return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
}

/* 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);
}

/* PyDictVersioning (used by GetModuleGlobalName) */
#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_COMPILING_IN_LIMITED_API
    if (unlikely(!__pyx_m)) {
        if (!PyErr_Occurred())
            PyErr_SetNone(PyExc_NameError);
        return NULL;
    }
    result = PyObject_GetAttr(__pyx_m, name);
    if (likely(result)) {
        return result;
    }
    PyErr_Clear();
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return result;
    }
#else
    result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyObjectCall (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall(" 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

/* PyObjectCallMethO (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
    self = __Pyx_CyOrPyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall(" 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

/* PyObjectFastCall (used by PyObjectFastCallMethod) */
#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
    PyObject *argstuple;
    PyObject *result = 0;
    size_t i;
    argstuple = PyTuple_New((Py_ssize_t)nargs);
    if (unlikely(!argstuple)) return NULL;
    for (i = 0; i < nargs; i++) {
        Py_INCREF(args[i]);
        if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
    }
    result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  bad:
    Py_DECREF(argstuple);
    return result;
}
#endif
#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  #if PY_VERSION_HEX < 0x03090000
    #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  #elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
    PyTypeObject *tp = Py_TYPE(callable);
    #if defined(__Pyx_CyFunction_USED)
    if (__Pyx_CyFunction_CheckExact(callable)) {
        return __Pyx_CyFunction_func_vectorcall(callable);
    }
    #endif
    if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
        return NULL;
    }
    assert(PyCallable_Check(callable));
    Py_ssize_t offset = tp->tp_vectorcall_offset;
    assert(offset > 0);
    vectorcallfunc ptr;
    memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
    return ptr;
}
  #else
    #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  #endif
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
    Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
#if CYTHON_COMPILING_IN_CPYTHON
    if (nargs == 0 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
            return __Pyx_PyObject_CallMethO(func, NULL);
    }
    else if (nargs == 1 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
            return __Pyx_PyObject_CallMethO(func, args[0]);
    }
#endif
    if (kwargs == NULL) {
        #if CYTHON_VECTORCALL
          #if CYTHON_COMPILING_IN_LIMITED_API
            return PyObject_Vectorcall(func, args, _nargs, NULL);
          #else
            vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
            if (f) {
                return f(func, args, _nargs, NULL);
            }
          #endif
        #endif
    }
    if (nargs == 0) {
        return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
    }
    #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
    return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
    #else
    return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
    #endif
}

/* PyObjectFastCallMethod */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) {
    PyObject *result;
    PyObject *attr = PyObject_GetAttr(args[0], name);
    if (unlikely(!attr))
        return NULL;
    result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1);
    Py_DECREF(attr);
    return result;
}
#endif

/* IterFinish (used by dict_iter) */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return -1;
        __Pyx_PyErr_Clear();
        return 0;
    }
    return 0;
}

/* PyObjectCallNoArg (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
    PyObject *arg[2] = {NULL, NULL};
    return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectCallOneArg (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *args[2] = {NULL, arg};
    return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectGetMethod (used by PyObjectCallMethod0) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    __Pyx_TypeName type_name;
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
        if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (likely(descr != NULL)) {
        *method = descr;
        return 0;
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
    PyErr_Format(PyExc_AttributeError,
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}
#endif

/* PyObjectCallMethod0 (used by dict_iter) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[1] = {obj};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_CallNoArg;
    return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
#endif
}

/* RaiseNeedMoreValuesToUnpack (used by UnpackTuple2) */
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");
}

/* RaiseTooManyValuesToUnpack (used by UnpackItemEndCheck) */
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);
}

/* UnpackItemEndCheck (used by UnpackTuple2) */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* RaiseNoneIterError (used by UnpackTupleError) */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError (used by UnpackTuple2) */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else {
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(t);
 #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely(size < 0)) return;
 #endif
      if (size < index) {
        __Pyx_RaiseNeedMoreValuesError(size);
      } else {
        __Pyx_RaiseTooManyValuesError(index);
      }
    }
}

/* UnpackTuple2 (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
        PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple) {
    if (likely(is_tuple || PyTuple_Check(tuple))) {
        Py_ssize_t size;
        if (has_known_size) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        size = __Pyx_PyTuple_GET_SIZE(tuple);
        if (likely(size == 2)) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        if (size >= 0) {
            __Pyx_UnpackTupleError(tuple, 2);
        }
        return -1;
    } else {
        return __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple);
    }
}
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
    value1 = __Pyx_PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = __Pyx_PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = __Pyx_PyObject_GetIterNextFunc(iter);
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
#if CYTHON_COMPILING_IN_PYPY
#include <string.h>
#endif
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#else
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
#if !CYTHON_AVOID_BORROWED_REFS
static CYTHON_INLINE int __Pyx_dict_iter_next_source_is_dict(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem) {
    PyObject *key, *value;
    if (unlikely(orig_length != PyDict_Size(iter_obj))) {
        PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
        return -1;
    }
    if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
        return 0;
    }
    if (pitem) {
        PyObject* tuple = PyTuple_New(2);
        if (unlikely(!tuple)) {
            return -1;
        }
        Py_INCREF(key);
        Py_INCREF(value);
        #if CYTHON_ASSUME_SAFE_MACROS
        PyTuple_SET_ITEM(tuple, 0, key);
        PyTuple_SET_ITEM(tuple, 1, value);
        #else
        if (unlikely(PyTuple_SetItem(tuple, 0, key) < 0)) {
            Py_DECREF(value);
            Py_DECREF(tuple);
            return -1;
        }
        if (unlikely(PyTuple_SetItem(tuple, 1, value) < 0)) {
            Py_DECREF(tuple);
            return -1;
        }
        #endif
        *pitem = tuple;
    } else {
        if (pkey) {
            Py_INCREF(key);
            *pkey = key;
        }
        if (pvalue) {
            Py_INCREF(value);
            *pvalue = value;
        }
    }
    return 1;
}
#endif
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_AVOID_BORROWED_REFS
    if (source_is_dict) {
        int result;
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_BEGIN_CRITICAL_SECTION(iter_obj);
#endif
        result = __Pyx_dict_iter_next_source_is_dict(iter_obj, orig_length, ppos, pkey, pvalue, pitem);
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_END_CRITICAL_SECTION();
#endif
        return result;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(tuple_size < 0)) return -1;
        #endif
        if (unlikely(pos >= tuple_size)) return 0;
        *ppos = pos + 1;
        #if CYTHON_ASSUME_SAFE_MACROS
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        #else
        next_item = PyTuple_GetItem(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
        #endif
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t list_size = __Pyx_PyList_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(list_size < 0)) return -1;
        #endif
        if (unlikely(pos >= list_size)) return 0;
        *ppos = pos + 1;
        next_item = __Pyx_PyList_GetItemRef(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* PyObjectVectorCallKwBuilder */
#if CYTHON_VECTORCALL
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_PyObject_FastCallDict;
    if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
    Py_INCREF(key);
    args[n] = value;
    return 0;
}
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_VectorcallBuilder_AddArgStr;
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
}
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    PyObject *pyKey = PyUnicode_FromString(key);
    if (!pyKey) return -1;
    return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
}
#else // CYTHON_VECTORCALL
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return PyDict_SetItem(builder, key, value);
}
#endif

/* 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);
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
    if (unlikely(obj == Py_None))
        obj = __pyx_mstate_global->__pyx_kp_u_None;
    return __Pyx_NewRef(obj);
}

/* RaiseClosureNameError */
static void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op2);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } 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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    calculate_long:
        {
            long x;
            x = a + b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla + llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) + (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
}
#endif

/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
    if (unlikely(!s)) return NULL;
    if (likely(PyUnicode_CheckExact(s))) return s;
    return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
    PyObject *result;
    if (unlikely(!s)) return NULL;
    result = PyObject_Format(s, f);
    Py_DECREF(s);
    return result;
}

/* DictGetItem */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error
        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 value;
}
#endif

/* dict_setdefault (used by FetchCommonType) */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
    PyObject* value;
#if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4)
    PyDict_SetDefaultRef(d, key, default_value, &value);
#elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    PyObject *args[] = {d, key, default_value};
    value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#elif CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
#else
    value = PyDict_SetDefault(d, key, default_value);
    if (unlikely(!value)) return NULL;
    Py_INCREF(value);
#endif
    return value;
}

/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
    PyObject *tp_dictoffset_o;
    Py_ssize_t tp_dictoffset;
    tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
    if (unlikely(!tp_dictoffset_o)) return -1;
    tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
    Py_DECREF(tp_dictoffset_o);
    if (unlikely(tp_dictoffset == 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' doesn't have a dictoffset");
        return -1;
    } else if (unlikely(tp_dictoffset < 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' has an unexpected negative dictoffset. "
            "Please report this as Cython bug");
        return -1;
    }
    return tp_dictoffset;
}
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
    static Py_ssize_t tp_dictoffset = 0;
    if (unlikely(tp_dictoffset == 0)) {
        tp_dictoffset = __Pyx_GetTypeDictOffset();
        if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
            tp_dictoffset = 0; // try again next time?
            return NULL;
        }
    }
    return *(PyObject**)((char*)tp + tp_dictoffset);
}
#endif

/* SetItemOnTypeDict (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_SetItem(tp_dict, k, v);
    if (likely(!result)) {
        PyType_Modified(tp);
        if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
            PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name,  (PyObject *) tp, k, NULL);
            if (!setNameResult) return -1;
            Py_DECREF(setNameResult);
        }
    }
    return result;
}

/* FixUpExtensionType (used by FetchCommonType) */
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
#if __PYX_LIMITED_VERSION_HEX > 0x030900B1
    CYTHON_UNUSED_VAR(spec);
    CYTHON_UNUSED_VAR(type);
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#else
    const PyType_Slot *slot = spec->slots;
    int changed = 0;
#if !CYTHON_COMPILING_IN_LIMITED_API
    while (slot && slot->slot && slot->slot != Py_tp_members)
        slot++;
    if (slot && slot->slot == Py_tp_members) {
#if !CYTHON_COMPILING_IN_CPYTHON
        const
#endif  // !CYTHON_COMPILING_IN_CPYTHON)
            PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
        while (memb && memb->name) {
            if (memb->name[0] == '_' && memb->name[1] == '_') {
                if (strcmp(memb->name, "__weaklistoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_weaklistoffset = memb->offset;
                    changed = 1;
                }
                else if (strcmp(memb->name, "__dictoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_dictoffset = memb->offset;
                    changed = 1;
                }
#if CYTHON_METH_FASTCALL
                else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_vectorcall_offset = memb->offset;
                    changed = 1;
                }
#endif  // CYTHON_METH_FASTCALL
#if !CYTHON_COMPILING_IN_PYPY
                else if (strcmp(memb->name, "__module__") == 0) {
                    PyObject *descr;
                    assert(memb->type == T_OBJECT);
                    assert(memb->flags == 0 || memb->flags == READONLY);
                    descr = PyDescr_NewMember(type, memb);
                    if (unlikely(!descr))
                        return -1;
                    int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                    Py_DECREF(descr);
                    if (unlikely(set_item_result < 0)) {
                        return -1;
                    }
                    changed = 1;
                }
#endif  // !CYTHON_COMPILING_IN_PYPY
            }
            memb++;
        }
    }
#endif  // !CYTHON_COMPILING_IN_LIMITED_API
#if !CYTHON_COMPILING_IN_PYPY
    slot = spec->slots;
    while (slot && slot->slot && slot->slot != Py_tp_getset)
        slot++;
    if (slot && slot->slot == Py_tp_getset) {
        PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
        while (getset && getset->name) {
            if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
                PyObject *descr = PyDescr_NewGetSet(type, getset);
                if (unlikely(!descr))
                    return -1;
                #if CYTHON_COMPILING_IN_LIMITED_API
                PyObject *pyname = PyUnicode_FromString(getset->name);
                if (unlikely(!pyname)) {
                    Py_DECREF(descr);
                    return -1;
                }
                int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
                Py_DECREF(pyname);
                #else
                CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
                int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                #endif
                Py_DECREF(descr);
                if (unlikely(set_item_result < 0)) {
                    return -1;
                }
                changed = 1;
            }
            ++getset;
        }
    }
#else
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#endif  // !CYTHON_COMPILING_IN_PYPY
    if (changed)
        PyType_Modified(type);
#endif  // PY_VERSION_HEX > 0x030900B1
    return 0;
}

/* AddModuleRef (used by FetchSharedCythonModule) */
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
      PyObject *module_dict = PyImport_GetModuleDict();
      PyObject *m;
      if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
          return NULL;
      }
      if (m != NULL && PyModule_Check(m)) {
          return m;
      }
      Py_XDECREF(m);
      m = PyModule_NewObject(name);
      if (m == NULL)
          return NULL;
      if (PyDict_CheckExact(module_dict)) {
          PyObject *new_m;
          (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
          Py_DECREF(m);
          return new_m;
      } else {
           if (PyObject_SetItem(module_dict, name, m) != 0) {
                Py_DECREF(m);
                return NULL;
            }
            return m;
      }
  }
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *py_name = PyUnicode_FromString(name);
      if (!py_name) return NULL;
      PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
      Py_DECREF(py_name);
      return module;
  }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#else
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *module = PyImport_AddModule(name);
      Py_XINCREF(module);
      return module;
  }
#endif

/* FetchSharedCythonModule (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
    return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
}

/* FetchCommonType (used by CommonTypesMetaclass) */
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
    if (result && metaclass) {
        PyObject *old_tp = (PyObject*)Py_TYPE(result);
    Py_INCREF((PyObject*)metaclass);
#if __PYX_LIMITED_VERSION_HEX >= 0x03090000
        Py_SET_TYPE(result, metaclass);
#else
        result->ob_type = metaclass;
#endif
        Py_DECREF(old_tp);
    }
    return result;
}
#else
#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
#endif
static int __Pyx_VerifyCachedType(PyObject *cached_type,
                               const char *name,
                               Py_ssize_t expected_basicsize) {
    Py_ssize_t basicsize;
    if (!PyType_Check(cached_type)) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s is not a type object", name);
        return -1;
    }
    if (expected_basicsize == 0) {
        return 0; // size is inherited, nothing useful to check
    }
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_basicsize;
    py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
    if (unlikely(!py_basicsize)) return -1;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = NULL;
    if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
#else
    basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
#endif
    if (basicsize != expected_basicsize) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s has the wrong size, try recompiling",
            name);
        return -1;
    }
    return 0;
}
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
    int get_item_ref_result;
    const char* object_name = strrchr(spec->name, '.');
    object_name = object_name ? object_name+1 : spec->name;
    py_object_name = PyUnicode_FromString(object_name);
    if (!py_object_name) return NULL;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) goto done;
    abi_module_dict = PyModule_GetDict(abi_module);
    if (!abi_module_dict) goto done;
    get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
    if (get_item_ref_result == 1) {
        if (__Pyx_VerifyCachedType(
              cached_type,
              object_name,
              spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else if (unlikely(get_item_ref_result == -1)) {
        goto bad;
    }
    cached_type = __Pyx_PyType_FromMetaclass(
        metaclass,
        CYTHON_USE_MODULE_STATE ? module : abi_module,
        spec, bases);
    if (unlikely(!cached_type)) goto bad;
    if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
    new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
    if (unlikely(new_cached_type != cached_type)) {
        if (unlikely(!new_cached_type)) goto bad;
        Py_DECREF(cached_type);
        cached_type = new_cached_type;
        if (__Pyx_VerifyCachedType(
                cached_type,
                object_name,
                spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else {
        Py_DECREF(new_cached_type);
    }
done:
    Py_XDECREF(abi_module);
    Py_DECREF(py_object_name);
    assert(cached_type == NULL || PyType_Check(cached_type));
    return (PyTypeObject *) cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CommonTypesMetaclass (used by CythonFunctionShared) */
static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
    return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
}
#if __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
    PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
    return NULL;
}
static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
    PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
    return -1;
}
#endif
static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
    {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
    {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
    #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
    #endif
    {0, 0}
};
static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
    __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
    0,
    0,
    Py_TPFLAGS_IMMUTABLETYPE |
    Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT,
    __pyx_CommonTypesMetaclass_slots
};
static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    PyObject *bases = PyTuple_Pack(1, &PyType_Type);
    if (unlikely(!bases)) {
        return -1;
    }
    mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
    Py_DECREF(bases);
    if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
        return -1;
    }
    return 0;
}

/* CallTypeTraverse (used by CythonFunctionShared) */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
    if (__Pyx_get_runtime_version() < 0x03090000) return 0;
    #endif
    if (!always_call) {
        PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
        unsigned long flags = PyType_GetFlags(base);
        if (flags & Py_TPFLAGS_HEAPTYPE) {
            return 0;
        }
    }
    Py_VISIT((PyObject*)Py_TYPE(o));
    return 0;
}
#endif

/* PyMethodNew (used by CythonFunctionShared) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    PyObject *result;
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    {
        PyObject *args[] = {func, self};
        result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
    }
    #else
    result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
    #endif
    return result;
}
#else
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    return PyMethod_New(func, self);
}
#endif

/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
    PyObject *result;
    PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
    if (unlikely(!selfless_args)) return NULL;
    result = PyObject_Call(method, selfless_args, kwargs);
    Py_DECREF(selfless_args);
    return result;
}
#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
        return _PyObject_Vectorcall
            (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
}
#else
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
    return
#if PY_VERSION_HEX < 0x03090000
    _PyObject_Vectorcall
#else
    PyObject_Vectorcall
#endif
        (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
}
#endif
static PyMethodDef __Pyx_UnboundCMethod_Def = {
     "CythonUnboundCMethod",
     __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
     METH_VARARGS | METH_KEYWORDS,
#else
     METH_FASTCALL | METH_KEYWORDS,
#endif
     NULL
};
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method, *result=NULL;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    result = method;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    } else
#endif
#if CYTHON_COMPILING_IN_PYPY
#else
    if (PyCFunction_Check(method))
#endif
    {
        PyObject *self;
        int self_found;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        self = PyObject_GetAttrString(method, "__self__");
        if (!self) {
            PyErr_Clear();
        }
#else
        self = PyCFunction_GET_SELF(method);
#endif
        self_found = (self && self != Py_None);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        Py_XDECREF(self);
#endif
        if (self_found) {
            PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
            if (unlikely(!unbound_method)) return -1;
            Py_DECREF(method);
            result = unbound_method;
        }
    }
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    if (unlikely(target->method)) {
        Py_DECREF(result);
    } else
#endif
    target->method = result;
    return 0;
}

/* CallUnboundCMethod0 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        if (likely(cfunc->flag == METH_NOARGS))
            return __Pyx_CallCFunction(cfunc, self, NULL);
        if (likely(cfunc->flag == METH_FASTCALL))
            return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
        if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
            return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
        if (cfunc->flag == METH_VARARGS)
            return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
        return __Pyx__CallUnboundCMethod0(cfunc, self);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *result;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
    result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
    return result;
}

/* py_dict_items (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
}

/* py_dict_values (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
}

/* OwnedDictNext (used by PyVectorcallFastCallDict) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
    PyObject *next = NULL;
    if (!*ppos) {
        if (pvalue) {
            PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
            if (unlikely(!dictview)) goto bad;
            *ppos = PyObject_GetIter(dictview);
            Py_DECREF(dictview);
        } else {
            *ppos = PyObject_GetIter(p);
        }
        if (unlikely(!*ppos)) goto bad;
    }
    next = PyIter_Next(*ppos);
    if (!next) {
        if (PyErr_Occurred()) goto bad;
        return 0;
    }
    if (pkey && pvalue) {
        *pkey = __Pyx_PySequence_ITEM(next, 0);
        if (unlikely(*pkey)) goto bad;
        *pvalue = __Pyx_PySequence_ITEM(next, 1);
        if (unlikely(*pvalue)) goto bad;
        Py_DECREF(next);
    } else if (pkey) {
        *pkey = next;
    } else {
        assert(pvalue);
        *pvalue = next;
    }
    return 1;
  bad:
    Py_XDECREF(next);
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
    PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
#else
    PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
#endif
    if (pkey) *pkey = NULL;
    if (pvalue) *pvalue = NULL;
    return 0;
}
#else // !CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
    int result = PyDict_Next(p, ppos, pkey, pvalue);
    if (likely(result == 1)) {
        if (pkey) Py_INCREF(*pkey);
        if (pvalue) Py_INCREF(*pvalue);
    }
    return result;
}
#endif

/* PyVectorcallFastCallDict (used by CythonFunctionShared) */
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    PyObject *res = NULL;
    PyObject *kwnames;
    PyObject **newargs;
    PyObject **kwvalues;
    Py_ssize_t i;
    #if CYTHON_AVOID_BORROWED_REFS
    PyObject *pos;
    #else
    Py_ssize_t pos;
    #endif
    size_t j;
    PyObject *key, *value;
    unsigned long keys_are_strings;
    #if !CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t nkw = PyDict_Size(kw);
    if (unlikely(nkw == -1)) return NULL;
    #else
    Py_ssize_t nkw = PyDict_GET_SIZE(kw);
    #endif
    newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
    if (unlikely(newargs == NULL)) {
        PyErr_NoMemory();
        return NULL;
    }
    for (j = 0; j < nargs; j++) newargs[j] = args[j];
    kwnames = PyTuple_New(nkw);
    if (unlikely(kwnames == NULL)) {
        PyMem_Free(newargs);
        return NULL;
    }
    kwvalues = newargs + nargs;
    pos = 0;
    i = 0;
    keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
    while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) {
        keys_are_strings &=
        #if CYTHON_COMPILING_IN_LIMITED_API
            PyType_GetFlags(Py_TYPE(key));
        #else
            Py_TYPE(key)->tp_flags;
        #endif
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
        #else
        PyTuple_SET_ITEM(kwnames, i, key);
        #endif
        kwvalues[i] = value;
        i++;
    }
    if (unlikely(!keys_are_strings)) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        goto cleanup;
    }
    res = vc(func, newargs, nargs, kwnames);
cleanup:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(pos);
    #endif
    Py_DECREF(kwnames);
    for (i = 0; i < nkw; i++)
        Py_DECREF(kwvalues[i]);
    PyMem_Free(newargs);
    return res;
}
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    Py_ssize_t kw_size =
        likely(kw == NULL) ?
        0 :
#if !CYTHON_ASSUME_SAFE_SIZE
        PyDict_Size(kw);
#else
        PyDict_GET_SIZE(kw);
#endif
    if (kw_size == 0) {
        return vc(func, args, nargs, NULL);
    }
#if !CYTHON_ASSUME_SAFE_SIZE
    else if (unlikely(kw_size == -1)) {
        return NULL;
    }
#endif
    return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
}
#endif

/* CythonFunctionShared (used by CythonFunction) */
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
    if (__Pyx_CyFunction_Check(func)) {
        return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
    } else if (PyCFunction_Check(func)) {
        return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
        int result;
        PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
        if (unlikely(!newFunc)) {
            PyErr_Clear(); // It's only an optimization, so don't throw an error
            return 0;
        }
        result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
        Py_DECREF(newFunc);
        return result;
    }
    return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
}
#else
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if (PyMethod_Check(func)) {
        func = PyMethod_GET_FUNCTION(func);
    }
    return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
}
#endif
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    __Pyx_Py_XDECREF_SET(
        __Pyx_CyFunction_GetClassObj(f),
            ((classobj) ? __Pyx_NewRef(classobj) : NULL));
#else
    __Pyx_Py_XDECREF_SET(
        ((PyCMethodObject *) (f))->mm_class,
        (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
#endif
}
static PyObject *
__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_doc == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
        if (unlikely(!op->func_doc)) return NULL;
#else
        if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
            op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
#endif
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
    PyObject *result;
    CYTHON_UNUSED_VAR(closure);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_doc_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_doc, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_name = PyObject_GetAttrString(op->func, "__name__");
#else
        op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_name_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_name, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    Py_INCREF(op->func_qualname);
    result = op->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_qualname, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
#endif
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(op);
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_defaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_kwdefaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value || value == Py_None) {
        value = NULL;
    } else if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_annotations, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_annotations_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
    int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
    if (is_coroutine) {
        PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
        fromlist = PyList_New(1);
        if (unlikely(!fromlist)) return NULL;
        Py_INCREF(marker);
#if CYTHON_ASSUME_SAFE_MACROS
        PyList_SET_ITEM(fromlist, 0, marker);
#else
        if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
            Py_DECREF(marker);
            Py_DECREF(fromlist);
            return NULL;
        }
#endif
        module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
        if (unlikely(!module)) goto ignore;
        is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
        Py_DECREF(module);
        if (likely(is_coroutine_value)) {
            return is_coroutine_value;
        }
ignore:
        PyErr_Clear();
    }
    return __Pyx_PyBool_FromLong(is_coroutine);
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    if (op->func_is_coroutine) {
        return __Pyx_NewRef(op->func_is_coroutine);
    }
    result = __Pyx_CyFunction_get_is_coroutine_value(op);
    if (unlikely(!result))
        return NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    if (op->func_is_coroutine) {
        Py_DECREF(result);
        result = __Pyx_NewRef(op->func_is_coroutine);
    } else {
        op->func_is_coroutine = __Pyx_NewRef(result);
    }
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        py_name, message, size);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        name, message, size);
#endif
}
static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s",
        py_name, message);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s",
        name, message);
#endif
}
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *
__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_GetAttrString(op->func, "__module__");
}
static int
__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_SetAttrString(op->func, "__module__", value);
}
#endif
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
    {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
#else
    {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
    {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
#endif
    {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
#if !CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
#endif
#if CYTHON_METH_FASTCALL
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
#else
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
#else
    {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
#endif
#endif
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(args);
    __Pyx_BEGIN_CRITICAL_SECTION(m);
    Py_INCREF(m->func_qualname);
    result = m->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyCFunctionObject *cf = (PyCFunctionObject*) op;
#endif
    if (unlikely(op == NULL))
        return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
    if (unlikely(!op->func)) return NULL;
#endif
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
#if !CYTHON_COMPILING_IN_LIMITED_API
    cf->m_ml = ml;
    cf->m_self = (PyObject *) op;
#endif
    Py_XINCREF(closure);
    op->func_closure = closure;
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_XINCREF(module);
    cf->m_module = module;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_dict = NULL;
#endif
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_classobj = NULL;
#else
    ((PyCMethodObject*)op)->mm_class = NULL;
#endif
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    op->func_is_coroutine = NULL;
#if CYTHON_METH_FASTCALL
    switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
    case METH_NOARGS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
        break;
    case METH_O:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
        break;
    case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
        break;
    case METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
        break;
    case METH_VARARGS | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = NULL;
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        Py_DECREF(op);
        return NULL;
    }
#endif
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func);
#else
    Py_CLEAR(((PyCFunctionObject*)m)->m_module);
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func_dict);
#elif PY_VERSION_HEX < 0x030d0000
    _PyObject_ClearManagedDict((PyObject*)m);
#else
    PyObject_ClearManagedDict((PyObject*)m);
#endif
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
#if PY_VERSION_HEX < 0x030900B1
    Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
#else
    {
        PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
        ((PyCMethodObject *) (m))->mm_class = NULL;
        Py_XDECREF(cls);
    }
#endif
#endif
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    Py_CLEAR(m->func_is_coroutine);
    Py_CLEAR(m->defaults);
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    __Pyx_PyHeapTypeObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    {
        int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func);
#else
    Py_VISIT(((PyCFunctionObject*)m)->m_module);
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func_dict);
#else
    {
        int e =
#if PY_VERSION_HEX < 0x030d0000
            _PyObject_VisitManagedDict
#else
            PyObject_VisitManagedDict
#endif
                ((PyObject*)m, visit, arg);
        if (e != 0) return e;
    }
#endif
    __Pyx_VISIT_CONST(m->func_name);
    __Pyx_VISIT_CONST(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    __Pyx_VISIT_CONST(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
#endif
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    Py_VISIT(m->func_is_coroutine);
    Py_VISIT(m->defaults);
    return 0;
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
    PyObject *repr;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
    __Pyx_END_CRITICAL_SECTION();
    return repr;
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
    PyCFunction meth;
    int flags;
    meth = PyCFunction_GetFunction(f);
    if (unlikely(!meth)) return NULL;
    flags = PyCFunction_GetFlags(f);
    if (unlikely(flags < 0)) return NULL;
#else
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    int flags = f->m_ml->ml_flags;
#endif
    Py_ssize_t size;
    switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 0))
                return (*meth)(self, NULL);
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes no arguments", size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes exactly one argument", size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        return NULL;
    }
    __Pyx_CyFunction_raise_type_error(
        (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *self, *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
    if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
    self = ((PyCFunctionObject*)func)->m_self;
#endif
    result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
    return result;
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
     __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
    if (vc) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
        return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
#else
        (void) &__Pyx_PyVectorcall_FastCallDict;
        return PyVectorcall_Call(func, args, kw);
#endif
    }
#endif
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
#if CYTHON_ASSUME_SAFE_SIZE
        argc = PyTuple_GET_SIZE(args);
#else
        argc = PyTuple_Size(args);
        if (unlikely(argc < 0)) return NULL;
#endif
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
{
    int ret = 0;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        if (unlikely(nargs < 1)) {
            __Pyx_CyFunction_raise_type_error(
                cyfunc, "needs an argument");
            return -1;
        }
        ret = 1;
    }
    if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
        __Pyx_CyFunction_raise_type_error(
            cyfunc, "takes no keyword arguments");
        return -1;
    }
    return ret;
}
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 0)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes no arguments", nargs);
        return NULL;
    }
    return meth(self, NULL);
}
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 1)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes exactly one argument", nargs);
        return NULL;
    }
    return meth(self, args[0]);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    #if PY_VERSION_HEX < 0x030e00A6
    size_t nargs_value = (size_t) nargs;
    #else
    Py_ssize_t nargs_value = nargs;
    #endif
    return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
}
#endif
static PyType_Slot __pyx_CyFunctionType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
    {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
    {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
    {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
    {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
    {Py_tp_methods, (void *)__pyx_CyFunction_methods},
    {Py_tp_members, (void *)__pyx_CyFunction_members},
    {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
    {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
    {0, 0},
};
static PyType_Spec __pyx_CyFunctionType_spec = {
    __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
    Py_TPFLAGS_METHOD_DESCRIPTOR |
#endif
#if CYTHON_METH_FASTCALL
#if defined(Py_TPFLAGS_HAVE_VECTORCALL)
    Py_TPFLAGS_HAVE_VECTORCALL |
#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
    _Py_TPFLAGS_HAVE_VECTORCALL |
#endif
#endif // CYTHON_METH_FASTCALL
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_DICT |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
    __pyx_CyFunctionType_slots
};
static int __pyx_CyFunction_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
    if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
    if (unlikely(!m->defaults))
        return NULL;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* CIntToDigits (used by CIntToPyUnicode) */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyUnicode_Concat(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyUnicode_Concat(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* COrdinalToPyUnicode (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) {
    return value <= 1114111;
}
static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) {
    Py_ssize_t padding_length = ulength - 1;
    if (likely((padding_length <= 250) && (value < 0xD800 || value > 0xDFFF))) {
        char chars[256];
        if (value <= 255) {
            memset(chars, padding_char, (size_t) padding_length);
            chars[ulength-1] = (char) value;
            return PyUnicode_DecodeLatin1(chars, ulength, NULL);
        }
        char *cpos = chars + sizeof(chars);
        if (value < 0x800) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xc0 | (value & 0x1f));
        } else if (value < 0x10000) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xe0 | (value & 0x0f));
        } else {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xf0 | (value & 0x07));
        }
        cpos -= padding_length;
        memset(cpos, padding_char, (size_t) padding_length);
        return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL);
    }
    if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) {
        const char chars[1] = {(char) value};
        return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char);
    }
    {
        PyObject *uchar, *padding_uchar, *padding, *result;
        padding_uchar = PyUnicode_FromOrdinal(padding_char);
        if (unlikely(!padding_uchar)) return NULL;
        padding = PySequence_Repeat(padding_uchar, padding_length);
        Py_DECREF(padding_uchar);
        if (unlikely(!padding)) return NULL;
        uchar = PyUnicode_FromOrdinal(value);
        if (unlikely(!uchar)) {
            Py_DECREF(padding);
            return NULL;
        }
        result = PyUnicode_Concat(padding, uchar);
        Py_DECREF(padding);
        Py_DECREF(uchar);
        return result;
    }
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_unsigned_int(unsigned int value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (unsigned int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_unsigned_int(unsigned int value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(unsigned int)*3+2];
    char *dpos, *end = digits + sizeof(unsigned int)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    unsigned int remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (unsigned int) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (unsigned int) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (unsigned int) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
    CYTHON_UNUSED_VAR(clineno);
    CYTHON_UNUSED_VAR(lineno);
    CYTHON_UNUSED_VAR(filename);
    CYTHON_MAYBE_UNUSED_VAR(nogil);
    __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(0);
    }
    ctx = PyUnicode_FromString(name);
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
    if (nogil)
        PyGILState_Release(state);
}

/* pybuiltin_invalid (used by pyint_simplify) */
static void __Pyx_PyBuiltin_Invalid(PyObject *obj, const char *type_name, const char *argname) {
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    if (argname) {
        PyErr_Format(PyExc_TypeError,
            "Argument '%.200s' has incorrect type (expected %.200s, got " __Pyx_FMT_TYPENAME ")",
            argname, type_name, obj_type_name
        );
    } else {
        PyErr_Format(PyExc_TypeError,
            "Expected %.200s, got " __Pyx_FMT_TYPENAME,
            type_name, obj_type_name
        );
    }
    __Pyx_DECREF_TypeName(obj_type_name);
}

/* pyint_simplify */
static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none) {
    PyObject *number = *number_var;
    if (likely((accept_none && number == Py_None) || PyLong_CheckExact(number))) {
        return 0;
    }
    PyObject *int_object;
    if (likely(PyNumber_Check(number))) {
        int_object = PyNumber_Long(number);
        if (unlikely(!int_object)) goto bad;
    } else {
        __Pyx_PyBuiltin_Invalid(number, "int", argname);
        goto bad;
    }
    *number_var = int_object;
    Py_DECREF(number);
    return 0;
bad:
    *number_var = NULL;
    Py_DECREF(number);
    return -1;
}

/* RaiseUnexpectedTypeError */
static int
__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
{
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
                 expected, obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* PyObjectLookupSpecial */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else if (with_error) {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#endif

/* GetTopmostException (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_value == NULL || exc_info->exc_value == 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 && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    PyObject *exc_value = exc_info->exc_value;
    if (exc_value == NULL || exc_value == Py_None) {
        *value = NULL;
        *type = NULL;
        *tb = NULL;
    } else {
        *value = exc_value;
        Py_INCREF(*value);
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        *tb = PyException_GetTraceback(exc_value);
    }
  #elif 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;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #endif
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    PyObject *tmp_value = exc_info->exc_value;
    exc_info->exc_value = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
  #else
    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
}
#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 = NULL, *local_value, *local_tb = NULL;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if PY_VERSION_HEX >= 0x030C0000
    local_value = tstate->current_exception;
    tstate->current_exception = 0;
  #else
    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;
  #endif
#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
    local_value = PyErr_GetRaisedException();
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
#if __PYX_LIMITED_VERSION_HEX > 0x030C0000
    if (likely(local_value)) {
        local_type = (PyObject*) Py_TYPE(local_value);
        Py_INCREF(local_type);
        local_tb = PyException_GetTraceback(local_value);
    }
#else
    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 (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
    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;
      #if PY_VERSION_HEX >= 0x030B00a4
        tmp_value = exc_info->exc_value;
        exc_info->exc_value = local_value;
        tmp_type = NULL;
        tmp_tb = NULL;
        Py_XDECREF(local_type);
        Py_XDECREF(local_tb);
      #else
        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;
      #endif
    }
    #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);
#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    PyErr_SetHandledException(local_value);
    Py_XDECREF(local_value);
    Py_XDECREF(local_type);
    Py_XDECREF(local_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
#endif
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (unlikely(!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,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
        return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
    } else
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE && 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)))) {
        return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
            return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
        } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            return __Pyx_NewRef(PyList_GET_ITEM(o, n));
        }
    } else
    #if !CYTHON_AVOID_BORROWED_REFS
    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)))) {
            return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
        }
    } else
    #endif
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_subscript) {
            PyObject *r, *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return NULL;
            r = mm->mp_subscript(o, key);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return sm->sq_item(o, i);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (Py_ssize_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(Py_ssize_t)*3+2];
    char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    Py_ssize_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (Py_ssize_t) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (Py_ssize_t) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (Py_ssize_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* SetStringIndexingError (used by GetItemIntUnicode) */
static void __Pyx_SetStringIndexingError(const char* message, int has_gil) {
    if (!has_gil) {
        PyGILState_STATE gil_state = PyGILState_Ensure();
        PyErr_SetString(PyExc_IndexError, message);
        PyGILState_Release(gil_state);
    } else
        PyErr_SetString(PyExc_IndexError, message);
}

/* GetItemIntUnicode */
static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i,
                                                           int wraparound, int boundscheck, int has_gil) {
    Py_ssize_t length;
    if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return (Py_UCS4)-1;
    if (wraparound | boundscheck) {
        length = __Pyx_PyUnicode_GET_LENGTH(ustring);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length < 0)) return (Py_UCS4)-1;
        #endif
        if (wraparound & unlikely(i < 0)) i += length;
        if ((!boundscheck) || likely(__Pyx_is_valid_index(i, length))) {
            return __Pyx_PyUnicode_READ_CHAR(ustring, i);
        } else {
            __Pyx_SetStringIndexingError("string index out of range", has_gil);
            return (Py_UCS4)-1;
        }
    } else {
        return __Pyx_PyUnicode_READ_CHAR(ustring, i);
    }
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
    return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
}

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        const char* module_name_str = 0;
        PyObject* module_name = 0;
        PyObject* module_dot = 0;
        PyObject* full_name = 0;
        PyErr_Clear();
        module_name_str = PyModule_GetName(module);
        if (unlikely(!module_name_str)) { goto modbad; }
        module_name = PyUnicode_FromString(module_name_str);
        if (unlikely(!module_name)) { goto modbad; }
        module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__6);
        if (unlikely(!module_dot)) { goto modbad; }
        full_name = PyUnicode_Concat(module_dot, name);
        if (unlikely(!full_name)) { goto modbad; }
        #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400) ||\
                CYTHON_COMPILING_IN_GRAAL
        {
            PyObject *modules = PyImport_GetModuleDict();
            if (unlikely(!modules))
                goto modbad;
            value = PyObject_GetItem(modules, full_name);
        }
        #else
        value = PyImport_GetModule(full_name);
        #endif
      modbad:
        Py_XDECREF(full_name);
        Py_XDECREF(module_dot);
        Py_XDECREF(module_name);
    }
    if (unlikely(!value)) {
        PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
    }
    return value;
}

/* AllocateExtensionType */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
    if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
        allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
        return alloc_func(t, 0);
    } else {
        newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (!tp_new) {
            PyObject *new_str = PyUnicode_FromString("__new__");
            if (likely(new_str)) {
                PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
                Py_DECREF(new_str);
                return o;
            } else
                return NULL;
        } else
    #endif
        return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
    }
}

/* ValidateBasesTuple (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
    Py_ssize_t i, n;
#if CYTHON_ASSUME_SAFE_SIZE
    n = PyTuple_GET_SIZE(bases);
#else
    n = PyTuple_Size(bases);
    if (unlikely(n < 0)) return -1;
#endif
    for (i = 1; i < n; i++)
    {
        PyTypeObject *b;
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *b0 = PySequence_GetItem(bases, i);
        if (!b0) return -1;
#elif CYTHON_ASSUME_SAFE_MACROS
        PyObject *b0 = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *b0 = PyTuple_GetItem(bases, i);
        if (!b0) return -1;
#endif
        b = (PyTypeObject*) b0;
        if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
        {
            __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
            PyErr_Format(PyExc_TypeError,
                "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
            __Pyx_DECREF_TypeName(b_name);
#if CYTHON_AVOID_BORROWED_REFS
            Py_DECREF(b0);
#endif
            return -1;
        }
        if (dictoffset == 0)
        {
            Py_ssize_t b_dictoffset = 0;
#if CYTHON_USE_TYPE_SLOTS
            b_dictoffset = b->tp_dictoffset;
#else
            PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
            if (!py_b_dictoffset) goto dictoffset_return;
            b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
            Py_DECREF(py_b_dictoffset);
            if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
#endif
            if (b_dictoffset) {
                {
                    __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
                    PyErr_Format(PyExc_TypeError,
                        "extension type '%.200s' has no __dict__ slot, "
                        "but base type '" __Pyx_FMT_TYPENAME "' has: "
                        "either add 'cdef dict __dict__' to the extension type "
                        "or add '__slots__ = [...]' to the base type",
                        type_name, b_name);
                    __Pyx_DECREF_TypeName(b_name);
                }
#if !CYTHON_USE_TYPE_SLOTS
              dictoffset_return:
#endif
#if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(b0);
#endif
                return -1;
            }
        }
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(b0);
#endif
    }
    return 0;
}
#endif

/* PyType_Ready */
CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
    while (t) {
        PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
        if (bases) {
            return 1;
        }
        t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
    }
    return 0;
}
static int __Pyx_PyType_Ready(PyTypeObject *t) {
#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
    (void)__Pyx_PyObject_CallMethod0;
#if CYTHON_USE_TYPE_SPECS
    (void)__Pyx_validate_bases_tuple;
#endif
    return PyType_Ready(t);
#else
    int r;
    if (!__Pyx_PyType_HasMultipleInheritance(t)) {
        return PyType_Ready(t);
    }
    PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
    if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
        return -1;
#if !defined(PYSTON_MAJOR_VERSION)
    {
        int gc_was_enabled;
    #if PY_VERSION_HEX >= 0x030A00b1
        gc_was_enabled = PyGC_Disable();
        (void)__Pyx_PyObject_CallMethod0;
    #else
        PyObject *ret, *py_status;
        PyObject *gc = NULL;
        #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
                !CYTHON_COMPILING_IN_GRAAL
        gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
        #endif
        if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
        if (unlikely(!gc)) return -1;
        py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
        if (unlikely(!py_status)) {
            Py_DECREF(gc);
            return -1;
        }
        gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
        Py_DECREF(py_status);
        if (gc_was_enabled > 0) {
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
            if (unlikely(!ret)) {
                Py_DECREF(gc);
                return -1;
            }
            Py_DECREF(ret);
        } else if (unlikely(gc_was_enabled == -1)) {
            Py_DECREF(gc);
            return -1;
        }
    #endif
        t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
#if PY_VERSION_HEX >= 0x030A0000
        t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
#endif
#else
        (void)__Pyx_PyObject_CallMethod0;
#endif
    r = PyType_Ready(t);
#if !defined(PYSTON_MAJOR_VERSION)
        t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
    #if PY_VERSION_HEX >= 0x030A00b1
        if (gc_was_enabled)
            PyGC_Enable();
    #else
        if (gc_was_enabled) {
            PyObject *tp, *v, *tb;
            PyErr_Fetch(&tp, &v, &tb);
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
            if (likely(ret || r == -1)) {
                Py_XDECREF(ret);
                PyErr_Restore(tp, v, tb);
            } else {
                Py_XDECREF(tp);
                Py_XDECREF(v);
                Py_XDECREF(tb);
                r = -1;
            }
        }
        Py_DECREF(gc);
    #endif
    }
#endif
    return r;
#endif
}

/* SetVTable */
static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) {
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
    if (unlikely(!ob))
        goto bad;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#else
    if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#endif
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* GetVTable (used by MergeVTables) */
static void* __Pyx_GetVtable(PyTypeObject *type) {
    void* ptr;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#else
    PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#endif
    if (!ob)
        goto bad;
    ptr = PyCapsule_GetPointer(ob, 0);
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* MergeVTables */
static int __Pyx_MergeVtables(PyTypeObject *type) {
    int i=0;
    Py_ssize_t size;
    void** base_vtables;
    __Pyx_TypeName tp_base_name = NULL;
    __Pyx_TypeName base_name = NULL;
    void* unknown = (void*)-1;
    PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*);
    int base_depth = 0;
    {
        PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        while (base) {
            base_depth += 1;
            base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
        }
    }
    base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1));
    base_vtables[0] = unknown;
#if CYTHON_COMPILING_IN_LIMITED_API
    size = PyTuple_Size(bases);
    if (size < 0) goto other_failure;
#else
    size = PyTuple_GET_SIZE(bases);
#endif
    for (i = 1; i < size; i++) {
        PyObject *basei;
        void* base_vtable;
#if CYTHON_AVOID_BORROWED_REFS
        basei = PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#else
        basei = PyTuple_GET_ITEM(bases, i);
#endif
        base_vtable = __Pyx_GetVtable((PyTypeObject*)basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
        if (base_vtable != NULL) {
            int j;
            PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
            for (j = 0; j < base_depth; j++) {
                if (base_vtables[j] == unknown) {
                    base_vtables[j] = __Pyx_GetVtable(base);
                    base_vtables[j + 1] = unknown;
                }
                if (base_vtables[j] == base_vtable) {
                    break;
                } else if (base_vtables[j] == NULL) {
                    goto bad;
                }
                base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
            }
        }
    }
    PyErr_Clear();
    PyMem_Free(base_vtables);
    return 0;
bad:
    {
        PyTypeObject* basei = NULL;
        PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base);
#if CYTHON_AVOID_BORROWED_REFS
        basei = (PyTypeObject*)PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = (PyTypeObject*)PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#else
        basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i);
#endif
        base_name = __Pyx_PyType_GetFullyQualifiedName(basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
    }
    PyErr_Format(PyExc_TypeError,
        "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
really_bad: // bad has failed!
#endif
    __Pyx_DECREF_TypeName(tp_base_name);
    __Pyx_DECREF_TypeName(base_name);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
other_failure:
#endif
    PyMem_Free(base_vtables);
    return -1;
}

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType_3_2_4
#define __PYX_HAVE_RT_ImportType_3_2_4
static PyTypeObject *__Pyx_ImportType_3_2_4(PyObject *module, const char *module_name, const char *class_name,
    size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_4 check_size)
{
    PyObject *result = 0;
    Py_ssize_t basicsize;
    Py_ssize_t itemsize;
#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API)
    PyObject *py_basicsize;
    PyObject *py_itemsize;
#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;
    }
#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) )
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
    itemsize = ((PyTypeObject *)result)->tp_itemsize;
#else
    if (size == 0) {
        return (PyTypeObject *)result;
    }
    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;
    py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
    if (!py_itemsize)
        goto bad;
    itemsize = PyLong_AsSsize_t(py_itemsize);
    Py_DECREF(py_itemsize);
    py_itemsize = 0;
    if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (itemsize) {
        if (size % alignment) {
            alignment = size % alignment;
        }
        if (itemsize < (Py_ssize_t)alignment)
            itemsize = (Py_ssize_t)alignment;
    }
    if ((size_t)(basicsize + itemsize) < 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+itemsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_4 &&
            ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd-%zd from PyObject",
            module_name, class_name, size, basicsize, basicsize+itemsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_4 && (size_t)basicsize > size) {
        if (PyErr_WarnFormat(NULL, 0,
                "%.200s.%.200s size changed, may indicate binary incompatibility. "
                "Expected %zd from C header, got %zd from PyObject",
                module_name, class_name, size, basicsize) < 0) {
            goto bad;
        }
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* PxdImportShared (used by FunctionImport) */
#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_4
#define __PYX_HAVE_RT_ImportFromPxd_3_2_4
static int __Pyx_ImportFromPxd_3_2_4(PyObject *module, const char *name, void **p, const char *sig, const char *what) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    d = PyObject_GetAttrString(module, "__pyx_capi__");
    if (!d)
        goto bad;
#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000)
    PyDict_GetItemStringRef(d, name, &cobj);
#else
    cobj = PyDict_GetItemString(d, name);
    Py_XINCREF(cobj);
#endif
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C %.8s %.200s",
                PyModule_GetName(module), what, name);
        goto bad;
    }
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    *p = PyCapsule_GetPointer(cobj, sig);
    if (!(*p))
        goto bad;
    Py_DECREF(d);
    Py_DECREF(cobj);
    return 0;
bad:
    Py_XDECREF(d);
    Py_XDECREF(cobj);
    return -1;
}
#endif

/* FunctionImport */
#ifndef __PYX_HAVE_RT_ImportFunction_3_2_4
#define __PYX_HAVE_RT_ImportFunction_3_2_4
static int __Pyx_ImportFunction_3_2_4(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    int result = __Pyx_ImportFromPxd_3_2_4(module, funcname, &tmp.p, sig, "function");
    if (result == 0) {
        *f = tmp.fp;
    }
    return result;
}
#endif

/* ListPack */
static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...) {
    va_list va;
    PyObject *l = PyList_New(n);
    va_start(va, n);
    if (unlikely(!l)) goto end;
    for (Py_ssize_t i=0; i<n; ++i) {
        PyObject *arg = va_arg(va, PyObject*);
        Py_INCREF(arg);
        if (__Pyx_PyList_SET_ITEM(l, i, arg) != (0)) {
            Py_CLEAR(l);
            goto end;
        }
    }
    end:
    va_end(va);
    return l;
}

/* Py3UpdateBases */
static PyObject*
__Pyx_PEP560_update_bases(PyObject *bases)
{
    Py_ssize_t i, j, size_bases;
    PyObject *base = NULL, *meth, *new_base, *result, *new_bases = NULL;
#if CYTHON_ASSUME_SAFE_SIZE
    size_bases = PyTuple_GET_SIZE(bases);
#else
    size_bases = PyTuple_Size(bases);
    if (size_bases < 0) return NULL;
#endif
    for (i = 0; i < size_bases; i++) {
#if CYTHON_AVOID_BORROWED_REFS
        Py_CLEAR(base);
#endif
#if CYTHON_ASSUME_SAFE_MACROS
        base = PyTuple_GET_ITEM(bases, i);
#else
        base = PyTuple_GetItem(bases, i);
        if (!base) goto error;
#endif
#if CYTHON_AVOID_BORROWED_REFS
        Py_INCREF(base);
#endif
        if (PyType_Check(base)) {
            if (new_bases) {
                if (PyList_Append(new_bases, base) < 0) {
                    goto error;
                }
            }
            continue;
        }
        meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_mstate_global->__pyx_n_u_mro_entries);
        if (!meth && PyErr_Occurred()) {
            goto error;
        }
        if (!meth) {
            if (new_bases) {
                if (PyList_Append(new_bases, base) < 0) {
                    goto error;
                }
            }
            continue;
        }
        new_base = __Pyx_PyObject_CallOneArg(meth, bases);
        Py_DECREF(meth);
        if (!new_base) {
            goto error;
        }
        if (!PyTuple_Check(new_base)) {
            PyErr_SetString(PyExc_TypeError,
                            "__mro_entries__ must return a tuple");
            Py_DECREF(new_base);
            goto error;
        }
        if (!new_bases) {
            if (!(new_bases = PyList_New(i))) {
                goto error;
            }
            for (j = 0; j < i; j++) {
                PyObject *base_from_list;
#if CYTHON_ASSUME_SAFE_MACROS
                base_from_list = PyTuple_GET_ITEM(bases, j);
                PyList_SET_ITEM(new_bases, j, base_from_list);
                Py_INCREF(base_from_list);
#else
                base_from_list = PyTuple_GetItem(bases, j);
                if (!base_from_list) goto error;
                Py_INCREF(base_from_list);
                if (PyList_SetItem(new_bases, j, base_from_list) < 0) goto error;
#endif
            }
        }
#if CYTHON_ASSUME_SAFE_SIZE
        j = PyList_GET_SIZE(new_bases);
#else
        j = PyList_Size(new_bases);
        if (j < 0) goto error;
#endif
        if (PyList_SetSlice(new_bases, j, j, new_base) < 0) {
            goto error;
        }
        Py_DECREF(new_base);
    }
    if (!new_bases) {
        Py_INCREF(bases);
        return bases;
    }
    result = PyList_AsTuple(new_bases);
    Py_DECREF(new_bases);
#if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(base);
#endif
    return result;
error:
    Py_XDECREF(new_bases);
#if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(base);
#endif
    return NULL;
}

/* CalculateMetaclass */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases;
#if CYTHON_ASSUME_SAFE_SIZE
    nbases = PyTuple_GET_SIZE(bases);
#else
    nbases = PyTuple_Size(bases);
    if (nbases < 0) return NULL;
#endif
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
#if CYTHON_ASSUME_SAFE_MACROS
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *tmp = PyTuple_GetItem(bases, i);
        if (!tmp) return NULL;
#endif
        tmptype = Py_TYPE(tmp);
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
        metaclass = &PyType_Type;
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* PyObjectCall2Args (used by Py3ClassCreate) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args[3] = {NULL, arg1, arg2};
    return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* Py3ClassCreate */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_mstate_global->__pyx_n_u_prepare);
        if (prep) {
            PyObject *pargs[3] = {NULL, name, bases};
            ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
            Py_DECREF(prep);
        } else {
            if (unlikely(PyErr_Occurred()))
                return NULL;
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result;
    PyObject *owned_metaclass = NULL;
    PyObject *margs[4] = {NULL, name, bases, dict};
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_mstate_global->__pyx_n_u_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CyFunctionClassCell */
static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj) {
    Py_ssize_t i, count = __Pyx_PyList_GET_SIZE(cyfunctions);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(count < 0)) return -1;
    #endif
    for (i = 0; i < count; i++) {
        __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *)
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && !CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
            PyList_GET_ITEM(cyfunctions, i);
#else
            __Pyx_PySequence_ITEM(cyfunctions, i);
        if (unlikely(!m))
            return -1;
#endif
        __Pyx_CyFunction_SetClassObj(m, classobj);
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && !CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
        Py_DECREF((PyObject*)m);
#endif
    }
    return 0;
}

/* CLineInTraceback (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
#else
PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
    PyObject **dict_ptr = _PyObject_GetDictPtr(o);
    return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
}
#endif
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline = NULL;
    PyObject *ptype, *pvalue, *ptraceback;
    PyObject *cython_runtime_dict;
    CYTHON_MAYBE_UNUSED_VAR(tstate);
    if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
    cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, cython_runtime_dict,
            __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
    }
    if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    Py_XDECREF(use_cline);
    Py_XDECREF(cython_runtime_dict);
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache (used by AddTraceback) */
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 __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
    __Pyx_CachedCodeObjectType* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = code_cache->entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__find_code_object;
    return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
    if (old_count < 0) {
        __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
        return NULL;
    }
#endif
    __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
#endif
    return result;
#endif
}
static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
{
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            code_cache->entries = entries;
            code_cache->max_count = 64;
            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(code_cache->entries, code_cache->count, code_line);
    if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
        __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_INCREF(code_object);
        Py_DECREF(tmp);
        return;
    }
    if (code_cache->count == code_cache->max_count) {
        int new_max = code_cache->max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        code_cache->entries = entries;
        code_cache->max_count = new_max;
    }
    for (i=code_cache->count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    code_cache->count++;
    Py_INCREF(code_object);
}
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__insert_code_object;
    return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type expected = 0;
    if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
        return;
    }
#endif
    __pyx__insert_code_object(code_cache, code_line, code_object);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
#endif
#endif
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
                                                       PyObject *firstlineno, PyObject *name) {
    PyObject *replace = NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
    replace = PyObject_GetAttrString(code, "replace");
    if (likely(replace)) {
        PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
        Py_DECREF(replace);
        return result;
    }
    PyErr_Clear();
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
    PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
    PyObject *exc_type, *exc_value, *exc_traceback;
    int success = 0;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
    }
    PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
    code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!code_object) {
        code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
        if (unlikely(!code_object)) goto bad;
        py_py_line = PyLong_FromLong(py_line);
        if (unlikely(!py_py_line)) goto bad;
        if (c_line) {
            py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        } else {
            py_funcname = PyUnicode_FromString(funcname);
        }
        if (unlikely(!py_funcname)) goto bad;
        dict = PyDict_New();
        if (unlikely(!dict)) goto bad;
        {
            PyObject *old_code_object = code_object;
            code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
            Py_DECREF(old_code_object);
        }
        if (unlikely(!code_object)) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
    } else {
        dict = PyDict_New();
    }
    getframe = PySys_GetObject("_getframe");
    if (unlikely(!getframe)) goto bad;
    if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
    frame = PyEval_EvalCode(code_object, dict, dict);
    if (unlikely(!frame) || frame == Py_None) goto bad;
    success = 1;
  bad:
    PyErr_Restore(exc_type, exc_value, exc_traceback);
    Py_XDECREF(code_object);
    Py_XDECREF(py_py_line);
    Py_XDECREF(py_funcname);
    Py_XDECREF(dict);
    Py_XDECREF(replace);
    if (success) {
        PyTraceBack_Here(
            (struct _frame*)frame);
    }
    Py_XDECREF(frame);
}
#else
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    if (c_line) {
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
    }
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    Py_XDECREF(py_funcname);
    return py_code;
bad:
    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;
    PyObject *ptype, *pvalue, *ptraceback;
    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) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_mstate_global->__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);
}
#endif

/* 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;\
    }

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint8_t(uint8_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint8_t neg_one = (uint8_t) -1, const_zero = (uint8_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint8_t) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(uint8_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint8_t) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(uint8_t),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint8_t));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyLong_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                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 && PY_VERSION_HEX < 0x030C00A7
        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))
        } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                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))
        } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        int val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (int) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (int) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (int) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (int) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((int) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((int) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (int) -1;
        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;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } 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 PyLong_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyLong_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                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 && PY_VERSION_HEX < 0x030C00A7
        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))
        } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                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))
        } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        size_t val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (size_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (size_t) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (size_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (size_t) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((size_t) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((size_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (size_t) -1;
        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;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_int(unsigned int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned int) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } 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 PyLong_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned int));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        unsigned int val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (unsigned int) -1;
        val = __Pyx_PyLong_As_unsigned_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                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 && PY_VERSION_HEX < 0x030C00A7
        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))
        } else if ((sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                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))
        } else if ((sizeof(unsigned int) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        unsigned int val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (unsigned int) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (unsigned int) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (unsigned int) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (unsigned int) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(unsigned int) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((unsigned int) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(unsigned int) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((unsigned int) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (unsigned int) -1;
        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;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } 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 PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE unsigned char __Pyx_PyLong_As_unsigned_char(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        unsigned char val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (unsigned char) -1;
        val = __Pyx_PyLong_As_unsigned_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                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 && PY_VERSION_HEX < 0x030C00A7
        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))
        } else if ((sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                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))
        } else if ((sizeof(unsigned char) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned char, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        unsigned char val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (unsigned char) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (unsigned char) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (unsigned char) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (unsigned char) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(unsigned char) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((unsigned char) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(unsigned char) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((unsigned char) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((unsigned char) 1) << (sizeof(unsigned char) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (unsigned char) -1;
        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;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_long(unsigned long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned long) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned long) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned long),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned long));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE unsigned long __Pyx_PyLong_As_unsigned_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (unsigned long) -1;
        val = __Pyx_PyLong_As_unsigned_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(unsigned long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) >= 2 * PyLong_SHIFT)) {
                            return (unsigned long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) >= 3 * PyLong_SHIFT)) {
                            return (unsigned long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned long) >= 4 * PyLong_SHIFT)) {
                            return (unsigned long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        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 long) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(unsigned long) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(unsigned long) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT)) {
                            return (unsigned long) (((unsigned long)-1)*(((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(unsigned long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT)) {
                            return (unsigned long) ((((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT)) {
                            return (unsigned long) (((unsigned long)-1)*(((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT)) {
                            return (unsigned long) ((((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned long) - 1 > 4 * PyLong_SHIFT)) {
                            return (unsigned long) (((unsigned long)-1)*(((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned long) - 1 > 4 * PyLong_SHIFT)) {
                            return (unsigned long) ((((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(unsigned long) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned long, long, PyLong_AsLong(x))
        } else if ((sizeof(unsigned long) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned long, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        unsigned long val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (unsigned long) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (unsigned long) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (unsigned long) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (unsigned long) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(unsigned long) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((unsigned long) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(unsigned long) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((unsigned long) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((unsigned long) 1) << (sizeof(unsigned long) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (unsigned long) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned long");
    return (unsigned long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned long");
    return (unsigned long) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_char(unsigned char value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned char) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } 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 PyLong_FromLong((long) value);
        } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned char),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned char));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* FormatTypeName */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
static __Pyx_TypeName
__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
{
    PyObject *module = NULL, *name = NULL, *result = NULL;
    #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
    name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_mstate_global->__pyx_n_u_qualname);
    #else
    name = PyType_GetQualName(tp);
    #endif
    if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
    module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_mstate_global->__pyx_n_u_module);
    if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
    if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
        result = name;
        name = NULL;
        goto done;
    }
    result = PyUnicode_FromFormat("%U.%U", module, name);
    if (unlikely(result == NULL)) goto bad;
  done:
    Py_XDECREF(name);
    Py_XDECREF(module);
    return result;
  bad:
    PyErr_Clear();
    if (name) {
        result = name;
        name = NULL;
    } else {
        result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__7);
    }
    goto done;
}
#endif

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyLong_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                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 && PY_VERSION_HEX < 0x030C00A7
        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))
        } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                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))
        } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        long val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (long) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (long) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (long) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (long) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((long) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((long) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (long) -1;
        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;
}

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
        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);
}
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (cls == a || cls == b) return 1;
    mro = cls->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            PyObject *base = PyTuple_GET_ITEM(mro, i);
            if (base == (PyObject *)a || base == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
}
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    if (exc_type1) {
        return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
    } else {
        return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
}
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);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        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

/* GetRuntimeVersion */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
void __Pyx_init_runtime_version(void) {
    if (__Pyx_cached_runtime_version == 0) {
        const char* rt_version = Py_GetVersion();
        unsigned long version = 0;
        unsigned long factor = 0x01000000UL;
        unsigned int digit = 0;
        int i = 0;
        while (factor) {
            while ('0' <= rt_version[i] && rt_version[i] <= '9') {
                digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
                ++i;
            }
            version += factor * digit;
            if (rt_version[i] != '.')
                break;
            digit = 0;
            factor >>= 8;
            ++i;
        }
        __Pyx_cached_runtime_version = version;
    }
}
#endif
static unsigned long __Pyx_get_runtime_version(void) {
#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    return Py_Version & ~0xFFUL;
#else
    return __Pyx_cached_runtime_version;
#endif
}

/* CheckBinaryVersion */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
    const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
    if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
        return 0;
    if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
        return 1;
    {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compile time Python version %d.%d "
                      "of module '%.100s' "
                      "%s "
                      "runtime version %d.%d",
                       (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
                       __Pyx_MODULE_NAME,
                       (allow_newer) ? "was newer than" : "does not match",
                       (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
       );
        return PyErr_WarnEx(NULL, message, 1);
    }
}

/* NewCodeObj */
#if CYTHON_COMPILING_IN_LIMITED_API
    static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                       PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                       PyObject *fv, PyObject *cell, PyObject* fn,
                                       PyObject *name, int fline, PyObject *lnos) {
        PyObject *exception_table = NULL;
        PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
        #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
        PyObject *version_info;
        PyObject *py_minor_version = NULL;
        #endif
        long minor_version = 0;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
        minor_version = 11;
        #else
        if (!(version_info = PySys_GetObject("version_info"))) goto end;
        if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
        minor_version = PyLong_AsLong(py_minor_version);
        Py_DECREF(py_minor_version);
        if (minor_version == -1 && PyErr_Occurred()) goto end;
        #endif
        if (!(types_module = PyImport_ImportModule("types"))) goto end;
        if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
        if (minor_version <= 7) {
            (void)p;
            result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else if (minor_version <= 10) {
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else {
            if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
        }
    end:
        Py_XDECREF(code_type);
        Py_XDECREF(exception_table);
        Py_XDECREF(types_module);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return result;
    }
#elif PY_VERSION_HEX >= 0x030B0000
  static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                         PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                         PyObject *fv, PyObject *cell, PyObject* fn,
                                         PyObject *name, int fline, PyObject *lnos) {
    PyCodeObject *result;
    result =
      #if PY_VERSION_HEX >= 0x030C0000
        PyUnstable_Code_NewWithPosOnlyArgs
      #else
        PyCode_NewWithPosOnlyArgs
      #endif
        (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
    if (likely(result))
        result->_co_firsttraceable = 0;
    #endif
    return result;
  }
#elif !CYTHON_COMPILING_IN_PYPY
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx__PyCode_New(a, p, 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
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
) {
    PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
    Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
    PyObject *varnames_tuple = PyTuple_New(var_count);
    if (unlikely(!varnames_tuple)) return NULL;
    for (Py_ssize_t i=0; i < var_count; i++) {
        Py_INCREF(varnames[i]);
        if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
    }
    #if CYTHON_COMPILING_IN_LIMITED_API
    varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
    if (!varnames_tuple_dedup) {
        if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
        varnames_tuple_dedup = varnames_tuple;
    }
    #else
    varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
    if (unlikely(!varnames_tuple_dedup)) goto done;
    #endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(varnames_tuple_dedup);
    #endif
    if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
        Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(line_table_length == -1)) goto done;
        #endif
        Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
        code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
        if (unlikely(!code_bytes)) goto done;
        char* c_code_bytes = PyBytes_AsString(code_bytes);
        if (unlikely(!c_code_bytes)) goto done;
        memset(c_code_bytes, 0, (size_t) code_len);
    }
    code_obj = (PyObject*) __Pyx__PyCode_New(
        (int) descr.argcount,
        (int) descr.num_posonly_args,
        (int) descr.num_kwonly_args,
        (int) descr.nlocals,
        0,
        (int) descr.flags,
        code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
        __pyx_mstate_global->__pyx_empty_tuple,
        __pyx_mstate_global->__pyx_empty_tuple,
        varnames_tuple_dedup,
        __pyx_mstate_global->__pyx_empty_tuple,
        __pyx_mstate_global->__pyx_empty_tuple,
        filename,
        funcname,
        (int) descr.first_line,
        (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
    );
done:
    Py_XDECREF(code_bytes);
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(varnames_tuple_dedup);
    #endif
    Py_DECREF(varnames_tuple);
    return code_obj;
}

/* DecompressString */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
    PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed;
    const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
    PyObject *methodname = PyUnicode_FromString("decompress");
    if (unlikely(!methodname)) return NULL;
    #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
    if (algo == 3) {
        PyObject *fromlist = Py_BuildValue("[O]", methodname);
        if (unlikely(!fromlist)) goto bad;
        module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
    } else
    #endif
        module = PyImport_ImportModule(module_name);
    if (unlikely(!module)) goto import_failed;
    decompress = PyObject_GetAttr(module, methodname);
    if (unlikely(!decompress)) goto import_failed;
    {
        #ifdef __cplusplus
            char *memview_bytes = const_cast<char*>(s);
        #else
            #if defined(__clang__)
              #pragma clang diagnostic push
              #pragma clang diagnostic ignored "-Wcast-qual"
            #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
              #pragma GCC diagnostic push
              #pragma GCC diagnostic ignored "-Wcast-qual"
            #endif
            char *memview_bytes = (char*) s;
            #if defined(__clang__)
              #pragma clang diagnostic pop
            #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
              #pragma GCC diagnostic pop
            #endif
        #endif
        #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
        int memview_flags = 0x100;
        #else
        int memview_flags = PyBUF_READ;
        #endif
        compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
    }
    if (unlikely(!compressed_bytes)) {
        Py_DECREF(decompress);
        goto bad;
    }
    decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
    Py_DECREF(compressed_bytes);
    Py_DECREF(decompress);
    Py_DECREF(module);
    Py_DECREF(methodname);
    return decompressed;
import_failed:
    PyErr_Format(PyExc_ImportError,
        "Failed to import '%.20s.decompress' - cannot initialise module strings. "
        "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
        module_name, algo);
bad:
    Py_XDECREF(module);
    Py_DECREF(methodname);
    return NULL;
}

#include <string.h>
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
    size_t len = strlen(s);
    if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
        PyErr_SetString(PyExc_OverflowError, "byte string is too long");
        return -1;
    }
    return (Py_ssize_t) len;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return PyByteArray_FromStringAndSize(c_str, len);
}
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_UTF8
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    {
        const char* result;
        Py_ssize_t unicode_length;
        CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
        #else
        result = PyUnicode_AsUTF8AndSize(o, length);
        #endif
        #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        unicode_length = PyUnicode_GetLength(o);
        if (unlikely(unicode_length < 0)) return NULL;
        if (unlikely(unicode_length != *length)) {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
        #endif
        return result;
    }
#else
#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_UTF8
    if (PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
    if (PyByteArray_Check(o)) {
#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
#else
        *length = PyByteArray_Size(o);
        if (*length == -1) return NULL;
        return PyByteArray_AsString(o);
#endif
    } else
    {
        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_LongWrongResultType(PyObject* result) {
    __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ").  "
                "The ability to return an instance of a strict subclass of int is deprecated, "
                "and may be removed in a future version of Python.",
                result_type_name)) {
            __Pyx_DECREF_TypeName(result_type_name);
            Py_DECREF(result);
            return NULL;
        }
        __Pyx_DECREF_TypeName(result_type_name);
        return result;
    }
    PyErr_Format(PyExc_TypeError,
                 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
                 result_type_name);
    __Pyx_DECREF_TypeName(result_type_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  PyObject *res = NULL;
  if (likely(PyLong_Check(x)))
      return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  if (likely(m && m->nb_int)) {
      res = m->nb_int(x);
  }
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
      res = PyNumber_Long(x);
  }
#endif
  if (likely(res)) {
      if (unlikely(!PyLong_CheckExact(res))) {
          return __Pyx_PyNumber_LongWrongResultType(res);
      }
  }
  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 (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(__Pyx_PyLong_IsCompact(b))) {
        return __Pyx_PyLong_CompactValue(b);
    } else {
      const digit* digits = __Pyx_PyLong_Digits(b);
      const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
      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 = PyLong_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyLong_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
    CYTHON_UNUSED_VAR(b);
    return __Pyx_NewRef(Py_None);
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return __Pyx_NewRef(b ? Py_True: Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
    return PyLong_FromSize_t(ival);
}


/* MultiPhaseInitModuleState */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
  #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
#else
  #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
#endif
#endif
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
#error "Module state with PEP489 requires atomics. Currently that's one of\
 C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
#endif
#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
#define __Pyx_ModuleStateLookup_Lock()
#define __Pyx_ModuleStateLookup_Unlock()
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(__cplusplus) && __cplusplus >= 201103L
#include <mutex>
static std::mutex __Pyx_ModuleStateLookup_mutex;
#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
#include <threads.h>
static mtx_t __Pyx_ModuleStateLookup_mutex;
static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
    mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
}
#define __Pyx_ModuleStateLookup_Lock()\
  call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
  mtx_lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(HAVE_PTHREAD_H)
#include <pthread.h>
static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(_WIN32)
#include <Windows.h>  // synchapi.h on its own doesn't work
static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
#else
#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
 Requires C standard >= C11, or C++ standard >= C++11,\
 or pthreads, or the Windows 32 API, or Python >= 3.13."
#endif
typedef struct {
    int64_t id;
    PyObject *module;
} __Pyx_InterpreterIdAndModule;
typedef struct {
    char interpreter_id_as_index;
    Py_ssize_t count;
    Py_ssize_t allocated;
    __Pyx_InterpreterIdAndModule table[1];
} __Pyx_ModuleStateLookupData;
#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
#endif
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
#else
static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
#endif
static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
        __Pyx_InterpreterIdAndModule* table,
        Py_ssize_t count,
        int64_t interpreterId) {
    __Pyx_InterpreterIdAndModule* begin = table;
    __Pyx_InterpreterIdAndModule* end = begin + count;
    if (begin->id == interpreterId) {
        return begin;
    }
    while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
        __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
        if (halfway->id == interpreterId) {
            return halfway;
        }
        if (halfway->id < interpreterId) {
            begin = halfway;
        } else {
            end = halfway;
        }
    }
    for (; begin < end; ++begin) {
        if (begin->id >= interpreterId) return begin;
    }
    return begin;
}
static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return NULL;
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
    {
        __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
        if (likely(data)) {
            __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
            if (likely(data == new_data)) {
                goto read_finished;
            }
        }
        __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
        __Pyx_ModuleStateLookup_Lock();
        __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
        data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
        __Pyx_ModuleStateLookup_Unlock();
    }
  read_finished:;
#else
    __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
#endif
    __Pyx_InterpreterIdAndModule* found = NULL;
    if (unlikely(!data)) goto end;
    if (data->interpreter_id_as_index) {
        if (interpreter_id < data->count) {
            found = data->table+interpreter_id;
        }
    } else {
        found = __Pyx_State_FindModuleStateLookupTableLowerBound(
            data->table, data->count, interpreter_id);
    }
  end:
    {
        PyObject *result=NULL;
        if (found && found->id == interpreter_id) {
            result = found->module;
        }
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
        __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
#endif
        return result;
    }
}
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
    while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
}
#else
#define __Pyx_ModuleStateLookup_wait_until_no_readers()
#endif
static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
    Py_ssize_t to_allocate = (*old_data)->allocated;
    while (to_allocate <= interpreter_id) {
        if (to_allocate == 0) to_allocate = 1;
        else to_allocate *= 2;
    }
    __Pyx_ModuleStateLookupData *new_data = *old_data;
    if (to_allocate != (*old_data)->allocated) {
         new_data = (__Pyx_ModuleStateLookupData *)realloc(
            *old_data,
            sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
        if (!new_data) {
            PyErr_NoMemory();
            return -1;
        }
        for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
            new_data->table[i].id = i;
            new_data->table[i].module = NULL;
        }
        new_data->allocated = to_allocate;
    }
    new_data->table[interpreter_id].module = module;
    if (new_data->count < interpreter_id+1) {
        new_data->count = interpreter_id+1;
    }
    *old_data = new_data;
    return 0;
}
static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
    __Pyx_InterpreterIdAndModule *read = data->table;
    __Pyx_InterpreterIdAndModule *write = data->table;
    __Pyx_InterpreterIdAndModule *end = read + data->count;
    for (; read<end; ++read) {
        if (read->module) {
            write->id = read->id;
            write->module = read->module;
            ++write;
        }
    }
    data->count = write - data->table;
    for (; write<end; ++write) {
        write->id = 0;
        write->module = NULL;
    }
    data->interpreter_id_as_index = 0;
}
static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return -1;
    int result = 0;
    __Pyx_ModuleStateLookup_Lock();
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
            __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
#else
    __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
#endif
    __Pyx_ModuleStateLookupData *new_data = old_data;
    if (!new_data) {
        new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
        if (!new_data) {
            result = -1;
            PyErr_NoMemory();
            goto end;
        }
        new_data->allocated = 1;
        new_data->interpreter_id_as_index = 1;
    }
    __Pyx_ModuleStateLookup_wait_until_no_readers();
    if (new_data->interpreter_id_as_index) {
        if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
            result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
            goto end;
        }
        __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
    }
    {
        Py_ssize_t insert_at = 0;
        {
            __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
                new_data->table, new_data->count, interpreter_id);
            assert(lower_bound);
            insert_at = lower_bound - new_data->table;
            if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
                lower_bound->module = module;
                goto end;  // already in table, nothing more to do
            }
        }
        if (new_data->count+1 >= new_data->allocated) {
            Py_ssize_t to_allocate = (new_data->count+1)*2;
            new_data =
                (__Pyx_ModuleStateLookupData*)realloc(
                    new_data,
                    sizeof(__Pyx_ModuleStateLookupData) +
                    (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
            if (!new_data) {
                result = -1;
                new_data = old_data;
                PyErr_NoMemory();
                goto end;
            }
            new_data->allocated = to_allocate;
        }
        ++new_data->count;
        int64_t last_id = interpreter_id;
        PyObject *last_module = module;
        for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
            int64_t current_id = new_data->table[i].id;
            new_data->table[i].id = last_id;
            last_id = current_id;
            PyObject *current_module = new_data->table[i].module;
            new_data->table[i].module = last_module;
            last_module = current_module;
        }
    }
  end:
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
#else
    __Pyx_ModuleStateLookup_data = new_data;
#endif
    __Pyx_ModuleStateLookup_Unlock();
    return result;
}
static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return -1;
    __Pyx_ModuleStateLookup_Lock();
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
            __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
#else
    __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
#endif
    if (data->interpreter_id_as_index) {
        if (interpreter_id < data->count) {
            data->table[interpreter_id].module = NULL;
        }
        goto done;
    }
    {
        __Pyx_ModuleStateLookup_wait_until_no_readers();
        __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
            data->table, data->count, interpreter_id);
        if (!lower_bound) goto done;
        if (lower_bound->id != interpreter_id) goto done;
        __Pyx_InterpreterIdAndModule *end = data->table+data->count;
        for (;lower_bound<end-1; ++lower_bound) {
            lower_bound->id = (lower_bound+1)->id;
            lower_bound->module = (lower_bound+1)->module;
        }
    }
    --data->count;
    if (data->count == 0) {
        free(data);
        data = NULL;
    }
  done:
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
#else
    __Pyx_ModuleStateLookup_data = data;
#endif
    __Pyx_ModuleStateLookup_Unlock();
    return 0;
}
#endif

/* #### Code section: utility_code_pragmas_end ### */
#ifdef _MSC_VER
#pragma warning( pop )
#endif



/* #### Code section: end ### */
#endif /* Py_PYTHON_H */
