[Git][pulseaudio/webrtc-audio-processing][master] AECM: MIPS: Use uintptr_t for pointer arithmetic

Arun Raghavan (@arun) gitlab at gitlab.freedesktop.org
Mon Dec 30 18:16:27 UTC 2024



Arun Raghavan pushed to branch master at PulseAudio / webrtc-audio-processing


Commits:
297fd4f2 by Alper Nebi Yasak at 2024-12-30T18:11:05+00:00
AECM: MIPS: Use uintptr_t for pointer arithmetic

Trying to compile the MIPS-specific AECM audio processing file for
mips64el on Debian results in the following errors:

  ../webrtc/modules/audio_processing/aecm/aecm_core_mips.cc: In function ‘int webrtc::WebRtcAecm_ProcessBlock(AecmCore*, const int16_t*, const int16_t*, const int16_t*, int16_t*)’:
  ../webrtc/modules/audio_processing/aecm/aecm_core_mips.cc:955:30: error: cast from ‘int16_t*’ {aka ‘short int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
    955 |   int16_t* fft = (int16_t*)(((uint32_t)fft_buf + 31) & ~31);
        |                              ^~~~~~~~~~~~~~~~~
  ../webrtc/modules/audio_processing/aecm/aecm_core_mips.cc:955:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    955 |   int16_t* fft = (int16_t*)(((uint32_t)fft_buf + 31) & ~31);
        |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../webrtc/modules/audio_processing/aecm/aecm_core_mips.cc:956:36: error: cast from ‘int32_t*’ {aka ‘int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
    956 |   int32_t* echoEst32 = (int32_t*)(((uint32_t)echoEst32_buf + 31) & ~31);
        |                                    ^~~~~~~~~~~~~~~~~~~~~~~
  ../webrtc/modules/audio_processing/aecm/aecm_core_mips.cc:956:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    956 |   int32_t* echoEst32 = (int32_t*)(((uint32_t)echoEst32_buf + 31) & ~31);
        |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../webrtc/modules/audio_processing/aecm/aecm_core_mips.cc:957:40: error: cast from ‘int32_t*’ {aka ‘int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
    957 |   ComplexInt16* dfw = (ComplexInt16*)(((uint32_t)dfw_buf + 31) & ~31);
        |                                        ^~~~~~~~~~~~~~~~~
  ../webrtc/modules/audio_processing/aecm/aecm_core_mips.cc:957:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    957 |   ComplexInt16* dfw = (ComplexInt16*)(((uint32_t)dfw_buf + 31) & ~31);
        |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../webrtc/modules/audio_processing/aecm/aecm_core_mips.cc:958:40: error: cast from ‘int32_t*’ {aka ‘int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
    958 |   ComplexInt16* efw = (ComplexInt16*)(((uint32_t)efw_buf + 31) & ~31);
        |                                        ^~~~~~~~~~~~~~~~~
  ../webrtc/modules/audio_processing/aecm/aecm_core_mips.cc:958:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    958 |   ComplexInt16* efw = (ComplexInt16*)(((uint32_t)efw_buf + 31) & ~31);
        |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Presumably, this file was written for 32-bit MIPS so the author used
uint32_t to do pointer arithmetic over these arrays. Fix the errors by
using uintptr_t to work with pointers.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak at gmail.com>

- - - - -


1 changed file:

- webrtc/modules/audio_processing/aecm/aecm_core_mips.cc


Changes:

=====================================
webrtc/modules/audio_processing/aecm/aecm_core_mips.cc
=====================================
@@ -952,10 +952,10 @@ int WebRtcAecm_ProcessBlock(AecmCore* aecm,
   int32_t dfw_buf[PART_LEN2 + 8];
   int32_t efw_buf[PART_LEN2 + 8];
 
-  int16_t* fft = (int16_t*)(((uint32_t)fft_buf + 31) & ~31);
-  int32_t* echoEst32 = (int32_t*)(((uint32_t)echoEst32_buf + 31) & ~31);
-  ComplexInt16* dfw = (ComplexInt16*)(((uint32_t)dfw_buf + 31) & ~31);
-  ComplexInt16* efw = (ComplexInt16*)(((uint32_t)efw_buf + 31) & ~31);
+  int16_t* fft = (int16_t*)(((uintptr_t)fft_buf + 31) & ~31);
+  int32_t* echoEst32 = (int32_t*)(((uintptr_t)echoEst32_buf + 31) & ~31);
+  ComplexInt16* dfw = (ComplexInt16*)(((uintptr_t)dfw_buf + 31) & ~31);
+  ComplexInt16* efw = (ComplexInt16*)(((uintptr_t)efw_buf + 31) & ~31);
 
   int16_t hnl[PART_LEN1];
   int16_t numPosCoef = 0;



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/commit/297fd4f2efc53b6d49433eaad91a8e09a0f9cbec

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/commit/297fd4f2efc53b6d49433eaad91a8e09a0f9cbec
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20241230/52adb862/attachment-0001.htm>


More information about the pulseaudio-commits mailing list