The caller of the function should not need to know exactly which implementation of it is being used. For the variants that don't support detecting the number of cores, the pNumberOfLogicProcessors parameter can be left untouched and the caller will use a higher level API for finding it out. This simplifies all the calling code, and simplifies adding more implementations of cpu feature detection.
Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 5 files). Show all
Unified · Split
| @@ -144,16 +144,7 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx) { · 143 unmodified lines | |||
| 144 | pCtx->bAuReadyFlag = 0; // au data is not ready | 144 | pCtx->bAuReadyFlag = 0; // au data is not ready |
| 145 | 145 | ||
| 146 | 146 | ||
| 147 | #if defined(X86_ASM) | ||
| 148 | pCtx->uiCpuFlag = WelsCPUFeatureDetect (&iCpuCores); | 147 | pCtx->uiCpuFlag = WelsCPUFeatureDetect (&iCpuCores); |
| 149 | #elif defined(HAVE_NEON) | ||
| 150 | #if defined(ANDROID_NDK) | ||
| 151 | pCtx->uiCpuFlag = WelsCPUFeatureDetect(&iCpuCores); | ||
| 152 | #endif | ||
| 153 | #if defined(APPLE_IOS) | ||
| 154 | pCtx->uiCpuFlag = WelsCPUFeatureDetectIOS(); | ||
| 155 | #endif | ||
| 156 | #endif | ||
| 157 | 148 | ||
| 158 | pCtx->iImgWidthInPixel = 0; | 149 | pCtx->iImgWidthInPixel = 0; |
| 159 | pCtx->iImgHeightInPixel = 0; // alloc picture data when picture size is available | 150 | pCtx->iImgHeightInPixel = 0; // alloc picture data when picture size is available |