... | ... |
@@ -27,7 +27,7 @@ |
27 | 27 |
#include "audio_data.h" |
28 | 28 |
#include "audio_mix.h" |
29 | 29 |
|
30 |
-static const char *coeff_type_names[] = { "q6", "q15", "flt" }; |
|
30 |
+static const char *coeff_type_names[] = { "q8", "q15", "flt" }; |
|
31 | 31 |
|
32 | 32 |
void ff_audio_mix_set_func(AudioMix *am, enum AVSampleFormat fmt, |
33 | 33 |
enum AVMixCoeffType coeff_type, int in_channels, |
... | ... |
@@ -89,7 +89,7 @@ static void MIX_FUNC_NAME(fmt, cfmt)(stype **samples, ctype **matrix, \ |
89 | 89 |
MIX_FUNC_GENERIC(FLTP, FLT, float, float, float, sum) |
90 | 90 |
MIX_FUNC_GENERIC(S16P, FLT, int16_t, float, float, av_clip_int16(lrintf(sum))) |
91 | 91 |
MIX_FUNC_GENERIC(S16P, Q15, int16_t, int32_t, int64_t, av_clip_int16(sum >> 15)) |
92 |
-MIX_FUNC_GENERIC(S16P, Q6, int16_t, int16_t, int32_t, av_clip_int16(sum >> 6)) |
|
92 |
+MIX_FUNC_GENERIC(S16P, Q8, int16_t, int16_t, int32_t, av_clip_int16(sum >> 8)) |
|
93 | 93 |
|
94 | 94 |
/* TODO: templatize the channel-specific C functions */ |
95 | 95 |
|
... | ... |
@@ -221,8 +221,8 @@ static int mix_function_init(AudioMix *am) |
221 | 221 |
ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_Q15, |
222 | 222 |
0, 0, 1, 1, "C", MIX_FUNC_NAME(S16P, Q15)); |
223 | 223 |
|
224 |
- ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_Q6, |
|
225 |
- 0, 0, 1, 1, "C", MIX_FUNC_NAME(S16P, Q6)); |
|
224 |
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_Q8, |
|
225 |
+ 0, 0, 1, 1, "C", MIX_FUNC_NAME(S16P, Q8)); |
|
226 | 226 |
|
227 | 227 |
/* channel-specific C versions */ |
228 | 228 |
|
... | ... |
@@ -320,7 +320,7 @@ void ff_audio_mix_close(AudioMix *am) |
320 | 320 |
av_free(am->matrix[0]); |
321 | 321 |
am->matrix = NULL; |
322 | 322 |
} |
323 |
- memset(am->matrix_q6, 0, sizeof(am->matrix_q6 )); |
|
323 |
+ memset(am->matrix_q8, 0, sizeof(am->matrix_q8 )); |
|
324 | 324 |
memset(am->matrix_q15, 0, sizeof(am->matrix_q15)); |
325 | 325 |
memset(am->matrix_flt, 0, sizeof(am->matrix_flt)); |
326 | 326 |
} |
... | ... |
@@ -47,7 +47,7 @@ typedef struct AudioMix { |
47 | 47 |
mix_func *mix; |
48 | 48 |
mix_func *mix_generic; |
49 | 49 |
|
50 |
- int16_t *matrix_q6[AVRESAMPLE_MAX_CHANNELS]; |
|
50 |
+ int16_t *matrix_q8[AVRESAMPLE_MAX_CHANNELS]; |
|
51 | 51 |
int32_t *matrix_q15[AVRESAMPLE_MAX_CHANNELS]; |
52 | 52 |
float *matrix_flt[AVRESAMPLE_MAX_CHANNELS]; |
53 | 53 |
void **matrix; |
... | ... |
@@ -257,14 +257,14 @@ int avresample_get_matrix(AVAudioResampleContext *avr, double *matrix, |
257 | 257 |
} |
258 | 258 |
|
259 | 259 |
switch (avr->mix_coeff_type) { |
260 |
- case AV_MIX_COEFF_TYPE_Q6: |
|
261 |
- if (!avr->am->matrix_q6[0]) { |
|
260 |
+ case AV_MIX_COEFF_TYPE_Q8: |
|
261 |
+ if (!avr->am->matrix_q8[0]) { |
|
262 | 262 |
av_log(avr, AV_LOG_ERROR, "matrix is not set\n"); |
263 | 263 |
return AVERROR(EINVAL); |
264 | 264 |
} |
265 | 265 |
for (o = 0; o < out_channels; o++) |
266 | 266 |
for (i = 0; i < in_channels; i++) |
267 |
- matrix[o * stride + i] = avr->am->matrix_q6[o][i] / 64.0; |
|
267 |
+ matrix[o * stride + i] = avr->am->matrix_q8[o][i] / 256.0; |
|
268 | 268 |
break; |
269 | 269 |
case AV_MIX_COEFF_TYPE_Q15: |
270 | 270 |
if (!avr->am->matrix_q15[0]) { |
... | ... |
@@ -325,8 +325,8 @@ int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix, |
325 | 325 |
avr->am->matrix = (void **)avr->am->matrix_## type; |
326 | 326 |
|
327 | 327 |
switch (avr->mix_coeff_type) { |
328 |
- case AV_MIX_COEFF_TYPE_Q6: |
|
329 |
- CONVERT_MATRIX(q6, av_clip_int16(lrint(64.0 * v))) |
|
328 |
+ case AV_MIX_COEFF_TYPE_Q8: |
|
329 |
+ CONVERT_MATRIX(q8, av_clip_int16(lrint(256.0 * v))) |
|
330 | 330 |
break; |
331 | 331 |
case AV_MIX_COEFF_TYPE_Q15: |
332 | 332 |
CONVERT_MATRIX(q15, av_clipl_int32(llrint(32768.0 * v))) |
... | ... |
@@ -39,7 +39,7 @@ typedef struct AVAudioResampleContext AVAudioResampleContext; |
39 | 39 |
|
40 | 40 |
/** Mixing Coefficient Types */ |
41 | 41 |
enum AVMixCoeffType { |
42 |
- AV_MIX_COEFF_TYPE_Q6, /** 16-bit 10.6 fixed-point */ |
|
42 |
+ AV_MIX_COEFF_TYPE_Q8, /** 16-bit 8.8 fixed-point */ |
|
43 | 43 |
AV_MIX_COEFF_TYPE_Q15, /** 32-bit 17.15 fixed-point */ |
44 | 44 |
AV_MIX_COEFF_TYPE_FLT, /** floating-point */ |
45 | 45 |
AV_MIX_COEFF_TYPE_NB, /** Number of coeff types. Not part of ABI */ |
... | ... |
@@ -40,8 +40,8 @@ static const AVOption options[] = { |
40 | 40 |
{ "out_sample_fmt", "Output Sample Format", OFFSET(out_sample_fmt), AV_OPT_TYPE_INT, { AV_SAMPLE_FMT_S16 }, AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_NB-1, PARAM }, |
41 | 41 |
{ "out_sample_rate", "Output Sample Rate", OFFSET(out_sample_rate), AV_OPT_TYPE_INT, { 48000 }, 1, INT_MAX, PARAM }, |
42 | 42 |
{ "internal_sample_fmt", "Internal Sample Format", OFFSET(internal_sample_fmt), AV_OPT_TYPE_INT, { AV_SAMPLE_FMT_FLTP }, AV_SAMPLE_FMT_NONE, AV_SAMPLE_FMT_NB-1, PARAM }, |
43 |
- { "mix_coeff_type", "Mixing Coefficient Type", OFFSET(mix_coeff_type), AV_OPT_TYPE_INT, { AV_MIX_COEFF_TYPE_FLT }, AV_MIX_COEFF_TYPE_Q6, AV_MIX_COEFF_TYPE_NB-1, PARAM, "mix_coeff_type" }, |
|
44 |
- { "q6", "16-bit 10.6 Fixed-Point", 0, AV_OPT_TYPE_CONST, { AV_MIX_COEFF_TYPE_Q6 }, INT_MIN, INT_MAX, PARAM, "mix_coeff_type" }, |
|
43 |
+ { "mix_coeff_type", "Mixing Coefficient Type", OFFSET(mix_coeff_type), AV_OPT_TYPE_INT, { AV_MIX_COEFF_TYPE_FLT }, AV_MIX_COEFF_TYPE_Q8, AV_MIX_COEFF_TYPE_NB-1, PARAM, "mix_coeff_type" }, |
|
44 |
+ { "q8", "16-bit 8.8 Fixed-Point", 0, AV_OPT_TYPE_CONST, { AV_MIX_COEFF_TYPE_Q8 }, INT_MIN, INT_MAX, PARAM, "mix_coeff_type" }, |
|
45 | 45 |
{ "q15", "32-bit 17.15 Fixed-Point", 0, AV_OPT_TYPE_CONST, { AV_MIX_COEFF_TYPE_Q15 }, INT_MIN, INT_MAX, PARAM, "mix_coeff_type" }, |
46 | 46 |
{ "flt", "Floating-Point", 0, AV_OPT_TYPE_CONST, { AV_MIX_COEFF_TYPE_FLT }, INT_MIN, INT_MAX, PARAM, "mix_coeff_type" }, |
47 | 47 |
{ "center_mix_level", "Center Mix Level", OFFSET(center_mix_level), AV_OPT_TYPE_DOUBLE, { M_SQRT1_2 }, -32.0, 32.0, PARAM }, |
... | ... |
@@ -21,7 +21,7 @@ |
21 | 21 |
|
22 | 22 |
#define LIBAVRESAMPLE_VERSION_MAJOR 0 |
23 | 23 |
#define LIBAVRESAMPLE_VERSION_MINOR 0 |
24 |
-#define LIBAVRESAMPLE_VERSION_MICRO 0 |
|
24 |
+#define LIBAVRESAMPLE_VERSION_MICRO 1 |
|
25 | 25 |
|
26 | 26 |
#define LIBAVRESAMPLE_VERSION_INT AV_VERSION_INT(LIBAVRESAMPLE_VERSION_MAJOR, \ |
27 | 27 |
LIBAVRESAMPLE_VERSION_MINOR, \ |