diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-09 18:03:49 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-09 18:25:06 +0100 |
commit | 82742294b7a866b89d6fd228b0692867d9e08fcd (patch) | |
tree | 054242b79f9f2ad1dfa6b85d5bbfe3e24d83d3ed /libswresample/swresample_internal.h | |
parent | 5b69c07d12b1e505fd7468828ed85d6d8d634621 (diff) | |
download | ffmpeg-82742294b7a866b89d6fd228b0692867d9e08fcd.tar.gz |
swr: Implement Noise shaping dither
The following variants are implemented:
lipshitz noise shaping dither
shibata noise shaping dither
low shibata noise shaping dither
high shibata noise shaping dither
f-weighted noise shaping dither
modified-e-weighted noise shaping dither
improved-e-weighted noise shaping dither
Data tables taken from SOX
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/swresample_internal.h')
-rw-r--r-- | libswresample/swresample_internal.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h index 70a361ba9e..ffbd4d0e7f 100644 --- a/libswresample/swresample_internal.h +++ b/libswresample/swresample_internal.h @@ -27,6 +27,8 @@ #define SQRT3_2 1.22474487139158904909 /* sqrt(3/2) */ +#define NS_TAPS 20 + #if ARCH_X86_64 typedef int64_t integer; #else @@ -71,6 +73,13 @@ struct SwrContext { enum SwrDitherType dither_method; int dither_pos; float dither_scale; + int ns_taps; ///< Noise shaping dither taps + float ns_scale; ///< Noise shaping dither scale + float ns_scale_1; ///< Noise shaping dither scale^-1 + int ns_pos; ///< Noise shaping dither position + float ns_coeffs[NS_TAPS]; ///< Noise shaping filter coefficients + float ns_errors[SWR_CH_MAX][2*NS_TAPS]; + int filter_size; /**< length of each FIR filter in the resampling filterbank relative to the cutoff frequency */ int phase_shift; /**< log2 of the number of entries in the resampling polyphase filterbank */ int linear_interp; /**< if 1 then the resampling FIR filter will be linearly interpolated */ @@ -152,6 +161,11 @@ int swri_resample_int32(struct ResampleContext *c, int32_t *dst, const int32_t * int swri_resample_float(struct ResampleContext *c, float *dst, const float *src, int *consumed, int src_size, int dst_size, int update_ctx); int swri_resample_double(struct ResampleContext *c,double *dst, const double *src, int *consumed, int src_size, int dst_size, int update_ctx); +void swri_noise_shaping_int16 (SwrContext *s, AudioData *srcs, AudioData *noises, int count); +void swri_noise_shaping_int32 (SwrContext *s, AudioData *srcs, AudioData *noises, int count); +void swri_noise_shaping_float (SwrContext *s, AudioData *srcs, AudioData *noises, int count); +void swri_noise_shaping_double(SwrContext *s, AudioData *srcs, AudioData *noises, int count); + int swri_rematrix_init(SwrContext *s); void swri_rematrix_free(SwrContext *s); int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy); |