FFmpeg
|
Dithered Audio Sample Quantization. More...
#include <math.h>
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/lfg.h"
#include "libavutil/mem.h"
#include "libavutil/samplefmt.h"
#include "audio_convert.h"
#include "dither.h"
#include "internal.h"
Go to the source code of this file.
Data Structures | |
struct | DitherState |
struct | DitherContext |
Macros | |
#define | MUTE_THRESHOLD_SEC 0.000333 |
#define | S16_SCALE 32753.0f |
#define | LFG_SCALE (1.0f / (2.0f * INT32_MAX)) |
#define | SQRT_1_6 0.40824829046386301723f |
Functions | |
static void | dither_int_to_float_rectangular_c (float *dst, int *src, int len) |
static void | dither_int_to_float_triangular_c (float *dst, int *src0, int len) |
static void | quantize_c (int16_t *dst, const float *src, float *dither, int len) |
static void | dither_highpass_filter (float *src, int len) |
static int | generate_dither_noise (DitherContext *c, DitherState *state, int min_samples) |
static void | quantize_triangular_ns (DitherContext *c, DitherState *state, int16_t *dst, const float *src, int nb_samples) |
static int | convert_samples (DitherContext *c, int16_t **dst, float *const *src, int channels, int nb_samples) |
int | ff_convert_dither (DitherContext *c, AudioData *dst, AudioData *src) |
Convert audio sample format with dithering. | |
void | ff_dither_free (DitherContext **cp) |
Free a DitherContext. | |
static av_cold void | dither_init (DitherDSPContext *ddsp, enum AVResampleDitherMethod method) |
DitherContext * | ff_dither_alloc (AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) |
Allocate and initialize a DitherContext. | |
Variables | |
static const float | ns_48_coef_b [4] |
static const float | ns_48_coef_a [4] |
static const float | ns_44_coef_b [4] |
static const float | ns_44_coef_a [4] |
Dithered Audio Sample Quantization.
Converts from dbl, flt, or s32 to s16 using dithering.
Definition in file dither.c.
#define MUTE_THRESHOLD_SEC 0.000333 |
Definition at line 78 of file dither.c.
Referenced by ff_dither_alloc().
#define S16_SCALE 32753.0f |
Definition at line 82 of file dither.c.
Referenced by quantize_c(), and quantize_triangular_ns().
#define LFG_SCALE (1.0f / (2.0f * INT32_MAX)) |
Definition at line 85 of file dither.c.
Referenced by dither_int_to_float_rectangular_c(), and dither_int_to_float_triangular_c().
#define SQRT_1_6 0.40824829046386301723f |
Definition at line 131 of file dither.c.
Referenced by dither_highpass_filter().
|
static |
Definition at line 105 of file dither.c.
Referenced by dither_init().
|
static |
Definition at line 112 of file dither.c.
Referenced by dither_init().
|
static |
Definition at line 124 of file dither.c.
Referenced by dither_init(), and ff_convert_dither().
|
static |
Definition at line 133 of file dither.c.
Referenced by generate_dither_noise().
|
static |
Definition at line 142 of file dither.c.
Referenced by convert_samples(), and ff_dither_alloc().
|
static |
Definition at line 172 of file dither.c.
Referenced by convert_samples().
|
static |
Definition at line 211 of file dither.c.
Referenced by ff_convert_dither().
int ff_convert_dither | ( | DitherContext * | c, |
AudioData * | dst, | ||
AudioData * | src | ||
) |
Convert audio sample format with dithering.
c | DitherContext |
dst | destination audio data |
src | source audio data |
void ff_dither_free | ( | DitherContext ** | c | ) |
Free a DitherContext.
c | DitherContext |
Definition at line 312 of file dither.c.
Referenced by ff_dither_alloc().
|
static |
Definition at line 329 of file dither.c.
Referenced by ff_dither_alloc().
DitherContext* ff_dither_alloc | ( | AVAudioResampleContext * | avr, |
enum AVSampleFormat | out_fmt, | ||
enum AVSampleFormat | in_fmt, | ||
int | channels, | ||
int | sample_rate, | ||
int | apply_map | ||
) |
Allocate and initialize a DitherContext.
The parameters in the AVAudioResampleContext are used to initialize the DitherContext.
avr | AVAudioResampleContext |
|
static |
Definition at line 89 of file dither.c.
Referenced by ff_dither_alloc().
|
static |
Definition at line 93 of file dither.c.
Referenced by ff_dither_alloc().
|
static |
Definition at line 97 of file dither.c.
Referenced by ff_dither_alloc().
|
static |
Definition at line 101 of file dither.c.
Referenced by ff_dither_alloc().