History

src/src_sinc.c : Adapt to change of coefficient storage.

Erik de Castro Lopo committed 19 years ago

Commit 5003d891 parent be0cfba2 files · +22 −34Browse files

Unified · Split

2 files
  1. ChangeLog +8 −0
  2. src/src_sinc.c +14 −34
ChangeLog+8−0
@@ -1,3 +1,11 @@
12007-06-15 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
2
3 * src/*_coeffs.h
4 Change the way the coefficients are defined for improved safety.
5
6 * src/src_sinc.c
7 Adapt to the above.
8
12007-05-24 Erik de Castro Lopo <erikd AT mega-nerd DOT com>92007-05-24 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
2 10
3 * src/src_sinc.c11 * src/src_sinc.c
src/src_sinc.c+14−34
@@ -47,6 +47,10 @@ · 46 unmodified lines
47typedef int32_t increment_t ;47typedef int32_t increment_t ;
48typedef float coeff_t ;48typedef float coeff_t ;
49 49
50#include "high_qual_coeffs.h"
51#include "mid_qual_coeffs.h"
52#include "fastest_coeffs.h"
53
50typedef struct54typedef struct
51{ int sinc_magic_marker ;55{ int sinc_magic_marker ;
52 56
@@ -55,11 +59,9 @@ typedef struct · 2 unmodified lines
55 long out_count, out_gen ;59 long out_count, out_gen ;
56 60
57 int coeff_half_len, index_inc ;61 int coeff_half_len, index_inc ;
58 int has_diffs ;
59 62
60 double src_ratio, input_index ;63 double src_ratio, input_index ;
61 64
62 int coeff_len ;
63 coeff_t const *coeffs ;65 coeff_t const *coeffs ;
64 66
65 int b_current, b_end, b_real_end, b_len ;67 int b_current, b_end, b_real_end, b_len ;
@@ -74,22 +76,6 @@ static void prepare_data (SINC_FILTER *filter, SRC_DATA *data, int half_filter_c · 8 unmodified lines
74 76
75static void sinc_reset (SRC_PRIVATE *psrc) ;77static void sinc_reset (SRC_PRIVATE *psrc) ;
76 78
77static coeff_t const high_qual_coeffs [] =
78{
79#include "../Octave/test.h"
80} ; /* high_qual_coeffs */
81
82static coeff_t const mid_qual_coeffs [] =
83{
84#include "mid_qual_coeffs.h"
85} ; /* mid_qual_coeffs */
86
87static coeff_t const fastest_coeffs [] =
88{
89#include "fastest_coeffs.h"
90} ; /* fastest_coeffs */
91
92
93static inline increment_t79static inline increment_t
94double_to_fp (double x)80double_to_fp (double x)
95{ if (sizeof (increment_t) == 8)81{ if (sizeof (increment_t) == 8)
@@ -184,27 +170,21 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) · 88 unmodified lines
184 170
185 switch (src_enum)171 switch (src_enum)
186 { case SRC_SINC_BEST_QUALITY :172 { case SRC_SINC_BEST_QUALITY :
187 temp_filter.coeffs = high_qual_coeffs ;173 temp_filter.coeffs = high_qual_coeffs.coeffs ;
188 temp_filter.coeff_half_len = ARRAY_LEN (high_qual_coeffs) - 1 ;174 temp_filter.coeff_half_len = ARRAY_LEN (high_qual_coeffs.coeffs) - 1 ;
189 temp_filter.index_inc = 512 ;175 temp_filter.index_inc = high_qual_coeffs.increment ;
190 temp_filter.has_diffs = SRC_FALSE ;
191 temp_filter.coeff_len = ARRAY_LEN (high_qual_coeffs) ;
192 break ;176 break ;
193 177
194 case SRC_SINC_MEDIUM_QUALITY :178 case SRC_SINC_MEDIUM_QUALITY :
195 temp_filter.coeffs = mid_qual_coeffs ;179 temp_filter.coeffs = mid_qual_coeffs.coeffs ;
196 temp_filter.coeff_half_len = ARRAY_LEN (mid_qual_coeffs) - 1 ;180 temp_filter.coeff_half_len = ARRAY_LEN (mid_qual_coeffs.coeffs) - 1 ;
197 temp_filter.index_inc = 128 ;181 temp_filter.index_inc = mid_qual_coeffs.increment ;
198 temp_filter.has_diffs = SRC_FALSE ;
199 temp_filter.coeff_len = ARRAY_LEN (mid_qual_coeffs) ;
200 break ;182 break ;
201 183
202 case SRC_SINC_FASTEST :184 case SRC_SINC_FASTEST :
203 temp_filter.coeffs = fastest_coeffs ;185 temp_filter.coeffs = fastest_coeffs.coeffs ;
204 temp_filter.coeff_half_len = ARRAY_LEN (fastest_coeffs) - 1 ;186 temp_filter.coeff_half_len = ARRAY_LEN (fastest_coeffs.coeffs) - 1 ;
205 temp_filter.index_inc = 128 ;187 temp_filter.index_inc = fastest_coeffs.increment ;
206 temp_filter.has_diffs = SRC_FALSE ;
207 temp_filter.coeff_len = ARRAY_LEN (fastest_coeffs) ;
208 break ;188 break ;
209 189
210 default :190 default :
@@ -216,7 +196,7 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) · 5 unmodified lines
216 ** a better way. Need to look at prepare_data () at the same time.196 ** a better way. Need to look at prepare_data () at the same time.
217 */197 */
218 198
219 temp_filter.b_len = 1000 + 2 * lrint (0.5 + temp_filter.coeff_len / (temp_filter.index_inc * 1.0) * SRC_MAX_RATIO) ;199 temp_filter.b_len = 1000 + 2 * lrint (0.5 + 2 * temp_filter.coeff_half_len / (temp_filter.index_inc * 1.0) * SRC_MAX_RATIO) ;
220 temp_filter.b_len = MIN (temp_filter.b_len, 4096) ;200 temp_filter.b_len = MIN (temp_filter.b_len, 4096) ;
221 temp_filter.b_len *= temp_filter.channels ;201 temp_filter.b_len *= temp_filter.channels ;
222 202

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t