History

port to Plan 9

Sigrid Solveig Haflínudóttir committed 6 years ago

Commit f87eb661 parent ca5618d13 files · +68 −12Browse files

Unified · Split

13 files
  1. src/mkfile +25 −0
  2. src/plan9.c +19 −0
  3. src/plan9/assert.h +0 −0
  4. src/plan9/config.h +17 −0
  5. src/plan9/math.h +0 −0
  6. src/plan9/stdint.h +0 −0
  7. src/plan9/stdio.h +0 −0
  8. src/plan9/stdlib.h +0 −0
  9. src/plan9/string.h +0 −0
  10. src/samplerate.h +1 −0
  11. src/src_linear.c +2 −4
  12. src/src_sinc.c +4 −6
  13. src/src_zoh.c +0 −2
src/mkfile+25−0
@@ -0,0 +1,25 @@
1</$objtype/mkfile
2LIB=/$objtype/lib/libsamplerate.a
3
4CFLAGS=$CFLAGS -p -Iplan9 -DHAVE_CONFIG_H
5
6OFILES=\
7 plan9.$O\
8 samplerate.$O\
9 src_linear.$O\
10 src_sinc.$O\
11 src_zoh.$O\
12
13HFILES=\
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
src/plan9.c+19−0
@@ -0,0 +1,19 @@
1int
2lrintf(float f)
3{
4 int i;
5
6 *((float*)&i) = f + 12582912.0f;
7
8 return (i & 0x7fffff) - 0x400000;
9}
10
11long
12lrint(double d)
13{
14 long long l;
15
16 *((double*)&l) = d + 6755399441055744.0;
17
18 return l;
19}
src/plan9/assert.h+0−0

Empty file added.

src/plan9/config.h+17−0
@@ -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
13typedef enum { false, true } bool;
14typedef s32int int32_t;
15
16int lrintf(float f);
17long lrint(double d);
src/plan9/math.h+0−0

Empty file added.

src/plan9/stdint.h+0−0

Empty file added.

src/plan9/stdio.h+0−0

Empty file added.

src/plan9/stdlib.h+0−0

Empty file added.

src/plan9/string.h+0−0

Empty file added.

src/samplerate.h+1−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
18extern "C" {18extern "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. */
23typedef struct SRC_STATE_tag SRC_STATE ;24typedef struct SRC_STATE_tag SRC_STATE ;
src/src_linear.c+2−4
@@ -228,7 +228,7 @@ linear_state_new (int channels, SRC_ERROR *error) · 227 unmodified lines
228 228
229static void229static void
230linear_reset (SRC_STATE *state)230linear_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
243SRC_STATE *243static SRC_STATE *
244linear_copy (SRC_STATE *state)244linear_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 */
src/src_sinc.c+4−6
@@ -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
573SRC_ERROR573static SRC_ERROR
574sinc_stereo_vari_process (SRC_STATE *state, SRC_DATA *data)574sinc_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
729SRC_ERROR729static SRC_ERROR
730sinc_quad_vari_process (SRC_STATE *state, SRC_DATA *data)730sinc_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
884SRC_ERROR884static SRC_ERROR
885sinc_hex_vari_process (SRC_STATE *state, SRC_DATA *data)885sinc_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
1144static SRC_ERROR1144static SRC_ERROR
1145prepare_data (SINC_FILTER *filter, int channels, SRC_DATA *data, int half_filter_chan_len)1145prepare_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 */
src/src_zoh.c+0−2
@@ -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 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t