Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Buethe <jbuethe@amazon.de>2023-07-29 03:19:48 +0300
committerJan Buethe <jbuethe@amazon.de>2023-07-29 03:20:23 +0300
commitaca390df18785abf70823879d8a071ba8997fee8 (patch)
tree090e58d36d1dc53ef087f05bade5d6eb24e25684
parentb50ddccf0e7c548803d079b21c5841bfd62939e9 (diff)
fixed wexchange for GRUs without bias
-rw-r--r--dnn/torch/weight-exchange/wexchange/c_export/common.py1
-rw-r--r--dnn/torch/weight-exchange/wexchange/torch/torch.py10
-rw-r--r--doc/draft-ietf-codec-opus-update.xml20
3 files changed, 19 insertions, 12 deletions
diff --git a/dnn/torch/weight-exchange/wexchange/c_export/common.py b/dnn/torch/weight-exchange/wexchange/c_export/common.py
index d8b3f7e7..b03ee7a0 100644
--- a/dnn/torch/weight-exchange/wexchange/c_export/common.py
+++ b/dnn/torch/weight-exchange/wexchange/c_export/common.py
@@ -303,6 +303,7 @@ def print_gru_layer(writer : CWriter,
N = weight.shape[0] // 3
for x in [weight, recurrent_weight, bias, recurrent_bias]:
+ if x is None: continue
tmp = x[0:N].copy()
x[0:N] = x[N:2*N]
x[N:2*N] = tmp
diff --git a/dnn/torch/weight-exchange/wexchange/torch/torch.py b/dnn/torch/weight-exchange/wexchange/torch/torch.py
index 4f6d7dfd..2f479a28 100644
--- a/dnn/torch/weight-exchange/wexchange/torch/torch.py
+++ b/dnn/torch/weight-exchange/wexchange/torch/torch.py
@@ -41,8 +41,14 @@ def dump_torch_gru_weights(where, gru, name='gru', input_sparse=False, recurrent
w_ih = gru.weight_ih_l0.detach().cpu().numpy()
w_hh = gru.weight_hh_l0.detach().cpu().numpy()
- b_ih = gru.bias_ih_l0.detach().cpu().numpy()
- b_hh = gru.bias_hh_l0.detach().cpu().numpy()
+ if hasattr(gru, 'bias_ih_l0'):
+ b_ih = gru.bias_ih_l0.detach().cpu().numpy()
+ else:
+ b_ih = None
+ if hasattr(gru, 'bias_hh_l0'):
+ b_hh = gru.bias_hh_l0.detach().cpu().numpy()
+ else:
+ b_hh = None
if isinstance(where, CWriter):
return print_gru_layer(where, name, w_ih, w_hh, b_ih, b_hh, format='torch', input_sparse=input_sparse, recurrent_sparse=recurrent_sparse, quantize=quantize, scale=scale, recurrent_scale=recurrent_scale)
diff --git a/doc/draft-ietf-codec-opus-update.xml b/doc/draft-ietf-codec-opus-update.xml
index 3124e22c..0dfb16bf 100644
--- a/doc/draft-ietf-codec-opus-update.xml
+++ b/doc/draft-ietf-codec-opus-update.xml
@@ -109,7 +109,7 @@
+ sizeof(((silk_decoder *)decState)->sStereo));
+ /* Not strictly needed, but it's cleaner that way */
+ ((silk_decoder *)decState)->prev_decode_only_middle = 0;
-
+
return ret;
}
<CODE ENDS>
@@ -189,29 +189,29 @@
RESAMPLER_ORDER_FIR_12 ];
+ opus_int16 buf[ 2*RESAMPLER_MAX_BATCH_SIZE_IN + \
RESAMPLER_ORDER_FIR_12 ];
-
+
/* Copy buffered samples to start of buffer */
- silk_memcpy( buf, S->sFIR, RESAMPLER_ORDER_FIR_12 \
* sizeof( opus_int32 ) );
+ silk_memcpy( buf, S->sFIR, RESAMPLER_ORDER_FIR_12 \
* sizeof( opus_int16 ) );
-
+
/* Iterate over blocks of frameSizeIn input samples */
index_increment_Q16 = S->invRatio_Q16;
while( 1 ) {
nSamplesIn = silk_min( inLen, S->batchSize );
-
+
/* Upsample 2x */
silk_resampler_private_up2_HQ( S->sIIR, &buf[ \
RESAMPLER_ORDER_FIR_12 ], in, nSamplesIn );
-
+
max_index_Q16 = silk_LSHIFT32( nSamplesIn, 16 + 1 \
); /* + 1 because 2x upsampling */
out = silk_resampler_private_IIR_FIR_INTERPOL( out, \
buf, max_index_Q16, index_increment_Q16 );
in += nSamplesIn;
inLen -= nSamplesIn;
-
+
if( inLen > 0 ) {
/* More iterations to do; copy last part of \
filtered signal to beginning of buffer */
@@ -223,7 +223,7 @@ RESAMPLER_ORDER_FIR_12 * sizeof( opus_int16 ) );
break;
}
}
-
+
/* Copy last part of filtered signal to the state for \
the next call */
- silk_memcpy( S->sFIR, &buf[ nSamplesIn << 1 ], \
@@ -284,7 +284,7 @@ rc_mult2 ), mult2Q);
NLSF_Q15[i-1] + NDeltaMin_Q15[i] );
+ NLSF_Q15[i] = silk_max_int( NLSF_Q15[i], \
silk_ADD_SAT16( NLSF_Q15[i-1], NDeltaMin_Q15[i] ) );
-
+
/* Last NLSF should be no higher than 1 - NDeltaMin[L] */
<CODE ENDS>
]]></artwork>
@@ -334,13 +334,13 @@ silk_ADD_SAT16( NLSF_Q15[i-1], NDeltaMin_Q15[i] ) );
<CODE BEGINS>
b = 0;
}
-
+
- if (resynth && M*eBands[i]-N >= M*eBands[start] && \
(update_lowband || lowband_offset==0))
+ if (resynth && (M*eBands[i]-N >= M*eBands[start] || \
i==start+1) && (update_lowband || lowband_offset==0))
lowband_offset = i;
-
+
+ if (i == start+1)
+ {
+ int n1, n2;