Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: webrtc/modules/audio_processing/ns/nsx_core.c

Issue 1955413003: Remove runtime NEON detection (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: gyp syntax Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/modules/audio_processing/ns/noise_suppression_x.h" 11 #include "webrtc/modules/audio_processing/ns/noise_suppression_x.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <math.h> 14 #include <math.h>
15 #include <stdlib.h> 15 #include <stdlib.h>
16 #include <string.h> 16 #include <string.h>
17 17
18 #include "webrtc/common_audio/signal_processing/include/real_fft.h" 18 #include "webrtc/common_audio/signal_processing/include/real_fft.h"
19 #include "webrtc/modules/audio_processing/ns/nsx_core.h" 19 #include "webrtc/modules/audio_processing/ns/nsx_core.h"
20 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" 20 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
21 21
22 #if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON) 22 #if defined(WEBRTC_HAS_NEON)
23 /* Tables are defined in ARM assembly files. */ 23 /* Tables are defined in ARM assembly files. */
24 extern const int16_t WebRtcNsx_kLogTable[9]; 24 extern const int16_t WebRtcNsx_kLogTable[9];
25 extern const int16_t WebRtcNsx_kCounterDiv[201]; 25 extern const int16_t WebRtcNsx_kCounterDiv[201];
26 extern const int16_t WebRtcNsx_kLogTableFrac[256]; 26 extern const int16_t WebRtcNsx_kLogTableFrac[256];
27 #else 27 #else
28 static const int16_t WebRtcNsx_kLogTable[9] = { 28 static const int16_t WebRtcNsx_kLogTable[9] = {
29 0, 177, 355, 532, 710, 887, 1065, 1242, 1420 29 0, 177, 355, 532, 710, 887, 1065, 1242, 1420
30 }; 30 };
31 31
32 static const int16_t WebRtcNsx_kCounterDiv[201] = { 32 static const int16_t WebRtcNsx_kCounterDiv[201] = {
(...skipping 25 matching lines...) Expand all
58 147, 148, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 160, 58 147, 148, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 160,
59 161, 162, 163, 164, 165, 166, 167, 168, 169, 169, 170, 171, 172, 173, 174, 59 161, 162, 163, 164, 165, 166, 167, 168, 169, 169, 170, 171, 172, 173, 174,
60 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187, 60 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187,
61 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 61 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200,
62 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 212, 62 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 212,
63 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 224, 63 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 224,
64 225, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236, 64 225, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236,
65 237, 238, 238, 239, 240, 241, 241, 242, 243, 244, 244, 245, 246, 247, 247, 65 237, 238, 238, 239, 240, 241, 241, 242, 243, 244, 244, 245, 246, 247, 247,
66 248, 249, 249, 250, 251, 252, 252, 253, 254, 255, 255 66 248, 249, 249, 250, 251, 252, 252, 253, 254, 255, 255
67 }; 67 };
68 #endif // WEBRTC_DETECT_NEON || WEBRTC_HAS_NEON 68 #endif // WEBRTC_HAS_NEON
69 69
70 // Skip first frequency bins during estimation. (0 <= value < 64) 70 // Skip first frequency bins during estimation. (0 <= value < 64)
71 static const size_t kStartBand = 5; 71 static const size_t kStartBand = 5;
72 72
73 // hybrib Hanning & flat window 73 // hybrib Hanning & flat window
74 static const int16_t kBlocks80w128x[128] = { 74 static const int16_t kBlocks80w128x[128] = {
75 0, 536, 1072, 1606, 2139, 2669, 3196, 3720, 4240, 4756, 5 266, 75 0, 536, 1072, 1606, 2139, 2669, 3196, 3720, 4240, 4756, 5 266,
76 5771, 6270, 6762, 7246, 7723, 8192, 8652, 9102, 9543, 9974, 10394, 76 5771, 6270, 6762, 7246, 7723, 8192, 8652, 9102, 9543, 9974, 10394,
77 10803, 11200, 11585, 11958, 12318, 12665, 12998, 13318, 13623, 13913, 14189, 77 10803, 11200, 11585, 11958, 12318, 12665, 12998, 13318, 13623, 13913, 14189,
78 14449, 14694, 14924, 15137, 15334, 15515, 15679, 15826, 15956, 16069, 16165, 78 14449, 14694, 14924, 15137, 15334, 15515, 15679, 15826, 15956, 16069, 16165,
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 550 }
551 551
552 // Declare function pointers. 552 // Declare function pointers.
553 NoiseEstimation WebRtcNsx_NoiseEstimation; 553 NoiseEstimation WebRtcNsx_NoiseEstimation;
554 PrepareSpectrum WebRtcNsx_PrepareSpectrum; 554 PrepareSpectrum WebRtcNsx_PrepareSpectrum;
555 SynthesisUpdate WebRtcNsx_SynthesisUpdate; 555 SynthesisUpdate WebRtcNsx_SynthesisUpdate;
556 AnalysisUpdate WebRtcNsx_AnalysisUpdate; 556 AnalysisUpdate WebRtcNsx_AnalysisUpdate;
557 Denormalize WebRtcNsx_Denormalize; 557 Denormalize WebRtcNsx_Denormalize;
558 NormalizeRealBuffer WebRtcNsx_NormalizeRealBuffer; 558 NormalizeRealBuffer WebRtcNsx_NormalizeRealBuffer;
559 559
560 #if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON) 560 #if defined(WEBRTC_HAS_NEON)
561 // Initialize function pointers for ARM Neon platform. 561 // Initialize function pointers for ARM Neon platform.
562 static void WebRtcNsx_InitNeon(void) { 562 static void WebRtcNsx_InitNeon(void) {
563 WebRtcNsx_NoiseEstimation = WebRtcNsx_NoiseEstimationNeon; 563 WebRtcNsx_NoiseEstimation = WebRtcNsx_NoiseEstimationNeon;
564 WebRtcNsx_PrepareSpectrum = WebRtcNsx_PrepareSpectrumNeon; 564 WebRtcNsx_PrepareSpectrum = WebRtcNsx_PrepareSpectrumNeon;
565 WebRtcNsx_SynthesisUpdate = WebRtcNsx_SynthesisUpdateNeon; 565 WebRtcNsx_SynthesisUpdate = WebRtcNsx_SynthesisUpdateNeon;
566 WebRtcNsx_AnalysisUpdate = WebRtcNsx_AnalysisUpdateNeon; 566 WebRtcNsx_AnalysisUpdate = WebRtcNsx_AnalysisUpdateNeon;
567 } 567 }
568 #endif 568 #endif
569 569
570 #if defined(MIPS32_LE) 570 #if defined(MIPS32_LE)
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 #endif 755 #endif
756 756
757 // Initialize function pointers. 757 // Initialize function pointers.
758 WebRtcNsx_NoiseEstimation = NoiseEstimationC; 758 WebRtcNsx_NoiseEstimation = NoiseEstimationC;
759 WebRtcNsx_PrepareSpectrum = PrepareSpectrumC; 759 WebRtcNsx_PrepareSpectrum = PrepareSpectrumC;
760 WebRtcNsx_SynthesisUpdate = SynthesisUpdateC; 760 WebRtcNsx_SynthesisUpdate = SynthesisUpdateC;
761 WebRtcNsx_AnalysisUpdate = AnalysisUpdateC; 761 WebRtcNsx_AnalysisUpdate = AnalysisUpdateC;
762 WebRtcNsx_Denormalize = DenormalizeC; 762 WebRtcNsx_Denormalize = DenormalizeC;
763 WebRtcNsx_NormalizeRealBuffer = NormalizeRealBufferC; 763 WebRtcNsx_NormalizeRealBuffer = NormalizeRealBufferC;
764 764
765 #ifdef WEBRTC_DETECT_NEON 765 #if defined(WEBRTC_HAS_NEON)
766 uint64_t features = WebRtc_GetCPUFeaturesARM();
767 if ((features & kCPUFeatureNEON) != 0) {
768 WebRtcNsx_InitNeon();
769 }
770 #elif defined(WEBRTC_HAS_NEON)
771 WebRtcNsx_InitNeon(); 766 WebRtcNsx_InitNeon();
772 #endif 767 #endif
773 768
774 #if defined(MIPS32_LE) 769 #if defined(MIPS32_LE)
775 WebRtcNsx_InitMips(); 770 WebRtcNsx_InitMips();
776 #endif 771 #endif
777 772
778 inst->initFlag = 1; 773 inst->initFlag = 1;
779 774
780 return 0; 775 return 0;
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 2098
2104 //apply gain 2099 //apply gain
2105 for (i = 0; i < num_high_bands; ++i) { 2100 for (i = 0; i < num_high_bands; ++i) {
2106 for (j = 0; j < inst->blockLen10ms; j++) { 2101 for (j = 0; j < inst->blockLen10ms; j++) {
2107 outFrameHB[i][j] = (int16_t)((gainTimeDomainHB * 2102 outFrameHB[i][j] = (int16_t)((gainTimeDomainHB *
2108 inst->dataBufHBFX[i][j]) >> 14); // Q0 2103 inst->dataBufHBFX[i][j]) >> 14); // Q0
2109 } 2104 }
2110 } 2105 }
2111 } // end of H band gain computation 2106 } // end of H band gain computation
2112 } 2107 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/ns/nsx_core.h ('k') | webrtc/modules/video_processing/util/denoiser_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698