diff --git a/dnn/torch/weight-exchange/wexchange/c_export/common.py b/dnn/torch/weight-exchange/wexchange/c_export/common.py index d8b3f7e7501ab66dbe017395b74dffae23ac2098..b03ee7a017b95e7e0f5ddf9d3b2aef95e9cf34b5 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 4f6d7dfd8026499fbc96b70bbba0d50c8b029faa..2f479a2857c210e3a7c051beca7a10fee9a34f04 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 3124e22c0806ae213205427e17b5a0e956424b31..0dfb16bf2c8034a74c06e52bdb53984d1f7c11d4 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;