Generated by Cython 0.28.5
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: colorspace_converter.cpp
001: # This file is part of Xpra.
002: # Copyright (C) 2013 Arthur Huillet
003: # Copyright (C) 2012-2018 Antoine Martin <antoine@devloop.org.uk>
004: # Xpra is released under the terms of the GNU GPL v2, or, at your option, any
005: # later version. See the file COPYING for details.
006:
007: #cython: auto_pickle=False, wraparound=False, cdivision=True, language_level=3
008: from __future__ import absolute_import
009:
+010: import os
__pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+011: import time
__pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
012:
+013: from xpra.log import Logger
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Logger); __Pyx_GIVEREF(__pyx_n_s_Logger); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Logger); __pyx_t_2 = __Pyx_Import(__pyx_n_s_xpra_log, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Logger, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+014: log = Logger("csc", "libyuv")
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_log, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_tuple__6 = PyTuple_Pack(2, __pyx_n_u_csc, __pyx_n_u_libyuv); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6);
015:
+016: from xpra.os_util import is_Ubuntu
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_is_Ubuntu); __Pyx_GIVEREF(__pyx_n_s_is_Ubuntu); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_is_Ubuntu); __pyx_t_2 = __Pyx_Import(__pyx_n_s_xpra_os_util, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_is_Ubuntu); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_Ubuntu, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+017: from xpra.codecs.codec_checks import do_testcsc
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_do_testcsc); __Pyx_GIVEREF(__pyx_n_s_do_testcsc); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_do_testcsc); __pyx_t_1 = __Pyx_Import(__pyx_n_s_xpra_codecs_codec_checks, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_do_testcsc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_do_testcsc, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+018: from xpra.codecs.codec_constants import get_subsampling_divs, csc_spec
__pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_get_subsampling_divs); __Pyx_GIVEREF(__pyx_n_s_get_subsampling_divs); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_subsampling_divs); __Pyx_INCREF(__pyx_n_s_csc_spec); __Pyx_GIVEREF(__pyx_n_s_csc_spec); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_csc_spec); __pyx_t_2 = __Pyx_Import(__pyx_n_s_xpra_codecs_codec_constants, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_subsampling_divs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_subsampling_divs, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_csc_spec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_csc_spec, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+019: from xpra.codecs.image_wrapper import ImageWrapper
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_ImageWrapper); __Pyx_GIVEREF(__pyx_n_s_ImageWrapper); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ImageWrapper); __pyx_t_1 = __Pyx_Import(__pyx_n_s_xpra_codecs_image_wrapper, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ImageWrapper, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
020: from xpra.buffers.membuf cimport memalign, object_as_buffer, memory_as_pybuffer
021:
022: from xpra.monotonic_time cimport monotonic_time
023: from libc.stdint cimport uint8_t, uintptr_t
024:
025:
026: cdef extern from "stdlib.h":
027: void free(void *ptr)
028:
029: cdef extern from "../../buffers/memalign.h":
030: unsigned int MEMALIGN_ALIGNMENT
031:
032:
033: cdef extern from "libyuv/convert.h" namespace "libyuv":
034: #int BGRAToI420(const uint8_t* src_frame, ...
035: #this is actually BGRX for little endian systems:
036: int ARGBToI420(const uint8_t* src_frame, int src_stride_frame,
037: uint8_t* dst_y, int dst_stride_y,
038: uint8_t* dst_u, int dst_stride_u,
039: uint8_t* dst_v, int dst_stride_v,
040: int width, int height) nogil
041:
042: cdef extern from "libyuv/scale.h" namespace "libyuv":
043: ctypedef unsigned int FilterMode
044: FilterMode kFilterNone
045: FilterMode kFilterBilinear
046: FilterMode kFilterBox
047: void ScalePlane(const uint8_t* src, int src_stride,
048: int src_width, int src_height,
049: uint8_t* dst, int dst_stride,
050: int dst_width, int dst_height,
051: FilterMode filtering) nogil
052:
+053: cdef get_fiter_mode_str(FilterMode fm):
static PyObject *__pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_get_fiter_mode_str(libyuv::FilterMode __pyx_v_fm) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_fiter_mode_str", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+054: if fm==kFilterNone:
__pyx_t_1 = ((__pyx_v_fm == libyuv::kFilterNone) != 0); if (__pyx_t_1) { /* … */ }
+055: return "None"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_u_None); __pyx_r = __pyx_n_u_None; goto __pyx_L0;
+056: elif fm==kFilterBilinear:
__pyx_t_1 = ((__pyx_v_fm == libyuv::kFilterBilinear) != 0); if (__pyx_t_1) { /* … */ }
+057: return "Bilinear"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_u_Bilinear); __pyx_r = __pyx_n_u_Bilinear; goto __pyx_L0;
+058: elif fm==kFilterBox:
__pyx_t_1 = ((__pyx_v_fm == libyuv::kFilterBox) != 0); if (__pyx_t_1) { /* … */ }
+059: return "Box"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_u_Box); __pyx_r = __pyx_n_u_Box; goto __pyx_L0;
+060: return "invalid"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_u_invalid); __pyx_r = __pyx_n_u_invalid; goto __pyx_L0;
061:
+062: cdef FilterMode get_filtermode(int speed):
static libyuv::FilterMode __pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_get_filtermode(int __pyx_v_speed) { libyuv::FilterMode __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_filtermode", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+063: if speed>66:
__pyx_t_1 = ((__pyx_v_speed > 66) != 0); if (__pyx_t_1) { /* … */ }
+064: return kFilterNone
__pyx_r = libyuv::kFilterNone; goto __pyx_L0;
+065: elif speed>33:
__pyx_t_1 = ((__pyx_v_speed > 33) != 0); if (__pyx_t_1) { /* … */ }
+066: return kFilterBilinear
__pyx_r = libyuv::kFilterBilinear; goto __pyx_L0;
+067: return kFilterBox
__pyx_r = libyuv::kFilterBox; goto __pyx_L0;
068:
069:
+070: cdef inline int roundup(int n, int m):
static CYTHON_INLINE int __pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_roundup(int __pyx_v_n, int __pyx_v_m) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("roundup", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+071: return (n + m - 1) & ~(m - 1)
__pyx_r = (((__pyx_v_n + __pyx_v_m) - 1) & (~(__pyx_v_m - 1))); goto __pyx_L0;
072:
+073: cdef inline uintptr_t roundupl(uintptr_t n, uintptr_t m):
static CYTHON_INLINE uintptr_t __pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_roundupl(uintptr_t __pyx_v_n, uintptr_t __pyx_v_m) { uintptr_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("roundupl", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+074: return (n + m - 1) & ~(m - 1)
__pyx_r = (((__pyx_v_n + __pyx_v_m) - 1) & (~(__pyx_v_m - 1))); goto __pyx_L0;
075:
+076: cdef inline uintptr_t memalign_ptr(uintptr_t ptr):
static CYTHON_INLINE uintptr_t __pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_memalign_ptr(uintptr_t __pyx_v_ptr) { uintptr_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("memalign_ptr", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+077: return <uintptr_t> roundupl(<unsigned long> ptr, MEMALIGN_ALIGNMENT)
__pyx_r = ((uintptr_t)__pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_roundupl(((unsigned long)__pyx_v_ptr), MEMALIGN_ALIGNMENT)); goto __pyx_L0;
078:
079:
+080: def init_module():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_1init_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_1init_module = {"init_module", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_1init_module, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_1init_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_module (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_init_module(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_init_module(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_module", 0); /* … */ /* 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_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.init_module", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_1init_module, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_module, __pyx_t_1) < 0) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_libyuv_colorspac, __pyx_n_s_init_module, 80, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 80, __pyx_L1_error)
081: #nothing to do!
+082: log("csc_libyuv.init_module()")
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_csc_libyuv_init_module); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
083:
+084: def cleanup_module():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_3cleanup_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_3cleanup_module = {"cleanup_module", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_3cleanup_module, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_3cleanup_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cleanup_module (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_2cleanup_module(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_2cleanup_module(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cleanup_module", 0); /* … */ /* 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_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.cleanup_module", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_3cleanup_module, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_cleanup_module, __pyx_t_1) < 0) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_libyuv_colorspac, __pyx_n_s_cleanup_module, 84, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 84, __pyx_L1_error)
+085: log("csc_libyuv.cleanup_module()")
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_csc_libyuv_cleanup_module); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2);
086:
+087: def get_type():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_5get_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_5get_type = {"get_type", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_5get_type, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_5get_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_type (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_4get_type(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_4get_type(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_type", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_5get_type, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_type, __pyx_t_1) < 0) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_libyuv_colorspac, __pyx_n_s_get_type, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 87, __pyx_L1_error)
+088: return "libyuv"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_u_libyuv); __pyx_r = __pyx_n_u_libyuv; goto __pyx_L0;
089:
+090: def get_version():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_7get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_7get_version = {"get_version", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_7get_version, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_7get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_version (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_6get_version(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_6get_version(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_version", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_7get_version, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_version, __pyx_t_1) < 0) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_libyuv_colorspac, __pyx_n_s_get_version, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 90, __pyx_L1_error)
+091: return 0
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_int_0); __pyx_r = __pyx_int_0; goto __pyx_L0;
092:
093: #hardcoded for now:
+094: MAX_WIDTH = 32768
if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WIDTH, __pyx_int_32768) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
+095: MAX_HEIGHT = 32768
if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_HEIGHT, __pyx_int_32768) < 0) __PYX_ERR(0, 95, __pyx_L1_error)
+096: IN_COLORSPACES = ["BGRX"]
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_u_BGRX); __Pyx_GIVEREF(__pyx_n_u_BGRX); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_BGRX); if (PyDict_SetItem(__pyx_d, __pyx_n_s_IN_COLORSPACES, __pyx_t_1) < 0) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+097: OUT_COLORSPACES = ["YUV420P"]
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_u_YUV420P); __Pyx_GIVEREF(__pyx_n_u_YUV420P); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_YUV420P); if (PyDict_SetItem(__pyx_d, __pyx_n_s_OUT_COLORSPACES, __pyx_t_1) < 0) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+098: def get_info():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_9get_info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_9get_info = {"get_info", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_9get_info, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_9get_info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_info (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_8get_info(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_8get_info(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_info", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.get_info", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_9get_info, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_info, __pyx_t_1) < 0) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_libyuv_colorspac, __pyx_n_s_get_info, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 98, __pyx_L1_error)
099: global IN_COLORSPACES, OUT_COLORSPACES, MAX_WIDTH, MAX_HEIGHT
+100: return {"version" : get_version(),
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_4) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_version, __pyx_t_2) < 0) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+101: "input-formats" : IN_COLORSPACES,
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_IN_COLORSPACES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_input_formats, __pyx_t_2) < 0) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+102: "output-formats" : OUT_COLORSPACES,
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_OUT_COLORSPACES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_output_formats, __pyx_t_2) < 0) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+103: "max-size" : (MAX_WIDTH, MAX_HEIGHT),
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_max_size, __pyx_t_4) < 0) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
104: }
105:
+106: def get_input_colorspaces():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_11get_input_colorspaces(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_11get_input_colorspaces = {"get_input_colorspaces", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_11get_input_colorspaces, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_11get_input_colorspaces(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_input_colorspaces (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_10get_input_colorspaces(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_10get_input_colorspaces(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_input_colorspaces", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.get_input_colorspaces", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_11get_input_colorspaces, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_input_colorspaces, __pyx_t_1) < 0) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_libyuv_colorspac, __pyx_n_s_get_input_colorspaces, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 106, __pyx_L1_error)
+107: return IN_COLORSPACES
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_IN_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
108:
+109: def get_output_colorspaces(input_colorspace):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_13get_output_colorspaces(PyObject *__pyx_self, PyObject *__pyx_v_input_colorspace); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_13get_output_colorspaces = {"get_output_colorspaces", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_13get_output_colorspaces, METH_O, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_13get_output_colorspaces(PyObject *__pyx_self, PyObject *__pyx_v_input_colorspace) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_output_colorspaces (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_12get_output_colorspaces(__pyx_self, ((PyObject *)__pyx_v_input_colorspace)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_12get_output_colorspaces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_input_colorspace) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_output_colorspaces", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.get_output_colorspaces", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_input_colorspace); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_13get_output_colorspaces, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_output_colorspaces, __pyx_t_1) < 0) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_libyuv_colorspac, __pyx_n_s_get_output_colorspaces, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 109, __pyx_L1_error)
+110: assert input_colorspace in IN_COLORSPACES
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_IN_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_input_colorspace, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!(__pyx_t_2 != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 110, __pyx_L1_error) } } #endif
+111: return OUT_COLORSPACES
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_OUT_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
112:
113:
+114: def get_spec(in_colorspace, out_colorspace):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15get_spec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15get_spec = {"get_spec", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15get_spec, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15get_spec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_in_colorspace = 0; PyObject *__pyx_v_out_colorspace = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_spec (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_colorspace,&__pyx_n_s_out_colorspace,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_in_colorspace)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_colorspace)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_spec", 1, 2, 2, 1); __PYX_ERR(0, 114, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_spec") < 0)) __PYX_ERR(0, 114, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_in_colorspace = values[0]; __pyx_v_out_colorspace = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_spec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 114, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.get_spec", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_14get_spec(__pyx_self, __pyx_v_in_colorspace, __pyx_v_out_colorspace); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_14get_spec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_colorspace, PyObject *__pyx_v_out_colorspace) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_spec", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.get_spec", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_in_colorspace, __pyx_n_s_out_colorspace); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15get_spec, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_spec, __pyx_t_1) < 0) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_libyuv_colorspac, __pyx_n_s_get_spec, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 114, __pyx_L1_error)
+115: assert in_colorspace in IN_COLORSPACES, "invalid input colorspace: %s (must be one of %s)" % (in_colorspace, IN_COLORSPACES)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_IN_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_in_colorspace, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!(__pyx_t_2 != 0))) { __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_4 = 127; __Pyx_INCREF(__pyx_kp_u_invalid_input_colorspace); __pyx_t_3 += 26; __Pyx_GIVEREF(__pyx_kp_u_invalid_input_colorspace); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_invalid_input_colorspace); __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_in_colorspace), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u_must_be_one_of); __pyx_t_3 += 17; __Pyx_GIVEREF(__pyx_kp_u_must_be_one_of); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_must_be_one_of); __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_IN_COLORSPACES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_6); __pyx_t_6 = 0; __Pyx_INCREF(__pyx_kp_u__3); __pyx_t_3 += 1; __Pyx_GIVEREF(__pyx_kp_u__3); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__3); __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 115, __pyx_L1_error) } } #endif
+116: assert out_colorspace in OUT_COLORSPACES, "invalid output colorspace: %s (must be one of %s)" % (out_colorspace, OUT_COLORSPACES)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_OUT_COLORSPACES); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_out_colorspace, __pyx_t_6, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!(__pyx_t_2 != 0))) { __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = 0; __pyx_t_4 = 127; __Pyx_INCREF(__pyx_kp_u_invalid_output_colorspace); __pyx_t_3 += 27; __Pyx_GIVEREF(__pyx_kp_u_invalid_output_colorspace); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_invalid_output_colorspace); __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_out_colorspace), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); __pyx_t_1 = 0; __Pyx_INCREF(__pyx_kp_u_must_be_one_of); __pyx_t_3 += 17; __Pyx_GIVEREF(__pyx_kp_u_must_be_one_of); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u_must_be_one_of); __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_OUT_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_1), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__3); __pyx_t_3 += 1; __Pyx_GIVEREF(__pyx_kp_u__3); PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_kp_u__3); __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 116, __pyx_L1_error) } } #endif
+117: return csc_spec(ColorspaceConverter, codec_type=get_type(), speed=100, setup_cost=0, min_w=8, min_h=2, can_scale=True, max_w=MAX_WIDTH, max_h=MAX_HEIGHT)
__Pyx_XDECREF(__pyx_r); __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_csc_spec); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_ptype_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_ptype_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter)); __pyx_t_1 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); } } if (__pyx_t_9) { __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_codec_type, __pyx_t_7) < 0) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_speed, __pyx_int_100) < 0) __PYX_ERR(0, 117, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_setup_cost, __pyx_int_0) < 0) __PYX_ERR(0, 117, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_min_w, __pyx_int_8) < 0) __PYX_ERR(0, 117, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_min_h, __pyx_int_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_can_scale, Py_True) < 0) __PYX_ERR(0, 117, __pyx_L1_error) __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_w, __pyx_t_7) < 0) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_h, __pyx_t_7) < 0) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0;
118:
119:
+120: class YUVImageWrapper(ImageWrapper):
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_YUVImageWrapper, __pyx_n_s_YUVImageWrapper, (PyObject *) NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* … */ __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_YUVImageWrapper, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_YUVImageWrapper, __pyx_t_4) < 0) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
121:
+122: def _cn(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_1_cn(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_1_cn = {"_cn", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_1_cn, METH_O, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_1_cn(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_cn (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper__cn(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper__cn(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_cn", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); /* … */ __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_1_cn, 0, __pyx_n_s_YUVImageWrapper__cn, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_cn, __pyx_t_4) < 0) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_libyuv_colorspac, __pyx_n_s_cn, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 122, __pyx_L1_error)
+123: return "libyuv.YUVImageWrapper"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_kp_u_libyuv_YUVImageWrapper); __pyx_r = __pyx_kp_u_libyuv_YUVImageWrapper; goto __pyx_L0;
124:
+125: def free(self): #@DuplicatedSignature
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_3free(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_3free = {"free", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_3free, METH_O, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_3free(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("free (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_2free(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_2free(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("free", 0); /* … */ /* 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_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.YUVImageWrapper.free", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); /* … */ __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_15YUVImageWrapper_3free, 0, __pyx_n_s_YUVImageWrapper_free, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_free, __pyx_t_4) < 0) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_libyuv_colorspac, __pyx_n_s_free, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 125, __pyx_L1_error)
+126: log("libyuv.YUVImageWrapper.free() cython_buffer=%#x", <unsigned long> self.cython_buffer)
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cython_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_As_unsigned_long(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_unsigned_long(((unsigned long)__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_libyuv_YUVImageWrapper_free_cyth, __pyx_t_3}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_libyuv_YUVImageWrapper_free_cyth, __pyx_t_3}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_INCREF(__pyx_kp_u_libyuv_YUVImageWrapper_free_cyth); __Pyx_GIVEREF(__pyx_kp_u_libyuv_YUVImageWrapper_free_cyth); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_u_libyuv_YUVImageWrapper_free_cyth); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+127: ImageWrapper.free(self)
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_free); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } if (!__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_7)) { PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_self}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_self}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_self); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+128: if self.cython_buffer>0:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cython_buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_8) { /* … */ }
+129: free(<void *> (<uintptr_t> self.cython_buffer))
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cython_buffer); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_9 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; free(((void *)((uintptr_t)__pyx_t_9)));
+130: self.cython_buffer = 0
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cython_buffer, __pyx_int_0) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
131:
132:
+133: cdef class ColorspaceConverter:
struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter { PyObject_HEAD int src_width; int src_height; int dst_width; int dst_height; int scaling; unsigned long frames; double time; PyObject *src_format; PyObject *dst_format; int out_stride[3]; int out_width[3]; int out_height[3]; unsigned long out_offsets[3]; unsigned long out_size[3]; unsigned long out_buffer_size; uint8_t *output_buffer; libyuv::FilterMode filtermode; int scaled_stride[3]; int scaled_width[3]; int scaled_height[3]; unsigned long scaled_offsets[3]; unsigned long scaled_size[3]; unsigned long scaled_buffer_size; PyObject *__weakref__; };
134: cdef int src_width
135: cdef int src_height
136: cdef int dst_width
137: cdef int dst_height
138: cdef int scaling
139:
140: cdef unsigned long frames
141: cdef double time
142:
143: cdef object src_format
144: cdef object dst_format
145: cdef int out_stride[3]
146: cdef int out_width[3]
147: cdef int out_height[3]
148: cdef unsigned long[3] out_offsets
149: cdef unsigned long out_size[3]
150: cdef unsigned long out_buffer_size
151: #when scaling:
152: cdef uint8_t *output_buffer
153: cdef FilterMode filtermode
154: cdef int scaled_stride[3]
155: cdef int scaled_width[3]
156: cdef int scaled_height[3]
157: cdef unsigned long[3] scaled_offsets
158: cdef unsigned long scaled_size[3]
159: cdef unsigned long scaled_buffer_size
160:
161: cdef object __weakref__
162:
+163: def init_context(self, int src_width, int src_height, src_format,
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_1init_context(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_1init_context(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { 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; int __pyx_v_speed; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_context (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src_width,&__pyx_n_s_src_height,&__pyx_n_s_src_format,&__pyx_n_s_dst_width,&__pyx_n_s_dst_height,&__pyx_n_s_dst_format,&__pyx_n_s_speed,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_src_width)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_src_height)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 6, 7, 1); __PYX_ERR(0, 163, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_src_format)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 6, 7, 2); __PYX_ERR(0, 163, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dst_width)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 6, 7, 3); __PYX_ERR(0, 163, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dst_height)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 6, 7, 4); __PYX_ERR(0, 163, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dst_format)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 6, 7, 5); __PYX_ERR(0, 163, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_speed); if (value) { values[6] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "init_context") < 0)) __PYX_ERR(0, 163, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_src_width = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_src_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error) __pyx_v_src_height = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_src_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error) __pyx_v_src_format = values[2]; __pyx_v_dst_width = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_dst_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L3_error) __pyx_v_dst_height = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_dst_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L3_error) __pyx_v_dst_format = values[5]; if (values[6]) { __pyx_v_speed = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_speed == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L3_error) } else { __pyx_v_speed = ((int)0x64); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("init_context", 0, 6, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 163, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.init_context", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_init_context(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__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_speed); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_init_context(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__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, int __pyx_v_speed) { PyObject *__pyx_v_divs = NULL; long __pyx_v_i; PyObject *__pyx_v_xdiv = NULL; PyObject *__pyx_v_ydiv = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_context", 0); /* … */ /* 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_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.init_context", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_divs); __Pyx_XDECREF(__pyx_v_xdiv); __Pyx_XDECREF(__pyx_v_ydiv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
164: int dst_width, int dst_height, dst_format, int speed=100): #@DuplicatedSignature
+165: log("libyuv.ColorspaceConverter.init_context%s", (src_width, src_height, src_format, dst_width, dst_height, dst_format, speed))
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_src_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_src_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_dst_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_dst_height); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_speed); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4); __Pyx_INCREF(__pyx_v_src_format); __Pyx_GIVEREF(__pyx_v_src_format); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_src_format); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_6); __Pyx_INCREF(__pyx_v_dst_format); __Pyx_GIVEREF(__pyx_v_dst_format); PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_dst_format); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_t_7); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_9 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_u_libyuv_ColorspaceConverter_init, __pyx_t_8}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_u_libyuv_ColorspaceConverter_init, __pyx_t_8}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL; } __Pyx_INCREF(__pyx_kp_u_libyuv_ColorspaceConverter_init); __Pyx_GIVEREF(__pyx_kp_u_libyuv_ColorspaceConverter_init); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_kp_u_libyuv_ColorspaceConverter_init); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_t_8); __pyx_t_8 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+166: assert src_format=="BGRX", "invalid source format: %s" % src_format
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_src_format, __pyx_n_u_BGRX, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 166, __pyx_L1_error) if (unlikely(!__pyx_t_10)) { __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_invalid_source_format_s, __pyx_v_src_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); PyErr_SetObject(PyExc_AssertionError, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 166, __pyx_L1_error) } } #endif
+167: assert dst_format=="YUV420P", "invalid destination format: %s" % dst_format
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_dst_format, __pyx_n_u_YUV420P, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 167, __pyx_L1_error) if (unlikely(!__pyx_t_10)) { __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_invalid_destination_format_s, __pyx_v_dst_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); PyErr_SetObject(PyExc_AssertionError, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 167, __pyx_L1_error) } } #endif
+168: self.scaling = int(src_width!=dst_width or src_height!=dst_height)
__pyx_t_10 = (__pyx_v_src_width != __pyx_v_dst_width); if (!__pyx_t_10) { } else { __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L3_bool_binop_done; } __pyx_t_10 = (__pyx_v_src_height != __pyx_v_dst_height); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; __pyx_L3_bool_binop_done:; __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->scaling = __pyx_t_9;
+169: if self.scaling:
__pyx_t_10 = (__pyx_v_self->scaling != 0); if (__pyx_t_10) { /* … */ }
+170: self.filtermode = get_filtermode(speed)
__pyx_v_self->filtermode = __pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_get_filtermode(__pyx_v_speed);
+171: self.src_format = "BGRX"
__Pyx_INCREF(__pyx_n_u_BGRX); __Pyx_GIVEREF(__pyx_n_u_BGRX); __Pyx_GOTREF(__pyx_v_self->src_format); __Pyx_DECREF(__pyx_v_self->src_format); __pyx_v_self->src_format = __pyx_n_u_BGRX;
+172: self.dst_format = "YUV420P"
__Pyx_INCREF(__pyx_n_u_YUV420P); __Pyx_GIVEREF(__pyx_n_u_YUV420P); __Pyx_GOTREF(__pyx_v_self->dst_format); __Pyx_DECREF(__pyx_v_self->dst_format); __pyx_v_self->dst_format = __pyx_n_u_YUV420P;
+173: self.src_width = src_width
__pyx_v_self->src_width = __pyx_v_src_width;
+174: self.src_height = src_height
__pyx_v_self->src_height = __pyx_v_src_height;
+175: self.dst_width = dst_width
__pyx_v_self->dst_width = __pyx_v_dst_width;
+176: self.dst_height = dst_height
__pyx_v_self->dst_height = __pyx_v_dst_height;
177: #pre-calculate unscaled YUV plane heights:
+178: self.out_buffer_size = 0
__pyx_v_self->out_buffer_size = 0;
+179: self.scaled_buffer_size = 0
__pyx_v_self->scaled_buffer_size = 0;
+180: divs = get_subsampling_divs(self.dst_format)
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_subsampling_divs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } if (!__pyx_t_6) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_self->dst_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_self->dst_format}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_self->dst_format}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_INCREF(__pyx_v_self->dst_format); __Pyx_GIVEREF(__pyx_v_self->dst_format); PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_self->dst_format); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_divs = __pyx_t_2; __pyx_t_2 = 0;
+181: for i in range(3):
for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11;
+182: xdiv, ydiv = divs[i]
__pyx_t_2 = __Pyx_GetItemInt(__pyx_v_divs, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 182, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_8 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_8); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_12(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_8 = __pyx_t_12(__pyx_t_6); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_6), 2) < 0) __PYX_ERR(0, 182, __pyx_L1_error) __pyx_t_12 = NULL; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L9_unpacking_done; __pyx_L8_unpacking_failed:; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_12 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 182, __pyx_L1_error) __pyx_L9_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_xdiv, __pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF_SET(__pyx_v_ydiv, __pyx_t_8); __pyx_t_8 = 0;
+183: self.out_width[i] = src_width // xdiv
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_src_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __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, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; (__pyx_v_self->out_width[__pyx_v_i]) = __pyx_t_9;
+184: self.out_height[i] = src_height // ydiv
__pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_src_height); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 184, __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, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_self->out_height[__pyx_v_i]) = __pyx_t_9;
+185: self.out_stride[i] = roundup(self.out_width[i], MEMALIGN_ALIGNMENT)
(__pyx_v_self->out_stride[__pyx_v_i]) = __pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_roundup((__pyx_v_self->out_width[__pyx_v_i]), MEMALIGN_ALIGNMENT);
+186: self.out_size[i] = self.out_stride[i] * self.out_height[i]
(__pyx_v_self->out_size[__pyx_v_i]) = ((__pyx_v_self->out_stride[__pyx_v_i]) * (__pyx_v_self->out_height[__pyx_v_i]));
+187: self.out_offsets[i] = self.out_buffer_size
__pyx_t_13 = __pyx_v_self->out_buffer_size; (__pyx_v_self->out_offsets[__pyx_v_i]) = __pyx_t_13;
188: #add two extra lines to height so we can access two rowstrides at a time,
189: #no matter where we start to read on the last line
190: #and round up to memalign each plane:
191: #(why two and not just one? libyuv will do this for input data with odd height)
+192: self.out_buffer_size += roundupl(self.out_size[i] + 2*self.out_stride[i], MEMALIGN_ALIGNMENT)
__pyx_v_self->out_buffer_size = (__pyx_v_self->out_buffer_size + __pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_roundupl(((__pyx_v_self->out_size[__pyx_v_i]) + (2 * (__pyx_v_self->out_stride[__pyx_v_i]))), MEMALIGN_ALIGNMENT));
+193: if self.scaling:
__pyx_t_10 = (__pyx_v_self->scaling != 0); if (__pyx_t_10) { /* … */ } }
+194: self.scaled_width[i] = dst_width // xdiv
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_dst_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __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, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; (__pyx_v_self->scaled_width[__pyx_v_i]) = __pyx_t_9;
+195: self.scaled_height[i] = dst_height // ydiv
__pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_dst_height); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 195, __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, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_self->scaled_height[__pyx_v_i]) = __pyx_t_9;
+196: self.scaled_stride[i] = roundup(self.scaled_width[i], MEMALIGN_ALIGNMENT)
(__pyx_v_self->scaled_stride[__pyx_v_i]) = __pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_roundup((__pyx_v_self->scaled_width[__pyx_v_i]), MEMALIGN_ALIGNMENT);
+197: self.scaled_size[i] = self.scaled_stride[i] * self.scaled_height[i]
(__pyx_v_self->scaled_size[__pyx_v_i]) = ((__pyx_v_self->scaled_stride[__pyx_v_i]) * (__pyx_v_self->scaled_height[__pyx_v_i]));
+198: self.scaled_offsets[i] = self.scaled_buffer_size
__pyx_t_13 = __pyx_v_self->scaled_buffer_size; (__pyx_v_self->scaled_offsets[__pyx_v_i]) = __pyx_t_13;
+199: self.scaled_buffer_size += self.scaled_size[i] + self.out_stride[i]
__pyx_v_self->scaled_buffer_size = (__pyx_v_self->scaled_buffer_size + ((__pyx_v_self->scaled_size[__pyx_v_i]) + (__pyx_v_self->out_stride[__pyx_v_i])));
+200: if self.scaling:
__pyx_t_10 = (__pyx_v_self->scaling != 0); if (__pyx_t_10) { /* … */ goto __pyx_L11; }
+201: self.output_buffer = <uint8_t *> memalign(self.out_buffer_size)
__pyx_v_self->output_buffer = ((uint8_t *)__pyx_f_4xpra_7buffers_6membuf_memalign(__pyx_v_self->out_buffer_size));
+202: if self.output_buffer==NULL:
__pyx_t_10 = ((__pyx_v_self->output_buffer == NULL) != 0); if (unlikely(__pyx_t_10)) { /* … */ }
+203: raise Exception("failed to allocate %i bytes for output buffer" % self.out_buffer_size)
__pyx_t_2 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->out_buffer_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_failed_to_allocate_i_bytes_for_o, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 203, __pyx_L1_error)
204: else:
+205: self.output_buffer = NULL
/*else*/ { __pyx_v_self->output_buffer = NULL; } __pyx_L11:;
+206: log("buffer size=%i, scaling=%s, filtermode=%s", self.out_buffer_size, self.scaling, get_fiter_mode_str(self.filtermode))
__pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->out_buffer_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->scaling); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_get_fiter_mode_str(__pyx_v_self->filtermode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_9 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_kp_u_buffer_size_i_scaling_s_filtermo, __pyx_t_1, __pyx_t_6, __pyx_t_7}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_kp_u_buffer_size_i_scaling_s_filtermo, __pyx_t_1, __pyx_t_6, __pyx_t_7}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_4 = PyTuple_New(4+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_INCREF(__pyx_kp_u_buffer_size_i_scaling_s_filtermo); __Pyx_GIVEREF(__pyx_kp_u_buffer_size_i_scaling_s_filtermo); PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_kp_u_buffer_size_i_scaling_s_filtermo); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_9, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_9, __pyx_t_7); __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+207: self.time = 0
__pyx_v_self->time = 0.0;
+208: self.frames = 0
__pyx_v_self->frames = 0;
209:
+210: def get_info(self): #@DuplicatedSignature
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_3get_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_3get_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_info (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_2get_info(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_2get_info(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { PyObject *__pyx_v_info = NULL; double __pyx_v_pps; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_info", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.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; }
+211: info = get_info()
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_info = __pyx_t_1; __pyx_t_1 = 0;
+212: info.update({
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_info, __pyx_n_s_update); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+213: "frames" : int(self.frames),
__pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->frames); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_frames, __pyx_t_5) < 0) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+214: "src_width" : self.src_width,
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->src_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_src_width, __pyx_t_5) < 0) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+215: "src_height": self.src_height,
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->src_height); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_src_height, __pyx_t_5) < 0) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+216: "dst_width" : self.dst_width,
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->dst_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_dst_width, __pyx_t_5) < 0) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+217: "dst_height": self.dst_height})
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->dst_height); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_dst_height, __pyx_t_5) < 0) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_5) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+218: if self.src_format:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_self->src_format); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 218, __pyx_L1_error) if (__pyx_t_6) { /* … */ }
+219: info["src_format"] = self.src_format
__pyx_t_1 = __pyx_v_self->src_format; __Pyx_INCREF(__pyx_t_1); if (unlikely(PyObject_SetItem(__pyx_v_info, __pyx_n_u_src_format, __pyx_t_1) < 0)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+220: if self.dst_format:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_self->dst_format); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) if (__pyx_t_6) { /* … */ }
+221: info["dst_format"] = self.dst_format
__pyx_t_1 = __pyx_v_self->dst_format; __Pyx_INCREF(__pyx_t_1); if (unlikely(PyObject_SetItem(__pyx_v_info, __pyx_n_u_dst_format, __pyx_t_1) < 0)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+222: if self.frames>0 and self.time>0:
__pyx_t_7 = ((__pyx_v_self->frames > 0) != 0); if (__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L6_bool_binop_done; } __pyx_t_7 = ((__pyx_v_self->time > 0.0) != 0); __pyx_t_6 = __pyx_t_7; __pyx_L6_bool_binop_done:; if (__pyx_t_6) { /* … */ }
+223: pps = float(self.src_width) * float(self.src_height) * float(self.frames) / self.time
__pyx_v_pps = (((((double)__pyx_v_self->src_width) * ((double)__pyx_v_self->src_height)) * ((double)__pyx_v_self->frames)) / __pyx_v_self->time);
+224: info["total_time_ms"] = int(self.time*1000.0)
__pyx_t_1 = __Pyx_PyInt_FromDouble((__pyx_v_self->time * 1000.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyObject_SetItem(__pyx_v_info, __pyx_n_u_total_time_ms, __pyx_t_1) < 0)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+225: info["pixels_per_second"] = int(pps)
__pyx_t_1 = __Pyx_PyInt_FromDouble(__pyx_v_pps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyObject_SetItem(__pyx_v_info, __pyx_n_u_pixels_per_second, __pyx_t_1) < 0)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+226: return info
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_info); __pyx_r = __pyx_v_info; goto __pyx_L0;
227:
+228: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_5__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_5__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_4__repr__(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_4__repr__(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+229: if not self.src_format or not self.dst_format:
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->src_format); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 229, __pyx_L1_error) __pyx_t_3 = ((!__pyx_t_2) != 0); if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->dst_format); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 229, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_3) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+230: return "libyuv(uninitialized)"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_kp_u_libyuv_uninitialized); __pyx_r = __pyx_kp_u_libyuv_uninitialized; goto __pyx_L0;
+231: return "libyuv(%s %sx%s %s)" % (self.src_format, self.src_width, self.src_height, self.dst_format)
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyTuple_New(9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = 127; __Pyx_INCREF(__pyx_kp_u_libyuv_2); __pyx_t_5 += 7; __Pyx_GIVEREF(__pyx_kp_u_libyuv_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_libyuv_2); __pyx_t_7 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_self->src_format), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_kp_u__4); __pyx_t_5 += 1; __Pyx_GIVEREF(__pyx_kp_u__4); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__4); __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_self->src_width, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_n_u_x); __pyx_t_5 += 1; __Pyx_GIVEREF(__pyx_n_u_x); PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_n_u_x); __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_self->src_height, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_kp_u__4); __pyx_t_5 += 1; __Pyx_GIVEREF(__pyx_kp_u__4); PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_kp_u__4); __pyx_t_7 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_self->dst_format), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_kp_u__3); __pyx_t_5 += 1; __Pyx_GIVEREF(__pyx_kp_u__3); PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_kp_u__3); __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 9, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0;
232:
+233: def __dealloc__(self): #@DuplicatedSignature
/* Python wrapper */ static void __pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_7__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_7__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_6__dealloc__(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_6__dealloc__(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+234: self.clean()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
235:
+236: def get_src_width(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_9get_src_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_9get_src_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_src_width (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_8get_src_width(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_8get_src_width(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_src_width", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.get_src_width", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+237: return self.src_width
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->src_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
238:
+239: def get_src_height(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_11get_src_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_11get_src_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_src_height (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_10get_src_height(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_10get_src_height(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_src_height", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.get_src_height", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+240: return self.src_height
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->src_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
241:
+242: def get_src_format(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_13get_src_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_13get_src_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_src_format (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_12get_src_format(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_12get_src_format(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_src_format", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+243: return self.src_format
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->src_format); __pyx_r = __pyx_v_self->src_format; goto __pyx_L0;
244:
+245: def get_dst_width(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_15get_dst_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_15get_dst_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_dst_width (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_14get_dst_width(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_14get_dst_width(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_dst_width", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.get_dst_width", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+246: return self.dst_width
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->dst_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
247:
+248: def get_dst_height(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_17get_dst_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_17get_dst_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_dst_height (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_16get_dst_height(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_16get_dst_height(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_dst_height", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.get_dst_height", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+249: return self.dst_height
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->dst_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
250:
+251: def get_dst_format(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_19get_dst_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_19get_dst_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_dst_format (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_18get_dst_format(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_18get_dst_format(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_dst_format", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+252: return self.dst_format
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->dst_format); __pyx_r = __pyx_v_self->dst_format; goto __pyx_L0;
253:
+254: def get_type(self): #@DuplicatedSignature
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_21get_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_21get_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_type (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_20get_type(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_20get_type(CYTHON_UNUSED struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_type", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+255: return "libyuv"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_u_libyuv); __pyx_r = __pyx_n_u_libyuv; goto __pyx_L0;
256:
257:
+258: def clean(self): #@DuplicatedSignature
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_23clean(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_23clean(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clean (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_22clean(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_22clean(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { long __pyx_v_i; uint8_t *__pyx_v_output_buffer; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clean", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+259: self.src_width = 0
__pyx_v_self->src_width = 0;
+260: self.src_height = 0
__pyx_v_self->src_height = 0;
+261: self.dst_width = 0
__pyx_v_self->dst_width = 0;
+262: self.dst_height = 0
__pyx_v_self->dst_height = 0;
+263: self.src_format = ""
__Pyx_INCREF(__pyx_kp_u__5); __Pyx_GIVEREF(__pyx_kp_u__5); __Pyx_GOTREF(__pyx_v_self->src_format); __Pyx_DECREF(__pyx_v_self->src_format); __pyx_v_self->src_format = __pyx_kp_u__5;
+264: self.dst_format = ""
__Pyx_INCREF(__pyx_kp_u__5); __Pyx_GIVEREF(__pyx_kp_u__5); __Pyx_GOTREF(__pyx_v_self->dst_format); __Pyx_DECREF(__pyx_v_self->dst_format); __pyx_v_self->dst_format = __pyx_kp_u__5;
+265: self.frames = 0
__pyx_v_self->frames = 0;
+266: self.time = 0
__pyx_v_self->time = 0.0;
+267: self.scaling = 0
__pyx_v_self->scaling = 0;
+268: for i in range(3):
for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { __pyx_v_i = __pyx_t_1;
+269: self.out_stride[i] = 0
(__pyx_v_self->out_stride[__pyx_v_i]) = 0;
+270: self.out_size[i] = 0
(__pyx_v_self->out_size[__pyx_v_i]) = 0; }
+271: cdef uint8_t *output_buffer = self.output_buffer
__pyx_t_2 = __pyx_v_self->output_buffer; __pyx_v_output_buffer = __pyx_t_2;
+272: self.output_buffer = NULL
__pyx_v_self->output_buffer = NULL;
+273: if output_buffer:
__pyx_t_3 = (__pyx_v_output_buffer != 0); if (__pyx_t_3) { /* … */ }
+274: free(output_buffer)
free(__pyx_v_output_buffer);
+275: self.out_buffer_size = 0
__pyx_v_self->out_buffer_size = 0;
276:
+277: def is_closed(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_25is_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_25is_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_closed (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_24is_closed(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_24is_closed(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_closed", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.is_closed", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+278: return self.out_buffer_size==0
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->out_buffer_size == 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
279:
280:
+281: def convert_image(self, image):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_27convert_image(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_27convert_image(PyObject *__pyx_v_self, PyObject *__pyx_v_image) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convert_image (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_26convert_image(((struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *)__pyx_v_self), ((PyObject *)__pyx_v_image)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_19ColorspaceConverter_26convert_image(struct __pyx_obj_4xpra_6codecs_10csc_libyuv_20colorspace_converter_ColorspaceConverter *__pyx_v_self, PyObject *__pyx_v_image) { Py_ssize_t __pyx_v_pic_buf_len; uint8_t const *__pyx_v_input_image; uint8_t *__pyx_v_output_buffer; uint8_t *__pyx_v_out_planes[3]; uint8_t *__pyx_v_scaled_buffer; uint8_t *__pyx_v_scaled_planes[3]; int __pyx_v_iplanes; int __pyx_v_i; int __pyx_v_result; int __pyx_v_width; int __pyx_v_height; int __pyx_v_stride; PyObject *__pyx_v_planes = 0; PyObject *__pyx_v_strides = 0; PyObject *__pyx_v_out_image = 0; double __pyx_v_start; PyObject *__pyx_v_pixels = NULL; double __pyx_v_elapsed; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convert_image", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.ColorspaceConverter.convert_image", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_planes); __Pyx_XDECREF(__pyx_v_strides); __Pyx_XDECREF(__pyx_v_out_image); __Pyx_XDECREF(__pyx_v_pixels); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+282: cdef Py_ssize_t pic_buf_len = 0
__pyx_v_pic_buf_len = 0;
283: cdef const uint8_t *input_image
284: cdef uint8_t *output_buffer
285: cdef uint8_t *out_planes[3]
286: cdef uint8_t *scaled_buffer
287: cdef uint8_t *scaled_planes[3]
288: cdef int iplanes
289: cdef int i, result
290: cdef int width, height, stride
291: cdef object planes, strides, out_image
+292: cdef double start = monotonic_time()
__pyx_v_start = __pyx_f_4xpra_14monotonic_time_monotonic_time();
+293: iplanes = image.get_planes()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_planes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_iplanes = __pyx_t_4;
+294: pixels = image.get_pixels()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_pixels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_pixels = __pyx_t_1; __pyx_t_1 = 0;
+295: stride = image.get_rowstride()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_rowstride); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_stride = __pyx_t_4;
+296: width = image.get_width()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_width = __pyx_t_4;
+297: height = image.get_height()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_height = __pyx_t_4;
+298: assert iplanes==ImageWrapper.PACKED, "invalid plane input format: %s" % iplanes
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_iplanes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_PACKED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_5)) { __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_iplanes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_invalid_plane_input_format_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 298, __pyx_L1_error) } } #endif
+299: assert pixels, "failed to get pixels from %s" % image
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_pixels); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 299, __pyx_L1_error) if (unlikely(!__pyx_t_5)) { __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_failed_to_get_pixels_from_s, __pyx_v_image); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); PyErr_SetObject(PyExc_AssertionError, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 299, __pyx_L1_error) } } #endif
+300: assert width>=self.src_width, "invalid image width: %s (minimum is %s)" % (width, self.src_width)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_width >= __pyx_v_self->src_width) != 0))) { __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = 0; __pyx_t_7 = 127; __Pyx_INCREF(__pyx_kp_u_invalid_image_width); __pyx_t_6 += 21; __Pyx_GIVEREF(__pyx_kp_u_invalid_image_width); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_invalid_image_width); __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_width, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_kp_u_minimum_is); __pyx_t_6 += 13; __Pyx_GIVEREF(__pyx_kp_u_minimum_is); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_minimum_is); __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_self->src_width, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_kp_u__3); __pyx_t_6 += 1; __Pyx_GIVEREF(__pyx_kp_u__3); PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u__3); __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 300, __pyx_L1_error) } } #endif
+301: assert height>=self.src_height, "invalid image height: %s (minimum is %s)" % (height, self.src_height)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_height >= __pyx_v_self->src_height) != 0))) { __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = 0; __pyx_t_7 = 127; __Pyx_INCREF(__pyx_kp_u_invalid_image_height); __pyx_t_6 += 22; __Pyx_GIVEREF(__pyx_kp_u_invalid_image_height); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_invalid_image_height); __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_height, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u_minimum_is); __pyx_t_6 += 13; __Pyx_GIVEREF(__pyx_kp_u_minimum_is); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_minimum_is); __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_self->src_height, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u__3); __pyx_t_6 += 1; __Pyx_GIVEREF(__pyx_kp_u__3); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__3); __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 301, __pyx_L1_error) } } #endif
302: #get pointer to input:
+303: assert object_as_buffer(pixels, <const void**> &input_image, &pic_buf_len)==0
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_f_4xpra_7buffers_6membuf_object_as_buffer(__pyx_v_pixels, ((void const **)(&__pyx_v_input_image)), (&__pyx_v_pic_buf_len)) == 0) != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 303, __pyx_L1_error) } } #endif
+304: if self.scaling:
__pyx_t_5 = (__pyx_v_self->scaling != 0); if (__pyx_t_5) { /* … */ goto __pyx_L3; }
305: #re-use the same temporary buffer every time:
+306: output_buffer = self.output_buffer
__pyx_t_8 = __pyx_v_self->output_buffer; __pyx_v_output_buffer = __pyx_t_8;
307: else:
308: #allocate output buffer:
+309: output_buffer = <unsigned char*> memalign(self.out_buffer_size)
/*else*/ { __pyx_v_output_buffer = ((unsigned char *)__pyx_f_4xpra_7buffers_6membuf_memalign(__pyx_v_self->out_buffer_size));
+310: if output_buffer==NULL:
__pyx_t_5 = ((__pyx_v_output_buffer == NULL) != 0); if (unlikely(__pyx_t_5)) { /* … */ } } __pyx_L3:;
+311: raise Exception("failed to allocate %i bytes for output buffer" % self.out_buffer_size)
__pyx_t_3 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->out_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_failed_to_allocate_i_bytes_for_o, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 311, __pyx_L1_error)
+312: for i in range(3):
for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
313: #offsets are aligned, so this is safe and gives us aligned pointers:
+314: out_planes[i] = <uint8_t*> (memalign_ptr(<uintptr_t> output_buffer) + self.out_offsets[i])
(__pyx_v_out_planes[__pyx_v_i]) = ((uint8_t *)(__pyx_f_4xpra_6codecs_10csc_libyuv_20colorspace_converter_memalign_ptr(((uintptr_t)__pyx_v_output_buffer)) + (__pyx_v_self->out_offsets[__pyx_v_i]))); }
+315: with nogil:
{ #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS __Pyx_FastGIL_Remember(); #endif /*try:*/ { /* … */ /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L9; } __pyx_L9:; } }
+316: result = ARGBToI420(input_image, stride,
__pyx_v_result = libyuv::ARGBToI420(__pyx_v_input_image, __pyx_v_stride, (__pyx_v_out_planes[0]), (__pyx_v_self->out_stride[0]), (__pyx_v_out_planes[1]), (__pyx_v_self->out_stride[1]), (__pyx_v_out_planes[2]), (__pyx_v_self->out_stride[2]), __pyx_v_width, __pyx_v_height); }
317: out_planes[0], self.out_stride[0],
318: out_planes[1], self.out_stride[1],
319: out_planes[2], self.out_stride[2],
320: width, height)
+321: assert result==0, "libyuv BGRAToI420 failed and returned %i" % result
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_result == 0) != 0))) { __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_libyuv_BGRAToI420_failed_and_ret, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 321, __pyx_L1_error) } } #endif
+322: cdef double elapsed = monotonic_time()-start
__pyx_v_elapsed = (__pyx_f_4xpra_14monotonic_time_monotonic_time() - __pyx_v_start);
+323: log("libyuv.ARGBToI420 took %.1fms", 1000.0*elapsed)
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyFloat_FromDouble((1000.0 * __pyx_v_elapsed)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_kp_u_libyuv_ARGBToI420_took_1fms, __pyx_t_1}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_kp_u_libyuv_ARGBToI420_took_1fms, __pyx_t_1}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { __pyx_t_10 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 323, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (__pyx_t_9) { __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; } __Pyx_INCREF(__pyx_kp_u_libyuv_ARGBToI420_took_1fms); __Pyx_GIVEREF(__pyx_kp_u_libyuv_ARGBToI420_took_1fms); PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_kp_u_libyuv_ARGBToI420_took_1fms); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+324: self.time += elapsed
__pyx_v_self->time = (__pyx_v_self->time + __pyx_v_elapsed);
+325: planes = []
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_planes = __pyx_t_2; __pyx_t_2 = 0;
+326: strides = []
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_strides = __pyx_t_2; __pyx_t_2 = 0;
+327: if self.scaling:
__pyx_t_5 = (__pyx_v_self->scaling != 0); if (__pyx_t_5) { /* … */ goto __pyx_L10; }
+328: start = monotonic_time()
__pyx_v_start = __pyx_f_4xpra_14monotonic_time_monotonic_time();
+329: scaled_buffer = <unsigned char*> memalign(self.scaled_buffer_size)
__pyx_v_scaled_buffer = ((unsigned char *)__pyx_f_4xpra_7buffers_6membuf_memalign(__pyx_v_self->scaled_buffer_size));
+330: if scaled_buffer==NULL:
__pyx_t_5 = ((__pyx_v_scaled_buffer == NULL) != 0); if (unlikely(__pyx_t_5)) { /* … */ }
+331: raise Exception("failed to allocate %i bytes for scaled buffer" % self.scaled_buffer_size)
__pyx_t_2 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->scaled_buffer_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_failed_to_allocate_i_bytes_for_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 331, __pyx_L1_error)
+332: with nogil:
{ #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS __Pyx_FastGIL_Remember(); #endif /*try:*/ { /* … */ /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L14; } __pyx_L14:; } }
+333: for i in range(3):
for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+334: scaled_planes[i] = scaled_buffer + self.scaled_offsets[i]
(__pyx_v_scaled_planes[__pyx_v_i]) = (__pyx_v_scaled_buffer + (__pyx_v_self->scaled_offsets[__pyx_v_i]));
+335: ScalePlane(out_planes[i], self.out_stride[i],
libyuv::ScalePlane((__pyx_v_out_planes[__pyx_v_i]), (__pyx_v_self->out_stride[__pyx_v_i]), (__pyx_v_self->out_width[__pyx_v_i]), (__pyx_v_self->out_height[__pyx_v_i]), (__pyx_v_scaled_planes[__pyx_v_i]), (__pyx_v_self->scaled_stride[__pyx_v_i]), (__pyx_v_self->scaled_width[__pyx_v_i]), (__pyx_v_self->scaled_height[__pyx_v_i]), __pyx_v_self->filtermode); } }
336: self.out_width[i], self.out_height[i],
337: scaled_planes[i], self.scaled_stride[i],
338: self.scaled_width[i], self.scaled_height[i],
339: self.filtermode)
+340: elapsed = monotonic_time()-start
__pyx_v_elapsed = (__pyx_f_4xpra_14monotonic_time_monotonic_time() - __pyx_v_start);
+341: log("libyuv.ScalePlane took %.1fms", 1000.0*elapsed)
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = PyFloat_FromDouble((1000.0 * __pyx_v_elapsed)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_1 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_u_libyuv_ScalePlane_took_1fms, __pyx_t_10}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_u_libyuv_ScalePlane_took_1fms, __pyx_t_10}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else #endif { __pyx_t_9 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_1) { __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __pyx_t_1 = NULL; } __Pyx_INCREF(__pyx_kp_u_libyuv_ScalePlane_took_1fms); __Pyx_GIVEREF(__pyx_kp_u_libyuv_ScalePlane_took_1fms); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_4, __pyx_kp_u_libyuv_ScalePlane_took_1fms); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_4, __pyx_t_10); __pyx_t_10 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+342: for i in range(3):
for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+343: strides.append(self.scaled_stride[i])
__pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_self->scaled_stride[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_strides, __pyx_t_2); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+344: planes.append(memory_as_pybuffer(<void *> scaled_planes[i], self.scaled_size[i], True))
__pyx_t_2 = __pyx_f_4xpra_7buffers_6membuf_memory_as_pybuffer(((void *)(__pyx_v_scaled_planes[__pyx_v_i])), (__pyx_v_self->scaled_size[__pyx_v_i]), 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 344, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_planes, __pyx_t_2); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 344, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; }
+345: self.frames += 1
__pyx_v_self->frames = (__pyx_v_self->frames + 1);
+346: out_image = YUVImageWrapper(0, 0, self.dst_width, self.dst_height, planes, self.dst_format, 24, strides, 1, ImageWrapper._3_PLANES)
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_YUVImageWrapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_self->dst_width); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_self->dst_height); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_3_PLANES); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[11] = {__pyx_t_1, __pyx_int_0, __pyx_int_0, __pyx_t_9, __pyx_t_10, __pyx_v_planes, __pyx_v_self->dst_format, __pyx_int_24, __pyx_v_strides, __pyx_int_1, __pyx_t_12}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[11] = {__pyx_t_1, __pyx_int_0, __pyx_int_0, __pyx_t_9, __pyx_t_10, __pyx_v_planes, __pyx_v_self->dst_format, __pyx_int_24, __pyx_v_strides, __pyx_int_1, __pyx_t_12}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } else #endif { __pyx_t_13 = PyTuple_New(10+__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (__pyx_t_1) { __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); __pyx_t_1 = NULL; } __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_4, __pyx_int_0); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_4, __pyx_int_0); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_4, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_v_planes); __Pyx_GIVEREF(__pyx_v_planes); PyTuple_SET_ITEM(__pyx_t_13, 4+__pyx_t_4, __pyx_v_planes); __Pyx_INCREF(__pyx_v_self->dst_format); __Pyx_GIVEREF(__pyx_v_self->dst_format); PyTuple_SET_ITEM(__pyx_t_13, 5+__pyx_t_4, __pyx_v_self->dst_format); __Pyx_INCREF(__pyx_int_24); __Pyx_GIVEREF(__pyx_int_24); PyTuple_SET_ITEM(__pyx_t_13, 6+__pyx_t_4, __pyx_int_24); __Pyx_INCREF(__pyx_v_strides); __Pyx_GIVEREF(__pyx_v_strides); PyTuple_SET_ITEM(__pyx_t_13, 7+__pyx_t_4, __pyx_v_strides); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_13, 8+__pyx_t_4, __pyx_int_1); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 9+__pyx_t_4, __pyx_t_12); __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_12 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_out_image = __pyx_t_2; __pyx_t_2 = 0;
+347: out_image.cython_buffer = <uintptr_t> scaled_buffer
__pyx_t_2 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_scaled_buffer)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyObject_SetAttrStr(__pyx_v_out_image, __pyx_n_s_cython_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
348: else:
349: #use output buffer directly:
+350: for i in range(3):
/*else*/ { for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+351: strides.append(self.out_stride[i])
__pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_self->out_stride[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_strides, __pyx_t_2); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+352: planes.append(memory_as_pybuffer(<void *> out_planes[i], self.out_size[i], True))
__pyx_t_2 = __pyx_f_4xpra_7buffers_6membuf_memory_as_pybuffer(((void *)(__pyx_v_out_planes[__pyx_v_i])), (__pyx_v_self->out_size[__pyx_v_i]), 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_planes, __pyx_t_2); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; }
+353: self.frames += 1
__pyx_v_self->frames = (__pyx_v_self->frames + 1);
+354: out_image = YUVImageWrapper(0, 0, self.dst_width, self.dst_height, planes, self.dst_format, 24, strides, 1, ImageWrapper._3_PLANES)
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_YUVImageWrapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_self->dst_width); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_self->dst_height); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_3_PLANES); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[11] = {__pyx_t_10, __pyx_int_0, __pyx_int_0, __pyx_t_13, __pyx_t_12, __pyx_v_planes, __pyx_v_self->dst_format, __pyx_int_24, __pyx_v_strides, __pyx_int_1, __pyx_t_9}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[11] = {__pyx_t_10, __pyx_int_0, __pyx_int_0, __pyx_t_13, __pyx_t_12, __pyx_v_planes, __pyx_v_self->dst_format, __pyx_int_24, __pyx_v_strides, __pyx_int_1, __pyx_t_9}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else #endif { __pyx_t_1 = PyTuple_New(10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__pyx_t_10) { __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); __pyx_t_10 = NULL; } __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_4, __pyx_int_0); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_4, __pyx_int_0); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_4, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_v_planes); __Pyx_GIVEREF(__pyx_v_planes); PyTuple_SET_ITEM(__pyx_t_1, 4+__pyx_t_4, __pyx_v_planes); __Pyx_INCREF(__pyx_v_self->dst_format); __Pyx_GIVEREF(__pyx_v_self->dst_format); PyTuple_SET_ITEM(__pyx_t_1, 5+__pyx_t_4, __pyx_v_self->dst_format); __Pyx_INCREF(__pyx_int_24); __Pyx_GIVEREF(__pyx_int_24); PyTuple_SET_ITEM(__pyx_t_1, 6+__pyx_t_4, __pyx_int_24); __Pyx_INCREF(__pyx_v_strides); __Pyx_GIVEREF(__pyx_v_strides); PyTuple_SET_ITEM(__pyx_t_1, 7+__pyx_t_4, __pyx_v_strides); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_1, 8+__pyx_t_4, __pyx_int_1); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 9+__pyx_t_4, __pyx_t_9); __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_9 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __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_v_out_image = __pyx_t_2; __pyx_t_2 = 0;
+355: out_image.cython_buffer = <uintptr_t> output_buffer
__pyx_t_2 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_output_buffer)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyObject_SetAttrStr(__pyx_v_out_image, __pyx_n_s_cython_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L10:;
+356: return out_image
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_out_image); __pyx_r = __pyx_v_out_image; goto __pyx_L0;
357:
358:
+359: def selftest(full=False):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_17selftest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_17selftest = {"selftest", (PyCFunction)__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_17selftest, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_10csc_libyuv_20colorspace_converter_17selftest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_full = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("selftest (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_full,0}; PyObject* values[1] = {0}; values[0] = ((PyObject *)Py_False); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_full); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "selftest") < 0)) __PYX_ERR(0, 359, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_full = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("selftest", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.selftest", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_16selftest(__pyx_self, __pyx_v_full); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_10csc_libyuv_20colorspace_converter_16selftest(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_full) { PyObject *__pyx_v_testcsc = NULL; PyObject *__pyx_v_get_csc_max_size = NULL; PyObject *__pyx_v_colorspace_converter = NULL; PyObject *__pyx_v_maxw = NULL; PyObject *__pyx_v_maxh = NULL; PyObject *__pyx_v_in_csc = NULL; PyObject *__pyx_v_out_csc = NULL; PyObject *__pyx_v_mw = NULL; PyObject *__pyx_v_mh = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("selftest", 0); /* … */ /* 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_5); __Pyx_AddTraceback("xpra.codecs.csc_libyuv.colorspace_converter.selftest", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_testcsc); __Pyx_XDECREF(__pyx_v_get_csc_max_size); __Pyx_XDECREF(__pyx_v_colorspace_converter); __Pyx_XDECREF(__pyx_v_maxw); __Pyx_XDECREF(__pyx_v_maxh); __Pyx_XDECREF(__pyx_v_in_csc); __Pyx_XDECREF(__pyx_v_out_csc); __Pyx_XDECREF(__pyx_v_mw); __Pyx_XDECREF(__pyx_v_mh); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__21 = PyTuple_Pack(10, __pyx_n_s_full, __pyx_n_s_testcsc, __pyx_n_s_get_csc_max_size, __pyx_n_s_colorspace_converter, __pyx_n_s_maxw, __pyx_n_s_maxh, __pyx_n_s_in_csc, __pyx_n_s_out_csc, __pyx_n_s_mw, __pyx_n_s_mh); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); /* … */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_10csc_libyuv_20colorspace_converter_17selftest, NULL, __pyx_n_s_xpra_codecs_csc_libyuv_colorspac_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_selftest, __pyx_t_2) < 0) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
360: global MAX_WIDTH, MAX_HEIGHT
+361: from xpra.codecs.codec_checks import testcsc, get_csc_max_size
__pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_testcsc); __Pyx_GIVEREF(__pyx_n_s_testcsc); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_testcsc); __Pyx_INCREF(__pyx_n_s_get_csc_max_size); __Pyx_GIVEREF(__pyx_n_s_get_csc_max_size); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_get_csc_max_size); __pyx_t_2 = __Pyx_Import(__pyx_n_s_xpra_codecs_codec_checks, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_testcsc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __pyx_v_testcsc = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_csc_max_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __pyx_v_get_csc_max_size = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+362: from xpra.codecs.csc_libyuv import colorspace_converter
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_colorspace_converter); __Pyx_GIVEREF(__pyx_n_s_colorspace_converter); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_colorspace_converter); __pyx_t_1 = __Pyx_Import(__pyx_n_s_xpra_codecs_csc_libyuv, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_colorspace_converter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_v_colorspace_converter = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+363: maxw, maxh = MAX_WIDTH, MAX_HEIGHT
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_maxw = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_maxh = __pyx_t_2; __pyx_t_2 = 0;
+364: in_csc = get_input_colorspaces()
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_input_colorspaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } if (__pyx_t_3) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_in_csc = __pyx_t_2; __pyx_t_2 = 0;
+365: out_csc = get_output_colorspaces(in_csc[0])
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_output_colorspaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_in_csc, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } if (!__pyx_t_4) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_out_csc = __pyx_t_2; __pyx_t_2 = 0;
+366: testcsc(colorspace_converter, full, in_csc, out_csc)
__Pyx_INCREF(__pyx_v_testcsc); __pyx_t_1 = __pyx_v_testcsc; __pyx_t_5 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_colorspace_converter, __pyx_v_full, __pyx_v_in_csc, __pyx_v_out_csc}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_colorspace_converter, __pyx_v_full, __pyx_v_in_csc, __pyx_v_out_csc}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { __pyx_t_3 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_INCREF(__pyx_v_colorspace_converter); __Pyx_GIVEREF(__pyx_v_colorspace_converter); PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_colorspace_converter); __Pyx_INCREF(__pyx_v_full); __Pyx_GIVEREF(__pyx_v_full); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_full); __Pyx_INCREF(__pyx_v_in_csc); __Pyx_GIVEREF(__pyx_v_in_csc); PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_in_csc); __Pyx_INCREF(__pyx_v_out_csc); __Pyx_GIVEREF(__pyx_v_out_csc); PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_6, __pyx_v_out_csc); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+367: if full:
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_full); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 367, __pyx_L1_error) if (__pyx_t_7) { /* … */ }
+368: mw, mh = get_csc_max_size(colorspace_converter, in_csc, out_csc, limit_w=32768, limit_h=32768)
__pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_colorspace_converter); __Pyx_GIVEREF(__pyx_v_colorspace_converter); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_colorspace_converter); __Pyx_INCREF(__pyx_v_in_csc); __Pyx_GIVEREF(__pyx_v_in_csc); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_in_csc); __Pyx_INCREF(__pyx_v_out_csc); __Pyx_GIVEREF(__pyx_v_out_csc); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_out_csc); __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_limit_w, __pyx_int_32768) < 0) __PYX_ERR(0, 368, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_limit_h, __pyx_int_32768) < 0) __PYX_ERR(0, 368, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_get_csc_max_size, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { PyObject* sequence = __pyx_t_3; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 368, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 368, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L5_unpacking_done; __pyx_L4_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 368, __pyx_L1_error) __pyx_L5_unpacking_done:; } __pyx_v_mw = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_mh = __pyx_t_2; __pyx_t_2 = 0;
+369: MAX_WIDTH = min(maxw, mw)
__Pyx_INCREF(__pyx_v_mw); __pyx_t_3 = __pyx_v_mw; __Pyx_INCREF(__pyx_v_maxw); __pyx_t_2 = __pyx_v_maxw; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 369, __pyx_L1_error) __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; } else { __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WIDTH, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+370: MAX_HEIGHT = min(maxh, mh)
__Pyx_INCREF(__pyx_v_mh); __pyx_t_3 = __pyx_v_mh; __Pyx_INCREF(__pyx_v_maxh); __pyx_t_1 = __pyx_v_maxh; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 370, __pyx_L1_error) __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = __pyx_t_3; } else { __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_HEIGHT, __pyx_t_3) < 0) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;