Lines Matching defs:psf
65 sf_count_t (*read_short) (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
66 sf_count_t (*read_int) (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
67 sf_count_t (*read_float) (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
68 sf_count_t (*read_double) (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
70 sf_count_t (*write_short) (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
71 sf_count_t (*write_int) (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
72 sf_count_t (*write_float) (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
73 sf_count_t (*write_double) (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
78 static sf_count_t dither_read_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
79 static sf_count_t dither_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
81 static sf_count_t dither_write_short (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
82 static sf_count_t dither_write_int (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
83 static sf_count_t dither_write_float (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
84 static sf_count_t dither_write_double (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
87 dither_init (SF_PRIVATE *psf, int mode)
90 pdither = psf->dither ; /* This may be NULL. */
93 if (mode == SFM_READ && psf->read_dither.type == SFD_NO_DITHER)
98 psf->read_short = pdither->read_short ;
100 psf->read_int = pdither->read_int ;
102 psf->read_float = pdither->read_float ;
104 psf->read_double = pdither->read_double ;
109 if (mode == SFM_WRITE && psf->write_dither.type == SFD_NO_DITHER)
114 psf->write_short = pdither->write_short ;
116 psf->write_int = pdither->write_int ;
118 psf->write_float = pdither->write_float ;
120 psf->write_double = pdither->write_double ;
125 if (mode == SFM_READ && psf->read_dither.type != 0)
127 pdither = psf->dither = calloc (1, sizeof (DITHER_DATA)) ;
131 switch (SF_CODEC (psf->sf.format))
134 pdither->read_int = psf->read_int ;
135 psf->read_int = dither_read_int ;
143 pdither->read_short = psf->read_short ;
144 psf->read_short = dither_read_short ;
152 if (mode == SFM_WRITE && psf->write_dither.type != 0)
154 pdither = psf->dither = calloc (1, sizeof (DITHER_DATA)) ;
158 switch (SF_CODEC (psf->sf.format))
161 pdither->write_int = psf->write_int ;
162 psf->write_int = dither_write_int ;
175 pdither->write_short = psf->write_short ;
176 psf->write_short = dither_write_short ;
178 pdither->write_int = psf->write_int ;
179 psf->write_int = dither_write_int ;
181 pdither->write_float = psf->write_float ;
182 psf->write_float = dither_write_float ;
184 pdither->write_double = psf->write_double ;
185 psf->write_double = dither_write_double ;
201 dither_read_short (SF_PRIVATE * UNUSED (psf), short * UNUSED (ptr), sf_count_t len)
207 dither_read_int (SF_PRIVATE * UNUSED (psf), int * UNUSED (ptr), sf_count_t len)
216 dither_write_short (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
221 if ((pdither = psf->dither) == NULL)
222 { psf->error = SFE_DITHER_BAD_PTR ;
226 switch (SF_CODEC (psf->sf.format))
233 return pdither->write_short (psf, ptr, len) ;
240 writecount /= psf->sf.channels ;
241 writecount *= psf->sf.channels ;
243 dither_short (ptr, (short*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ;
245 thiswrite = (int) pdither->write_short (psf, (short*) pdither->buffer, writecount) ;
256 dither_write_int (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
261 if ((pdither = psf->dither) == NULL)
262 { psf->error = SFE_DITHER_BAD_PTR ;
266 switch (SF_CODEC (psf->sf.format))
278 return pdither->write_int (psf, ptr, len) ;
286 writecount /= psf->sf.channels ;
287 writecount *= psf->sf.channels ;
289 dither_int (ptr, (int*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ;
291 thiswrite = (int) pdither->write_int (psf, (int*) pdither->buffer, writecount) ;
302 dither_write_float (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
307 if ((pdither = psf->dither) == NULL)
308 { psf->error = SFE_DITHER_BAD_PTR ;
312 switch (SF_CODEC (psf->sf.format))
324 return pdither->write_float (psf, ptr, len) ;
331 writecount /= psf->sf.channels ;
332 writecount *= psf->sf.channels ;
334 dither_float (ptr, (float*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ;
336 thiswrite = (int) pdither->write_float (psf, (float*) pdither->buffer, writecount) ;
347 dither_write_double (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
352 if ((pdither = psf->dither) == NULL)
353 { psf->error = SFE_DITHER_BAD_PTR ;
357 switch (SF_CODEC (psf->sf.format))
369 return pdither->write_double (psf, ptr, len) ;
377 writecount /= psf->sf.channels ;
378 writecount *= psf->sf.channels ;
380 dither_double (ptr, (double*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ;
382 thiswrite = (int) pdither->write_double (psf, (double*) pdither->buffer, writecount) ;