mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-29 01:13:34 +03:00
Add core.acceleration attribute
This commit is contained in:
parent
910911061f
commit
2db9cd3499
|
@ -128,6 +128,7 @@ features = {
|
||||||
"libjpeg_turbo": ("PIL._imaging", "HAVE_LIBJPEGTURBO", "libjpeg_turbo_version"),
|
"libjpeg_turbo": ("PIL._imaging", "HAVE_LIBJPEGTURBO", "libjpeg_turbo_version"),
|
||||||
"libimagequant": ("PIL._imaging", "HAVE_LIBIMAGEQUANT", "imagequant_version"),
|
"libimagequant": ("PIL._imaging", "HAVE_LIBIMAGEQUANT", "imagequant_version"),
|
||||||
"xcb": ("PIL._imaging", "HAVE_XCB", None),
|
"xcb": ("PIL._imaging", "HAVE_XCB", None),
|
||||||
|
"acceleration": ("PIL._imaging", "acceleration", "acceleration"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -267,6 +268,7 @@ def pilinfo(out: IO[str] | None = None, supported_formats: bool = True) -> None:
|
||||||
|
|
||||||
for name, feature in [
|
for name, feature in [
|
||||||
("pil", "PIL CORE"),
|
("pil", "PIL CORE"),
|
||||||
|
("acceleration", "Acceleration"),
|
||||||
("tkinter", "TKINTER"),
|
("tkinter", "TKINTER"),
|
||||||
("freetype2", "FREETYPE2"),
|
("freetype2", "FREETYPE2"),
|
||||||
("littlecms2", "LITTLECMS2"),
|
("littlecms2", "LITTLECMS2"),
|
||||||
|
@ -291,7 +293,7 @@ def pilinfo(out: IO[str] | None = None, supported_formats: bool = True) -> None:
|
||||||
if v is None:
|
if v is None:
|
||||||
v = version(name)
|
v = version(name)
|
||||||
if v is not None:
|
if v is not None:
|
||||||
version_static = name in ("pil", "jpg")
|
version_static = name in ("pil", "jpg", "acceleration")
|
||||||
if name == "littlecms2":
|
if name == "littlecms2":
|
||||||
# this check is also in src/_imagingcms.c:setup_module()
|
# this check is also in src/_imagingcms.c:setup_module()
|
||||||
version_static = tuple(int(x) for x in v.split(".")) < (2, 7)
|
version_static = tuple(int(x) for x in v.split(".")) < (2, 7)
|
||||||
|
|
|
@ -4407,6 +4407,19 @@ setup_module(PyObject *m) {
|
||||||
Py_INCREF(have_xcb);
|
Py_INCREF(have_xcb);
|
||||||
PyModule_AddObject(m, "HAVE_XCB", have_xcb);
|
PyModule_AddObject(m, "HAVE_XCB", have_xcb);
|
||||||
|
|
||||||
|
#ifdef __AVX2__
|
||||||
|
PyModule_AddStringConstant(m, "acceleration", "avx2");
|
||||||
|
#elif defined(__SSE4__)
|
||||||
|
PyModule_AddStringConstant(m, "acceleration", "sse4");
|
||||||
|
#elif defined(__SSE2__)
|
||||||
|
PyModule_AddStringConstant(m, "acceleration", "sse2");
|
||||||
|
#elif defined(__NEON__)
|
||||||
|
PyModule_AddStringConstant(m, "acceleration", "neon");
|
||||||
|
#else
|
||||||
|
Py_INCREF(Py_False);
|
||||||
|
PyModule_AddObject(m, "acceleration", Py_False);
|
||||||
|
#endif
|
||||||
|
|
||||||
PyObject *pillow_version = PyUnicode_FromString(version);
|
PyObject *pillow_version = PyUnicode_FromString(version);
|
||||||
PyDict_SetItemString(
|
PyDict_SetItemString(
|
||||||
d, "PILLOW_VERSION", pillow_version ? pillow_version : Py_None
|
d, "PILLOW_VERSION", pillow_version ? pillow_version : Py_None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user