Unified · Split
| @@ -0,0 +1,25 @@ | |||
| 1 | </$objtype/mkfile | ||
| 2 | LIB=/$objtype/lib/libsamplerate.a | ||
| 3 | |||
| 4 | CFLAGS=$CFLAGS -p -Iplan9 -DHAVE_CONFIG_H | ||
| 5 | |||
| 6 | OFILES=\ | ||
| 7 | plan9.$O\ | ||
| 8 | samplerate.$O\ | ||
| 9 | src_linear.$O\ | ||
| 10 | src_sinc.$O\ | ||
| 11 | src_zoh.$O\ | ||
| 12 | |||
| 13 | HFILES=\ | ||
| 14 | /sys/include/samplerate.h\ | ||
| 15 | common.h\ | ||
| 16 | fastest_coeffs.h\ | ||
| 17 | high_qual_coeffs.h\ | ||
| 18 | mid_qual_coeffs.h\ | ||
| 19 | samplerate.h\ | ||
| 20 | src_config.h\ | ||
| 21 | |||
| 22 | /sys/include/%.h: %.h | ||
| 23 | cp $stem.h /sys/include/$stem.h | ||
| 24 | |||
| 25 | </sys/src/cmd/mksyslib | ||
| @@ -0,0 +1,19 @@ | |||
| 1 | int | ||
| 2 | lrintf(float f) | ||
| 3 | { | ||
| 4 | int i; | ||
| 5 | |||
| 6 | *((float*)&i) = f + 12582912.0f; | ||
| 7 | |||
| 8 | return (i & 0x7fffff) - 0x400000; | ||
| 9 | } | ||
| 10 | |||
| 11 | long | ||
| 12 | lrint(double d) | ||
| 13 | { | ||
| 14 | long long l; | ||
| 15 | |||
| 16 | *((double*)&l) = d + 6755399441055744.0; | ||
| 17 | |||
| 18 | return l; | ||
| 19 | } | ||
Empty file added.
| @@ -0,0 +1,17 @@ | |||
| 1 | #include <u.h> | ||
| 2 | #include <libc.h> | ||
| 3 | |||
| 4 | #define SIZEOF_INT sizeof(int) | ||
| 5 | #define SIZEOF_LONG sizeof(long) | ||
| 6 | #define CPU_IS_LITTLE_ENDIAN | ||
| 7 | #define PACKAGE "libsamplerate" | ||
| 8 | #define VERSION "nein" | ||
| 9 | |||
| 10 | #define NULL nil | ||
| 11 | #define UNUSED(x) USED(x) | ||
| 12 | |||
| 13 | typedef enum { false, true } bool; | ||
| 14 | typedef s32int int32_t; | ||
| 15 | |||
| 16 | int lrintf(float f); | ||
| 17 | long lrint(double d); | ||
Empty file added.
Empty file added.
Empty file added.
Empty file added.
Empty file added.
| @@ -18,6 +18,7 @@ · 17 unmodified lines | |||
| 18 | extern "C" { | 18 | extern "C" { |
| 19 | #endif /* __cplusplus */ | 19 | #endif /* __cplusplus */ |
| 20 | 20 | ||
| 21 | #pragma lib "libsamplerate.a" | ||
| 21 | 22 | ||
| 22 | /* Opaque data type SRC_STATE. */ | 23 | /* Opaque data type SRC_STATE. */ |
| 23 | typedef struct SRC_STATE_tag SRC_STATE ; | 24 | typedef struct SRC_STATE_tag SRC_STATE ; |
| @@ -228,7 +228,7 @@ linear_state_new (int channels, SRC_ERROR *error) · 227 unmodified lines | |||
| 228 | 228 | ||
| 229 | static void | 229 | static void |
| 230 | linear_reset (SRC_STATE *state) | 230 | linear_reset (SRC_STATE *state) |
| 231 | { LINEAR_DATA *priv = NULL ; | 231 | { LINEAR_DATA *priv ; |
| 232 | 232 | ||
| 233 | priv = (LINEAR_DATA*) state->private_data ; | 233 | priv = (LINEAR_DATA*) state->private_data ; |
| 234 | if (priv == NULL) | 234 | if (priv == NULL) |
| @@ -240,7 +240,7 @@ linear_reset (SRC_STATE *state) · 5 unmodified lines | |||
| 240 | return ; | 240 | return ; |
| 241 | } /* linear_reset */ | 241 | } /* linear_reset */ |
| 242 | 242 | ||
| 243 | SRC_STATE * | 243 | static SRC_STATE * |
| 244 | linear_copy (SRC_STATE *state) | 244 | linear_copy (SRC_STATE *state) |
| 245 | { | 245 | { |
| 246 | assert (state != NULL) ; | 246 | assert (state != NULL) ; |
| @@ -290,9 +290,7 @@ linear_close (SRC_STATE *state) · 43 unmodified lines | |||
| 290 | linear->last_value = NULL ; | 290 | linear->last_value = NULL ; |
| 291 | } | 291 | } |
| 292 | free (linear) ; | 292 | free (linear) ; |
| 293 | linear = NULL ; | ||
| 294 | } | 293 | } |
| 295 | free (state) ; | 294 | free (state) ; |
| 296 | state = NULL ; | ||
| 297 | } | 295 | } |
| 298 | } /* linear_close */ | 296 | } /* linear_close */ |
| @@ -570,7 +570,7 @@ calc_output_stereo (SINC_FILTER *filter, int channels, increment_t increment, in · 569 unmodified lines | |||
| 570 | output [ch] = (float) (scale * (left [ch] + right [ch])) ; | 570 | output [ch] = (float) (scale * (left [ch] + right [ch])) ; |
| 571 | } /* calc_output_stereo */ | 571 | } /* calc_output_stereo */ |
| 572 | 572 | ||
| 573 | SRC_ERROR | 573 | static SRC_ERROR |
| 574 | sinc_stereo_vari_process (SRC_STATE *state, SRC_DATA *data) | 574 | sinc_stereo_vari_process (SRC_STATE *state, SRC_DATA *data) |
| 575 | { SINC_FILTER *filter ; | 575 | { SINC_FILTER *filter ; |
| 576 | double input_index, src_ratio, count, float_increment, terminate, rem ; | 576 | double input_index, src_ratio, count, float_increment, terminate, rem ; |
| @@ -726,7 +726,7 @@ calc_output_quad (SINC_FILTER *filter, int channels, increment_t increment, incr · 149 unmodified lines | |||
| 726 | output [ch] = (float) (scale * (left [ch] + right [ch])) ; | 726 | output [ch] = (float) (scale * (left [ch] + right [ch])) ; |
| 727 | } /* calc_output_quad */ | 727 | } /* calc_output_quad */ |
| 728 | 728 | ||
| 729 | SRC_ERROR | 729 | static SRC_ERROR |
| 730 | sinc_quad_vari_process (SRC_STATE *state, SRC_DATA *data) | 730 | sinc_quad_vari_process (SRC_STATE *state, SRC_DATA *data) |
| 731 | { SINC_FILTER *filter ; | 731 | { SINC_FILTER *filter ; |
| 732 | double input_index, src_ratio, count, float_increment, terminate, rem ; | 732 | double input_index, src_ratio, count, float_increment, terminate, rem ; |
| @@ -881,7 +881,7 @@ calc_output_hex (SINC_FILTER *filter, int channels, increment_t increment, incre · 148 unmodified lines | |||
| 881 | output [ch] = (float) (scale * (left [ch] + right [ch])) ; | 881 | output [ch] = (float) (scale * (left [ch] + right [ch])) ; |
| 882 | } /* calc_output_hex */ | 882 | } /* calc_output_hex */ |
| 883 | 883 | ||
| 884 | SRC_ERROR | 884 | static SRC_ERROR |
| 885 | sinc_hex_vari_process (SRC_STATE *state, SRC_DATA *data) | 885 | sinc_hex_vari_process (SRC_STATE *state, SRC_DATA *data) |
| 886 | { SINC_FILTER *filter ; | 886 | { SINC_FILTER *filter ; |
| 887 | double input_index, src_ratio, count, float_increment, terminate, rem ; | 887 | double input_index, src_ratio, count, float_increment, terminate, rem ; |
| @@ -1143,7 +1143,7 @@ sinc_multichan_vari_process (SRC_STATE *state, SRC_DATA *data) · 255 unmodified lines | |||
| 1143 | 1143 | ||
| 1144 | static SRC_ERROR | 1144 | static SRC_ERROR |
| 1145 | prepare_data (SINC_FILTER *filter, int channels, SRC_DATA *data, int half_filter_chan_len) | 1145 | prepare_data (SINC_FILTER *filter, int channels, SRC_DATA *data, int half_filter_chan_len) |
| 1146 | { int len = 0 ; | 1146 | { int len ; |
| 1147 | 1147 | ||
| 1148 | if (filter->b_real_end >= 0) | 1148 | if (filter->b_real_end >= 0) |
| 1149 | return SRC_ERR_NO_ERROR ; /* Should be terminating. Just return. */ | 1149 | return SRC_ERR_NO_ERROR ; /* Should be terminating. Just return. */ |
| @@ -1231,9 +1231,7 @@ sinc_close (SRC_STATE *state) · 81 unmodified lines | |||
| 1231 | sinc->buffer = NULL ; | 1231 | sinc->buffer = NULL ; |
| 1232 | } | 1232 | } |
| 1233 | free (sinc) ; | 1233 | free (sinc) ; |
| 1234 | sinc = NULL ; | ||
| 1235 | } | 1234 | } |
| 1236 | free (state) ; | 1235 | free (state) ; |
| 1237 | state = NULL ; | ||
| 1238 | } | 1236 | } |
| 1239 | } /* sinc_close */ | 1237 | } /* sinc_close */ |
| @@ -279,9 +279,7 @@ zoh_close (SRC_STATE *state) · 278 unmodified lines | |||
| 279 | zoh->last_value = NULL ; | 279 | zoh->last_value = NULL ; |
| 280 | } | 280 | } |
| 281 | free (zoh) ; | 281 | free (zoh) ; |
| 282 | zoh = NULL ; | ||
| 283 | } | 282 | } |
| 284 | free (state) ; | 283 | free (state) ; |
| 285 | state = NULL ; | ||
| 286 | } | 284 | } |
| 287 | } /* zoh_close */ | 285 | } /* zoh_close */ |