Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Arun Raghavan
webrtc-audio-processing
Commits
7fcd4d2d
Commit
7fcd4d2d
authored
Oct 13, 2015
by
Arun Raghavan
🐾
Browse files
build: More build fixes and cleanups
parent
65a28608
Changes
19
Hide whitespace changes
Inline
Side-by-side
webrtc/Makefile.am
View file @
7fcd4d2d
SUBDIRS
=
base common_audio system_wrappers modules
SUBDIRS
=
.
base common_audio system_wrappers modules
noinst_HEADERS
=
common.h
noinst_HEADERS
=
common.h
\
common_types.h
\
typedefs.h
noinst_LTLIBRARIES
=
libwebrtc.la
libwebrtc_la_SOURCES
=
common_types.cc
libwebrtc_la_CXXFLAGS
=
$(AM_CXXFLAGS)
$(COMMON_CXXFLAGS)
EXTRA_DIST
=
BUILD.gn PATENTS LICENSE_THIRD_PARTY
webrtc/base/Makefile.am
View file @
7fcd4d2d
...
...
@@ -3,7 +3,6 @@ noinst_LTLIBRARIES = libbase.la
noinst_HEADERS
=
arraysize.h
\
atomicops.h
\
basictypes.h
\
checks.h
\
constructormagic.h
\
safe_conversions.h
\
safe_conversions_impl.h
\
...
...
@@ -13,6 +12,8 @@ noinst_HEADERS = arraysize.h \
libbase_la_SOURCES
=
criticalsection.cc
\
criticalsection.h
\
checks.cc
\
checks.h
\
event.cc
\
event.h
\
platform_thread.cc
\
...
...
webrtc/base/checks.cc
0 → 100644
View file @
7fcd4d2d
/*
* Copyright 2006 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.
*/
// Most of this was borrowed (with minor modifications) from V8's and Chromium's
// src/base/logging.cc.
// Use the C++ version to provide __GLIBCXX__.
#include
<cstdarg>
#include
<cstdio>
#include
<cstdlib>
#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
#include
<cxxabi.h>
#include
<execinfo.h>
#endif
#if defined(WEBRTC_ANDROID)
#define LOG_TAG "rtc"
#include
<android/log.h>
// NOLINT
#endif
#include
"webrtc/base/checks.h"
#if defined(_MSC_VER)
// Warning C4722: destructor never returns, potential memory leak.
// FatalMessage's dtor very intentionally aborts.
#pragma warning(disable:4722)
#endif
namespace
rtc
{
void
VPrintError
(
const
char
*
format
,
va_list
args
)
{
#if defined(WEBRTC_ANDROID)
__android_log_vprint
(
ANDROID_LOG_ERROR
,
LOG_TAG
,
format
,
args
);
#else
vfprintf
(
stderr
,
format
,
args
);
#endif
}
void
PrintError
(
const
char
*
format
,
...)
{
va_list
args
;
va_start
(
args
,
format
);
VPrintError
(
format
,
args
);
va_end
(
args
);
}
// TODO(ajm): This works on Mac (although the parsing fails) but I don't seem
// to get usable symbols on Linux. This is copied from V8. Chromium has a more
// advanced stace trace system; also more difficult to copy.
void
DumpBacktrace
()
{
#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
void
*
trace
[
100
];
int
size
=
backtrace
(
trace
,
sizeof
(
trace
)
/
sizeof
(
*
trace
));
char
**
symbols
=
backtrace_symbols
(
trace
,
size
);
PrintError
(
"
\n
==== C stack trace ===============================
\n\n
"
);
if
(
size
==
0
)
{
PrintError
(
"(empty)
\n
"
);
}
else
if
(
symbols
==
NULL
)
{
PrintError
(
"(no symbols)
\n
"
);
}
else
{
for
(
int
i
=
1
;
i
<
size
;
++
i
)
{
char
mangled
[
201
];
if
(
sscanf
(
symbols
[
i
],
"%*[^(]%*[(]%200[^)+]"
,
mangled
)
==
1
)
{
// NOLINT
PrintError
(
"%2d: "
,
i
);
int
status
;
size_t
length
;
char
*
demangled
=
abi
::
__cxa_demangle
(
mangled
,
NULL
,
&
length
,
&
status
);
PrintError
(
"%s
\n
"
,
demangled
!=
NULL
?
demangled
:
mangled
);
free
(
demangled
);
}
else
{
// If parsing failed, at least print the unparsed symbol.
PrintError
(
"%s
\n
"
,
symbols
[
i
]);
}
}
}
free
(
symbols
);
#endif
}
FatalMessage
::
FatalMessage
(
const
char
*
file
,
int
line
)
{
Init
(
file
,
line
);
}
FatalMessage
::
FatalMessage
(
const
char
*
file
,
int
line
,
std
::
string
*
result
)
{
Init
(
file
,
line
);
stream_
<<
"Check failed: "
<<
*
result
<<
std
::
endl
<<
"# "
;
delete
result
;
}
NO_RETURN
FatalMessage
::~
FatalMessage
()
{
fflush
(
stdout
);
fflush
(
stderr
);
stream_
<<
std
::
endl
<<
"#"
<<
std
::
endl
;
PrintError
(
stream_
.
str
().
c_str
());
DumpBacktrace
();
fflush
(
stderr
);
abort
();
}
void
FatalMessage
::
Init
(
const
char
*
file
,
int
line
)
{
stream_
<<
std
::
endl
<<
std
::
endl
<<
"#"
<<
std
::
endl
<<
"# Fatal error in "
<<
file
<<
", line "
<<
line
<<
std
::
endl
<<
"# "
;
}
// MSVC doesn't like complex extern templates and DLLs.
#if !defined(COMPILER_MSVC)
// Explicit instantiations for commonly used comparisons.
template
std
::
string
*
MakeCheckOpString
<
int
,
int
>(
const
int
&
,
const
int
&
,
const
char
*
names
);
template
std
::
string
*
MakeCheckOpString
<
unsigned
long
,
unsigned
long
>(
const
unsigned
long
&
,
const
unsigned
long
&
,
const
char
*
names
);
template
std
::
string
*
MakeCheckOpString
<
unsigned
long
,
unsigned
int
>(
const
unsigned
long
&
,
const
unsigned
int
&
,
const
char
*
names
);
template
std
::
string
*
MakeCheckOpString
<
unsigned
int
,
unsigned
long
>(
const
unsigned
int
&
,
const
unsigned
long
&
,
const
char
*
names
);
template
std
::
string
*
MakeCheckOpString
<
std
::
string
,
std
::
string
>(
const
std
::
string
&
,
const
std
::
string
&
,
const
char
*
name
);
#endif
}
// namespace rtc
webrtc/common_audio/Makefile.am
View file @
7fcd4d2d
...
...
@@ -69,6 +69,7 @@ libcommon_audio_la_SOURCES = resampler/include/push_resampler.h \
audio_converter.h
\
audio_ring_buffer.cc
\
audio_ring_buffer.h
\
audio_util.cc
\
blocker.cc
\
blocker.h
\
channel_buffer.cc
\
...
...
webrtc/common_audio/audio_util.cc
0 → 100644
View file @
7fcd4d2d
/*
* Copyright (c) 2013 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/include/audio_util.h"
#include
"webrtc/typedefs.h"
namespace
webrtc
{
void
FloatToS16
(
const
float
*
src
,
size_t
size
,
int16_t
*
dest
)
{
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
dest
[
i
]
=
FloatToS16
(
src
[
i
]);
}
void
S16ToFloat
(
const
int16_t
*
src
,
size_t
size
,
float
*
dest
)
{
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
dest
[
i
]
=
S16ToFloat
(
src
[
i
]);
}
void
FloatS16ToS16
(
const
float
*
src
,
size_t
size
,
int16_t
*
dest
)
{
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
dest
[
i
]
=
FloatS16ToS16
(
src
[
i
]);
}
void
FloatToFloatS16
(
const
float
*
src
,
size_t
size
,
float
*
dest
)
{
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
dest
[
i
]
=
FloatToFloatS16
(
src
[
i
]);
}
void
FloatS16ToFloat
(
const
float
*
src
,
size_t
size
,
float
*
dest
)
{
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
dest
[
i
]
=
FloatS16ToFloat
(
src
[
i
]);
}
template
<
>
void
DownmixInterleavedToMono
<
int16_t
>
(
const
int16_t
*
interleaved
,
size_t
num_frames
,
int
num_channels
,
int16_t
*
deinterleaved
)
{
DownmixInterleavedToMonoImpl
<
int16_t
,
int32_t
>
(
interleaved
,
num_frames
,
num_channels
,
deinterleaved
);
}
}
// namespace webrtc
webrtc/common_types.cc
0 → 100644
View file @
7fcd4d2d
/*
* 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_types.h"
#include
<string.h>
namespace
webrtc
{
int
InStream
::
Rewind
()
{
return
-
1
;
}
int
OutStream
::
Rewind
()
{
return
-
1
;
}
StreamDataCounters
::
StreamDataCounters
()
:
first_packet_time_ms
(
-
1
)
{}
RTPHeaderExtension
::
RTPHeaderExtension
()
:
hasTransmissionTimeOffset
(
false
),
transmissionTimeOffset
(
0
),
hasAbsoluteSendTime
(
false
),
absoluteSendTime
(
0
),
hasTransportSequenceNumber
(
false
),
transportSequenceNumber
(
0
),
hasAudioLevel
(
false
),
voiceActivity
(
false
),
audioLevel
(
0
),
hasVideoRotation
(
false
),
videoRotation
(
0
)
{
}
RTPHeader
::
RTPHeader
()
:
markerBit
(
false
),
payloadType
(
0
),
sequenceNumber
(
0
),
timestamp
(
0
),
ssrc
(
0
),
numCSRCs
(
0
),
paddingLength
(
0
),
headerLength
(
0
),
payload_type_frequency
(
0
),
extension
()
{
memset
(
&
arrOfCSRCs
,
0
,
sizeof
(
arrOfCSRCs
));
}
}
// namespace webrtc
webrtc/modules/audio_coding/Makefile.am
View file @
7fcd4d2d
...
...
@@ -3,11 +3,18 @@ noinst_LTLIBRARIES = libaudio_coding.la
libaudio_coding_la_SOURCES
=
codecs/isac/main/interface/isac.h
\
codecs/isac/main/source/arith_routines.c
\
codecs/isac/main/source/arith_routines.h
\
codecs/isac/main/source/arith_routines_hist.c
\
codecs/isac/main/source/arith_routines_logist.c
\
codecs/isac/main/source/codec.h
\
codecs/isac/main/source/encode_lpc_swb.c
\
codecs/isac/main/source/encode_lpc_swb.h
\
codecs/isac/main/source/entropy_coding.c
\
codecs/isac/main/source/entropy_coding.h
\
codecs/isac/main/source/filter_functions.c
\
codecs/isac/main/source/filterbanks.c
\
codecs/isac/main/source/filterbank_tables.c
\
codecs/isac/main/source/filterbank_tables.h
\
codecs/isac/main/source/intialize.c
\
codecs/isac/main/source/lpc_analysis.c
\
codecs/isac/main/source/lpc_analysis.h
\
codecs/isac/main/source/lpc_gain_swb_tables.c
\
...
...
@@ -21,6 +28,7 @@ libaudio_coding_la_SOURCES = codecs/isac/main/interface/isac.h \
codecs/isac/main/source/os_specific_inline.h
\
codecs/isac/main/source/pitch_estimator.c
\
codecs/isac/main/source/pitch_estimator.h
\
codecs/isac/main/source/pitch_filter.c
\
codecs/isac/main/source/pitch_gain_tables.c
\
codecs/isac/main/source/pitch_gain_tables.h
\
codecs/isac/main/source/pitch_lag_tables.c
\
...
...
webrtc/modules/audio_coding/codecs/isac/main/source/arith_routines_hist.c
0 → 100644
View file @
7fcd4d2d
/*
* Copyright (c) 2011 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
"settings.h"
#include
"arith_routines.h"
/*
* code symbols into arithmetic bytestream
*/
void
WebRtcIsac_EncHistMulti
(
Bitstr
*
streamdata
,
/* in-/output struct containing bitstream */
const
int
*
data
,
/* input: data vector */
const
uint16_t
**
cdf
,
/* input: array of cdf arrays */
const
int
N
)
/* input: data vector length */
{
uint32_t
W_lower
,
W_upper
;
uint32_t
W_upper_LSB
,
W_upper_MSB
;
uint8_t
*
stream_ptr
;
uint8_t
*
stream_ptr_carry
;
uint32_t
cdf_lo
,
cdf_hi
;
int
k
;
/* point to beginning of stream buffer */
stream_ptr
=
streamdata
->
stream
+
streamdata
->
stream_index
;
W_upper
=
streamdata
->
W_upper
;
for
(
k
=
N
;
k
>
0
;
k
--
)
{
/* fetch cdf_lower and cdf_upper from cdf tables */
cdf_lo
=
(
uint32_t
)
*
(
*
cdf
+
*
data
);
cdf_hi
=
(
uint32_t
)
*
(
*
cdf
++
+
*
data
++
+
1
);
/* update interval */
W_upper_LSB
=
W_upper
&
0x0000FFFF
;
W_upper_MSB
=
W_upper
>>
16
;
W_lower
=
W_upper_MSB
*
cdf_lo
;
W_lower
+=
(
W_upper_LSB
*
cdf_lo
)
>>
16
;
W_upper
=
W_upper_MSB
*
cdf_hi
;
W_upper
+=
(
W_upper_LSB
*
cdf_hi
)
>>
16
;
/* shift interval such that it begins at zero */
W_upper
-=
++
W_lower
;
/* add integer to bitstream */
streamdata
->
streamval
+=
W_lower
;
/* handle carry */
if
(
streamdata
->
streamval
<
W_lower
)
{
/* propagate carry */
stream_ptr_carry
=
stream_ptr
;
while
(
!
(
++
(
*--
stream_ptr_carry
)));
}
/* renormalize interval, store most significant byte of streamval and update streamval */
while
(
!
(
W_upper
&
0xFF000000
)
)
/* W_upper < 2^24 */
{
W_upper
<<=
8
;
*
stream_ptr
++
=
(
uint8_t
)
(
streamdata
->
streamval
>>
24
);
streamdata
->
streamval
<<=
8
;
}
}
/* calculate new stream_index */
streamdata
->
stream_index
=
(
int
)(
stream_ptr
-
streamdata
->
stream
);
streamdata
->
W_upper
=
W_upper
;
return
;
}
/*
* function to decode more symbols from the arithmetic bytestream, using method of bisection
* cdf tables should be of size 2^k-1 (which corresponds to an alphabet size of 2^k-2)
*/
int
WebRtcIsac_DecHistBisectMulti
(
int
*
data
,
/* output: data vector */
Bitstr
*
streamdata
,
/* in-/output struct containing bitstream */
const
uint16_t
**
cdf
,
/* input: array of cdf arrays */
const
uint16_t
*
cdf_size
,
/* input: array of cdf table sizes+1 (power of two: 2^k) */
const
int
N
)
/* input: data vector length */
{
uint32_t
W_lower
,
W_upper
;
uint32_t
W_tmp
;
uint32_t
W_upper_LSB
,
W_upper_MSB
;
uint32_t
streamval
;
const
uint8_t
*
stream_ptr
;
const
uint16_t
*
cdf_ptr
;
int
size_tmp
;
int
k
;
W_lower
=
0
;
//to remove warning -DH
stream_ptr
=
streamdata
->
stream
+
streamdata
->
stream_index
;
W_upper
=
streamdata
->
W_upper
;
if
(
W_upper
==
0
)
/* Should not be possible in normal operation */
return
-
2
;
if
(
streamdata
->
stream_index
==
0
)
/* first time decoder is called for this stream */
{
/* read first word from bytestream */
streamval
=
*
stream_ptr
<<
24
;
streamval
|=
*++
stream_ptr
<<
16
;
streamval
|=
*++
stream_ptr
<<
8
;
streamval
|=
*++
stream_ptr
;
}
else
{
streamval
=
streamdata
->
streamval
;
}
for
(
k
=
N
;
k
>
0
;
k
--
)
{
/* find the integer *data for which streamval lies in [W_lower+1, W_upper] */
W_upper_LSB
=
W_upper
&
0x0000FFFF
;
W_upper_MSB
=
W_upper
>>
16
;
/* start halfway the cdf range */
size_tmp
=
*
cdf_size
++
>>
1
;
cdf_ptr
=
*
cdf
+
(
size_tmp
-
1
);
/* method of bisection */
for
(
;;
)
{
W_tmp
=
W_upper_MSB
*
*
cdf_ptr
;
W_tmp
+=
(
W_upper_LSB
*
*
cdf_ptr
)
>>
16
;
size_tmp
>>=
1
;
if
(
size_tmp
==
0
)
break
;
if
(
streamval
>
W_tmp
)
{
W_lower
=
W_tmp
;
cdf_ptr
+=
size_tmp
;
}
else
{
W_upper
=
W_tmp
;
cdf_ptr
-=
size_tmp
;
}
}
if
(
streamval
>
W_tmp
)
{
W_lower
=
W_tmp
;
*
data
++
=
(
int
)(
cdf_ptr
-
*
cdf
++
);
}
else
{
W_upper
=
W_tmp
;
*
data
++
=
(
int
)(
cdf_ptr
-
*
cdf
++
-
1
);
}
/* shift interval to start at zero */
W_upper
-=
++
W_lower
;
/* add integer to bitstream */
streamval
-=
W_lower
;
/* renormalize interval and update streamval */
while
(
!
(
W_upper
&
0xFF000000
)
)
/* W_upper < 2^24 */
{
/* read next byte from stream */
streamval
=
(
streamval
<<
8
)
|
*++
stream_ptr
;
W_upper
<<=
8
;
}
if
(
W_upper
==
0
)
/* Should not be possible in normal operation */
return
-
2
;
}
streamdata
->
stream_index
=
(
int
)(
stream_ptr
-
streamdata
->
stream
);
streamdata
->
W_upper
=
W_upper
;
streamdata
->
streamval
=
streamval
;
/* find number of bytes in original stream (determined by current interval width) */
if
(
W_upper
>
0x01FFFFFF
)
return
streamdata
->
stream_index
-
2
;
else
return
streamdata
->
stream_index
-
1
;
}
/*
* function to decode more symbols from the arithmetic bytestream, taking single step up or
* down at a time
* cdf tables can be of arbitrary size, but large tables may take a lot of iterations
*/
int
WebRtcIsac_DecHistOneStepMulti
(
int
*
data
,
/* output: data vector */
Bitstr
*
streamdata
,
/* in-/output struct containing bitstream */
const
uint16_t
**
cdf
,
/* input: array of cdf arrays */
const
uint16_t
*
init_index
,
/* input: vector of initial cdf table search entries */
const
int
N
)
/* input: data vector length */
{
uint32_t
W_lower
,
W_upper
;
uint32_t
W_tmp
;
uint32_t
W_upper_LSB
,
W_upper_MSB
;
uint32_t
streamval
;
const
uint8_t
*
stream_ptr
;
const
uint16_t
*
cdf_ptr
;
int
k
;
stream_ptr
=
streamdata
->
stream
+
streamdata
->
stream_index
;
W_upper
=
streamdata
->
W_upper
;
if
(
W_upper
==
0
)
/* Should not be possible in normal operation */
return
-
2
;
if
(
streamdata
->
stream_index
==
0
)
/* first time decoder is called for this stream */
{
/* read first word from bytestream */
streamval
=
*
stream_ptr
<<
24
;
streamval
|=
*++
stream_ptr
<<
16
;
streamval
|=
*++
stream_ptr
<<
8
;
streamval
|=
*++
stream_ptr
;
}
else
{
streamval
=
streamdata
->
streamval
;
}
for
(
k
=
N
;
k
>
0
;
k
--
)
{
/* find the integer *data for which streamval lies in [W_lower+1, W_upper] */
W_upper_LSB
=
W_upper
&
0x0000FFFF
;
W_upper_MSB
=
W_upper
>>
16
;
/* start at the specified table entry */
cdf_ptr
=
*
cdf
+
(
*
init_index
++
);
W_tmp
=
W_upper_MSB
*
*
cdf_ptr
;
W_tmp
+=
(
W_upper_LSB
*
*
cdf_ptr
)
>>
16
;
if
(
streamval
>
W_tmp
)
{
for
(
;;
)
{
W_lower
=
W_tmp
;
if
(
cdf_ptr
[
0
]
==
65535
)
/* range check */
return
-
3
;
W_tmp
=
W_upper_MSB
*
*++
cdf_ptr
;
W_tmp
+=
(
W_upper_LSB
*
*
cdf_ptr
)
>>
16
;
if
(
streamval
<=
W_tmp
)
break
;
}
W_upper
=
W_tmp
;
*
data
++
=
(
int
)(
cdf_ptr
-
*
cdf
++
-
1
);
}
else
{
for
(
;;
)
{
W_upper
=
W_tmp
;
--
cdf_ptr
;
if
(
cdf_ptr
<*
cdf
)
{
/* range check */
return
-
3
;
}
W_tmp
=
W_upper_MSB
*
*
cdf_ptr
;
W_tmp
+=
(
W_upper_LSB
*
*
cdf_ptr
)
>>
16
;
if
(
streamval
>
W_tmp
)
break
;
}
W_lower
=
W_tmp
;
*
data
++
=
(
int
)(
cdf_ptr
-
*
cdf
++
);
}
/* shift interval to start at zero */
W_upper
-=
++
W_lower
;
/* add integer to bitstream */
streamval
-=
W_lower
;
/* renormalize interval and update streamval */
while
(
!
(
W_upper
&
0xFF000000
)
)
/* W_upper < 2^24 */
{
/* read next byte from stream */
streamval
=
(
streamval
<<
8
)
|
*++
stream_ptr
;
W_upper
<<=
8
;
}
}
streamdata
->
stream_index
=
(
int
)(
stream_ptr
-
streamdata
->
stream
);
streamdata
->
W_upper
=
W_upper
;
streamdata
->
streamval
=
streamval
;
/* find number of bytes in original stream (determined by current interval width) */
if
(
W_upper
>
0x01FFFFFF
)
return
streamdata
->
stream_index
-
2
;
else
return
streamdata
->
stream_index
-
1
;
}
webrtc/modules/audio_coding/codecs/isac/main/source/arith_routines_logist.c
0 → 100644
View file @
7fcd4d2d
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*