shithub: alienpatch

ref: c0979e3295ef4f20da953f4364db1a084c3c4541
dir: /opus/

View raw version
diff a8e6a77c5fe0c37aa6788f939f24f8cd22ae2652 uncommitted
--- a/celt/stack_alloc.h
+++ b/celt/stack_alloc.h
@@ -140,7 +140,7 @@
 
 #else
 
-#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
+#define ALIGN(stack, size) ((stack) += ((size) - (_intptr_t)(stack)) & ((size) - 1))
 #define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)/sizeof(char)),(stack)+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeof(char))))
 #if 0 /* Set this to 1 to instrument pseudostack usage */
 #define RESTORE_STACK (printf("%ld %s:%d\n", global_stack-scratch_ptr, __FILE__, __LINE__),global_stack = _saved_stack)
--- /tmp/fuckyoutoo
+++ mkfile
@@ -0,0 +1,187 @@
+APE=/sys/src/ape
+<$APE/config
+
+LIB=/$objtype/lib/ape/libopus.a
+
+OFILES=\
+# silk \
+	CNG.$O \
+	code_signs.$O \
+	init_decoder.$O \
+	decode_core.$O \
+	decode_frame.$O \
+	decode_parameters.$O \
+	decode_indices.$O \
+	decode_pulses.$O \
+	decoder_set_fs.$O \
+	dec_API.$O \
+	enc_API.$O \
+	encode_indices.$O \
+	encode_pulses.$O \
+	gain_quant.$O \
+	interpolate.$O \
+	LP_variable_cutoff.$O \
+	NLSF_decode.$O \
+	NSQ.$O \
+	NSQ_del_dec.$O \
+	PLC.$O \
+	shell_coder.$O \
+	tables_gain.$O \
+	tables_LTP.$O \
+	tables_NLSF_CB_NB_MB.$O \
+	tables_NLSF_CB_WB.$O \
+	tables_other.$O \
+	tables_pitch_lag.$O \
+	tables_pulses_per_block.$O \
+	VAD.$O \
+	control_audio_bandwidth.$O \
+	quant_LTP_gains.$O \
+	VQ_WMat_EC.$O \
+	HP_variable_cutoff.$O \
+	NLSF_encode.$O \
+	NLSF_VQ.$O \
+	NLSF_unpack.$O \
+	NLSF_del_dec_quant.$O \
+	process_NLSFs.$O \
+	stereo_LR_to_MS.$O \
+	stereo_MS_to_LR.$O \
+	check_control_input.$O \
+	control_SNR.$O \
+	init_encoder.$O \
+	control_codec.$O \
+	A2NLSF.$O \
+	ana_filt_bank_1.$O \
+	biquad_alt.$O \
+	bwexpander_32.$O \
+	bwexpander.$O \
+	debug.$O \
+	decode_pitch.$O \
+	inner_prod_aligned.$O \
+	lin2log.$O \
+	log2lin.$O \
+	LPC_analysis_filter.$O \
+	LPC_inv_pred_gain.$O \
+	table_LSF_cos.$O \
+	NLSF2A.$O \
+	NLSF_stabilize.$O \
+	NLSF_VQ_weights_laroia.$O \
+	pitch_est_tables.$O \
+	resampler.$O \
+	resampler_down2_3.$O \
+	resampler_down2.$O \
+	resampler_private_AR2.$O \
+	resampler_private_down_FIR.$O \
+	resampler_private_IIR_FIR.$O \
+	resampler_private_up2_HQ.$O \
+	resampler_rom.$O \
+	sigm_Q15.$O \
+	sort.$O \
+	sum_sqr_shift.$O \
+	stereo_decode_pred.$O \
+	stereo_encode_pred.$O \
+	stereo_find_predictor.$O \
+	stereo_quant_pred.$O \
+	LPC_fit.$O \
+# silk/float \
+	apply_sine_window_FLP.$O \
+	corrMatrix_FLP.$O \
+	encode_frame_FLP.$O \
+	find_LPC_FLP.$O \
+	find_LTP_FLP.$O \
+	find_pitch_lags_FLP.$O \
+	find_pred_coefs_FLP.$O \
+	LPC_analysis_filter_FLP.$O \
+	LTP_analysis_filter_FLP.$O \
+	LTP_scale_ctrl_FLP.$O \
+	noise_shape_analysis_FLP.$O \
+	process_gains_FLP.$O \
+	regularize_correlations_FLP.$O \
+	residual_energy_FLP.$O \
+	warped_autocorrelation_FLP.$O \
+	wrappers_FLP.$O \
+	autocorrelation_FLP.$O \
+	burg_modified_FLP.$O \
+	bwexpander_FLP.$O \
+	energy_FLP.$O \
+	inner_product_FLP.$O \
+	k2a_FLP.$O \
+	LPC_inv_pred_gain_FLP.$O \
+	pitch_analysis_core_FLP.$O \
+	scale_copy_vector_FLP.$O \
+	scale_vector_FLP.$O \
+	schur_FLP.$O \
+	sort_FLP.$O \
+# celt \
+	bands.$O \
+	celt.$O \
+	celt_encoder.$O \
+	celt_decoder.$O \
+	cwrs.$O \
+	entcode.$O \
+	entdec.$O \
+	entenc.$O \
+	kiss_fft.$O \
+	laplace.$O \
+	mathops.$O \
+	mdct.$O \
+	modes.$O \
+	pitch.$O \
+	celt_lpc.$O \
+	quant_bands.$O \
+	rate.$O \
+	vq.$O \
+# src \
+	analysis.$O \
+	mlp.$O \
+	mlp_data.$O \
+	opus.$O \
+	opus_decoder.$O \
+	opus_encoder.$O \
+	opus_multistream.$O \
+	opus_multistream_encoder.$O \
+	opus_multistream_decoder.$O \
+	repacketizer.$O \
+	opus_projection_encoder.$O \
+	opus_projection_decoder.$O \
+	mapping_matrix.$O
+
+HFILES=\
+	/sys/include/ape/opus/opus.h \
+	/sys/include/ape/opus/opus_custom.h \
+	/sys/include/ape/opus/opus_defines.h \
+	/sys/include/ape/opus/opus_multistream.h \
+	/sys/include/ape/opus/opus_projection.h \
+	/sys/include/ape/opus/opus_types.h \
+
+UPDATE=\
+	mkfile\
+	$HFILES\
+	${OFILES:%.$O=%.c}\
+
+</sys/src/cmd/mksyslib
+
+CFLAGS=$CFLAGS -c -Iinclude -Isilk -Isilk/fixed -Isilk/float -Icelt \
+	-DPACKAGE_VERSION="$VERSION" \
+	-DOPUS_BUILD \
+	-DCUSTOM_MODES \
+	-DNONTHREADSAFE_PSEUDOSTACK \
+	-DHAVE_STDINT_H
+
+%.$O:	silk/%.c
+	$CC $CFLAGS silk/$stem.c
+
+%.$O:	silk/fixed/%.c
+	$CC $CFLAGS silk/fixed/$stem.c
+
+%.$O:	silk/float/%.c
+	$CC $CFLAGS silk/float/$stem.c
+
+%.$O:	celt/%.c
+	$CC $CFLAGS celt/$stem.c
+
+%.$O:	src/%.c
+	$CC $CFLAGS src/$stem.c
+
+$HFILES:
+	mkdir -p /sys/include/ape/opus
+	dircp include /sys/include/ape/opus
--- a/silk/LPC_inv_pred_gain.c
+++ b/silk/LPC_inv_pred_gain.c
@@ -45,7 +45,7 @@
 )
 {
     opus_int   k, n, mult2Q;
-    opus_int32 invGain_Q30, rc_Q31, rc_mult1_Q30, rc_mult2, tmp1, tmp2;
+    opus_int32 invGain_Q30, rc_Q31, rc_mult1_Q30, rc_mult2, tmp1, tmp2, tmp3;
 
     invGain_Q30 = SILK_FIX_CONST( 1, 30 );
     for( k = order - 1; k > 0; k-- ) {
@@ -80,14 +80,14 @@
             opus_int64 tmp64;
             tmp1 = A_QA[ n ];
             tmp2 = A_QA[ k - n - 1 ];
-            tmp64 = silk_RSHIFT_ROUND64( silk_SMULL( silk_SUB_SAT32(tmp1,
-                  MUL32_FRAC_Q( tmp2, rc_Q31, 31 ) ), rc_mult2 ), mult2Q);
+            tmp3 = silk_SUB_SAT32(tmp1, MUL32_FRAC_Q( tmp2, rc_Q31, 31 ) );
+            tmp64 = silk_RSHIFT_ROUND64( silk_SMULL(tmp3, rc_mult2 ), mult2Q);
             if( tmp64 > silk_int32_MAX || tmp64 < silk_int32_MIN ) {
                return 0;
             }
             A_QA[ n ] = ( opus_int32 )tmp64;
-            tmp64 = silk_RSHIFT_ROUND64( silk_SMULL( silk_SUB_SAT32(tmp2,
-                  MUL32_FRAC_Q( tmp1, rc_Q31, 31 ) ), rc_mult2), mult2Q);
+            tmp3 = silk_SUB_SAT32(tmp2, MUL32_FRAC_Q( tmp1, rc_Q31, 31 ) );
+            tmp64 = silk_RSHIFT_ROUND64( silk_SMULL(tmp3, rc_mult2), mult2Q);
             if( tmp64 > silk_int32_MAX || tmp64 < silk_int32_MIN ) {
                return 0;
             }