opencv/3rdparty/zlib-ng/cpu_features.c
Letu Ren 0de26fd78e Add zlib-ng as an alternative zlib implementation
Zlib-ng is zlib replacement with optimizations for "next generation" systems. Its optimization may benifits image library decode and encode speed such as libpng. In our tests, if using zlib-ng and libpng combination on a x86_64 machine with AVX2, the time of `imdecode` amd `imencode` will drop 20% approximately. This patch enables zlib-ng's optimization if `CV_DISABLE_OPTIMIZATION` is OFF. Since Zlib-ng can dispatch intrinsics on the fly, port work is much easier.

Related discussion: https://github.com/opencv/opencv/issues/22573
2024-01-14 14:58:47 +08:00

24 lines
751 B
C

/* cpu_features.c -- CPU architecture feature check
* Copyright (C) 2017 Hans Kristian Rosbach
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zbuild.h"
#include "cpu_features.h"
#include <string.h>
Z_INTERNAL void cpu_check_features(struct cpu_features *features) {
memset(features, 0, sizeof(struct cpu_features));
#if defined(X86_FEATURES)
x86_check_features(&features->x86);
#elif defined(ARM_FEATURES)
arm_check_features(&features->arm);
#elif defined(PPC_FEATURES) || defined(POWER_FEATURES)
power_check_features(&features->power);
#elif defined(S390_FEATURES)
s390_check_features(&features->s390);
#elif defined(RISCV_FEATURES)
riscv_check_features(&features->riscv);
#endif
}