2
#include <sampleformat.h>
3
#include <float_cast.h>
8
#define SWAP_ENDIAN(n) ((n >> 8)|(n << 8))
9
#define CLAMP(i, min, max) if(i<min)i=min;if(i>max)i=max;
11
#define CONVERSION_FUNC_START \
13
for(i = 0; i < ctx->input_format.num_channels; i++)\
15
for(j = 0; j < ctx->input_frame->valid_samples; j++) \
18
#define CONVERSION_FUNC_END \
22
#define U_8 channels.u_8[i][j]
23
#define S_8 channels.s_8[i][j]
24
#define U_16 channels.u_16[i][j]
25
#define S_16 channels.s_16[i][j]
26
#define S_32 channels.s_32[i][j]
27
#define FLOAT channels.f[i][j]
29
#define RENAME(a) a ## _ni
31
#include "_sampleformat_c.c"
33
#undef CONVERSION_FUNC_START
34
#undef CONVERSION_FUNC_END
47
#define CONVERSION_FUNC_START \
49
imax = ctx->input_format.num_channels * ctx->input_frame->valid_samples; \
50
for(i = 0; i < imax; i++)\
53
#define CONVERSION_FUNC_END \
56
#define U_8 samples.u_8[i]
57
#define S_8 samples.s_8[i]
58
#define U_16 samples.u_16[i]
59
#define S_16 samples.s_16[i]
60
#define S_32 samples.s_32[i]
61
#define FLOAT samples.f[i]
63
#define RENAME(a) a ## _i
65
#include "_sampleformat_c.c"
67
void gavl_init_sampleformat_funcs_c(gavl_sampleformat_table_t * t, gavl_interleave_mode_t interleave_mode)
69
if(interleave_mode == GAVL_INTERLEAVE_NONE)
70
return gavl_init_sampleformat_funcs_c_ni(t);
71
else if(interleave_mode == GAVL_INTERLEAVE_ALL)
72
return gavl_init_sampleformat_funcs_c_i(t);
75
fprintf(stderr, "BUUUG: Unsupported interleave mode for sampleformat conversion\n");