Bug 1239078 - Bump libopus update script for 1.1.2. r=kinetik

New upstream release.

This fixes a unified build issue with MAX_PULSES and
incorporates our TonalityAnalysisState initializer patch.

Issues remain in the unified build with QA and
opus_custom_*coder_get_size declarations, so we still
need to build those separately.
This commit is contained in:
Ralph Giles 2016-01-12 12:11:58 -08:00
parent 5b38716384
commit deb262f100
3 changed files with 10 additions and 165 deletions

View File

@ -1,5 +1,7 @@
--- sources.mozbuild- 2015-12-31 01:09:35.663118019 -0800
+++ sources.mozbuild 2015-12-31 01:12:04.970093876 -0800
diff --git a/media/libopus/sources.mozbuild b/media/libopus/sources.mozbuild
index 8a39b9f..dfc2c62 100644
--- a/media/libopus/sources.mozbuild
+++ b/media/libopus/sources.mozbuild
@@ -2,8 +2,6 @@
celt_sources = [
'celt/bands.c',
@ -9,13 +11,15 @@
'celt/celt_lpc.c',
'celt/cwrs.c',
'celt/entcode.c',
@@ -20,6 +18,13 @@
@@ -20,6 +18,15 @@ celt_sources = [
'celt/vq.c',
]
+opus_nonunified_sources = [
+ # Disabled because of name clash of opus_custom_encoder_get_size.
+ 'celt/celt_decoder.c',
+ 'celt/celt_encoder.c',
+ # Disabled for (safe) warning about QA redefinition.
+ 'silk/LPC_inv_pred_gain.c',
+ 'silk/NLSF2A.c',
+]
@ -23,7 +27,7 @@
celt_sources_sse = [
'celt/x86/pitch_sse.c',
'celt/x86/x86_celt_map.c',
@@ -105,8 +110,6 @@
@@ -105,8 +112,6 @@ silk_sources = [
'silk/log2lin.c',
'silk/LP_variable_cutoff.c',
'silk/LPC_analysis_filter.c',

View File

@ -1,158 +0,0 @@
diff --git a/src/analysis.c b/src/analysis.c
index 322e53c..360ebcc 100644
--- a/src/analysis.c
+++ b/src/analysis.c
@@ -138,6 +138,21 @@ static OPUS_INLINE float fast_atan2f(float y, float x) {
}
}
+void tonality_analysis_init(TonalityAnalysisState *tonal)
+{
+ /* Initialize reusable fields. */
+ tonal->arch = opus_select_arch();
+ /* Clear remaining fields. */
+ tonality_analysis_reset(tonal);
+}
+
+void tonality_analysis_reset(TonalityAnalysisState *tonal)
+{
+ /* Clear non-reusable fields. */
+ char *start = (char*)&tonal->TONALITY_ANALYSIS_RESET_START;
+ OPUS_CLEAR(start, sizeof(TonalityAnalysisState) - (start - (char*)tonal));
+}
+
void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int len)
{
int pos;
@@ -187,7 +202,7 @@ void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int
info_out->music_prob = psum;
}
-static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt_mode, const void *x, int len, int offset, int c1, int c2, int C, int lsb_depth, downmix_func downmix, int arch)
+static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt_mode, const void *x, int len, int offset, int c1, int c2, int C, int lsb_depth, downmix_func downmix)
{
int i, b;
const kiss_fft_state *kfft;
@@ -260,7 +275,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
remaining = len - (ANALYSIS_BUF_SIZE-tonal->mem_fill);
downmix(x, &tonal->inmem[240], remaining, offset+ANALYSIS_BUF_SIZE-tonal->mem_fill, c1, c2, C);
tonal->mem_fill = 240 + remaining;
- opus_fft(kfft, in, out, arch);
+ opus_fft(kfft, in, out, tonal->arch);
#ifndef FIXED_POINT
/* If there's any NaN on the input, the entire output will be NaN, so we only need to check one value. */
if (celt_isnan(out[0].r))
@@ -633,7 +648,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
void run_analysis(TonalityAnalysisState *analysis, const CELTMode *celt_mode, const void *analysis_pcm,
int analysis_frame_size, int frame_size, int c1, int c2, int C, opus_int32 Fs,
- int lsb_depth, downmix_func downmix, AnalysisInfo *analysis_info, int arch)
+ int lsb_depth, downmix_func downmix, AnalysisInfo *analysis_info)
{
int offset;
int pcm_len;
@@ -646,7 +661,7 @@ void run_analysis(TonalityAnalysisState *analysis, const CELTMode *celt_mode, co
pcm_len = analysis_frame_size - analysis->analysis_offset;
offset = analysis->analysis_offset;
do {
- tonality_analysis(analysis, celt_mode, analysis_pcm, IMIN(480, pcm_len), offset, c1, c2, C, lsb_depth, downmix, arch);
+ tonality_analysis(analysis, celt_mode, analysis_pcm, IMIN(480, pcm_len), offset, c1, c2, C, lsb_depth, downmix);
offset += 480;
pcm_len -= 480;
} while (pcm_len>0);
diff --git a/src/analysis.h b/src/analysis.h
index 9c328e8..9eae56a 100644
--- a/src/analysis.h
+++ b/src/analysis.h
@@ -39,6 +39,8 @@
#define DETECT_SIZE 200
typedef struct {
+ int arch;
+#define TONALITY_ANALYSIS_RESET_START angle
float angle[240];
float d_angle[240];
float d2_angle[240];
@@ -78,10 +80,24 @@ typedef struct {
AnalysisInfo info[DETECT_SIZE];
} TonalityAnalysisState;
+/** Initialize a TonalityAnalysisState struct.
+ *
+ * This performs some possibly slow initialization steps which should
+ * not be repeated every analysis step. No allocated memory is retained
+ * by the state struct, so no cleanup call is required.
+ */
+void tonality_analysis_init(TonalityAnalysisState *analysis);
+
+/** Reset a TonalityAnalysisState stuct.
+ *
+ * Call this when there's a discontinuity in the data.
+ */
+void tonality_analysis_reset(TonalityAnalysisState *analysis);
+
void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int len);
void run_analysis(TonalityAnalysisState *analysis, const CELTMode *celt_mode, const void *analysis_pcm,
int analysis_frame_size, int frame_size, int c1, int c2, int C, opus_int32 Fs,
- int lsb_depth, downmix_func downmix, AnalysisInfo *analysis_info, int arch);
+ int lsb_depth, downmix_func downmix, AnalysisInfo *analysis_info);
#endif
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index 7403a4c..4340de4 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -82,5 +82,8 @@ struct OpusEncoder {
int encoder_buffer;
int lfe;
+#ifndef DISABLE_FLOAT_API
+ TonalityAnalysisState analysis;
+#endif
#define OPUS_ENCODER_RESET_START stream_channels
int stream_channels;
@@ -101,7 +104,6 @@ struct OpusEncoder {
StereoWidthState width_mem;
opus_val16 delay_buffer[MAX_ENCODER_BUFFER*2];
#ifndef DISABLE_FLOAT_API
- TonalityAnalysisState analysis;
int detected_bandwidth;
#endif
opus_uint32 rangeFinal;
@@ -242,6 +244,10 @@ int opus_encoder_init(OpusEncoder* st, opus_int32 Fs, int channels, int applicat
st->mode = MODE_HYBRID;
st->bandwidth = OPUS_BANDWIDTH_FULLBAND;
+#ifndef DISABLE_FLOAT_API
+ tonality_analysis_init(&st->analysis);
+#endif
+
return OPUS_OK;
}
@@ -1005,7 +1011,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
analysis_read_subframe_bak = st->analysis.read_subframe;
run_analysis(&st->analysis, celt_mode, analysis_pcm, analysis_size, frame_size,
c1, c2, analysis_channels, st->Fs,
- lsb_depth, downmix, &analysis_info, st->arch);
+ lsb_depth, downmix, &analysis_info);
}
#else
(void)analysis_pcm;
@@ -2449,10 +2455,12 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
void *silk_enc;
silk_EncControlStruct dummy;
silk_enc = (char*)st+st->silk_enc_offset;
+#ifndef DISABLE_FLOAT_API
+ tonality_analysis_reset(&st->analysis);
+#endif
- OPUS_CLEAR((char*)&st->OPUS_ENCODER_RESET_START,
- sizeof(OpusEncoder)-
- ((char*)&st->OPUS_ENCODER_RESET_START - (char*)st));
+ char *start = (char*)&st->OPUS_ENCODER_RESET_START;
+ OPUS_CLEAR(start, sizeof(OpusEncoder) - (start - (char*)st));
celt_encoder_ctl(celt_enc, OPUS_RESET_STATE);
silk_InitEncoder( silk_enc, st->arch, &dummy );

View File

@ -74,6 +74,5 @@ sed -e "s/DEFINES\['OPUS_VERSION'\][ \t]*=[ \t]*'\".*\"'/DEFINES['OPUS_VERSION']
python gen-sources.py $1
# apply outstanding local patches
patch -p3 < ./gcc-4.8-ICE.patch
patch -p1 < ./tonality_init.patch
patch -p0 < nonunified.patch
patch -p3 < gcc-4.8-ICE.patch
patch -p3 < nonunified.patch