Reland "Activating AVX2 support by default"

This is a reland of ad148272b89394978915cb00e1c1be552d908a42

Original change's description:
> Activating AVX2 support by default
>
> This CL activates the newly added AVX2 support by default.
> The activation is done beneath a kill-switch.
>
> Beyond the above, the CL also changes an incorrect DCHECK_GT
> to a DCHECK_GE.
>
> Bug: webrtc:11663
> Change-Id: I231ccb2f5efabf74cd8190411daa954b2b94a2a0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183042
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32193}

Bug: webrtc:11663
Change-Id: I669435c2f4e451ee0766d809443484f2dde09d8d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185482
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32200}
This commit is contained in:
Per Åhgren
2020-09-25 12:02:32 +02:00
committed by Commit Bot
parent cd92b0be9a
commit e5d669ed28
8 changed files with 81 additions and 34 deletions

View File

@ -45,6 +45,7 @@
#include "rtc_base/system/arch.h"
#include "rtc_base/task_queue_for_test.h"
#include "rtc_base/thread.h"
#include "system_wrappers/include/cpu_features_wrapper.h"
#include "test/gtest.h"
#include "test/testsupport/file_utils.h"
@ -348,6 +349,19 @@ bool ReadChunk(FILE* file,
return true;
}
// Returns the reference file name that matches the current CPU
// architecture/optimizations.
std::string GetReferenceFilename() {
#if defined(WEBRTC_AUDIOPROC_FIXED_PROFILE)
return test::ResourcePath("audio_processing/output_data_fixed", "pb");
#elif defined(WEBRTC_AUDIOPROC_FLOAT_PROFILE)
if (GetCPUInfo(kAVX2) != 0) {
return test::ResourcePath("audio_processing/output_data_float_avx2", "pb");
}
return test::ResourcePath("audio_processing/output_data_float", "pb");
#endif
}
class ApmTest : public ::testing::Test {
protected:
ApmTest();
@ -415,13 +429,7 @@ class ApmTest : public ::testing::Test {
ApmTest::ApmTest()
: output_path_(test::OutputPath()),
#if defined(WEBRTC_AUDIOPROC_FIXED_PROFILE)
ref_filename_(
test::ResourcePath("audio_processing/output_data_fixed", "pb")),
#elif defined(WEBRTC_AUDIOPROC_FLOAT_PROFILE)
ref_filename_(
test::ResourcePath("audio_processing/output_data_float", "pb")),
#endif
ref_filename_(GetReferenceFilename()),
output_sample_rate_hz_(0),
num_output_channels_(0),
far_file_(NULL),
@ -1775,7 +1783,7 @@ TEST_F(ApmTest, Process) {
max_output_average - kMaxOutputAverageOffset,
kMaxOutputAverageNear);
#if defined(WEBRTC_AUDIOPROC_FLOAT_PROFILE)
const double kFloatNear = 0.0005;
const double kFloatNear = 0.002;
EXPECT_NEAR(test->rms_dbfs_average(), rms_dbfs_average, kFloatNear);
#endif
} else {