webrtc-audio-processing/big_endian_support.patch

91 lines
3.4 KiB
Diff
Raw Permalink Normal View History

Accepting request 404777 from home:oholecek:branches:multimedia:libs - Remove webrtc-aarch64.patch, no longer needed - Adapt the rest of webrtc- patches to new arch naming - Remove unneeded explicit version dependency for automake - Update to 0.3 * build: enforce linking with --no-undefined, add explicit -lpthread * build: Make sure files with SSE2 code are compiled with -msse2 - Remove no-undefined.patch - Remove webrtc-audio-processing-0.2-x86_msse2.patch - Add no-undefined.patch patch https://cgit.freedesktop.org/pulseaudio/webrtc-audio-processing/patch/?id=d58164e4d87854233564b59e76259b72e21507f6 - Add big_endian_support_2.patch https://bugs.freedesktop.org/show_bug.cgi?id=95738 - Adapt webrtc-audio-processing-0.2-x86_msse2.patch to new version - Adapt big_endian_support.patch to new version - Add webrtc-audio-processing-0.2-x86_msse2.patch patch fixing 386 build https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-May/026294.html - Add big_endian_support.patch https://bugs.freedesktop.org/show_bug.cgi?id=95738 - New automake version dependency >= 1.5 - Update to 0.2: Contains API breaking changes. Upstream changes include: * Rewritten AGC and voice activity detection * Intelligibility enhancer * Extended AEC filter * Beamformer * Transient suppressor * ARM, NEON and MIPS optimisations (MIPS optimisations are not hooked up) API changes: * We no longer include a top-level audio_processing.h. The webrtc tree format is used, so use webrtc/modules/audio_processing/include/audio_processing.h * The top-level module_common_types.h has also been moved to webrtc/modules/interface/module_common_types.h * C++11 support is now required while compiling client code * AudioProcessing::Create() does not take any arguments any more * AudioProcessing::Destroy() is gone, use standard C++ "delete" instead * Stream parameters are now configured via StreamConfig and ProcessingConfig rather than set_sample_rate(), set_num_channels(), etc. * AudioFrame field names have changed * Use config API for newer audio processing options * Use ProcessReverseStream() instead of AnalyzeReverseStream(), particularly when using the intelligibility enhancer * GainControl::set_analog_level_limits() is broken. The AGC implementation hard codes 0-255 as the volume range Other notes: * The new audio processing parameters are not all tested, and a few are not enabled upstream (in Chromium) either * The rewritten AGC appears to be less sensitive, and it might make sense to initialise the capture volume to something reasonable (33% or 50%, for example) to make sure there is sufficient energy in the stream to trigger the AGC mechanism - Adapted all 3 arch patches OBS-URL: https://build.opensuse.org/request/show/404777 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/webrtc-audio-processing?expand=0&rev=11
2016-06-25 18:50:49 +02:00
diff -up webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc.than webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc
--- webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc.than 2016-05-24 08:28:45.749940095 -0400
+++ webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc 2016-05-24 08:50:30.361020010 -0400
@@ -64,9 +64,6 @@ WavReader::~WavReader() {
size_t WavReader::ReadSamples(const size_t num_samples,
int16_t* const samples) {
Accepting request 404777 from home:oholecek:branches:multimedia:libs - Remove webrtc-aarch64.patch, no longer needed - Adapt the rest of webrtc- patches to new arch naming - Remove unneeded explicit version dependency for automake - Update to 0.3 * build: enforce linking with --no-undefined, add explicit -lpthread * build: Make sure files with SSE2 code are compiled with -msse2 - Remove no-undefined.patch - Remove webrtc-audio-processing-0.2-x86_msse2.patch - Add no-undefined.patch patch https://cgit.freedesktop.org/pulseaudio/webrtc-audio-processing/patch/?id=d58164e4d87854233564b59e76259b72e21507f6 - Add big_endian_support_2.patch https://bugs.freedesktop.org/show_bug.cgi?id=95738 - Adapt webrtc-audio-processing-0.2-x86_msse2.patch to new version - Adapt big_endian_support.patch to new version - Add webrtc-audio-processing-0.2-x86_msse2.patch patch fixing 386 build https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-May/026294.html - Add big_endian_support.patch https://bugs.freedesktop.org/show_bug.cgi?id=95738 - New automake version dependency >= 1.5 - Update to 0.2: Contains API breaking changes. Upstream changes include: * Rewritten AGC and voice activity detection * Intelligibility enhancer * Extended AEC filter * Beamformer * Transient suppressor * ARM, NEON and MIPS optimisations (MIPS optimisations are not hooked up) API changes: * We no longer include a top-level audio_processing.h. The webrtc tree format is used, so use webrtc/modules/audio_processing/include/audio_processing.h * The top-level module_common_types.h has also been moved to webrtc/modules/interface/module_common_types.h * C++11 support is now required while compiling client code * AudioProcessing::Create() does not take any arguments any more * AudioProcessing::Destroy() is gone, use standard C++ "delete" instead * Stream parameters are now configured via StreamConfig and ProcessingConfig rather than set_sample_rate(), set_num_channels(), etc. * AudioFrame field names have changed * Use config API for newer audio processing options * Use ProcessReverseStream() instead of AnalyzeReverseStream(), particularly when using the intelligibility enhancer * GainControl::set_analog_level_limits() is broken. The AGC implementation hard codes 0-255 as the volume range Other notes: * The new audio processing parameters are not all tested, and a few are not enabled upstream (in Chromium) either * The rewritten AGC appears to be less sensitive, and it might make sense to initialise the capture volume to something reasonable (33% or 50%, for example) to make sure there is sufficient energy in the stream to trigger the AGC mechanism - Adapted all 3 arch patches OBS-URL: https://build.opensuse.org/request/show/404777 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/webrtc-audio-processing?expand=0&rev=11
2016-06-25 18:50:49 +02:00
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Need to convert samples to big-endian when reading from WAV file"
-#endif
size_t num_samples_left_to_read = num_samples;
size_t next_chunk_start = 0;
Accepting request 404777 from home:oholecek:branches:multimedia:libs - Remove webrtc-aarch64.patch, no longer needed - Adapt the rest of webrtc- patches to new arch naming - Remove unneeded explicit version dependency for automake - Update to 0.3 * build: enforce linking with --no-undefined, add explicit -lpthread * build: Make sure files with SSE2 code are compiled with -msse2 - Remove no-undefined.patch - Remove webrtc-audio-processing-0.2-x86_msse2.patch - Add no-undefined.patch patch https://cgit.freedesktop.org/pulseaudio/webrtc-audio-processing/patch/?id=d58164e4d87854233564b59e76259b72e21507f6 - Add big_endian_support_2.patch https://bugs.freedesktop.org/show_bug.cgi?id=95738 - Adapt webrtc-audio-processing-0.2-x86_msse2.patch to new version - Adapt big_endian_support.patch to new version - Add webrtc-audio-processing-0.2-x86_msse2.patch patch fixing 386 build https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-May/026294.html - Add big_endian_support.patch https://bugs.freedesktop.org/show_bug.cgi?id=95738 - New automake version dependency >= 1.5 - Update to 0.2: Contains API breaking changes. Upstream changes include: * Rewritten AGC and voice activity detection * Intelligibility enhancer * Extended AEC filter * Beamformer * Transient suppressor * ARM, NEON and MIPS optimisations (MIPS optimisations are not hooked up) API changes: * We no longer include a top-level audio_processing.h. The webrtc tree format is used, so use webrtc/modules/audio_processing/include/audio_processing.h * The top-level module_common_types.h has also been moved to webrtc/modules/interface/module_common_types.h * C++11 support is now required while compiling client code * AudioProcessing::Create() does not take any arguments any more * AudioProcessing::Destroy() is gone, use standard C++ "delete" instead * Stream parameters are now configured via StreamConfig and ProcessingConfig rather than set_sample_rate(), set_num_channels(), etc. * AudioFrame field names have changed * Use config API for newer audio processing options * Use ProcessReverseStream() instead of AnalyzeReverseStream(), particularly when using the intelligibility enhancer * GainControl::set_analog_level_limits() is broken. The AGC implementation hard codes 0-255 as the volume range Other notes: * The new audio processing parameters are not all tested, and a few are not enabled upstream (in Chromium) either * The rewritten AGC appears to be less sensitive, and it might make sense to initialise the capture volume to something reasonable (33% or 50%, for example) to make sure there is sufficient energy in the stream to trigger the AGC mechanism - Adapted all 3 arch patches OBS-URL: https://build.opensuse.org/request/show/404777 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/webrtc-audio-processing?expand=0&rev=11
2016-06-25 18:50:49 +02:00
@@ -76,6 +73,12 @@ size_t WavReader::ReadSamples(size_t num
num_samples_left_to_read -= num_samples_read;
}
Accepting request 404777 from home:oholecek:branches:multimedia:libs - Remove webrtc-aarch64.patch, no longer needed - Adapt the rest of webrtc- patches to new arch naming - Remove unneeded explicit version dependency for automake - Update to 0.3 * build: enforce linking with --no-undefined, add explicit -lpthread * build: Make sure files with SSE2 code are compiled with -msse2 - Remove no-undefined.patch - Remove webrtc-audio-processing-0.2-x86_msse2.patch - Add no-undefined.patch patch https://cgit.freedesktop.org/pulseaudio/webrtc-audio-processing/patch/?id=d58164e4d87854233564b59e76259b72e21507f6 - Add big_endian_support_2.patch https://bugs.freedesktop.org/show_bug.cgi?id=95738 - Adapt webrtc-audio-processing-0.2-x86_msse2.patch to new version - Adapt big_endian_support.patch to new version - Add webrtc-audio-processing-0.2-x86_msse2.patch patch fixing 386 build https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-May/026294.html - Add big_endian_support.patch https://bugs.freedesktop.org/show_bug.cgi?id=95738 - New automake version dependency >= 1.5 - Update to 0.2: Contains API breaking changes. Upstream changes include: * Rewritten AGC and voice activity detection * Intelligibility enhancer * Extended AEC filter * Beamformer * Transient suppressor * ARM, NEON and MIPS optimisations (MIPS optimisations are not hooked up) API changes: * We no longer include a top-level audio_processing.h. The webrtc tree format is used, so use webrtc/modules/audio_processing/include/audio_processing.h * The top-level module_common_types.h has also been moved to webrtc/modules/interface/module_common_types.h * C++11 support is now required while compiling client code * AudioProcessing::Create() does not take any arguments any more * AudioProcessing::Destroy() is gone, use standard C++ "delete" instead * Stream parameters are now configured via StreamConfig and ProcessingConfig rather than set_sample_rate(), set_num_channels(), etc. * AudioFrame field names have changed * Use config API for newer audio processing options * Use ProcessReverseStream() instead of AnalyzeReverseStream(), particularly when using the intelligibility enhancer * GainControl::set_analog_level_limits() is broken. The AGC implementation hard codes 0-255 as the volume range Other notes: * The new audio processing parameters are not all tested, and a few are not enabled upstream (in Chromium) either * The rewritten AGC appears to be less sensitive, and it might make sense to initialise the capture volume to something reasonable (33% or 50%, for example) to make sure there is sufficient energy in the stream to trigger the AGC mechanism - Adapted all 3 arch patches OBS-URL: https://build.opensuse.org/request/show/404777 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/webrtc-audio-processing?expand=0&rev=11
2016-06-25 18:50:49 +02:00
+#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
+ //convert to big-endian
+ for(size_t idx = 0; idx < num_samples; idx++) {
+ samples[idx] = (samples[idx]<<8) | (samples[idx]>>8);
+ }
+#endif
return num_samples - num_samples_left_to_read;
Accepting request 404777 from home:oholecek:branches:multimedia:libs - Remove webrtc-aarch64.patch, no longer needed - Adapt the rest of webrtc- patches to new arch naming - Remove unneeded explicit version dependency for automake - Update to 0.3 * build: enforce linking with --no-undefined, add explicit -lpthread * build: Make sure files with SSE2 code are compiled with -msse2 - Remove no-undefined.patch - Remove webrtc-audio-processing-0.2-x86_msse2.patch - Add no-undefined.patch patch https://cgit.freedesktop.org/pulseaudio/webrtc-audio-processing/patch/?id=d58164e4d87854233564b59e76259b72e21507f6 - Add big_endian_support_2.patch https://bugs.freedesktop.org/show_bug.cgi?id=95738 - Adapt webrtc-audio-processing-0.2-x86_msse2.patch to new version - Adapt big_endian_support.patch to new version - Add webrtc-audio-processing-0.2-x86_msse2.patch patch fixing 386 build https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-May/026294.html - Add big_endian_support.patch https://bugs.freedesktop.org/show_bug.cgi?id=95738 - New automake version dependency >= 1.5 - Update to 0.2: Contains API breaking changes. Upstream changes include: * Rewritten AGC and voice activity detection * Intelligibility enhancer * Extended AEC filter * Beamformer * Transient suppressor * ARM, NEON and MIPS optimisations (MIPS optimisations are not hooked up) API changes: * We no longer include a top-level audio_processing.h. The webrtc tree format is used, so use webrtc/modules/audio_processing/include/audio_processing.h * The top-level module_common_types.h has also been moved to webrtc/modules/interface/module_common_types.h * C++11 support is now required while compiling client code * AudioProcessing::Create() does not take any arguments any more * AudioProcessing::Destroy() is gone, use standard C++ "delete" instead * Stream parameters are now configured via StreamConfig and ProcessingConfig rather than set_sample_rate(), set_num_channels(), etc. * AudioFrame field names have changed * Use config API for newer audio processing options * Use ProcessReverseStream() instead of AnalyzeReverseStream(), particularly when using the intelligibility enhancer * GainControl::set_analog_level_limits() is broken. The AGC implementation hard codes 0-255 as the volume range Other notes: * The new audio processing parameters are not all tested, and a few are not enabled upstream (in Chromium) either * The rewritten AGC appears to be less sensitive, and it might make sense to initialise the capture volume to something reasonable (33% or 50%, for example) to make sure there is sufficient energy in the stream to trigger the AGC mechanism - Adapted all 3 arch patches OBS-URL: https://build.opensuse.org/request/show/404777 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/webrtc-audio-processing?expand=0&rev=11
2016-06-25 18:50:49 +02:00
}
@@ -120,10 +123,17 @@ WavWriter::~WavWriter() {
void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) {
#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
-#error "Need to convert samples to little-endian when writing to WAV file"
-#endif
+ int16_t * le_samples = new int16_t[num_samples];
+ for(size_t idx = 0; idx < num_samples; idx++) {
+ le_samples[idx] = (samples[idx]<<8) | (samples[idx]>>8);
+ }
+ const size_t written =
+ fwrite(le_samples, sizeof(*le_samples), num_samples, file_handle_);
+ delete []le_samples;
+#else
const size_t written =
fwrite(samples, sizeof(*samples), num_samples, file_handle_);
+#endif
RTC_CHECK_EQ(num_samples, written);
num_samples_ += static_cast<uint32_t>(written);
RTC_CHECK(written <= std::numeric_limits<uint32_t>::max() ||
diff -up webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc.than webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc
--- webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc.than 2016-05-24 08:50:52.591379263 -0400
+++ webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc 2016-05-24 08:52:08.552606848 -0400
@@ -129,7 +129,39 @@ static inline std::string ReadFourCC(uin
return std::string(reinterpret_cast<char*>(&x), 4);
}
#else
-#error "Write be-to-le conversion functions"
+static inline void WriteLE16(uint16_t* f, uint16_t x) {
+ *f = ((x << 8) & 0xff00) | ( ( x >> 8) & 0x00ff);
+}
+
+static inline void WriteLE32(uint32_t* f, uint32_t x) {
+ *f = ( (x & 0x000000ff) << 24 )
+ | ((x & 0x0000ff00) << 8)
+ | ((x & 0x00ff0000) >> 8)
+ | ((x & 0xff000000) >> 24 );
+}
+
+static inline void WriteFourCC(uint32_t* f, char a, char b, char c, char d) {
+ *f = (static_cast<uint32_t>(a) << 24 )
+ | (static_cast<uint32_t>(b) << 16)
+ | (static_cast<uint32_t>(c) << 8)
+ | (static_cast<uint32_t>(d) );
+}
+
+static inline uint16_t ReadLE16(uint16_t x) {
+ return (( x & 0x00ff) << 8 )| ((x & 0xff00)>>8);
+}
+
+static inline uint32_t ReadLE32(uint32_t x) {
+ return ( (x & 0x000000ff) << 24 )
+ | ( (x & 0x0000ff00) << 8 )
+ | ( (x & 0x00ff0000) >> 8)
+ | ( (x & 0xff000000) >> 24 );
+}
+
+static inline std::string ReadFourCC(uint32_t x) {
+ x = ReadLE32(x);
+ return std::string(reinterpret_cast<char*>(&x), 4);
+}
#endif
static inline uint32_t RiffChunkSize(uint32_t bytes_in_payload) {