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

Unified Diff: webrtc/common_audio/signal_processing/dot_product_with_scale.c

Issue 2717123004: Avoid overflow in WebRtcSpl_DotProductWithScale (Closed)
Patch Set: Remove wd4334 Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/common_audio/signal_processing/dot_product_with_scale.c
diff --git a/webrtc/common_audio/signal_processing/dot_product_with_scale.c b/webrtc/common_audio/signal_processing/dot_product_with_scale.c
deleted file mode 100644
index 1302d62541266fdc45b07576de5ff5026d69032f..0000000000000000000000000000000000000000
--- a/webrtc/common_audio/signal_processing/dot_product_with_scale.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
-
-int32_t WebRtcSpl_DotProductWithScale(const int16_t* vector1,
- const int16_t* vector2,
- size_t length,
- int scaling) {
- int32_t sum = 0;
- size_t i = 0;
-
- /* Unroll the loop to improve performance. */
- for (i = 0; i + 3 < length; i += 4) {
- sum += (vector1[i + 0] * vector2[i + 0]) >> scaling;
- sum += (vector1[i + 1] * vector2[i + 1]) >> scaling;
- sum += (vector1[i + 2] * vector2[i + 2]) >> scaling;
- sum += (vector1[i + 3] * vector2[i + 3]) >> scaling;
- }
- for (; i < length; i++) {
- sum += (vector1[i] * vector2[i]) >> scaling;
- }
-
- return sum;
-}

Powered by Google App Engine
This is Rietveld 408576698