1 /*
2 * Copyright (C) 2012-2013 Michael Niedermayer (michaelni@gmx.at)
3 *
4 * This file is part of libswresample
5 *
6 * libswresample is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * libswresample is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with libswresample; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
23
25
27 double scale =
s->dither.noise_scale;
28 #define TMP_EXTRA 2
31
34
36 double v;
38
39 switch(
s->dither.method){
41 default:
46 break;
47 }
49 }
50
52 double v;
53
54 switch(
s->dither.method){
55 default:
58 break;
61 break;
62 }
63
65
66 switch(noise_fmt){
72 }
73 }
74
76 return 0;
77 }
78
80 {
83
86
89
94 }
99
101
103 scale *= 1<<(32-
s->dither.output_sample_bits);
104
106 s->dither.method = 0;
107 return 0;
108 }
109
110 s->dither.ns_pos = 0;
111 s->dither.noise_scale=
scale;
112 s->dither.ns_scale =
scale;
114 memset(
s->dither.ns_errors, 0,
sizeof(
s->dither.ns_errors));
117 if (llabs(
s->out_sample_rate -
f->rate)*20 <=
f->rate &&
f->name ==
s->dither.method) {
118 int j;
119 s->dither.ns_taps =
f->len;
120 for (j=0; j<
f->len; j++)
121 s->dither.ns_coeffs[j] =
f->coefs[j];
123 break;
124 }
125 }
127 av_log(
s,
AV_LOG_WARNING,
"Requested noise shaping dither not available at this sampling rate, using triangular hp dither\n");
129 }
130
131 return 0;
132 }
133
134 #define TEMPLATE_DITHER_S16
136 #undef TEMPLATE_DITHER_S16
137
138 #define TEMPLATE_DITHER_S32
140 #undef TEMPLATE_DITHER_S32
141
142 #define TEMPLATE_DITHER_FLT
144 #undef TEMPLATE_DITHER_FLT
145
146 #define TEMPLATE_DITHER_DBL
148 #undef TEMPLATE_DITHER_DBL