Lines Matching refs:psf
56 static sf_count_t host_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
57 static sf_count_t host_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
58 static sf_count_t host_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
59 static sf_count_t host_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
61 static sf_count_t host_write_s2f (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
62 static sf_count_t host_write_i2f (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
63 static sf_count_t host_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
64 static sf_count_t host_write_d2f (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
66 static void float32_peak_update (SF_PRIVATE *psf, const float *buffer, int count, sf_count_t indx)…
68 static sf_count_t replace_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
69 static sf_count_t replace_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
70 static sf_count_t replace_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
71 static sf_count_t replace_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
73 static sf_count_t replace_write_s2f (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
74 static sf_count_t replace_write_i2f (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
75 static sf_count_t replace_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
76 static sf_count_t replace_write_d2f (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
81 static int float32_get_capability (SF_PRIVATE *psf) ;
88 float32_init (SF_PRIVATE *psf) in float32_init() argument
91 if (psf->sf.channels < 1) in float32_init()
92 { psf_log_printf (psf, "float32_init : internal error : channels = %d\n", psf->sf.channels) ; in float32_init()
96 float_caps = float32_get_capability (psf) ; in float32_init()
98 psf->blockwidth = sizeof (float) * psf->sf.channels ; in float32_init()
100 if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR) in float32_init()
101 { switch (psf->endian + float_caps) in float32_init()
103 psf->data_endswap = SF_FALSE ; in float32_init()
104 psf->read_short = host_read_f2s ; in float32_init()
105 psf->read_int = host_read_f2i ; in float32_init()
106 psf->read_float = host_read_f ; in float32_init()
107 psf->read_double = host_read_f2d ; in float32_init()
111 psf->data_endswap = SF_FALSE ; in float32_init()
112 psf->read_short = host_read_f2s ; in float32_init()
113 psf->read_int = host_read_f2i ; in float32_init()
114 psf->read_float = host_read_f ; in float32_init()
115 psf->read_double = host_read_f2d ; in float32_init()
119 psf->data_endswap = SF_TRUE ; in float32_init()
120 psf->read_short = host_read_f2s ; in float32_init()
121 psf->read_int = host_read_f2i ; in float32_init()
122 psf->read_float = host_read_f ; in float32_init()
123 psf->read_double = host_read_f2d ; in float32_init()
127 psf->data_endswap = SF_TRUE ; in float32_init()
128 psf->read_short = host_read_f2s ; in float32_init()
129 psf->read_int = host_read_f2i ; in float32_init()
130 psf->read_float = host_read_f ; in float32_init()
131 psf->read_double = host_read_f2d ; in float32_init()
136 psf->data_endswap = SF_TRUE ; in float32_init()
137 psf->read_short = replace_read_f2s ; in float32_init()
138 psf->read_int = replace_read_f2i ; in float32_init()
139 psf->read_float = replace_read_f ; in float32_init()
140 psf->read_double = replace_read_f2d ; in float32_init()
144 psf->data_endswap = SF_FALSE ; in float32_init()
145 psf->read_short = replace_read_f2s ; in float32_init()
146 psf->read_int = replace_read_f2i ; in float32_init()
147 psf->read_float = replace_read_f ; in float32_init()
148 psf->read_double = replace_read_f2d ; in float32_init()
152 psf->data_endswap = SF_FALSE ; in float32_init()
153 psf->read_short = replace_read_f2s ; in float32_init()
154 psf->read_int = replace_read_f2i ; in float32_init()
155 psf->read_float = replace_read_f ; in float32_init()
156 psf->read_double = replace_read_f2d ; in float32_init()
160 psf->data_endswap = SF_TRUE ; in float32_init()
161 psf->read_short = replace_read_f2s ; in float32_init()
162 psf->read_int = replace_read_f2i ; in float32_init()
163 psf->read_float = replace_read_f ; in float32_init()
164 psf->read_double = replace_read_f2d ; in float32_init()
171 if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR) in float32_init()
172 { switch (psf->endian + float_caps) in float32_init()
174 psf->data_endswap = SF_FALSE ; in float32_init()
175 psf->write_short = host_write_s2f ; in float32_init()
176 psf->write_int = host_write_i2f ; in float32_init()
177 psf->write_float = host_write_f ; in float32_init()
178 psf->write_double = host_write_d2f ; in float32_init()
182 psf->data_endswap = SF_FALSE ; in float32_init()
183 psf->write_short = host_write_s2f ; in float32_init()
184 psf->write_int = host_write_i2f ; in float32_init()
185 psf->write_float = host_write_f ; in float32_init()
186 psf->write_double = host_write_d2f ; in float32_init()
190 psf->data_endswap = SF_TRUE ; in float32_init()
191 psf->write_short = host_write_s2f ; in float32_init()
192 psf->write_int = host_write_i2f ; in float32_init()
193 psf->write_float = host_write_f ; in float32_init()
194 psf->write_double = host_write_d2f ; in float32_init()
198 psf->data_endswap = SF_TRUE ; in float32_init()
199 psf->write_short = host_write_s2f ; in float32_init()
200 psf->write_int = host_write_i2f ; in float32_init()
201 psf->write_float = host_write_f ; in float32_init()
202 psf->write_double = host_write_d2f ; in float32_init()
207 psf->data_endswap = SF_TRUE ; in float32_init()
208 psf->write_short = replace_write_s2f ; in float32_init()
209 psf->write_int = replace_write_i2f ; in float32_init()
210 psf->write_float = replace_write_f ; in float32_init()
211 psf->write_double = replace_write_d2f ; in float32_init()
215 psf->data_endswap = SF_FALSE ; in float32_init()
216 psf->write_short = replace_write_s2f ; in float32_init()
217 psf->write_int = replace_write_i2f ; in float32_init()
218 psf->write_float = replace_write_f ; in float32_init()
219 psf->write_double = replace_write_d2f ; in float32_init()
223 psf->data_endswap = SF_FALSE ; in float32_init()
224 psf->write_short = replace_write_s2f ; in float32_init()
225 psf->write_int = replace_write_i2f ; in float32_init()
226 psf->write_float = replace_write_f ; in float32_init()
227 psf->write_double = replace_write_d2f ; in float32_init()
231 psf->data_endswap = SF_TRUE ; in float32_init()
232 psf->write_short = replace_write_s2f ; in float32_init()
233 psf->write_int = replace_write_i2f ; in float32_init()
234 psf->write_float = replace_write_f ; in float32_init()
235 psf->write_double = replace_write_d2f ; in float32_init()
242 if (psf->filelength > psf->dataoffset) in float32_init()
243 { psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset : in float32_init()
244 psf->filelength - psf->dataoffset ; in float32_init()
247 psf->datalength = 0 ; in float32_init()
249 psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ; in float32_init()
385 float32_peak_update (SF_PRIVATE *psf, const float *buffer, int count, sf_count_t indx) in float32_peak_update() argument
390 for (chan = 0 ; chan < psf->sf.channels ; chan++) in float32_peak_update()
393 for (k = chan ; k < count ; k += psf->sf.channels) in float32_peak_update()
399 if (fmaxval > psf->peak_info->peaks [chan].value) in float32_peak_update()
400 { psf->peak_info->peaks [chan].value = fmaxval ; in float32_peak_update()
401 …psf->peak_info->peaks [chan].position = psf->write_current + indx + (position / psf->sf.channels) ; in float32_peak_update()
409 float32_get_capability (SF_PRIVATE *psf) in float32_get_capability() argument
418 if (! psf->ieee_replace) in float32_get_capability()
429 psf_log_printf (psf, "Using IEEE replacement code for float.\n") ; in float32_get_capability()
512 host_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) in host_read_f2s() argument
519 convert = (psf->add_clipping) ? f2s_clip_array : f2s_array ; in host_read_f2s()
521 scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ; in host_read_f2s()
526 readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in host_read_f2s()
529 if (psf->data_endswap == SF_TRUE) in host_read_f2s()
543 host_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) in host_read_f2i() argument
550 convert = (psf->add_clipping) ? f2i_clip_array : f2i_array ; in host_read_f2i()
552 scale = (psf->float_int_mult == 0) ? 1.0 : 2147483648.0f / psf->float_max ; in host_read_f2i()
557 readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in host_read_f2i()
559 if (psf->data_endswap == SF_TRUE) in host_read_f2i()
573 host_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) in host_read_f() argument
578 if (psf->data_endswap != SF_TRUE) in host_read_f()
579 return psf_fread (ptr, sizeof (float), len, psf) ; in host_read_f()
586 readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in host_read_f()
600 host_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) in host_read_f2d() argument
610 readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in host_read_f2d()
612 if (psf->data_endswap == SF_TRUE) in host_read_f2d()
627 host_write_s2f (SF_PRIVATE *psf, const short *ptr, sf_count_t len) in host_write_s2f() argument
634 scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / 0x8000 ; in host_write_s2f()
642 if (psf->peak_info) in host_write_s2f()
643 float32_peak_update (psf, ubuf.fbuf, bufferlen, total / psf->sf.channels) ; in host_write_s2f()
645 if (psf->data_endswap == SF_TRUE) in host_write_s2f()
648 writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in host_write_s2f()
659 host_write_i2f (SF_PRIVATE *psf, const int *ptr, sf_count_t len) in host_write_i2f() argument
665 scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / (8.0 * 0x10000000) ; in host_write_i2f()
673 if (psf->peak_info) in host_write_i2f()
674 float32_peak_update (psf, ubuf.fbuf, bufferlen, total / psf->sf.channels) ; in host_write_i2f()
676 if (psf->data_endswap == SF_TRUE) in host_write_i2f()
679 writecount = psf_fwrite (ubuf.fbuf, sizeof (float) , bufferlen, psf) ; in host_write_i2f()
690 host_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) in host_write_f() argument
695 if (psf->peak_info) in host_write_f()
696 float32_peak_update (psf, ptr, len, 0) ; in host_write_f()
698 if (psf->data_endswap != SF_TRUE) in host_write_f()
699 return psf_fwrite (ptr, sizeof (float), len, psf) ; in host_write_f()
709 writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in host_write_f()
720 host_write_d2f (SF_PRIVATE *psf, const double *ptr, sf_count_t len) in host_write_d2f() argument
733 if (psf->peak_info) in host_write_d2f()
734 float32_peak_update (psf, ubuf.fbuf, bufferlen, total / psf->sf.channels) ; in host_write_d2f()
736 if (psf->data_endswap == SF_TRUE) in host_write_d2f()
739 writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in host_write_d2f()
753 replace_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) in replace_read_f2s() argument
760 scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ; in replace_read_f2s()
765 readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in replace_read_f2s()
767 if (psf->data_endswap == SF_TRUE) in replace_read_f2s()
783 replace_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) in replace_read_f2i() argument
790 scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ; in replace_read_f2i()
795 readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in replace_read_f2i()
797 if (psf->data_endswap == SF_TRUE) in replace_read_f2i()
813 replace_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) in replace_read_f() argument
825 readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in replace_read_f()
827 if (psf->data_endswap == SF_TRUE) in replace_read_f()
844 replace_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) in replace_read_f2d() argument
854 readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in replace_read_f2d()
856 if (psf->data_endswap == SF_TRUE) in replace_read_f2d()
872 replace_write_s2f (SF_PRIVATE *psf, const short *ptr, sf_count_t len) in replace_write_s2f() argument
878 scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / 0x8000 ; in replace_write_s2f()
886 if (psf->peak_info) in replace_write_s2f()
887 float32_peak_update (psf, ubuf.fbuf, bufferlen, total / psf->sf.channels) ; in replace_write_s2f()
891 if (psf->data_endswap == SF_TRUE) in replace_write_s2f()
894 writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in replace_write_s2f()
905 replace_write_i2f (SF_PRIVATE *psf, const int *ptr, sf_count_t len) in replace_write_i2f() argument
911 scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / (8.0 * 0x10000000) ; in replace_write_i2f()
919 if (psf->peak_info) in replace_write_i2f()
920 float32_peak_update (psf, ubuf.fbuf, bufferlen, total / psf->sf.channels) ; in replace_write_i2f()
924 if (psf->data_endswap == SF_TRUE) in replace_write_i2f()
927 writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in replace_write_i2f()
938 replace_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) in replace_write_f() argument
944 if (psf->peak_info) in replace_write_f()
945 float32_peak_update (psf, ptr, len, 0) ; in replace_write_f()
957 if (psf->data_endswap == SF_TRUE) in replace_write_f()
960 writecount = psf_fwrite (ubuf.fbuf, sizeof (float) , bufferlen, psf) ; in replace_write_f()
971 replace_write_d2f (SF_PRIVATE *psf, const double *ptr, sf_count_t len) in replace_write_d2f() argument
983 if (psf->peak_info) in replace_write_d2f()
984 float32_peak_update (psf, ubuf.fbuf, bufferlen, total / psf->sf.channels) ; in replace_write_d2f()
988 if (psf->data_endswap == SF_TRUE) in replace_write_d2f()
991 writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ; in replace_write_d2f()