mirror of
https://github.com/KrisKennaway/ii-pix.git
synced 2024-12-22 09:29:30 +00:00
Mark nogil functions as noexcept to avoid warning from newer cython (#15)
This commit is contained in:
parent
69a96b4719
commit
f55e878b8e
@ -4,12 +4,12 @@
|
|||||||
# cython: wraparound=False
|
# cython: wraparound=False
|
||||||
|
|
||||||
|
|
||||||
cdef inline float clip(float a, float min_value, float max_value) nogil:
|
cdef inline float clip(float a, float min_value, float max_value) noexcept nogil:
|
||||||
"""Clip a value between min_value and max_value inclusive."""
|
"""Clip a value between min_value and max_value inclusive."""
|
||||||
return min(max(a, min_value), max_value)
|
return min(max(a, min_value), max_value)
|
||||||
|
|
||||||
|
|
||||||
cdef inline float3 convert_rgb_to_cam16ucs(float[:, ::1] rgb_to_cam16ucs, float r, float g, float b) nogil:
|
cdef inline float3 convert_rgb_to_cam16ucs(float[:, ::1] rgb_to_cam16ucs, float r, float g, float b) noexcept nogil:
|
||||||
"""Converts floating point (r,g,b) valueto 3-tuple in CAM16UCS colour space, via 24-bit RGB lookup matrix."""
|
"""Converts floating point (r,g,b) valueto 3-tuple in CAM16UCS colour space, via 24-bit RGB lookup matrix."""
|
||||||
|
|
||||||
cdef unsigned int rgb_24bit = (<unsigned int>(r*255) << 16) + (<unsigned int>(g*255) << 8) + <unsigned int>(b*255)
|
cdef unsigned int rgb_24bit = (<unsigned int>(r*255) << 16) + (<unsigned int>(g*255) << 8) + <unsigned int>(b*255)
|
||||||
@ -20,7 +20,7 @@ cdef inline float3 convert_rgb_to_cam16ucs(float[:, ::1] rgb_to_cam16ucs, float
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
cdef inline float colour_distance_squared(float[3] colour1, float[3] colour2) nogil:
|
cdef inline float colour_distance_squared(float[3] colour1, float[3] colour2) noexcept nogil:
|
||||||
"""Computes Euclidean squared distance between two floating-point colour 3-tuples."""
|
"""Computes Euclidean squared distance between two floating-point colour 3-tuples."""
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -219,7 +219,7 @@ cdef int dither_lookahead(Dither* dither, unsigned char palette_depth, float[:,
|
|||||||
# quant_error: RGB quantization error to be diffused
|
# quant_error: RGB quantization error to be diffused
|
||||||
#
|
#
|
||||||
cdef inline void apply_one_line(Dither* dither, int xl, int xr, int x, float[] image, int image_shape1,
|
cdef inline void apply_one_line(Dither* dither, int xl, int xr, int x, float[] image, int image_shape1,
|
||||||
float[] quant_error) nogil:
|
float[] quant_error) noexcept nogil:
|
||||||
|
|
||||||
cdef int i, j
|
cdef int i, j
|
||||||
cdef float error_fraction
|
cdef float error_fraction
|
||||||
@ -241,7 +241,7 @@ cdef inline void apply_one_line(Dither* dither, int xl, int xr, int x, float[] i
|
|||||||
# image: RGB pixel data, to be mutated
|
# image: RGB pixel data, to be mutated
|
||||||
# quant_error: RGB quantization error to be diffused
|
# quant_error: RGB quantization error to be diffused
|
||||||
#
|
#
|
||||||
cdef void apply(Dither* dither, int x_res, int y_res, int x, int y, float[:,:,::1] image, float[] quant_error) nogil:
|
cdef void apply(Dither* dither, int x_res, int y_res, int x, int y, float[:,:,::1] image, float[] quant_error) noexcept nogil:
|
||||||
|
|
||||||
cdef int i, j, k
|
cdef int i, j, k
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user