Generated by Cython 0.29
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.c
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, 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: from xpra.codecs.codec_checks import do_testcsc
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __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, 14, __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, 14, __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, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+015: log = Logger("csc", "swscale")
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_log, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_u_csc, __pyx_n_u_swscale); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7);
016:
+017: from xpra.util import envbool
__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_envbool); __Pyx_GIVEREF(__pyx_n_s_envbool); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_envbool); __pyx_t_1 = __Pyx_Import(__pyx_n_s_xpra_util, __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_envbool); 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_envbool, __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.os_util import is_Ubuntu
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __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, 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_is_Ubuntu); 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_is_Ubuntu, __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.codec_constants import csc_spec
__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_csc_spec); __Pyx_GIVEREF(__pyx_n_s_csc_spec); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_csc_spec); __pyx_t_1 = __Pyx_Import(__pyx_n_s_xpra_codecs_codec_constants, __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_csc_spec); 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_csc_spec, __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.codecs.image_wrapper import ImageWrapper
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_ImageWrapper); __Pyx_GIVEREF(__pyx_n_s_ImageWrapper); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ImageWrapper); __pyx_t_2 = __Pyx_Import(__pyx_n_s_xpra_codecs_image_wrapper, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __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_ImageWrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ImageWrapper, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
021: from xpra.codecs.libav_common.av_log cimport override_logger, restore_logger #@UnresolvedImport
+022: from xpra.codecs.libav_common.av_log import suspend_nonfatal_logging, resume_nonfatal_logging
__pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_suspend_nonfatal_logging); __Pyx_GIVEREF(__pyx_n_s_suspend_nonfatal_logging); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_suspend_nonfatal_logging); __Pyx_INCREF(__pyx_n_s_resume_nonfatal_logging); __Pyx_GIVEREF(__pyx_n_s_resume_nonfatal_logging); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_resume_nonfatal_logging); __pyx_t_1 = __Pyx_Import(__pyx_n_s_xpra_codecs_libav_common_av_log, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __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_suspend_nonfatal_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_suspend_nonfatal_logging, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_resume_nonfatal_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_resume_nonfatal_logging, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
023: from xpra.buffers.membuf cimport padbuf, MemBuf, object_as_buffer
024:
025: from libc.stdint cimport uintptr_t, uint8_t
026: from xpra.monotonic_time cimport monotonic_time
027:
028:
029: ctypedef long AVPixelFormat
030: cdef extern from "libavcodec/version.h":
031: int LIBSWSCALE_VERSION_MAJOR
032: int LIBSWSCALE_VERSION_MINOR
033: int LIBSWSCALE_VERSION_MICRO
034:
035: cdef extern from "libavutil/pixfmt.h":
036: AVPixelFormat AV_PIX_FMT_YUV420P
037: AVPixelFormat AV_PIX_FMT_YUV422P
038: AVPixelFormat AV_PIX_FMT_YUV444P
039: AVPixelFormat AV_PIX_FMT_RGB24
040: AVPixelFormat AV_PIX_FMT_0RGB
041: AVPixelFormat AV_PIX_FMT_BGR0
042: AVPixelFormat AV_PIX_FMT_ARGB
043: AVPixelFormat AV_PIX_FMT_BGRA
044: AVPixelFormat AV_PIX_FMT_ABGR
045: AVPixelFormat AV_PIX_FMT_RGBA
046: AVPixelFormat AV_PIX_FMT_GBRP
047: AVPixelFormat AV_PIX_FMT_BGR24
048: AVPixelFormat AV_PIX_FMT_NONE
049:
+050: ctypedef void SwsContext
typedef void __pyx_t_4xpra_6codecs_11csc_swscale_20colorspace_converter_SwsContext;
051: cdef extern from "libswscale/swscale.h":
052: ctypedef struct SwsFilter:
053: pass
054: unsigned int SWS_ACCURATE_RND
055: unsigned int SWS_BICUBIC
056: unsigned int SWS_BICUBLIN
057: unsigned int SWS_BILINEAR
058: unsigned int SWS_FAST_BILINEAR
059: unsigned int SWS_FULL_CHR_H_INT
060:
061: SwsContext *sws_getContext(int srcW, int srcH, AVPixelFormat srcFormat,
062: int dstW, int dstH, AVPixelFormat dstFormat,
063: int flags, SwsFilter *srcFilter,
064: SwsFilter *dstFilter, const double *param)
065: void sws_freeContext(SwsContext *context)
066:
067: int sws_scale(SwsContext *c, const uint8_t *const srcSlice[],
068: const int srcStride[], int srcSliceY, int srcSliceH,
069: uint8_t *const dst[], const int dstStride[]) nogil
070:
071:
+072: cdef class CSCPixelFormat:
struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat { PyObject_HEAD __pyx_t_4xpra_6codecs_11csc_swscale_20colorspace_converter_AVPixelFormat av_enum; char *av_enum_name; float width_mult[4]; float height_mult[4]; char *pix_fmt; };
073: cdef AVPixelFormat av_enum
074: cdef char* av_enum_name
075: cdef float width_mult[4]
076: cdef float height_mult[4]
077: cdef char *pix_fmt
+078: def __init__(self, AVPixelFormat av_enum, char *av_enum_name, width_mult, height_mult, char *pix_fmt):
/* Python wrapper */ static int __pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_14CSCPixelFormat_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_14CSCPixelFormat_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __pyx_t_4xpra_6codecs_11csc_swscale_20colorspace_converter_AVPixelFormat __pyx_v_av_enum; char *__pyx_v_av_enum_name; PyObject *__pyx_v_width_mult = 0; PyObject *__pyx_v_height_mult = 0; char *__pyx_v_pix_fmt; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_av_enum,&__pyx_n_s_av_enum_name,&__pyx_n_s_width_mult,&__pyx_n_s_height_mult,&__pyx_n_s_pix_fmt,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_av_enum)) != 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_av_enum_name)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); __PYX_ERR(0, 78, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width_mult)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); __PYX_ERR(0, 78, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height_mult)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); __PYX_ERR(0, 78, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pix_fmt)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); __PYX_ERR(0, 78, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 78, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_av_enum = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_av_enum == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L3_error) __pyx_v_av_enum_name = __Pyx_PyObject_AsWritableString(values[1]); if (unlikely((!__pyx_v_av_enum_name) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L3_error) __pyx_v_width_mult = values[2]; __pyx_v_height_mult = values[3]; __pyx_v_pix_fmt = __Pyx_PyObject_AsWritableString(values[4]); if (unlikely((!__pyx_v_pix_fmt) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 78, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.CSCPixelFormat.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_14CSCPixelFormat___init__(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat *)__pyx_v_self), __pyx_v_av_enum, __pyx_v_av_enum_name, __pyx_v_width_mult, __pyx_v_height_mult, __pyx_v_pix_fmt); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_14CSCPixelFormat___init__(struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat *__pyx_v_self, __pyx_t_4xpra_6codecs_11csc_swscale_20colorspace_converter_AVPixelFormat __pyx_v_av_enum, char *__pyx_v_av_enum_name, PyObject *__pyx_v_width_mult, PyObject *__pyx_v_height_mult, char *__pyx_v_pix_fmt) { long __pyx_v_i; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.CSCPixelFormat.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+079: self.av_enum = av_enum
__pyx_v_self->av_enum = __pyx_v_av_enum;
+080: self.av_enum_name = av_enum_name
__pyx_v_self->av_enum_name = __pyx_v_av_enum_name;
+081: for i in range(4):
for (__pyx_t_1 = 0; __pyx_t_1 < 4; __pyx_t_1+=1) { __pyx_v_i = __pyx_t_1;
+082: self.width_mult[i] = 0.0
(__pyx_v_self->width_mult[__pyx_v_i]) = 0.0;
+083: self.height_mult[i] = 0.0
(__pyx_v_self->height_mult[__pyx_v_i]) = 0.0; }
+084: for i in range(4):
for (__pyx_t_1 = 0; __pyx_t_1 < 4; __pyx_t_1+=1) { __pyx_v_i = __pyx_t_1;
+085: self.width_mult[i] = width_mult[i]
__pyx_t_2 = __Pyx_GetItemInt(__pyx_v_width_mult, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_self->width_mult[__pyx_v_i]) = __pyx_t_3;
+086: self.height_mult[i] = height_mult[i]
__pyx_t_2 = __Pyx_GetItemInt(__pyx_v_height_mult, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_self->height_mult[__pyx_v_i]) = __pyx_t_3; }
+087: self.pix_fmt = pix_fmt
__pyx_v_self->pix_fmt = __pyx_v_pix_fmt;
088:
+089: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_14CSCPixelFormat_3__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_14CSCPixelFormat_3__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_14CSCPixelFormat_2__repr__(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_14CSCPixelFormat_2__repr__(CYTHON_UNUSED struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.CSCPixelFormat.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+090: return "CSCPixelFormat(%s)" % av_enum_name
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_av_enum_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_CSCPixelFormat_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
091:
092: #we could use a class to represent these options:
+093: COLORSPACES = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_COLORSPACES, __pyx_t_1) < 0) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
094: #keeping this array in scope ensures the strings don't go away!
+095: FORMAT_OPTIONS = [
__pyx_t_1 = PyList_New(12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_1, 3, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyList_SET_ITEM(__pyx_t_1, 4, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_1, 5, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_8); PyList_SET_ITEM(__pyx_t_1, 6, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_9); PyList_SET_ITEM(__pyx_t_1, 7, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_10); PyList_SET_ITEM(__pyx_t_1, 8, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_11); PyList_SET_ITEM(__pyx_t_1, 9, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_12); PyList_SET_ITEM(__pyx_t_1, 10, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_13); PyList_SET_ITEM(__pyx_t_1, 11, __pyx_t_13); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_FORMAT_OPTIONS, __pyx_t_1) < 0) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+096: ("RGB24", AV_PIX_FMT_RGB24, (3, 0, 0, 0), (1, 0, 0, 0), "RGB" ),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_RGB24); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__8 = PyTuple_Pack(4, __pyx_int_3, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_u_RGB24); __Pyx_GIVEREF(__pyx_n_u_RGB24); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_RGB24); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_tuple__8); __Pyx_INCREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_tuple__9); __Pyx_INCREF(__pyx_n_u_RGB); __Pyx_GIVEREF(__pyx_n_u_RGB); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_n_u_RGB); __pyx_t_1 = 0; __pyx_tuple__9 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9);
+097: ("BGR24", AV_PIX_FMT_BGR24, (3, 0, 0, 0), (1, 0, 0, 0), "BGR" ),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_BGR24); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__8 = PyTuple_Pack(4, __pyx_int_3, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_u_BGR24); __Pyx_GIVEREF(__pyx_n_u_BGR24); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_BGR24); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_tuple__8); __Pyx_INCREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_tuple__9); __Pyx_INCREF(__pyx_n_u_BGR); __Pyx_GIVEREF(__pyx_n_u_BGR); PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_n_u_BGR); __pyx_t_1 = 0; __pyx_tuple__9 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9);
+098: ("0RGB", AV_PIX_FMT_0RGB, (4, 0, 0, 0), (1, 0, 0, 0), "XRGB" ),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_0RGB); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__10 = PyTuple_Pack(4, __pyx_int_4, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_kp_u_0RGB); __Pyx_GIVEREF(__pyx_kp_u_0RGB); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_0RGB); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_tuple__10); __Pyx_INCREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_tuple__9); __Pyx_INCREF(__pyx_n_u_XRGB); __Pyx_GIVEREF(__pyx_n_u_XRGB); PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_n_u_XRGB); __pyx_t_1 = 0; __pyx_tuple__9 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9);
+099: ("BGR0", AV_PIX_FMT_BGR0, (4, 0, 0, 0), (1, 0, 0, 0), "BGRX" ),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_BGR0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__10 = PyTuple_Pack(4, __pyx_int_4, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_n_u_BGR0); __Pyx_GIVEREF(__pyx_n_u_BGR0); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_n_u_BGR0); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_tuple__10); __Pyx_INCREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_tuple__9); __Pyx_INCREF(__pyx_n_u_BGRX); __Pyx_GIVEREF(__pyx_n_u_BGRX); PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_n_u_BGRX); __pyx_t_1 = 0; __pyx_tuple__9 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9);
+100: ("ARGB", AV_PIX_FMT_ARGB, (4, 0, 0, 0), (1, 0, 0, 0), "XRGB" ),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_ARGB); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__10 = PyTuple_Pack(4, __pyx_int_4, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_n_u_ARGB); __Pyx_GIVEREF(__pyx_n_u_ARGB); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_u_ARGB); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_tuple__10); __Pyx_INCREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_tuple__9); __Pyx_INCREF(__pyx_n_u_XRGB); __Pyx_GIVEREF(__pyx_n_u_XRGB); PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_n_u_XRGB); __pyx_t_1 = 0; __pyx_tuple__9 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9);
+101: ("RGBA", AV_PIX_FMT_RGBA, (4, 0, 0, 0), (1, 0, 0, 0), "RGBX" ),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_RGBA); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__10 = PyTuple_Pack(4, __pyx_int_4, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_n_u_RGBA); __Pyx_GIVEREF(__pyx_n_u_RGBA); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_n_u_RGBA); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_tuple__10); __Pyx_INCREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_tuple__9); __Pyx_INCREF(__pyx_n_u_RGBX); __Pyx_GIVEREF(__pyx_n_u_RGBX); PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_n_u_RGBX); __pyx_t_1 = 0; __pyx_tuple__9 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9);
+102: ("BGRA", AV_PIX_FMT_BGRA, (4, 0, 0, 0), (1, 0, 0, 0), "BGRX" ),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_BGRA); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__10 = PyTuple_Pack(4, __pyx_int_4, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_n_u_BGRA); __Pyx_GIVEREF(__pyx_n_u_BGRA); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_BGRA); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_tuple__10); __Pyx_INCREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_tuple__9); __Pyx_INCREF(__pyx_n_u_BGRX); __Pyx_GIVEREF(__pyx_n_u_BGRX); PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_n_u_BGRX); __pyx_t_1 = 0; __pyx_tuple__9 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9);
+103: ("ABGR", AV_PIX_FMT_ABGR, (4, 0, 0, 0), (1, 0, 0, 0), "XBGR" ),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_ABGR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__10 = PyTuple_Pack(4, __pyx_int_4, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_t_9 = PyTuple_New(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_n_u_ABGR); __Pyx_GIVEREF(__pyx_n_u_ABGR); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_n_u_ABGR); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_tuple__10); __Pyx_INCREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_tuple__9); __Pyx_INCREF(__pyx_n_u_XBGR); __Pyx_GIVEREF(__pyx_n_u_XBGR); PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_n_u_XBGR); __pyx_t_1 = 0; __pyx_tuple__9 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9);
+104: ("YUV420P", AV_PIX_FMT_YUV420P, (1, 0.5, 0.5, 0), (1, 0.5, 0.5, 0), "YUV420P"),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_YUV420P); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__11 = PyTuple_Pack(4, __pyx_int_1, __pyx_float_0_5, __pyx_float_0_5, __pyx_int_0); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); __pyx_t_10 = PyTuple_New(5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_n_u_YUV420P); __Pyx_GIVEREF(__pyx_n_u_YUV420P); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_n_u_YUV420P); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_tuple__11); __Pyx_INCREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_tuple__11); __Pyx_INCREF(__pyx_n_u_YUV420P); __Pyx_GIVEREF(__pyx_n_u_YUV420P); PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_n_u_YUV420P); __pyx_t_1 = 0; __pyx_tuple__11 = PyTuple_Pack(4, __pyx_int_1, __pyx_float_0_5, __pyx_float_0_5, __pyx_int_0); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11);
+105: ("YUV422P", AV_PIX_FMT_YUV422P, (1, 0.5, 0.5, 0), (1, 1, 1, 0), "YUV422P"),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_YUV422P); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__11 = PyTuple_Pack(4, __pyx_int_1, __pyx_float_0_5, __pyx_float_0_5, __pyx_int_0); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); __pyx_t_11 = PyTuple_New(5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_n_u_YUV422P); __Pyx_GIVEREF(__pyx_n_u_YUV422P); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_n_u_YUV422P); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_tuple__11); __Pyx_INCREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_tuple__12); __Pyx_INCREF(__pyx_n_u_YUV422P); __Pyx_GIVEREF(__pyx_n_u_YUV422P); PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_n_u_YUV422P); __pyx_t_1 = 0; __pyx_tuple__12 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_1, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12);
+106: ("YUV444P", AV_PIX_FMT_YUV444P, (1, 1, 1, 0), (1, 1, 1, 0), "YUV444P"),
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_YUV444P); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__12 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_1, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); __pyx_t_12 = PyTuple_New(5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_n_u_YUV444P); __Pyx_GIVEREF(__pyx_n_u_YUV444P); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_n_u_YUV444P); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_tuple__12); __Pyx_INCREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_tuple__12); __Pyx_INCREF(__pyx_n_u_YUV444P); __Pyx_GIVEREF(__pyx_n_u_YUV444P); PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_n_u_YUV444P); __pyx_t_1 = 0; __pyx_tuple__12 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_1, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12);
+107: ("GBRP", AV_PIX_FMT_GBRP, (1, 1, 1, 0), (1, 1, 1, 0), "GBRP" )
__pyx_t_1 = __Pyx_PyInt_From_long(AV_PIX_FMT_GBRP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_tuple__12 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_1, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); __pyx_t_13 = PyTuple_New(5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_INCREF(__pyx_n_u_GBRP); __Pyx_GIVEREF(__pyx_n_u_GBRP); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_n_u_GBRP); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_1); __Pyx_INCREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_tuple__12); __Pyx_INCREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_tuple__12); __Pyx_INCREF(__pyx_n_u_GBRP); __Pyx_GIVEREF(__pyx_n_u_GBRP); PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_n_u_GBRP); __pyx_t_1 = 0; __pyx_tuple__12 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_1, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12);
108: ]
+109: FORMATS = {}
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); 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_FORMATS, __pyx_t_1) < 0) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+110: for av_enum_name, av_enum, width_mult, height_mult, pix_fmt in FORMAT_OPTIONS:
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FORMAT_OPTIONS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_13 = __pyx_t_1; __Pyx_INCREF(__pyx_t_13); __pyx_t_14 = 0; __pyx_t_15 = NULL; } else { __pyx_t_14 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_15 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 110, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_15)) { if (likely(PyList_CheckExact(__pyx_t_13))) { if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_13)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 110, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_13, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_13)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 110, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_13, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_15(__pyx_t_13); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 110, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 5)) { if (size > 5) __Pyx_RaiseTooManyValuesError(5); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 110, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_9 = PyTuple_GET_ITEM(sequence, 3); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); } else { __pyx_t_12 = PyList_GET_ITEM(sequence, 0); __pyx_t_11 = PyList_GET_ITEM(sequence, 1); __pyx_t_10 = PyList_GET_ITEM(sequence, 2); __pyx_t_9 = PyList_GET_ITEM(sequence, 3); __pyx_t_8 = PyList_GET_ITEM(sequence, 4); } __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_8); #else { Py_ssize_t i; PyObject** temps[5] = {&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_9,&__pyx_t_8}; for (i=0; i < 5; i++) { PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(item); *(temps[i]) = item; } } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; PyObject** temps[5] = {&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_9,&__pyx_t_8}; __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_16 = Py_TYPE(__pyx_t_7)->tp_iternext; for (index=0; index < 5; index++) { PyObject* item = __pyx_t_16(__pyx_t_7); if (unlikely(!item)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(item); *(temps[index]) = item; } if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_7), 5) < 0) __PYX_ERR(0, 110, __pyx_L1_error) __pyx_t_16 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L5_unpacking_done; __pyx_L4_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_16 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 110, __pyx_L1_error) __pyx_L5_unpacking_done:; } if (PyDict_SetItem(__pyx_d, __pyx_n_s_av_enum_name, __pyx_t_12) < 0) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_av_enum, __pyx_t_11) < 0) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_width_mult, __pyx_t_10) < 0) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_height_mult, __pyx_t_9) < 0) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_pix_fmt, __pyx_t_8) < 0) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* … */ } __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+111: FORMATS[pix_fmt] = CSCPixelFormat(av_enum, av_enum_name.encode("latin1"), width_mult, height_mult, pix_fmt.encode("latin1"))
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_av_enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_av_enum_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_encode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_10, function); } } __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_n_u_latin1) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_n_u_latin1); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_width_mult); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_height_mult); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_pix_fmt); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } __pyx_t_11 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_12, __pyx_n_u_latin1) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_n_u_latin1); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_11); __pyx_t_1 = 0; __pyx_t_8 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_11 = 0; __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat), __pyx_t_7, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_FORMATS); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pix_fmt); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_t_9, __pyx_t_11) < 0)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+112: if pix_fmt not in COLORSPACES:
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pix_fmt); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_17 = (__Pyx_PySequence_ContainsTF(__pyx_t_11, __pyx_t_9, Py_NE)); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_18 = (__pyx_t_17 != 0); if (__pyx_t_18) { /* … */ }
+113: COLORSPACES.append(pix_fmt)
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pix_fmt); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_19 = __Pyx_PyObject_Append(__pyx_t_9, __pyx_t_11); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+114: log("swscale pixel formats: %s", FORMATS)
__Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_log); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_FORMATS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_kp_u_swscale_pixel_formats_s); __Pyx_GIVEREF(__pyx_kp_u_swscale_pixel_formats_s); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_swscale_pixel_formats_s); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_9, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+115: log("colorspaces: %s", COLORSPACES)
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_INCREF(__pyx_kp_u_colorspaces_s); __Pyx_GIVEREF(__pyx_kp_u_colorspaces_s); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_kp_u_colorspaces_s); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
116:
117: BYTES_PER_PIXEL = {
+118: AV_PIX_FMT_YUV420P : 1,
__pyx_t_9 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_13 = __Pyx_PyInt_From_long(AV_PIX_FMT_YUV420P); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_9, __pyx_t_13, __pyx_int_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+119: AV_PIX_FMT_YUV422P : 1,
__pyx_t_13 = __Pyx_PyInt_From_long(AV_PIX_FMT_YUV422P); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_9, __pyx_t_13, __pyx_int_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+120: AV_PIX_FMT_YUV444P : 1,
__pyx_t_13 = __Pyx_PyInt_From_long(AV_PIX_FMT_YUV444P); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_9, __pyx_t_13, __pyx_int_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+121: AV_PIX_FMT_RGB24 : 3,
__pyx_t_13 = __Pyx_PyInt_From_long(AV_PIX_FMT_RGB24); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_9, __pyx_t_13, __pyx_int_3) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+122: AV_PIX_FMT_0RGB : 4,
__pyx_t_13 = __Pyx_PyInt_From_long(AV_PIX_FMT_0RGB); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_9, __pyx_t_13, __pyx_int_4) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+123: AV_PIX_FMT_BGR0 : 4,
__pyx_t_13 = __Pyx_PyInt_From_long(AV_PIX_FMT_BGR0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_9, __pyx_t_13, __pyx_int_4) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+124: AV_PIX_FMT_ARGB : 4,
__pyx_t_13 = __Pyx_PyInt_From_long(AV_PIX_FMT_ARGB); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_9, __pyx_t_13, __pyx_int_4) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+125: AV_PIX_FMT_BGRA : 4,
__pyx_t_13 = __Pyx_PyInt_From_long(AV_PIX_FMT_BGRA); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_9, __pyx_t_13, __pyx_int_4) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+126: AV_PIX_FMT_GBRP : 1,
__pyx_t_13 = __Pyx_PyInt_From_long(AV_PIX_FMT_GBRP); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_9, __pyx_t_13, __pyx_int_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_BYTES_PER_PIXEL, __pyx_t_9) < 0) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
127: }
128:
129:
+130: cdef inline int roundup(int n, int m):
static CYTHON_INLINE int __pyx_f_4xpra_6codecs_11csc_swscale_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; }
+131: return (n + m - 1) & ~(m - 1)
__pyx_r = (((__pyx_v_n + __pyx_v_m) - 1) & (~(__pyx_v_m - 1))); goto __pyx_L0;
132:
133:
+134: cdef class SWSFlags:
struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_SWSFlags { PyObject_HEAD int flags; PyObject *flags_strs; };
135: cdef int flags
136: cdef object flags_strs
+137: def __init__(self, int flags, flags_strs): #@DuplicatedSignature
/* Python wrapper */ static int __pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_flags; PyObject *__pyx_v_flags_strs = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flags,&__pyx_n_s_flags_strs,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_flags)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags_strs)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 137, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 137, __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_flags = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L3_error) __pyx_v_flags_strs = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 137, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.SWSFlags.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags___init__(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_SWSFlags *)__pyx_v_self), __pyx_v_flags, __pyx_v_flags_strs); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags___init__(struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_SWSFlags *__pyx_v_self, int __pyx_v_flags, PyObject *__pyx_v_flags_strs) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+138: self.flags = flags
__pyx_v_self->flags = __pyx_v_flags;
+139: self.flags_strs = flags_strs
__Pyx_INCREF(__pyx_v_flags_strs); __Pyx_GIVEREF(__pyx_v_flags_strs); __Pyx_GOTREF(__pyx_v_self->flags_strs); __Pyx_DECREF(__pyx_v_self->flags_strs); __pyx_v_self->flags_strs = __pyx_v_flags_strs;
140:
+141: def get_flags(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags_3get_flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags_3get_flags(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_flags (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags_2get_flags(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_SWSFlags *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags_2get_flags(struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_SWSFlags *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_flags", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.SWSFlags.get_flags", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+142: return self.flags
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
143:
+144: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags_5__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags_5__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags_4__repr__(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_SWSFlags *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_8SWSFlags_4__repr__(struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_SWSFlags *__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_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.SWSFlags.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+145: try:
{ /*try:*/ { /* … */ } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L7_try_return:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L0; __pyx_L6_except_return:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L0; }
+146: return "|".join(self.flags_strs)
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __pyx_v_self->flags_strs; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = PyUnicode_Join(__pyx_kp_u_, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L7_try_return;
+147: except:
/*except:*/ { __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.SWSFlags.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 147, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_6);
+148: return str(self.flags_strs)
__Pyx_XDECREF(__pyx_r); __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_self->flags_strs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L6_except_return; } __pyx_L5_except_error:;
149:
150:
151: #keeping this array in scope ensures the strings don't go away!
152: FLAGS_OPTIONS = (
+153: (30, (SWS_BICUBIC, ), ("BICUBIC", )),
__pyx_t_9 = __Pyx_PyInt_From_unsigned_int(SWS_BICUBIC); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_int_30); __Pyx_GIVEREF(__pyx_int_30); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_30); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_13); __Pyx_INCREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_tuple__13); __pyx_t_13 = 0; /* … */ __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_u_BICUBIC); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); /* … */ __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7); __pyx_t_9 = 0; __pyx_t_13 = 0; __pyx_t_11 = 0; __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_FLAGS_OPTIONS, __pyx_t_10) < 0) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+154: (40, (SWS_BICUBLIN, ), ("BICUBLIN", )),
__pyx_t_13 = __Pyx_PyInt_From_unsigned_int(SWS_BICUBLIN); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_INCREF(__pyx_int_40); __Pyx_GIVEREF(__pyx_int_40); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_int_40); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_11); __Pyx_INCREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_tuple__14); __pyx_t_11 = 0; /* … */ __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_u_BICUBLIN); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14);
+155: (60, (SWS_BILINEAR, ), ("BILINEAR", )),
__pyx_t_11 = __Pyx_PyInt_From_unsigned_int(SWS_BILINEAR); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_int_60); __Pyx_GIVEREF(__pyx_int_60); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_60); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_7); __Pyx_INCREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_tuple__15); __pyx_t_7 = 0; /* … */ __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_u_BILINEAR); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15);
+156: (80, (SWS_FAST_BILINEAR, ), ("FAST_BILINEAR", )),
__pyx_t_7 = __Pyx_PyInt_From_unsigned_int(SWS_FAST_BILINEAR); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_int_80); __Pyx_GIVEREF(__pyx_int_80); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_80); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_10); __Pyx_INCREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_tuple__16); __pyx_t_10 = 0; /* … */ __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_u_FAST_BILINEAR); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16);
157: )
+158: FLAGS = []
__pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_d, __pyx_n_s_FLAGS, __pyx_t_10) < 0) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+159: for speed, flags, flag_strs in FLAGS_OPTIONS:
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_FLAGS_OPTIONS); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) { __pyx_t_7 = __pyx_t_10; __Pyx_INCREF(__pyx_t_7); __pyx_t_14 = 0; __pyx_t_15 = NULL; } else { __pyx_t_14 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_15 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 159, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; for (;;) { if (likely(!__pyx_t_15)) { if (likely(PyList_CheckExact(__pyx_t_7))) { if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_7)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_10 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_14); __Pyx_INCREF(__pyx_t_10); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 159, __pyx_L1_error) #else __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); #endif } else { if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_7)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_14); __Pyx_INCREF(__pyx_t_10); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 159, __pyx_L1_error) #else __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); #endif } } else { __pyx_t_10 = __pyx_t_15(__pyx_t_7); if (unlikely(!__pyx_t_10)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 159, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_10); } if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { PyObject* sequence = __pyx_t_10; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 159, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); } else { __pyx_t_11 = PyList_GET_ITEM(sequence, 0); __pyx_t_13 = PyList_GET_ITEM(sequence, 1); __pyx_t_9 = PyList_GET_ITEM(sequence, 2); } __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(__pyx_t_9); #else __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else { Py_ssize_t index = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_16 = Py_TYPE(__pyx_t_8)->tp_iternext; index = 0; __pyx_t_11 = __pyx_t_16(__pyx_t_8); if (unlikely(!__pyx_t_11)) goto __pyx_L9_unpacking_failed; __Pyx_GOTREF(__pyx_t_11); index = 1; __pyx_t_13 = __pyx_t_16(__pyx_t_8); if (unlikely(!__pyx_t_13)) goto __pyx_L9_unpacking_failed; __Pyx_GOTREF(__pyx_t_13); index = 2; __pyx_t_9 = __pyx_t_16(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_8), 3) < 0) __PYX_ERR(0, 159, __pyx_L1_error) __pyx_t_16 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L10_unpacking_done; __pyx_L9_unpacking_failed:; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_16 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 159, __pyx_L1_error) __pyx_L10_unpacking_done:; } if (PyDict_SetItem(__pyx_d, __pyx_n_s_speed, __pyx_t_11) < 0) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_flags, __pyx_t_13) < 0) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_flag_strs, __pyx_t_9) < 0) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; /* … */ } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+160: flag_value = 0
if (PyDict_SetItem(__pyx_d, __pyx_n_s_flag_value, __pyx_int_0) < 0) __PYX_ERR(0, 160, __pyx_L1_error)
+161: for flag in flags:
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_flags); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) { __pyx_t_9 = __pyx_t_10; __Pyx_INCREF(__pyx_t_9); __pyx_t_20 = 0; __pyx_t_21 = NULL; } else { __pyx_t_20 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_21 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; for (;;) { if (likely(!__pyx_t_21)) { if (likely(PyList_CheckExact(__pyx_t_9))) { if (__pyx_t_20 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_10 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_20); __Pyx_INCREF(__pyx_t_10); __pyx_t_20++; if (unlikely(0 < 0)) __PYX_ERR(0, 161, __pyx_L1_error) #else __pyx_t_10 = PySequence_ITEM(__pyx_t_9, __pyx_t_20); __pyx_t_20++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); #endif } else { if (__pyx_t_20 >= PyTuple_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_20); __Pyx_INCREF(__pyx_t_10); __pyx_t_20++; if (unlikely(0 < 0)) __PYX_ERR(0, 161, __pyx_L1_error) #else __pyx_t_10 = PySequence_ITEM(__pyx_t_9, __pyx_t_20); __pyx_t_20++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); #endif } } else { __pyx_t_10 = __pyx_t_21(__pyx_t_9); if (unlikely(!__pyx_t_10)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 161, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_10); } if (PyDict_SetItem(__pyx_d, __pyx_n_s_flag, __pyx_t_10) < 0) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* … */ } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+162: flag_value |= flag
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_flag_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_flag); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_11 = PyNumber_InPlaceOr(__pyx_t_10, __pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_flag_value, __pyx_t_11) < 0) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+163: swsf = SWSFlags(flag_value, flag_strs)
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_flag_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_flag_strs); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_11); __pyx_t_9 = 0; __pyx_t_11 = 0; __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4xpra_6codecs_11csc_swscale_20colorspace_converter_SWSFlags), __pyx_t_13, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_swsf, __pyx_t_11) < 0) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+164: FLAGS.append((speed, swsf))
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_FLAGS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_speed); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_swsf); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); __pyx_t_13 = 0; __pyx_t_9 = 0; __pyx_t_19 = __Pyx_PyObject_Append(__pyx_t_11, __pyx_t_10); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+165: log("speed=%s %s=%s", speed, swsf, flag_value)
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_speed); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_swsf); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_flag_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = NULL; __pyx_t_22 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); __pyx_t_22 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_11)) { PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_kp_u_speed_s_s_s, __pyx_t_9, __pyx_t_13, __pyx_t_8}; __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_22, 4+__pyx_t_22); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) { PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_kp_u_speed_s_s_s, __pyx_t_9, __pyx_t_13, __pyx_t_8}; __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_22, 4+__pyx_t_22); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { __pyx_t_12 = PyTuple_New(4+__pyx_t_22); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (__pyx_t_1) { __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1); __pyx_t_1 = NULL; } __Pyx_INCREF(__pyx_kp_u_speed_s_s_s); __Pyx_GIVEREF(__pyx_kp_u_speed_s_s_s); PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_22, __pyx_kp_u_speed_s_s_s); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_22, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_22, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_22, __pyx_t_8); __pyx_t_9 = 0; __pyx_t_13 = 0; __pyx_t_8 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_12, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+166: log("swscale flags: %s", FLAGS)
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_FLAGS); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_kp_u_swscale_flags_s); __Pyx_GIVEREF(__pyx_kp_u_swscale_flags_s); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_u_swscale_flags_s); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
167:
168:
+169: cdef int get_swscale_flags(int speed, int scaling, int subsampling, dst_format):
static int __pyx_f_4xpra_6codecs_11csc_swscale_20colorspace_converter_get_swscale_flags(int __pyx_v_speed, int __pyx_v_scaling, int __pyx_v_subsampling, PyObject *__pyx_v_dst_format) { int __pyx_v_flags; PyObject *__pyx_v_s = NULL; PyObject *__pyx_v_swsflags = NULL; CYTHON_UNUSED PyObject *__pyx_v__ = NULL; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_swscale_flags", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_WriteUnraisable("xpra.codecs.csc_swscale.colorspace_converter.get_swscale_flags", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_s); __Pyx_XDECREF(__pyx_v_swsflags); __Pyx_XDECREF(__pyx_v__); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+170: if not scaling and not subsampling:
__pyx_t_2 = ((!(__pyx_v_scaling != 0)) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = ((!(__pyx_v_subsampling != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+171: speed = 100
__pyx_v_speed = 0x64;
+172: cdef int flags = 0
__pyx_v_flags = 0;
+173: for s, swsflags in FLAGS:
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FLAGS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_6)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 173, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 173, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 173, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_3); } 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, 173, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_7 = PyList_GET_ITEM(sequence, 0); __pyx_t_8 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); #else __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 173, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L9_unpacking_done; __pyx_L8_unpacking_failed:; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 173, __pyx_L1_error) __pyx_L9_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF_SET(__pyx_v_swsflags, __pyx_t_8); __pyx_t_8 = 0; /* … */ } __pyx_L7_break:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+174: if s>=speed:
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_speed); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyObject_RichCompare(__pyx_v_s, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_1) { /* … */ }
+175: flags = swsflags.get_flags()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_swsflags, __pyx_n_s_get_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_flags = __pyx_t_11;
+176: break
goto __pyx_L7_break;
177: #not found? use the highest one:
+178: if flags==0:
__pyx_t_1 = ((__pyx_v_flags == 0) != 0); if (__pyx_t_1) { /* … */ }
+179: _, swsflags = FLAGS[-1]
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FLAGS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) { PyObject* sequence = __pyx_t_8; 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, 179, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_4 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_10 = Py_TYPE(__pyx_t_7)->tp_iternext; index = 0; __pyx_t_4 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L12_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); index = 1; __pyx_t_3 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L12_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_7), 2) < 0) __PYX_ERR(0, 179, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L13_unpacking_done; __pyx_L12_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 179, __pyx_L1_error) __pyx_L13_unpacking_done:; } __pyx_v__ = __pyx_t_4; __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_v_swsflags, __pyx_t_3); __pyx_t_3 = 0;
+180: flags = swsflags.get_flags()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_swsflags, __pyx_n_s_get_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_flags = __pyx_t_11;
181: #look away now: we get an acceleration warning with XRGB
182: #when we don't add SWS_ACCURATE_RND...
183: #but we don't want the flag otherwise, unless we are scaling or downsampling:
+184: if ((scaling or subsampling) and speed<100) or dst_format=="XRGB":
__pyx_t_2 = (__pyx_v_scaling != 0); if (!__pyx_t_2) { } else { goto __pyx_L17_next_and; } __pyx_t_2 = (__pyx_v_subsampling != 0); if (!__pyx_t_2) { goto __pyx_L16_next_or; } else { } __pyx_L17_next_and:; __pyx_t_2 = ((__pyx_v_speed < 0x64) != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L15_bool_binop_done; } __pyx_L16_next_or:; __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_dst_format, __pyx_n_u_XRGB, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 184, __pyx_L1_error) __pyx_t_1 = __pyx_t_2; __pyx_L15_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+185: flags |= SWS_ACCURATE_RND
__pyx_v_flags = (__pyx_v_flags | SWS_ACCURATE_RND);
+186: if dst_format=="GBRP":
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_dst_format, __pyx_n_u_GBRP, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 186, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+187: flags |= SWS_FULL_CHR_H_INT
__pyx_v_flags = (__pyx_v_flags | SWS_FULL_CHR_H_INT);
+188: return flags
__pyx_r = __pyx_v_flags; goto __pyx_L0;
189:
190:
+191: def get_swscale_flags_strs(int flags):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_1get_swscale_flags_strs(PyObject *__pyx_self, PyObject *__pyx_arg_flags); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_1get_swscale_flags_strs = {"get_swscale_flags_strs", (PyCFunction)__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_1get_swscale_flags_strs, METH_O, 0}; static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_1get_swscale_flags_strs(PyObject *__pyx_self, PyObject *__pyx_arg_flags) { int __pyx_v_flags; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_swscale_flags_strs (wrapper)", 0); assert(__pyx_arg_flags); { __pyx_v_flags = __Pyx_PyInt_As_int(__pyx_arg_flags); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.get_swscale_flags_strs", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_get_swscale_flags_strs(__pyx_self, ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_get_swscale_flags_strs(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_flags) { PyObject *__pyx_v_strs = NULL; PyObject *__pyx_v_flag_value = NULL; CYTHON_UNUSED PyObject *__pyx_v_flag_name = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_swscale_flags_strs", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.get_swscale_flags_strs", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_strs); __Pyx_XDECREF(__pyx_v_flag_value); __Pyx_XDECREF(__pyx_v_flag_name); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__17 = PyTuple_Pack(5, __pyx_n_s_flags, __pyx_n_s_flags, __pyx_n_s_strs, __pyx_n_s_flag_value, __pyx_n_s_flag_name); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); /* … */ __pyx_t_10 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_1get_swscale_flags_strs, NULL, __pyx_n_s_xpra_codecs_csc_swscale_colorspa_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_swscale_flags_strs, __pyx_t_10) < 0) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 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_swscale_colorspa, __pyx_n_s_get_swscale_flags_strs, 191, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 191, __pyx_L1_error)
+192: strs = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_strs = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+193: for flag_value, flag_name in {
__pyx_t_2 = 0; /* … */ while (1) { /* … */ __Pyx_XDECREF_SET(__pyx_v_flag_value, __pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF_SET(__pyx_v_flag_name, __pyx_t_5); __pyx_t_5 = 0;
+194: SWS_BICUBIC : "BICUBIC",
__pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_From_unsigned_int(SWS_BICUBIC); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_t_6, __pyx_n_u_BICUBIC) < 0) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* … */ __pyx_t_6 = __Pyx_dict_iterator(__pyx_t_5, 1, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_6; __pyx_t_6 = 0; /* … */ __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4); if (unlikely(__pyx_t_7 == 0)) break; if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_5);
+195: SWS_BICUBLIN : "BICUBLIN",
__pyx_t_6 = __Pyx_PyInt_From_unsigned_int(SWS_BICUBLIN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_t_6, __pyx_n_u_BICUBLIN) < 0) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+196: SWS_FAST_BILINEAR : "FAST_BILINEAR",
__pyx_t_6 = __Pyx_PyInt_From_unsigned_int(SWS_FAST_BILINEAR); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_t_6, __pyx_n_u_FAST_BILINEAR) < 0) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+197: SWS_ACCURATE_RND : "ACCURATE_RND"}.items():
__pyx_t_6 = __Pyx_PyInt_From_unsigned_int(SWS_ACCURATE_RND); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_t_6, __pyx_n_u_ACCURATE_RND) < 0) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+198: if (flag_value & flags)>0:
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyNumber_And(__pyx_v_flag_value, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_8) { /* … */ } } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+199: strs.append(flag)
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_flag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_strs, __pyx_t_5); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+200: return strs
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_strs); __pyx_r = __pyx_v_strs; goto __pyx_L0;
201:
202:
+203: def init_module():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_3init_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_3init_module = {"init_module", (PyCFunction)__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_3init_module, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_3init_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_11csc_swscale_20colorspace_converter_2init_module(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_2init_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_XDECREF(__pyx_t_3); __Pyx_AddTraceback("xpra.codecs.csc_swscale.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_10 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_3init_module, NULL, __pyx_n_s_xpra_codecs_csc_swscale_colorspa_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_module, __pyx_t_10) < 0) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* … */ __pyx_codeobj__19 = (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_swscale_colorspa, __pyx_n_s_init_module, 203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 203, __pyx_L1_error)
204: #nothing to do!
+205: log("csc_swscale.init_module()")
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_csc_swscale_init_module) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_csc_swscale_init_module); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __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;
+206: override_logger()
__pyx_t_1 = __pyx_f_4xpra_6codecs_12libav_common_6av_log_override_logger(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
207:
+208: def cleanup_module():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_5cleanup_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_5cleanup_module = {"cleanup_module", (PyCFunction)__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_5cleanup_module, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_5cleanup_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_11csc_swscale_20colorspace_converter_4cleanup_module(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_4cleanup_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_XDECREF(__pyx_t_3); __Pyx_AddTraceback("xpra.codecs.csc_swscale.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_10 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_5cleanup_module, NULL, __pyx_n_s_xpra_codecs_csc_swscale_colorspa_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_d, __pyx_n_s_cleanup_module, __pyx_t_10) < 0) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* … */ __pyx_codeobj__20 = (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_swscale_colorspa, __pyx_n_s_cleanup_module, 208, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 208, __pyx_L1_error)
+209: log("csc_swscale.cleanup_module()")
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_csc_swscale_cleanup_module) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_csc_swscale_cleanup_module); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __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;
+210: restore_logger()
__pyx_t_1 = __pyx_f_4xpra_6codecs_12libav_common_6av_log_restore_logger(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
211:
+212: def get_type():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_7get_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_7get_type = {"get_type", (PyCFunction)__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_7get_type, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_7get_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_11csc_swscale_20colorspace_converter_6get_type(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_6get_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_10 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_7get_type, NULL, __pyx_n_s_xpra_codecs_csc_swscale_colorspa_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_type, __pyx_t_10) < 0) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* … */ __pyx_codeobj__21 = (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_swscale_colorspa, __pyx_n_s_get_type, 212, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 212, __pyx_L1_error)
+213: return "swscale"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_u_swscale); __pyx_r = __pyx_n_u_swscale; goto __pyx_L0;
214:
+215: def get_version():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_9get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_9get_version = {"get_version", (PyCFunction)__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_9get_version, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_9get_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_11csc_swscale_20colorspace_converter_8get_version(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_8get_version(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_version", 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_swscale.colorspace_converter.get_version", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_10 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_9get_version, NULL, __pyx_n_s_xpra_codecs_csc_swscale_colorspa_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_version, __pyx_t_10) < 0) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* … */ __pyx_codeobj__22 = (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_swscale_colorspa, __pyx_n_s_get_version, 215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 215, __pyx_L1_error)
+216: return (LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(LIBSWSCALE_VERSION_MAJOR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int(LIBSWSCALE_VERSION_MINOR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_From_int(LIBSWSCALE_VERSION_MICRO); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
217:
+218: def get_info():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_11get_info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_11get_info = {"get_info", (PyCFunction)__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_11get_info, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_11get_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_11csc_swscale_20colorspace_converter_10get_info(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_10get_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_swscale.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_10 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_11get_info, NULL, __pyx_n_s_xpra_codecs_csc_swscale_colorspa_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_info, __pyx_t_10) < 0) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* … */ __pyx_codeobj__23 = (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_swscale_colorspa, __pyx_n_s_get_info, 218, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 218, __pyx_L1_error)
219: global COLORSPACES, MAX_WIDTH, MAX_HEIGHT
+220: return {
__Pyx_XDECREF(__pyx_r);
+221: "version" : get_version(),
__pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __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, 221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+222: "formats" : COLORSPACES,
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_formats, __pyx_t_2) < 0) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+223: "max-size" : (MAX_WIDTH, MAX_HEIGHT),
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __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, 221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
224: }
225:
+226: def get_input_colorspaces():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_13get_input_colorspaces(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_13get_input_colorspaces = {"get_input_colorspaces", (PyCFunction)__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_13get_input_colorspaces, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_13get_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_11csc_swscale_20colorspace_converter_12get_input_colorspaces(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_12get_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_swscale.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_10 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_13get_input_colorspaces, NULL, __pyx_n_s_xpra_codecs_csc_swscale_colorspa_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_input_colorspaces, __pyx_t_10) < 0) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* … */ __pyx_codeobj__24 = (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_swscale_colorspa, __pyx_n_s_get_input_colorspaces, 226, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 226, __pyx_L1_error)
+227: return COLORSPACES
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
228:
+229: def get_output_colorspaces(input_colorspace):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_15get_output_colorspaces(PyObject *__pyx_self, PyObject *__pyx_v_input_colorspace); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_15get_output_colorspaces = {"get_output_colorspaces", (PyCFunction)__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_15get_output_colorspaces, METH_O, 0}; static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_15get_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_11csc_swscale_20colorspace_converter_14get_output_colorspaces(__pyx_self, ((PyObject *)__pyx_v_input_colorspace)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_14get_output_colorspaces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_input_colorspace) { PyObject *__pyx_v_exclude = NULL; PyObject *__pyx_7genexpr__pyx_v_x = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_output_colorspaces", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.get_output_colorspaces", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_exclude); __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__25 = PyTuple_Pack(3, __pyx_n_s_input_colorspace, __pyx_n_s_exclude, __pyx_n_s_x); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); /* … */ __pyx_t_10 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_15get_output_colorspaces, NULL, __pyx_n_s_xpra_codecs_csc_swscale_colorspa_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_output_colorspaces, __pyx_t_10) < 0) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_swscale_colorspa, __pyx_n_s_get_output_colorspaces, 229, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 229, __pyx_L1_error)
230: #exclude input colorspace:
+231: exclude = [input_colorspace]
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_input_colorspace); __Pyx_GIVEREF(__pyx_v_input_colorspace); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_input_colorspace); __pyx_v_exclude = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+232: if input_colorspace in ("YUV420P", "YUV422P"):
__Pyx_INCREF(__pyx_v_input_colorspace); __pyx_t_1 = __pyx_v_input_colorspace; __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_YUV420P, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 232, __pyx_L1_error) if (!__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_YUV422P, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 232, __pyx_L1_error) __pyx_t_2 = __pyx_t_3; __pyx_L4_bool_binop_done:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { /* … */ }
233: #these would cause a warning:
234: #"No accelerated colorspace conversion found from yuv420p to gbrp."
+235: exclude.append("GBRP")
__pyx_t_4 = __Pyx_PyList_Append(__pyx_v_exclude, __pyx_n_u_GBRP); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 235, __pyx_L1_error)
+236: return [x for x in COLORSPACES if x not in exclude]
__Pyx_XDECREF(__pyx_r); { /* enter inner scope */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 236, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 236, __pyx_L8_error) } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (;;) { if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_6))) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 236, __pyx_L8_error) #else __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 236, __pyx_L8_error) #else __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); #endif } } else { __pyx_t_5 = __pyx_t_8(__pyx_t_6); if (unlikely(!__pyx_t_5)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 236, __pyx_L8_error) } break; } __Pyx_GOTREF(__pyx_t_5); } __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_x, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_7genexpr__pyx_v_x, __pyx_v_exclude, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 236, __pyx_L8_error) __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_7genexpr__pyx_v_x))) __PYX_ERR(0, 236, __pyx_L8_error) } } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0; goto __pyx_L12_exit_scope; __pyx_L8_error:; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0; goto __pyx_L1_error; __pyx_L12_exit_scope:; } /* exit inner scope */ __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
237:
238:
239: #a safe guess, which we probe later on:
+240: MAX_WIDTH = 16384
if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WIDTH, __pyx_int_16384) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
+241: MAX_HEIGHT = 16384
if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_HEIGHT, __pyx_int_16384) < 0) __PYX_ERR(0, 241, __pyx_L1_error)
+242: def get_spec(in_colorspace, out_colorspace):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_17get_spec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_17get_spec = {"get_spec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_17get_spec, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_17get_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, 242, __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, 242, __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, 242, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.csc_swscale.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_11csc_swscale_20colorspace_converter_16get_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_11csc_swscale_20colorspace_converter_16get_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_swscale.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__27 = PyTuple_Pack(2, __pyx_n_s_in_colorspace, __pyx_n_s_out_colorspace); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); /* … */ __pyx_t_10 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_17get_spec, NULL, __pyx_n_s_xpra_codecs_csc_swscale_colorspa_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_spec, __pyx_t_10) < 0) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_csc_swscale_colorspa, __pyx_n_s_get_spec, 242, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 242, __pyx_L1_error)
+243: assert in_colorspace in COLORSPACES, "invalid input colorspace: %s (must be one of %s)" % (in_colorspace, COLORSPACES)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __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, 243, __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, 243, __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, 243, __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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 243, __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, 243, __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__2); __pyx_t_3 += 1; __Pyx_GIVEREF(__pyx_kp_u__2); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__2); __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 243, __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, 243, __pyx_L1_error) } } #endif
+244: assert out_colorspace in COLORSPACES, "invalid output colorspace: %s (must be one of %s)" % (out_colorspace, COLORSPACES)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __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, 244, __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, 244, __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, 244, __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_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __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, 244, __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__2); __pyx_t_3 += 1; __Pyx_GIVEREF(__pyx_kp_u__2); PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_kp_u__2); __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 244, __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, 244, __pyx_L1_error) } } #endif
245: #setup cost is very low (usually less than 1ms!)
246: #there are restrictions on dimensions (8x2 minimum!)
247: #swscale can be used to scale (obviously)
+248: return csc_spec(ColorspaceConverter, codec_type=get_type(), setup_cost=20, min_w=8, min_h=2, can_scale=True, max_w=MAX_WIDTH, max_h=MAX_HEIGHT)
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_csc_spec); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_ptype_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_ptype_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter)); __pyx_t_1 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_get_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 248, __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); } } __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __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, 248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_setup_cost, __pyx_int_20) < 0) __PYX_ERR(0, 248, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_min_w, __pyx_int_8) < 0) __PYX_ERR(0, 248, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_min_h, __pyx_int_2) < 0) __PYX_ERR(0, 248, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_can_scale, Py_True) < 0) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __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, 248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __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, 248, __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, 248, __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;
249:
250:
+251: MIN_SWSCALE_VERSION = (2, 1, 1)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_MIN_SWSCALE_VERSION, __pyx_tuple__29) < 0) __PYX_ERR(0, 251, __pyx_L1_error) /* … */ __pyx_tuple__29 = PyTuple_Pack(3, __pyx_int_2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29);
+252: if (LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO)<MIN_SWSCALE_VERSION and is_Ubuntu():
__pyx_t_10 = __Pyx_PyInt_From_int(LIBSWSCALE_VERSION_MAJOR); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = __Pyx_PyInt_From_int(LIBSWSCALE_VERSION_MINOR); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_7 = __Pyx_PyInt_From_int(LIBSWSCALE_VERSION_MICRO); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_7); __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_7 = 0; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_MIN_SWSCALE_VERSION); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (__pyx_t_17) { } else { __pyx_t_18 = __pyx_t_17; goto __pyx_L14_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_is_Ubuntu); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_18 = __pyx_t_17; __pyx_L14_bool_binop_done:; if (__pyx_t_18) { /* … */ }
+253: log.warn("buggy Ubuntu swscale version detected: %s", get_version())
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_warn); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_get_version); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_12 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_kp_u_buggy_Ubuntu_swscale_version_det); __Pyx_GIVEREF(__pyx_kp_u_buggy_Ubuntu_swscale_version_det); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_buggy_Ubuntu_swscale_version_det); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_7, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+254: if envbool("XPRA_FORCE_SWSCALE", False):
__Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_envbool); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_18) { /* … */ __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_u_XPRA_FORCE_SWSCALE, Py_False); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30); /* … */ goto __pyx_L16; }
+255: log.warn("XPRA_FORCE_SWSCALE enabled at your own risk!")
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_warn); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* … */ __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_u_XPRA_FORCE_SWSCALE_enabled_at_yo); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31);
256: else:
+257: log.warn("cowardly refusing to use it to avoid problems, set the environment variable:")
/*else*/ { __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_warn); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* … */ __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_u_cowardly_refusing_to_use_it_to_a); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32);
+258: log.warn("XPRA_FORCE_SWSCALE=1")
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_warn); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* … */ __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_u_XPRA_FORCE_SWSCALE_1); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33);
+259: log.warn("to use it anyway, at your own risk")
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_warn); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* … */ __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_u_to_use_it_anyway_at_your_own_ris); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34);
+260: COLORSPACES = []
__pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_COLORSPACES, __pyx_t_7) < 0) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_L16:;
261:
262:
+263: cdef class ColorspaceConverter:
struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter { PyObject_HEAD int src_width; int src_height; __pyx_t_4xpra_6codecs_11csc_swscale_20colorspace_converter_AVPixelFormat src_format_enum; PyObject *src_format; int dst_width; int dst_height; unsigned char dst_bytes_per_pixel; __pyx_t_4xpra_6codecs_11csc_swscale_20colorspace_converter_AVPixelFormat dst_format_enum; PyObject *dst_format; unsigned long frames; double time; __pyx_t_4xpra_6codecs_11csc_swscale_20colorspace_converter_SwsContext *context; int flags; int out_height[4]; int out_stride[4]; unsigned long out_size[4]; PyObject *__weakref__; };
264: cdef int src_width
265: cdef int src_height
266: cdef AVPixelFormat src_format_enum
267: cdef object src_format
268: cdef int dst_width
269: cdef int dst_height
270: cdef unsigned char dst_bytes_per_pixel
271: cdef AVPixelFormat dst_format_enum
272: cdef object dst_format
273:
274: cdef unsigned long frames
275: cdef double time
276: cdef SwsContext *context
277: cdef int flags #@DuplicatedSignature
278:
279: cdef int out_height[4]
280: cdef int out_stride[4]
281: cdef unsigned long out_size[4]
282:
283: cdef object __weakref__
284:
+285: def init_context(self, int src_width, int src_height, src_format,
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_1init_context(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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, 285, __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, 285, __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, 285, __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, 285, __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, 285, __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, 285, __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, 285, __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, 285, __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, 286, __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, 286, __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, 286, __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, 285, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.csc_swscale.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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_init_context(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_init_context(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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) { struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat *__pyx_v_src = 0; struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat *__pyx_v_dst = 0; int __pyx_v_subsampling; long __pyx_v_i; int __pyx_v_scaling; 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_swscale.colorspace_converter.ColorspaceConverter.init_context", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_src); __Pyx_XDECREF((PyObject *)__pyx_v_dst); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
286: int dst_width, int dst_height, dst_format, int speed=100): #@DuplicatedSignature
+287: log("swscale.ColorspaceConverter.init_context%s", (src_width, src_height, src_format, dst_width, dst_height, dst_format, speed))
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __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, 287, __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, 287, __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, 287, __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, 287, __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, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 287, __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_swscale_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, 287, __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_swscale_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, 287, __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, 287, __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_swscale_ColorspaceConverter_init); __Pyx_GIVEREF(__pyx_kp_u_swscale_ColorspaceConverter_init); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_kp_u_swscale_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, 287, __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;
288: cdef CSCPixelFormat src
289: cdef CSCPixelFormat dst
290: #src:
+291: src = FORMATS.get(src_format)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FORMATS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_2, __pyx_v_src_format) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_src_format); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat))))) __PYX_ERR(0, 291, __pyx_L1_error) __pyx_v_src = ((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat *)__pyx_t_1); __pyx_t_1 = 0;
+292: log("source format=%s", src)
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_9 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_u_source_format_s, ((PyObject *)__pyx_v_src)}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __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_6)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_u_source_format_s, ((PyObject *)__pyx_v_src)}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL; } __Pyx_INCREF(__pyx_kp_u_source_format_s); __Pyx_GIVEREF(__pyx_kp_u_source_format_s); PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_kp_u_source_format_s); __Pyx_INCREF(((PyObject *)__pyx_v_src)); __Pyx_GIVEREF(((PyObject *)__pyx_v_src)); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, ((PyObject *)__pyx_v_src)); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+293: assert src, "invalid source format: %s" % src_format
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_10 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_src)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 293, __pyx_L1_error) if (unlikely(!__pyx_t_10)) { __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_invalid_source_format_s, __pyx_v_src_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __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, 293, __pyx_L1_error) } } #endif
+294: self.src_format = src_format
__Pyx_INCREF(__pyx_v_src_format); __Pyx_GIVEREF(__pyx_v_src_format); __Pyx_GOTREF(__pyx_v_self->src_format); __Pyx_DECREF(__pyx_v_self->src_format); __pyx_v_self->src_format = __pyx_v_src_format;
+295: self.src_format_enum = src.av_enum
__pyx_t_11 = __pyx_v_src->av_enum; __pyx_v_self->src_format_enum = __pyx_t_11;
296: #dst:
+297: dst = FORMATS.get(dst_format)
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_FORMATS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_get); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); } } __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_dst_format) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_dst_format); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat))))) __PYX_ERR(0, 297, __pyx_L1_error) __pyx_v_dst = ((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_CSCPixelFormat *)__pyx_t_1); __pyx_t_1 = 0;
+298: log("destination format=%s", dst)
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_log); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_9 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_destination_format_s, ((PyObject *)__pyx_v_dst)}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_destination_format_s, ((PyObject *)__pyx_v_dst)}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_INCREF(__pyx_kp_u_destination_format_s); __Pyx_GIVEREF(__pyx_kp_u_destination_format_s); PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_kp_u_destination_format_s); __Pyx_INCREF(((PyObject *)__pyx_v_dst)); __Pyx_GIVEREF(((PyObject *)__pyx_v_dst)); PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, ((PyObject *)__pyx_v_dst)); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+299: assert dst, "invalid destination format: %s" % dst_format
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_10 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_dst)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 299, __pyx_L1_error) if (unlikely(!__pyx_t_10)) { __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_invalid_destination_format_s, __pyx_v_dst_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __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, 299, __pyx_L1_error) } } #endif
+300: self.dst_format = dst_format
__Pyx_INCREF(__pyx_v_dst_format); __Pyx_GIVEREF(__pyx_v_dst_format); __Pyx_GOTREF(__pyx_v_self->dst_format); __Pyx_DECREF(__pyx_v_self->dst_format); __pyx_v_self->dst_format = __pyx_v_dst_format;
+301: self.dst_format_enum = dst.av_enum
__pyx_t_11 = __pyx_v_dst->av_enum; __pyx_v_self->dst_format_enum = __pyx_t_11;
+302: self.dst_bytes_per_pixel = BYTES_PER_PIXEL.get(dst.av_enum, 1)
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_BYTES_PER_PIXEL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_dst->av_enum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_6); __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_6, __pyx_t_8, __pyx_int_1}; __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, 302, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 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_6, __pyx_t_8, __pyx_int_1}; __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, 302, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_t_8); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_int_1); __pyx_t_8 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __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_t_12 = __Pyx_PyInt_As_unsigned_char(__pyx_t_1); if (unlikely((__pyx_t_12 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->dst_bytes_per_pixel = __pyx_t_12;
303: #pre-calculate plane heights:
+304: cdef int subsampling = False
__pyx_v_subsampling = 0;
+305: for i in range(4):
for (__pyx_t_13 = 0; __pyx_t_13 < 4; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13;
+306: self.out_height[i] = (int) (dst_height * dst.height_mult[i])
(__pyx_v_self->out_height[__pyx_v_i]) = ((int)(__pyx_v_dst_height * (__pyx_v_dst->height_mult[__pyx_v_i])));
+307: self.out_stride[i] = roundup((int) (dst_width * dst.width_mult[i]), 16)
(__pyx_v_self->out_stride[__pyx_v_i]) = __pyx_f_4xpra_6codecs_11csc_swscale_20colorspace_converter_roundup(((int)(__pyx_v_dst_width * (__pyx_v_dst->width_mult[__pyx_v_i]))), 16);
+308: if i!=3 and (dst.height_mult[i]!=1.0 or dst.width_mult[i]!=1.0):
__pyx_t_14 = ((__pyx_v_i != 3) != 0); if (__pyx_t_14) { } else { __pyx_t_10 = __pyx_t_14; goto __pyx_L6_bool_binop_done; } __pyx_t_14 = (((__pyx_v_dst->height_mult[__pyx_v_i]) != 1.0) != 0); if (!__pyx_t_14) { } else { __pyx_t_10 = __pyx_t_14; goto __pyx_L6_bool_binop_done; } __pyx_t_14 = (((__pyx_v_dst->width_mult[__pyx_v_i]) != 1.0) != 0); __pyx_t_10 = __pyx_t_14; __pyx_L6_bool_binop_done:; if (__pyx_t_10) { /* … */ }
+309: subsampling = True
__pyx_v_subsampling = 1;
+310: 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])); }
311:
+312: self.src_width = src_width
__pyx_v_self->src_width = __pyx_v_src_width;
+313: self.src_height = src_height
__pyx_v_self->src_height = __pyx_v_src_height;
+314: self.dst_width = dst_width
__pyx_v_self->dst_width = __pyx_v_dst_width;
+315: self.dst_height = dst_height
__pyx_v_self->dst_height = __pyx_v_dst_height;
316:
+317: cdef int scaling = (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_9 = __pyx_t_10; goto __pyx_L9_bool_binop_done; } __pyx_t_10 = (__pyx_v_src_height != __pyx_v_dst_height); __pyx_t_9 = __pyx_t_10; __pyx_L9_bool_binop_done:; __pyx_v_scaling = __pyx_t_9;
+318: self.flags = get_swscale_flags(speed, scaling, subsampling, dst_format)
__pyx_v_self->flags = __pyx_f_4xpra_6codecs_11csc_swscale_20colorspace_converter_get_swscale_flags(__pyx_v_speed, __pyx_v_scaling, __pyx_v_subsampling, __pyx_v_dst_format);
319: #log("sws get_swscale_flags(%s, %s, %s)=%s", speed, scaling, subsampling, get_swscale_flags_strs(self.flags))
+320: self.time = 0
__pyx_v_self->time = 0.0;
+321: self.frames = 0
__pyx_v_self->frames = 0;
322:
+323: self.context = sws_getContext(self.src_width, self.src_height, self.src_format_enum,
__pyx_v_self->context = sws_getContext(__pyx_v_self->src_width, __pyx_v_self->src_height, __pyx_v_self->src_format_enum, __pyx_v_self->dst_width, __pyx_v_self->dst_height, __pyx_v_self->dst_format_enum, __pyx_v_self->flags, NULL, NULL, NULL);
324: self.dst_width, self.dst_height, self.dst_format_enum,
325: self.flags, NULL, NULL, NULL)
+326: log("sws context=%#x", <uintptr_t> self.context)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->context)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_8); __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_8, __pyx_kp_u_sws_context_x, __pyx_t_7}; __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, 326, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_kp_u_sws_context_x, __pyx_t_7}; __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, 326, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_8) { __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL; } __Pyx_INCREF(__pyx_kp_u_sws_context_x); __Pyx_GIVEREF(__pyx_kp_u_sws_context_x); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_kp_u_sws_context_x); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_t_7); __pyx_t_7 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __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;
+327: assert self.context!=NULL, "sws_getContext returned NULL"
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_self->context != NULL) != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_sws_getContext_returned_NULL); __PYX_ERR(0, 327, __pyx_L1_error) } } #endif
328:
+329: def get_info(self): #@DuplicatedSignature
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_3get_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_2get_info(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_2get_info(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("xpra.codecs.csc_swscale.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; }
+330: info = get_info()
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __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;
+331: info.update({
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_info, __pyx_n_s_update); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+332: "flags" : get_swscale_flags_strs(self.flags),
__pyx_t_3 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_get_swscale_flags_strs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->flags); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_flags, __pyx_t_4) < 0) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+333: "frames" : int(self.frames),
__pyx_t_4 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->frames); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __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, 333, __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, 332, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+334: "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, 334, __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, 332, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+335: "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, 335, __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, 332, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+336: "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, 336, __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, 332, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+337: "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, 337, __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, 332, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+338: "dst_bytes_per_pixel" : self.dst_bytes_per_pixel,
__pyx_t_5 = __Pyx_PyInt_From_unsigned_char(__pyx_v_self->dst_bytes_per_pixel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_dst_bytes_per_pixel, __pyx_t_5) < 0) __PYX_ERR(0, 332, __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); } } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __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;
339: })
+340: if self.src_format:
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_self->src_format); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 340, __pyx_L1_error) if (__pyx_t_8) { /* … */ }
+341: 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, 341, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+342: if self.dst_format:
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_self->dst_format); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 342, __pyx_L1_error) if (__pyx_t_8) { /* … */ }
+343: 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, 343, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+344: if self.frames>0 and self.time>0:
__pyx_t_9 = ((__pyx_v_self->frames > 0) != 0); if (__pyx_t_9) { } else { __pyx_t_8 = __pyx_t_9; goto __pyx_L6_bool_binop_done; } __pyx_t_9 = ((__pyx_v_self->time > 0.0) != 0); __pyx_t_8 = __pyx_t_9; __pyx_L6_bool_binop_done:; if (__pyx_t_8) { /* … */ }
+345: 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);
+346: 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, 346, __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, 346, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+347: info["pixels_per_second"] = int(pps)
__pyx_t_1 = __Pyx_PyInt_FromDouble(__pyx_v_pps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __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, 347, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+348: return info
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_info); __pyx_r = __pyx_v_info; goto __pyx_L0;
349:
+350: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_5__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_4__repr__(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_4__repr__(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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_swscale.colorspace_converter.ColorspaceConverter.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+351: 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, 351, __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, 351, __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) { /* … */ }
+352: return "swscale(uninitialized)"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_kp_u_swscale_uninitialized); __pyx_r = __pyx_kp_u_swscale_uninitialized; goto __pyx_L0;
+353: return "swscale(%s %sx%s - %s %sx%s)" % (self.src_format, self.src_width, self.src_height,
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyTuple_New(13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = 127; __Pyx_INCREF(__pyx_kp_u_swscale_2); __pyx_t_5 += 8; __Pyx_GIVEREF(__pyx_kp_u_swscale_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_swscale_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, 353, __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__3); __pyx_t_5 += 1; __Pyx_GIVEREF(__pyx_kp_u__3); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__3); __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_self->src_width, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 353, __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, 353, __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 += 3; __Pyx_GIVEREF(__pyx_kp_u__4); PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_kp_u__4); /* … */ __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 13, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 353, __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;
+354: self.dst_format, self.dst_width, self.dst_height)
__pyx_t_7 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_self->dst_format), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __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_From_int(__pyx_v_self->dst_width, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __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, 9, __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, 10, __pyx_n_u_x); __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_self->dst_height, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __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, 11, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_kp_u__2); __pyx_t_5 += 1; __Pyx_GIVEREF(__pyx_kp_u__2); PyTuple_SET_ITEM(__pyx_t_4, 12, __pyx_kp_u__2);
355:
+356: def __dealloc__(self): #@DuplicatedSignature
/* Python wrapper */ static void __pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_7__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_7__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_6__dealloc__(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_6__dealloc__(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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_swscale.colorspace_converter.ColorspaceConverter.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+357: self.clean()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __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;
358:
+359: def get_src_width(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_9get_src_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_8get_src_width(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_8get_src_width(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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_swscale.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; }
+360: 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, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
361:
+362: def get_src_height(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_11get_src_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_10get_src_height(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_10get_src_height(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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_swscale.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; }
+363: 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, 363, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
364:
+365: def get_src_format(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_13get_src_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_12get_src_format(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_12get_src_format(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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; }
+366: 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;
367:
+368: def get_dst_width(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_15get_dst_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_14get_dst_width(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_14get_dst_width(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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_swscale.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; }
+369: 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, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
370:
+371: def get_dst_height(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_17get_dst_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_16get_dst_height(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_16get_dst_height(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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_swscale.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; }
+372: 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, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
373:
+374: def get_dst_format(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_19get_dst_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_18get_dst_format(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_18get_dst_format(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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; }
+375: 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;
376:
+377: def get_type(self): #@DuplicatedSignature
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_21get_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_20get_type(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_20get_type(CYTHON_UNUSED struct __pyx_obj_4xpra_6codecs_11csc_swscale_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; }
+378: return "swscale"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_u_swscale); __pyx_r = __pyx_n_u_swscale; goto __pyx_L0;
379:
380:
+381: def clean(self): #@DuplicatedSignature
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_23clean(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_22clean(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_22clean(struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *__pyx_v_self) { int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clean", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.ColorspaceConverter.clean", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
382: #overzealous clean is cheap!
383: cdef int i
+384: if self.context!=NULL:
__pyx_t_1 = ((__pyx_v_self->context != NULL) != 0); if (__pyx_t_1) { /* … */ }
+385: log("swscale.ColorspaceConverter.clean() sws context=%#x", <uintptr_t> self.context)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->context)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_swscale_ColorspaceConverter_clea, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_swscale_ColorspaceConverter_clea, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 385, __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_swscale_ColorspaceConverter_clea); __Pyx_GIVEREF(__pyx_kp_u_swscale_ColorspaceConverter_clea); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_u_swscale_ColorspaceConverter_clea); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+386: sws_freeContext(self.context)
sws_freeContext(__pyx_v_self->context);
+387: self.context = NULL
__pyx_v_self->context = NULL;
+388: self.src_width = 0
__pyx_v_self->src_width = 0;
+389: self.src_height = 0
__pyx_v_self->src_height = 0;
+390: self.src_format_enum = AV_PIX_FMT_NONE
__pyx_v_self->src_format_enum = AV_PIX_FMT_NONE;
+391: 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;
+392: self.dst_width = 0
__pyx_v_self->dst_width = 0;
+393: self.dst_height = 0
__pyx_v_self->dst_height = 0;
+394: self.dst_format_enum = AV_PIX_FMT_NONE
__pyx_v_self->dst_format_enum = AV_PIX_FMT_NONE;
+395: 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;
+396: self.frames = 0
__pyx_v_self->frames = 0;
+397: self.time = 0
__pyx_v_self->time = 0.0;
+398: self.flags = 0
__pyx_v_self->flags = 0;
+399: for i in range(4):
for (__pyx_t_6 = 0; __pyx_t_6 < 4; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6;
+400: self.out_height[i] = 0
(__pyx_v_self->out_height[__pyx_v_i]) = 0;
+401: self.out_stride[i] = 0
(__pyx_v_self->out_stride[__pyx_v_i]) = 0;
+402: self.out_size[i] = 0
(__pyx_v_self->out_size[__pyx_v_i]) = 0; }
403:
+404: def is_closed(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_25is_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_24is_closed(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_24is_closed(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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_swscale.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; }
+405: return self.context!=NULL
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->context != NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
406:
407:
+408: def convert_image(self, image):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_27convert_image(PyObject *__pyx_v_self, PyObject *__pyx_v_image); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_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_11csc_swscale_20colorspace_converter_19ColorspaceConverter_26convert_image(((struct __pyx_obj_4xpra_6codecs_11csc_swscale_20colorspace_converter_ColorspaceConverter *)__pyx_v_self), ((PyObject *)__pyx_v_image)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_19ColorspaceConverter_26convert_image(struct __pyx_obj_4xpra_6codecs_11csc_swscale_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[4]; uint8_t *__pyx_v_output_image[4]; int __pyx_v_input_stride[4]; int __pyx_v_iplanes; int __pyx_v_oplanes; int __pyx_v_i; int __pyx_v_result; size_t __pyx_v_pad; double __pyx_v_start; PyObject *__pyx_v_pixels = NULL; PyObject *__pyx_v_strides = NULL; PyObject *__pyx_v_planes = NULL; PyObject *__pyx_v_output_buf = NULL; struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *__pyx_v_mb = 0; PyObject *__pyx_v_out = NULL; double __pyx_v_elapsed; int __pyx_8genexpr1__pyx_v_i; int __pyx_8genexpr2__pyx_v_i; 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_8); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_15); __Pyx_XDECREF(__pyx_t_16); __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.ColorspaceConverter.convert_image", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_pixels); __Pyx_XDECREF(__pyx_v_strides); __Pyx_XDECREF(__pyx_v_planes); __Pyx_XDECREF(__pyx_v_output_buf); __Pyx_XDECREF((PyObject *)__pyx_v_mb); __Pyx_XDECREF(__pyx_v_out); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+409: cdef Py_ssize_t pic_buf_len = 0
__pyx_v_pic_buf_len = 0;
+410: assert self.context!=NULL
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_self->context != NULL) != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 410, __pyx_L1_error) } } #endif
411: cdef const uint8_t *input_image[4]
412: cdef uint8_t *output_image[4]
413: cdef int input_stride[4]
414: cdef int iplanes,oplanes
415: cdef int i #@DuplicatedSignature
416: cdef int height
417: cdef int stride
418: cdef int result
419: cdef size_t pad
+420: cdef double start = monotonic_time()
__pyx_v_start = __pyx_f_4xpra_14monotonic_time_monotonic_time();
+421: 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, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 421, __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, 421, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_iplanes = __pyx_t_4;
+422: 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, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __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;
+423: strides = 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, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_strides = __pyx_t_1; __pyx_t_1 = 0;
+424: assert iplanes in ImageWrapper.PLANE_OPTIONS, "invalid number of planes: %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, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_PLANE_OPTIONS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!(__pyx_t_5 != 0))) { __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_iplanes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_invalid_number_of_planes_s, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 424, __pyx_L1_error) } } #endif
+425: if iplanes==ImageWrapper.PACKED:
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_iplanes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_PACKED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { /* … */ goto __pyx_L3; }
426: #magic: repack raw pixels/rowstride:
+427: planes = [pixels]
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_pixels); __Pyx_GIVEREF(__pyx_v_pixels); PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_pixels); __pyx_v_planes = __pyx_t_3; __pyx_t_3 = 0;
+428: strides = [strides]
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_strides); __Pyx_GIVEREF(__pyx_v_strides); PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_strides); __Pyx_DECREF_SET(__pyx_v_strides, __pyx_t_3); __pyx_t_3 = 0;
+429: iplanes = 1
__pyx_v_iplanes = 1;
430: else:
+431: planes = pixels
/*else*/ {
__Pyx_INCREF(__pyx_v_pixels);
__pyx_v_planes = __pyx_v_pixels;
}
__pyx_L3:;
+432: if self.dst_format.endswith("P"):
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->dst_format, __pyx_n_s_endswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_u_P) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_P); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { /* … */ goto __pyx_L4; }
+433: pad = self.dst_width
__pyx_t_4 = __pyx_v_self->dst_width; __pyx_v_pad = __pyx_t_4;
434: else:
+435: pad = self.dst_width * 4
/*else*/ { __pyx_v_pad = (__pyx_v_self->dst_width * 4); } __pyx_L4:;
436: #print("convert_image(%s) input=%s, strides=%s" % (image, len(input), strides))
+437: 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, 437, __pyx_L1_error) if (unlikely(!__pyx_t_5)) { __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_failed_to_get_pixels_from_s, __pyx_v_image); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __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, 437, __pyx_L1_error) } } #endif
+438: assert image.get_width()>=self.src_width, "invalid image width: %s (minimum is %s)" % (image.get_width(), self.src_width)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->src_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_5)) { __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __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_1, 0, __pyx_kp_u_invalid_image_width); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7; __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 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_1, 2, __pyx_kp_u_minimum_is); __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_self->src_width, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __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_1, 3, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u__2); __pyx_t_6 += 1; __Pyx_GIVEREF(__pyx_kp_u__2); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__2); __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 438, __pyx_L1_error) } } #endif
+439: assert image.get_height()>=self.src_height, "invalid image height: %s (minimum is %s)" % (image.get_height(), self.src_height)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->src_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_5)) { __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __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_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_1), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7; __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, 439, __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__2); __pyx_t_6 += 1; __Pyx_GIVEREF(__pyx_kp_u__2); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__2); __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __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, 439, __pyx_L1_error) } } #endif
+440: assert len(planes)==iplanes, "expected %s planes but found %s" % (iplanes, len(pixels))
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_6 = PyObject_Length(__pyx_v_planes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 440, __pyx_L1_error) if (unlikely(!((__pyx_t_6 == __pyx_v_iplanes) != 0))) { __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = 0; __pyx_t_7 = 127; __Pyx_INCREF(__pyx_kp_u_expected); __pyx_t_9 += 9; __Pyx_GIVEREF(__pyx_kp_u_expected); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_expected); __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_iplanes, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 += __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_planes_but_found); __pyx_t_9 += 18; __Pyx_GIVEREF(__pyx_kp_u_planes_but_found); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_planes_but_found); __pyx_t_10 = PyObject_Length(__pyx_v_pixels); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 440, __pyx_L1_error) __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_10, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 += __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_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __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, 440, __pyx_L1_error) } } #endif
+441: assert len(strides)==iplanes, "expected %s rowstrides but found %s" % (iplanes, len(strides))
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_6 = PyObject_Length(__pyx_v_strides); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 441, __pyx_L1_error) if (unlikely(!((__pyx_t_6 == __pyx_v_iplanes) != 0))) { __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = 0; __pyx_t_7 = 127; __Pyx_INCREF(__pyx_kp_u_expected); __pyx_t_9 += 9; __Pyx_GIVEREF(__pyx_kp_u_expected); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_expected); __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_iplanes, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 += __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_rowstrides_but_found); __pyx_t_9 += 22; __Pyx_GIVEREF(__pyx_kp_u_rowstrides_but_found); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_rowstrides_but_found); __pyx_t_10 = PyObject_Length(__pyx_v_strides); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 441, __pyx_L1_error) __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_10, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 += __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_t_3 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __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, 441, __pyx_L1_error) } } #endif
+442: for i in range(4):
for (__pyx_t_4 = 0; __pyx_t_4 < 4; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+443: if i<iplanes:
__pyx_t_5 = ((__pyx_v_i < __pyx_v_iplanes) != 0); if (__pyx_t_5) { /* … */ goto __pyx_L7; }
+444: input_stride[i] = strides[i]
__pyx_t_3 = __Pyx_GetItemInt(__pyx_v_strides, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_input_stride[__pyx_v_i]) = __pyx_t_11;
+445: assert object_as_buffer(planes[i], <const void**> &input_image[i], &pic_buf_len)==0
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_planes, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(!((__pyx_f_4xpra_7buffers_6membuf_object_as_buffer(__pyx_t_3, ((void const **)(&(__pyx_v_input_image[__pyx_v_i]))), (&__pyx_v_pic_buf_len)) == 0) != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 445, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } #endif
446: else:
447: #some versions of swscale check all 4 planes
448: #even when we only pass 1! see "check_image_pointers"
449: #(so we just copy the last valid plane in the remaining slots - ugly!)
+450: input_stride[i] = input_stride[iplanes-1]
/*else*/ { (__pyx_v_input_stride[__pyx_v_i]) = (__pyx_v_input_stride[(__pyx_v_iplanes - 1)]);
+451: input_image[i] = input_image[iplanes-1]
(__pyx_v_input_image[__pyx_v_i]) = (__pyx_v_input_image[(__pyx_v_iplanes - 1)]); } __pyx_L7:; }
452:
453: #allocate the output buffer(s):
+454: output_buf = []
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_output_buf = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
455: cdef MemBuf mb
+456: for i in range(3):
for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+457: if self.out_size[i]>0:
__pyx_t_5 = (((__pyx_v_self->out_size[__pyx_v_i]) > 0) != 0); if (__pyx_t_5) { /* … */ goto __pyx_L10; }
+458: mb = padbuf(self.out_size[i], pad)
__pyx_t_3 = __pyx_f_4xpra_7buffers_6membuf_padbuf((__pyx_v_self->out_size[__pyx_v_i]), __pyx_v_pad); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4xpra_7buffers_6membuf_MemBuf))))) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_mb, ((struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *)__pyx_t_3)); __pyx_t_3 = 0;
+459: output_buf.append(mb)
__pyx_t_12 = __Pyx_PyList_Append(__pyx_v_output_buf, ((PyObject *)__pyx_v_mb)); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 459, __pyx_L1_error)
+460: output_image[i] = <uint8_t *> mb.get_mem()
(__pyx_v_output_image[__pyx_v_i]) = ((uint8_t *)((struct __pyx_vtabstruct_4xpra_7buffers_6membuf_MemBuf *)__pyx_v_mb->__pyx_vtab)->get_mem(__pyx_v_mb));
461: else:
462: #the buffer may not be used, but is not allowed to be NULL:
+463: output_image[i] = output_image[0]
/*else*/ { (__pyx_v_output_image[__pyx_v_i]) = (__pyx_v_output_image[0]); } __pyx_L10:; }
+464: 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_L13; } __pyx_L13:; } }
+465: result = sws_scale(self.context, input_image, input_stride, 0, self.src_height, output_image, self.out_stride)
__pyx_v_result = sws_scale(__pyx_v_self->context, __pyx_v_input_image, __pyx_v_input_stride, 0, __pyx_v_self->src_height, __pyx_v_output_image, __pyx_v_self->out_stride); }
+466: assert result!=0, "sws_scale failed!"
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_result != 0) != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_sws_scale_failed); __PYX_ERR(0, 466, __pyx_L1_error) } } #endif
+467: assert result==self.dst_height, "invalid output height: %s, expected %s" % (result, self.dst_height)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_result == __pyx_v_self->dst_height) != 0))) { __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = 0; __pyx_t_7 = 127; __Pyx_INCREF(__pyx_kp_u_invalid_output_height); __pyx_t_6 += 23; __Pyx_GIVEREF(__pyx_kp_u_invalid_output_height); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_invalid_output_height); __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_result, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __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_expected_2); __pyx_t_6 += 11; __Pyx_GIVEREF(__pyx_kp_u_expected_2); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_expected_2); __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_self->dst_height, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __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_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __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, 467, __pyx_L1_error) } } #endif
468: #now parse the output:
+469: if self.dst_format.endswith("P"):
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->dst_format, __pyx_n_s_endswith); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(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_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_P) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_P); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __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, 469, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_5) { /* … */ goto __pyx_L14; }
470: #planar mode, assume 3 planes:
+471: oplanes = ImageWrapper._3_PLANES
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_3_PLANES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_oplanes = __pyx_t_4;
+472: out = [memoryview(output_buf[i]) for i in range(3)]
{ /* enter inner scope */ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { __pyx_8genexpr1__pyx_v_i = __pyx_t_4; __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_memoryview); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_output_buf, __pyx_8genexpr1__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } } /* exit inner scope */ __pyx_v_out = __pyx_t_3; __pyx_t_3 = 0;
+473: strides = [self.out_stride[i] for i in range(3)]
{ /* enter inner scope */ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { __pyx_8genexpr2__pyx_v_i = __pyx_t_4; __pyx_t_8 = __Pyx_PyInt_From_int((__pyx_v_self->out_stride[__pyx_8genexpr2__pyx_v_i])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } } /* exit inner scope */ __Pyx_DECREF_SET(__pyx_v_strides, __pyx_t_3); __pyx_t_3 = 0;
474: else:
475: #assume no planes, plain RGB packed pixels:
+476: oplanes = ImageWrapper.PACKED
/*else*/ { __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_PACKED); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_oplanes = __pyx_t_4;
+477: strides = self.out_stride[0]
__pyx_t_8 = __Pyx_PyInt_From_int((__pyx_v_self->out_stride[0])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 477, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF_SET(__pyx_v_strides, __pyx_t_8); __pyx_t_8 = 0;
+478: out = memoryview(output_buf[0])
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_memoryview); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_output_buf, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_out = __pyx_t_1; __pyx_t_1 = 0; } __pyx_L14:;
+479: cdef double elapsed = monotonic_time()-start
__pyx_v_elapsed = (__pyx_f_4xpra_14monotonic_time_monotonic_time() - __pyx_v_start);
+480: log("%s took %.1fms", self, 1000.0*elapsed)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyFloat_FromDouble((1000.0 * __pyx_v_elapsed)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_2 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_kp_u_s_took_1fms, ((PyObject *)__pyx_v_self), __pyx_t_8}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_kp_u_s_took_1fms, ((PyObject *)__pyx_v_self), __pyx_t_8}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { __pyx_t_13 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); __pyx_t_2 = NULL; } __Pyx_INCREF(__pyx_kp_u_s_took_1fms); __Pyx_GIVEREF(__pyx_kp_u_s_took_1fms); PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_4, __pyx_kp_u_s_took_1fms); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_4, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_4, __pyx_t_8); __pyx_t_8 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+481: self.time += elapsed
__pyx_v_self->time = (__pyx_v_self->time + __pyx_v_elapsed);
+482: self.frames += 1
__pyx_v_self->frames = (__pyx_v_self->frames + 1);
+483: return ImageWrapper(0, 0, self.dst_width, self.dst_height, out, self.dst_format, 24, strides, self.dst_bytes_per_pixel, oplanes)
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ImageWrapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __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, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_self->dst_height); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_2 = __Pyx_PyInt_From_unsigned_char(__pyx_v_self->dst_bytes_per_pixel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_oplanes); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_15 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[11] = {__pyx_t_15, __pyx_int_0, __pyx_int_0, __pyx_t_13, __pyx_t_8, __pyx_v_out, __pyx_v_self->dst_format, __pyx_int_24, __pyx_v_strides, __pyx_t_2, __pyx_t_14}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[11] = {__pyx_t_15, __pyx_int_0, __pyx_int_0, __pyx_t_13, __pyx_t_8, __pyx_v_out, __pyx_v_self->dst_format, __pyx_int_24, __pyx_v_strides, __pyx_t_2, __pyx_t_14}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } else #endif { __pyx_t_16 = PyTuple_New(10+__pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); if (__pyx_t_15) { __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL; } __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_4, __pyx_int_0); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_4, __pyx_int_0); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_4, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_4, __pyx_v_out); __Pyx_INCREF(__pyx_v_self->dst_format); __Pyx_GIVEREF(__pyx_v_self->dst_format); PyTuple_SET_ITEM(__pyx_t_16, 5+__pyx_t_4, __pyx_v_self->dst_format); __Pyx_INCREF(__pyx_int_24); __Pyx_GIVEREF(__pyx_int_24); PyTuple_SET_ITEM(__pyx_t_16, 6+__pyx_t_4, __pyx_int_24); __Pyx_INCREF(__pyx_v_strides); __Pyx_GIVEREF(__pyx_v_strides); PyTuple_SET_ITEM(__pyx_t_16, 7+__pyx_t_4, __pyx_v_strides); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_16, 8+__pyx_t_4, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 9+__pyx_t_4, __pyx_t_14); __pyx_t_13 = 0; __pyx_t_8 = 0; __pyx_t_2 = 0; __pyx_t_14 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
484:
485:
+486: def selftest(full=False):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19selftest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_19selftest = {"selftest", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19selftest, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_11csc_swscale_20colorspace_converter_19selftest(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, 486, __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, 486, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.csc_swscale.colorspace_converter.selftest", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_18selftest(__pyx_self, __pyx_v_full); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_11csc_swscale_20colorspace_converter_18selftest(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_planar_tests = NULL; PyObject *__pyx_v_packed_tests = NULL; PyObject *__pyx_v_maxw = NULL; PyObject *__pyx_v_maxh = NULL; PyObject *__pyx_v_planar = NULL; PyObject *__pyx_v_packed = NULL; PyObject *__pyx_v_mw = NULL; PyObject *__pyx_v_mh = NULL; PyObject *__pyx_8genexpr3__pyx_v_x = NULL; PyObject *__pyx_8genexpr4__pyx_v_x = NULL; PyObject *__pyx_8genexpr5__pyx_v_x = 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_5); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_15); __Pyx_AddTraceback("xpra.codecs.csc_swscale.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_planar_tests); __Pyx_XDECREF(__pyx_v_packed_tests); __Pyx_XDECREF(__pyx_v_maxw); __Pyx_XDECREF(__pyx_v_maxh); __Pyx_XDECREF(__pyx_v_planar); __Pyx_XDECREF(__pyx_v_packed); __Pyx_XDECREF(__pyx_v_mw); __Pyx_XDECREF(__pyx_v_mh); __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_x); __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_x); __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_x); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__35 = PyTuple_Pack(15, __pyx_n_s_full, __pyx_n_s_testcsc, __pyx_n_s_get_csc_max_size, __pyx_n_s_colorspace_converter, __pyx_n_s_planar_tests, __pyx_n_s_packed_tests, __pyx_n_s_maxw, __pyx_n_s_maxh, __pyx_n_s_planar, __pyx_n_s_packed, __pyx_n_s_mw, __pyx_n_s_mh, __pyx_n_s_x, __pyx_n_s_x, __pyx_n_s_x); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); /* … */ __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_11csc_swscale_20colorspace_converter_19selftest, NULL, __pyx_n_s_xpra_codecs_csc_swscale_colorspa_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_selftest, __pyx_t_7) < 0) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
487: global MAX_WIDTH, MAX_HEIGHT
+488: 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, 488, __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, 488, __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, 488, __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, 488, __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;
+489: from xpra.codecs.csc_swscale import colorspace_converter
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __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_swscale, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __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, 489, __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;
+490: override_logger()
__pyx_t_1 = __pyx_f_4xpra_6codecs_12libav_common_6av_log_override_logger(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+491: try:
/*try:*/ {
+492: suspend_nonfatal_logging()
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_suspend_nonfatal_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
493: #test a limited set, not all combinations:
+494: if full:
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_full); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 494, __pyx_L4_error) if (__pyx_t_4) { /* … */ goto __pyx_L6; }
+495: planar_tests = [x for x in get_input_colorspaces() if x.endswith("P")]
{ /* enter inner scope */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_input_colorspaces); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; __pyx_t_7 = NULL; } else { __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 495, __pyx_L9_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 495, __pyx_L9_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 495, __pyx_L9_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_2); #endif } } else { __pyx_t_2 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_2)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 495, __pyx_L9_error) } break; } __Pyx_GOTREF(__pyx_t_2); } __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_x, __pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr3__pyx_v_x, __pyx_n_s_endswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 495, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_n_u_P) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_P); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 495, __pyx_L9_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr3__pyx_v_x))) __PYX_ERR(0, 495, __pyx_L9_error) } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_x); __pyx_8genexpr3__pyx_v_x = 0; goto __pyx_L13_exit_scope; __pyx_L9_error:; __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_x); __pyx_8genexpr3__pyx_v_x = 0; goto __pyx_L4_error; __pyx_L13_exit_scope:; } /* exit inner scope */ __pyx_v_planar_tests = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+496: packed_tests = [x for x in get_input_colorspaces() if ((x.find("BGR")>=0 or x.find("RGB")>=0) and not x not in planar_tests)]
{ /* enter inner scope */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_input_colorspaces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; __pyx_t_7 = NULL; } else { __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 496, __pyx_L16_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 496, __pyx_L16_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 496, __pyx_L16_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_7(__pyx_t_2); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 496, __pyx_L16_error) } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_x, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr4__pyx_v_x, __pyx_n_s_find); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_n_u_BGR) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_BGR); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (!__pyx_t_9) { } else { goto __pyx_L21_next_and; } __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr4__pyx_v_x, __pyx_n_s_find); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_8, __pyx_n_u_RGB) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_RGB); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 496, __pyx_L16_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_9) { } else { __pyx_t_4 = __pyx_t_9; goto __pyx_L20_bool_binop_done; } __pyx_L21_next_and:; __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_8genexpr4__pyx_v_x, __pyx_v_planar_tests, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 496, __pyx_L16_error) __pyx_t_10 = (__pyx_t_9 != 0); __pyx_t_4 = __pyx_t_10; __pyx_L20_bool_binop_done:; if (__pyx_t_4) { if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr4__pyx_v_x))) __PYX_ERR(0, 496, __pyx_L16_error) } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_x); __pyx_8genexpr4__pyx_v_x = 0; goto __pyx_L23_exit_scope; __pyx_L16_error:; __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_x); __pyx_8genexpr4__pyx_v_x = 0; goto __pyx_L4_error; __pyx_L23_exit_scope:; } /* exit inner scope */ __pyx_v_packed_tests = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
497: else:
+498: planar_tests = [x for x in ("YUV420P", "YUV422P", "YUV444P", "GBRP") if x in get_input_colorspaces()]
/*else*/ { { /* enter inner scope */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L26_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_tuple__6; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; for (;;) { if (__pyx_t_6 >= 4) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 498, __pyx_L26_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 498, __pyx_L26_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_x, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_get_input_colorspaces); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 498, __pyx_L26_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 498, __pyx_L26_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_8genexpr5__pyx_v_x, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 498, __pyx_L26_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_10 = (__pyx_t_4 != 0); if (__pyx_t_10) { if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr5__pyx_v_x))) __PYX_ERR(0, 498, __pyx_L26_error) } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_x); __pyx_8genexpr5__pyx_v_x = 0; goto __pyx_L30_exit_scope; __pyx_L26_error:; __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_x); __pyx_8genexpr5__pyx_v_x = 0; goto __pyx_L4_error; __pyx_L30_exit_scope:; } /* exit inner scope */ __pyx_v_planar_tests = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_tuple__6 = PyTuple_Pack(4, __pyx_n_u_YUV420P, __pyx_n_u_YUV422P, __pyx_n_u_YUV444P, __pyx_n_u_GBRP); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6);
+499: packed_tests = ["BGRX"] #only test BGRX
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L4_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); __pyx_v_packed_tests = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; } __pyx_L6:;
+500: maxw, maxh = 2**24, 2**24
__pyx_t_1 = __pyx_int_16777216; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_int_16777216; __Pyx_INCREF(__pyx_t_2); __pyx_v_maxw = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_maxh = __pyx_t_2; __pyx_t_2 = 0;
+501: for planar in planar_tests:
__pyx_t_2 = __pyx_v_planar_tests; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; for (;;) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 501, __pyx_L4_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); #endif __Pyx_XDECREF_SET(__pyx_v_planar, __pyx_t_1); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+502: for packed in packed_tests:
__pyx_t_1 = __pyx_v_packed_tests; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0; for (;;) { if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 502, __pyx_L4_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_packed, __pyx_t_3); __pyx_t_3 = 0; /* … */ __pyx_L33_continue:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
503: #test planar to packed:
+504: if packed not in get_output_colorspaces(planar):
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_get_output_colorspaces); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 504, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_v_planar) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_planar); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_v_packed, __pyx_t_3, Py_NE)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 504, __pyx_L4_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = (__pyx_t_10 != 0); if (__pyx_t_4) { /* … */ }
+505: continue
goto __pyx_L33_continue;
+506: testcsc(colorspace_converter, full, [planar], [packed])
__pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 506, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_planar); __Pyx_GIVEREF(__pyx_v_planar); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_planar); __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 506, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_packed); __Pyx_GIVEREF(__pyx_v_packed); PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_packed); __Pyx_INCREF(__pyx_v_testcsc); __pyx_t_12 = __pyx_v_testcsc; __pyx_t_13 = NULL; __pyx_t_14 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_13)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); __pyx_t_14 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_12)) { PyObject *__pyx_temp[5] = {__pyx_t_13, __pyx_v_colorspace_converter, __pyx_v_full, __pyx_t_5, __pyx_t_8}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) { PyObject *__pyx_temp[5] = {__pyx_t_13, __pyx_v_colorspace_converter, __pyx_v_full, __pyx_t_5, __pyx_t_8}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { __pyx_t_15 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 506, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_15); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL; } __Pyx_INCREF(__pyx_v_colorspace_converter); __Pyx_GIVEREF(__pyx_v_colorspace_converter); PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_v_colorspace_converter); __Pyx_INCREF(__pyx_v_full); __Pyx_GIVEREF(__pyx_v_full); PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_v_full); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_14, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_14, __pyx_t_8); __pyx_t_5 = 0; __pyx_t_8 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+507: if full:
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_full); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 507, __pyx_L4_error) if (__pyx_t_4) { /* … */ }
+508: mw, mh = get_csc_max_size(colorspace_converter, [planar], [packed])
__pyx_t_12 = PyList_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 508, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_planar); __Pyx_GIVEREF(__pyx_v_planar); PyList_SET_ITEM(__pyx_t_12, 0, __pyx_v_planar); __pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 508, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_v_packed); __Pyx_GIVEREF(__pyx_v_packed); PyList_SET_ITEM(__pyx_t_15, 0, __pyx_v_packed); __Pyx_INCREF(__pyx_v_get_csc_max_size); __pyx_t_8 = __pyx_v_get_csc_max_size; __pyx_t_5 = NULL; __pyx_t_14 = 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_14 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_colorspace_converter, __pyx_t_12, __pyx_t_15}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_14, 3+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_colorspace_converter, __pyx_t_12, __pyx_t_15}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_14, 3+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } else #endif { __pyx_t_13 = PyTuple_New(3+__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 508, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_13); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_13, 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_13, 0+__pyx_t_14, __pyx_v_colorspace_converter); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_14, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_14, __pyx_t_15); __pyx_t_12 = 0; __pyx_t_15 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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, 508, __pyx_L4_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_8 = PyList_GET_ITEM(sequence, 0); __pyx_t_13 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_13); #else __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 508, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 508, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_13); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; __pyx_t_15 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 508, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext; index = 0; __pyx_t_8 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_8)) goto __pyx_L37_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); index = 1; __pyx_t_13 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_13)) goto __pyx_L37_unpacking_failed; __Pyx_GOTREF(__pyx_t_13); if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 2) < 0) __PYX_ERR(0, 508, __pyx_L4_error) __pyx_t_16 = NULL; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; goto __pyx_L38_unpacking_done; __pyx_L37_unpacking_failed:; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_16 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 508, __pyx_L4_error) __pyx_L38_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_mw, __pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF_SET(__pyx_v_mh, __pyx_t_13); __pyx_t_13 = 0;
+509: maxw = min(maxw, mw)
__Pyx_INCREF(__pyx_v_mw); __pyx_t_3 = __pyx_v_mw; __Pyx_INCREF(__pyx_v_maxw); __pyx_t_13 = __pyx_v_maxw; __pyx_t_15 = PyObject_RichCompare(__pyx_t_3, __pyx_t_13, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 509, __pyx_L4_error) __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 509, __pyx_L4_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_4) { __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = __pyx_t_3; } else { __Pyx_INCREF(__pyx_t_13); __pyx_t_8 = __pyx_t_13; } __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_t_8; __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF_SET(__pyx_v_maxw, __pyx_t_3); __pyx_t_3 = 0;
+510: maxh = min(maxh, mh)
__Pyx_INCREF(__pyx_v_mh); __pyx_t_3 = __pyx_v_mh; __Pyx_INCREF(__pyx_v_maxh); __pyx_t_8 = __pyx_v_maxh; __pyx_t_15 = PyObject_RichCompare(__pyx_t_3, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 510, __pyx_L4_error) __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 510, __pyx_L4_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_4) { __Pyx_INCREF(__pyx_t_3); __pyx_t_13 = __pyx_t_3; } else { __Pyx_INCREF(__pyx_t_8); __pyx_t_13 = __pyx_t_8; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_t_13; __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF_SET(__pyx_v_maxh, __pyx_t_3); __pyx_t_3 = 0;
511: #test BGRX to planar:
+512: if packed not in get_input_colorspaces():
__Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_get_input_colorspaces); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 512, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); } } __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_13); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 512, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_packed, __pyx_t_3, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 512, __pyx_L4_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_10 = (__pyx_t_4 != 0); if (__pyx_t_10) { /* … */ }
+513: continue
goto __pyx_L33_continue;
+514: if planar not in get_output_colorspaces(packed):
__Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_get_output_colorspaces); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 514, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); } } __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_8, __pyx_v_packed) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_packed); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_v_planar, __pyx_t_3, Py_NE)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 514, __pyx_L4_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = (__pyx_t_10 != 0); if (__pyx_t_4) { /* … */ }
+515: continue
goto __pyx_L33_continue;
+516: testcsc(colorspace_converter, full, [packed], [planar])
__pyx_t_13 = PyList_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 516, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_INCREF(__pyx_v_packed); __Pyx_GIVEREF(__pyx_v_packed); PyList_SET_ITEM(__pyx_t_13, 0, __pyx_v_packed); __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 516, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_planar); __Pyx_GIVEREF(__pyx_v_planar); PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_planar); __Pyx_INCREF(__pyx_v_testcsc); __pyx_t_15 = __pyx_v_testcsc; __pyx_t_12 = NULL; __pyx_t_14 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_15); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_15, function); __pyx_t_14 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_15)) { PyObject *__pyx_temp[5] = {__pyx_t_12, __pyx_v_colorspace_converter, __pyx_v_full, __pyx_t_13, __pyx_t_8}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) { PyObject *__pyx_temp[5] = {__pyx_t_12, __pyx_v_colorspace_converter, __pyx_v_full, __pyx_t_13, __pyx_t_8}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { __pyx_t_5 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_12) { __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12); __pyx_t_12 = NULL; } __Pyx_INCREF(__pyx_v_colorspace_converter); __Pyx_GIVEREF(__pyx_v_colorspace_converter); PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_14, __pyx_v_colorspace_converter); __Pyx_INCREF(__pyx_v_full); __Pyx_GIVEREF(__pyx_v_full); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_14, __pyx_v_full); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_14, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_14, __pyx_t_8); __pyx_t_13 = 0; __pyx_t_8 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+517: if full:
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_full); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 517, __pyx_L4_error) if (__pyx_t_4) { /* … */ }
+518: mw, mh = get_csc_max_size(colorspace_converter, [packed], [planar])
__pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 518, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_v_packed); __Pyx_GIVEREF(__pyx_v_packed); PyList_SET_ITEM(__pyx_t_15, 0, __pyx_v_packed); __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 518, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_planar); __Pyx_GIVEREF(__pyx_v_planar); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_planar); __Pyx_INCREF(__pyx_v_get_csc_max_size); __pyx_t_8 = __pyx_v_get_csc_max_size; __pyx_t_13 = NULL; __pyx_t_14 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_13)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_14 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_v_colorspace_converter, __pyx_t_15, __pyx_t_5}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_14, 3+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_v_colorspace_converter, __pyx_t_15, __pyx_t_5}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_14, 3+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_12 = PyTuple_New(3+__pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 518, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_12); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL; } __Pyx_INCREF(__pyx_v_colorspace_converter); __Pyx_GIVEREF(__pyx_v_colorspace_converter); PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_14, __pyx_v_colorspace_converter); __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_14, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_14, __pyx_t_5); __pyx_t_15 = 0; __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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, 518, __pyx_L4_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_8 = PyList_GET_ITEM(sequence, 0); __pyx_t_12 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_12); #else __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 518, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 518, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_12); #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, 518, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_16 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_8 = __pyx_t_16(__pyx_t_5); if (unlikely(!__pyx_t_8)) goto __pyx_L42_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); index = 1; __pyx_t_12 = __pyx_t_16(__pyx_t_5); if (unlikely(!__pyx_t_12)) goto __pyx_L42_unpacking_failed; __Pyx_GOTREF(__pyx_t_12); if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_5), 2) < 0) __PYX_ERR(0, 518, __pyx_L4_error) __pyx_t_16 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L43_unpacking_done; __pyx_L42_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_16 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 518, __pyx_L4_error) __pyx_L43_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_mw, __pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF_SET(__pyx_v_mh, __pyx_t_12); __pyx_t_12 = 0;
+519: maxw = min(maxw, mw)
__Pyx_INCREF(__pyx_v_mw); __pyx_t_3 = __pyx_v_mw; __Pyx_INCREF(__pyx_v_maxw); __pyx_t_12 = __pyx_v_maxw; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_12, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 519, __pyx_L4_error) __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 519, __pyx_L4_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = __pyx_t_3; } else { __Pyx_INCREF(__pyx_t_12); __pyx_t_8 = __pyx_t_12; } __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_t_8; __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF_SET(__pyx_v_maxw, __pyx_t_3); __pyx_t_3 = 0;
+520: maxh = min(maxh, mh)
__Pyx_INCREF(__pyx_v_mh); __pyx_t_3 = __pyx_v_mh; __Pyx_INCREF(__pyx_v_maxh); __pyx_t_8 = __pyx_v_maxh; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 520, __pyx_L4_error) __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 520, __pyx_L4_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = __pyx_t_3; } else { __Pyx_INCREF(__pyx_t_8); __pyx_t_12 = __pyx_t_8; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_t_12; __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF_SET(__pyx_v_maxh, __pyx_t_3); __pyx_t_3 = 0;
+521: if full and maxw<65536 and maxh<65536:
__pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_full); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 521, __pyx_L4_error) if (__pyx_t_10) { } else { __pyx_t_4 = __pyx_t_10; goto __pyx_L45_bool_binop_done; } __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxw, __pyx_int_65536, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L4_error) __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 521, __pyx_L4_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_10) { } else { __pyx_t_4 = __pyx_t_10; goto __pyx_L45_bool_binop_done; } __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxh, __pyx_int_65536, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L4_error) __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 521, __pyx_L4_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_10; __pyx_L45_bool_binop_done:; if (__pyx_t_4) { /* … */ } }
+522: MAX_WIDTH = maxw
if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WIDTH, __pyx_v_maxw) < 0) __PYX_ERR(0, 522, __pyx_L4_error)
+523: MAX_HEIGHT = maxh
if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_HEIGHT, __pyx_v_maxh) < 0) __PYX_ERR(0, 523, __pyx_L4_error)
+524: log("%s max dimensions: %ix%i", colorspace_converter, MAX_WIDTH, MAX_HEIGHT)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 524, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 524, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_8 = NULL; __pyx_t_14 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_14 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_kp_u_s_max_dimensions_ix_i, __pyx_v_colorspace_converter, __pyx_t_3, __pyx_t_12}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_kp_u_s_max_dimensions_ix_i, __pyx_v_colorspace_converter, __pyx_t_3, __pyx_t_12}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } else #endif { __pyx_t_5 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 524, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_8) { __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL; } __Pyx_INCREF(__pyx_kp_u_s_max_dimensions_ix_i); __Pyx_GIVEREF(__pyx_kp_u_s_max_dimensions_ix_i); PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_14, __pyx_kp_u_s_max_dimensions_ix_i); __Pyx_INCREF(__pyx_v_colorspace_converter); __Pyx_GIVEREF(__pyx_v_colorspace_converter); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_14, __pyx_v_colorspace_converter); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_14, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_14, __pyx_t_12); __pyx_t_3 = 0; __pyx_t_12 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L4_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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
525: finally:
+526: resume_nonfatal_logging()
/*finally:*/ { /*normal exit:*/{ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_resume_nonfatal_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; 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_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __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; goto __pyx_L5; } __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_22); __Pyx_XGOTREF(__pyx_t_23); __Pyx_XGOTREF(__pyx_t_24); __pyx_t_14 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename; { __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_resume_nonfatal_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L49_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; 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_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L49_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_22); __Pyx_XGIVEREF(__pyx_t_23); __Pyx_XGIVEREF(__pyx_t_24); __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24); } __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21); __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18; goto __pyx_L1_error; __pyx_L49_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_22); __Pyx_XGIVEREF(__pyx_t_23); __Pyx_XGIVEREF(__pyx_t_24); __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24); } __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; goto __pyx_L1_error; } __pyx_L5:; }