From 4a17c682e9a173c27feec9e67fb8c4c36090b1a6 Mon Sep 17 00:00:00 2001
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date: Fri, 25 Oct 2024 01:53:16 +0300
Subject: [PATCH] common_audio: Add MIPS_DSP_R1_LE guard for vector scaling ops

The MIPS-specific source for vector scaling operations fails to build on
Debian's mips64el:

  [97/303] Compiling C object webrtc/common_audio/libcommon_audio.a.p/signal_processing_vector_scaling_operations_mips.c.o
  FAILED: webrtc/common_audio/libcommon_audio.a.p/signal_processing_vector_scaling_operations_mips.c.o
  cc [...] webrtc/common_audio/libcommon_audio.a.p/signal_processing_vector_scaling_operations_mips.c.o.d -o webrtc/common_audio/libcommon_audio.a.p/signal_processing_vector_scaling_operations_mips.c.o -c ../webrtc/common_audio/signal_processing/vector_scaling_operations_mips.c
  /tmp/cc7UGPkY.s: Assembler messages:
  /tmp/cc7UGPkY.s:57: Error: opcode not supported on this processor: mips64r2 (mips64r2) `extrv_r.w $3,$ac0,$8'
  ninja: build stopped: subcommand failed.

The EXTRV_R.W instruction it uses is part of DSP extensions for this
architecture. In signal_processing_library.h, this function's prototype
is guarded with #if defined(MIPS_DSP_R1_LE). Guard the implementation
like that as well to fix the error.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
---
 .../signal_processing/vector_scaling_operations_mips.c          | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/webrtc/common_audio/signal_processing/vector_scaling_operations_mips.c b/webrtc/common_audio/signal_processing/vector_scaling_operations_mips.c
index ba2d26d..08ca293 100644
--- a/webrtc/common_audio/signal_processing/vector_scaling_operations_mips.c
+++ b/webrtc/common_audio/signal_processing/vector_scaling_operations_mips.c
@@ -16,6 +16,7 @@
 
 #include "common_audio/signal_processing/include/signal_processing_library.h"
 
+#if defined(MIPS_DSP_R1_LE)
 int WebRtcSpl_ScaleAndAddVectorsWithRound_mips(const int16_t* in_vector1,
                                                int16_t in_vector1_scale,
                                                const int16_t* in_vector2,
@@ -55,3 +56,4 @@ int WebRtcSpl_ScaleAndAddVectorsWithRound_mips(const int16_t* in_vector1,
   }
   return 0;
 }
+#endif
-- 
2.47.1

