Lines Matching refs:sp

48 do_src(audio_stream_t *sp, void *p1, void *p2, int len, int nchan)  in do_src()  argument
57 size = sp->s_cnv_max / 4; /* sample size is 4 */ in do_src()
61 grc3_convert(sp->s_src_state[ch], sp->s_src_quality, in do_src()
64 return (((grc3state_t *)sp->s_src_state[0])->outsz); in do_src()
68 setup_src(audio_stream_t *sp, int srate, int trate, int sch, int tch) in setup_src() argument
76 if (sp->s_src_quality < 1) in setup_src()
77 sp->s_src_quality = 1; in setup_src()
78 if (sp->s_src_quality > 5) in setup_src()
79 sp->s_src_quality = 5; in setup_src()
82 grc3_reset(sp->s_src_state[ch]); in setup_src()
83 grc3_setup(sp->s_src_state[ch], srate, trate); in setup_src()
88 cnv_srconly(audio_stream_t *sp, int len) in cnv_srconly() argument
90 void *src = sp->s_cnv_src; in cnv_srconly()
91 void *dst = sp->s_cnv_dst; in cnv_srconly()
96 len = do_src(sp, src, dst, len, sp->s_cnv_src_nchan); in cnv_srconly()
98 sp->s_cnv_src = dst; in cnv_srconly()
99 sp->s_cnv_dst = src; in cnv_srconly()
105 cnv_s24oe(audio_stream_t *sp, int len) in cnv_s24oe() argument
110 int32_t *src = sp->s_cnv_src; in cnv_s24oe()
112 for (int i = len * sp->s_cnv_src_nchan; i; i--) { in cnv_s24oe()
122 cnv_from_s8(audio_stream_t *sp, int len) in cnv_from_s8() argument
124 void *s = sp->s_cnv_src; in cnv_from_s8()
125 void *d = sp->s_cnv_dst; in cnv_from_s8()
129 for (int i = len * sp->s_cnv_src_nchan; i; i--) in cnv_from_s8()
132 sp->s_cnv_src = d; in cnv_from_s8()
133 sp->s_cnv_dst = s; in cnv_from_s8()
138 cnv_from_u8(audio_stream_t *sp, int len) in cnv_from_u8() argument
140 void *s = sp->s_cnv_src; in cnv_from_u8()
141 void *d = sp->s_cnv_dst; in cnv_from_u8()
145 for (int i = len * sp->s_cnv_src_nchan; i; i--) in cnv_from_u8()
148 sp->s_cnv_src = d; in cnv_from_u8()
149 sp->s_cnv_dst = s; in cnv_from_u8()
154 cnv_from_ulaw(audio_stream_t *sp, int len) in cnv_from_ulaw() argument
156 void *s = sp->s_cnv_src; in cnv_from_ulaw()
157 void *d = sp->s_cnv_dst; in cnv_from_ulaw()
161 for (int i = len * sp->s_cnv_src_nchan; i; i--) { in cnv_from_ulaw()
164 sp->s_cnv_src = d; in cnv_from_ulaw()
165 sp->s_cnv_dst = s; in cnv_from_ulaw()
170 cnv_from_alaw(audio_stream_t *sp, int len) in cnv_from_alaw() argument
172 void *s = sp->s_cnv_src; in cnv_from_alaw()
173 void *d = sp->s_cnv_dst; in cnv_from_alaw()
177 for (int i = len * sp->s_cnv_src_nchan; i; i--) { in cnv_from_alaw()
180 sp->s_cnv_src = d; in cnv_from_alaw()
181 sp->s_cnv_dst = s; in cnv_from_alaw()
186 cnv_from_s16ne(audio_stream_t *sp, int len) in cnv_from_s16ne() argument
188 void *s = sp->s_cnv_src; in cnv_from_s16ne()
189 void *d = sp->s_cnv_dst; in cnv_from_s16ne()
193 for (int i = len * sp->s_cnv_src_nchan; i; i--) in cnv_from_s16ne()
196 sp->s_cnv_src = d; in cnv_from_s16ne()
197 sp->s_cnv_dst = s; in cnv_from_s16ne()
202 cnv_from_s16oe(audio_stream_t *sp, int len) in cnv_from_s16oe() argument
204 void *s = sp->s_cnv_src; in cnv_from_s16oe()
205 void *d = sp->s_cnv_dst; in cnv_from_s16oe()
209 for (int i = len * sp->s_cnv_src_nchan; i; i--) in cnv_from_s16oe()
212 sp->s_cnv_src = d; in cnv_from_s16oe()
213 sp->s_cnv_dst = s; in cnv_from_s16oe()
218 cnv_from_u16ne(audio_stream_t *sp, int len) in cnv_from_u16ne() argument
220 void *s = sp->s_cnv_src; in cnv_from_u16ne()
221 void *d = sp->s_cnv_dst; in cnv_from_u16ne()
225 for (int i = len * sp->s_cnv_src_nchan; i; i--) in cnv_from_u16ne()
228 sp->s_cnv_src = d; in cnv_from_u16ne()
229 sp->s_cnv_dst = s; in cnv_from_u16ne()
234 cnv_from_u16oe(audio_stream_t *sp, int len) in cnv_from_u16oe() argument
236 void *s = sp->s_cnv_src; in cnv_from_u16oe()
237 void *d = sp->s_cnv_dst; in cnv_from_u16oe()
241 for (int i = len * sp->s_cnv_src_nchan; i; i--) in cnv_from_u16oe()
244 sp->s_cnv_src = d; in cnv_from_u16oe()
245 sp->s_cnv_dst = s; in cnv_from_u16oe()
250 cnv_from_s24p(audio_stream_t *sp, int len) in cnv_from_s24p() argument
252 void *s = sp->s_cnv_src; in cnv_from_s24p()
253 void *d = sp->s_cnv_dst; in cnv_from_s24p()
258 for (int i = len * sp->s_cnv_src_nchan; i; i--) { in cnv_from_s24p()
266 sp->s_cnv_src = d; in cnv_from_s24p()
267 sp->s_cnv_dst = s; in cnv_from_s24p()
272 cnv_from_s32ne(audio_stream_t *sp, int len) in cnv_from_s32ne() argument
275 int32_t *src = sp->s_cnv_src; in cnv_from_s32ne()
277 for (int i = len * sp->s_cnv_src_nchan; i; i--, src++) in cnv_from_s32ne()
284 cnv_from_s32oe(audio_stream_t *sp, int len) in cnv_from_s32oe() argument
287 int32_t *src = sp->s_cnv_src; in cnv_from_s32oe()
289 for (int i = len * sp->s_cnv_src_nchan; i; i--, src++) in cnv_from_s32oe()
302 cnv_to_u8(audio_stream_t *sp, int len) in cnv_to_u8() argument
304 int32_t *src = sp->s_cnv_src; in cnv_to_u8()
307 for (int i = len * sp->s_cnv_dst_nchan; i; i--) in cnv_to_u8()
314 cnv_to_s8(audio_stream_t *sp, int len) in cnv_to_s8() argument
316 int32_t *src = sp->s_cnv_src; in cnv_to_s8()
319 for (int i = len * sp->s_cnv_dst_nchan; i; i--) in cnv_to_s8()
326 cnv_to_ulaw(audio_stream_t *sp, int len) in cnv_to_ulaw() argument
328 int32_t *src = sp->s_cnv_src; in cnv_to_ulaw()
331 for (int i = len * sp->s_cnv_dst_nchan; i; i--) { in cnv_to_ulaw()
343 cnv_to_alaw(audio_stream_t *sp, int len) in cnv_to_alaw() argument
345 int32_t *src = sp->s_cnv_src; in cnv_to_alaw()
348 for (int i = len * sp->s_cnv_dst_nchan; i; i--) { in cnv_to_alaw()
360 cnv_to_s16ne(audio_stream_t *sp, int len) in cnv_to_s16ne() argument
362 int32_t *src = sp->s_cnv_src; in cnv_to_s16ne()
365 for (int i = len * sp->s_cnv_dst_nchan; i; i--) in cnv_to_s16ne()
372 cnv_to_s16oe(audio_stream_t *sp, int len) in cnv_to_s16oe() argument
374 int32_t *src = sp->s_cnv_src; in cnv_to_s16oe()
377 for (int i = len * sp->s_cnv_dst_nchan; i; i--) in cnv_to_s16oe()
384 cnv_to_u16ne(audio_stream_t *sp, int len) in cnv_to_u16ne() argument
386 int32_t *src = sp->s_cnv_src; in cnv_to_u16ne()
389 for (int i = len * sp->s_cnv_dst_nchan; i; i--) in cnv_to_u16ne()
396 cnv_to_u16oe(audio_stream_t *sp, int len) in cnv_to_u16oe() argument
398 int32_t *src = sp->s_cnv_src; in cnv_to_u16oe()
401 for (int i = len * sp->s_cnv_dst_nchan; i; i--) in cnv_to_u16oe()
408 cnv_to_s24p(audio_stream_t *sp, int len) in cnv_to_s24p() argument
410 int32_t *src = sp->s_cnv_src; in cnv_to_s24p()
414 for (int i = len * sp->s_cnv_dst_nchan; i; i--) { in cnv_to_s24p()
426 cnv_to_s32ne(audio_stream_t *sp, int len) in cnv_to_s32ne() argument
428 int32_t *src = sp->s_cnv_src; in cnv_to_s32ne()
430 for (int i = len * sp->s_cnv_dst_nchan; i; i--, src++) in cnv_to_s32ne()
437 cnv_to_s32oe(audio_stream_t *sp, int len) in cnv_to_s32oe() argument
439 int32_t *src = sp->s_cnv_src; in cnv_to_s32oe()
441 for (int i = len * sp->s_cnv_dst_nchan; i; i--, src++) in cnv_to_s32oe()
448 cnv_default(audio_stream_t *sp, int len) in cnv_default() argument
461 switch (sp->s_cnv_src_format) { in cnv_default()
464 len = cnv_from_u8(sp, len); in cnv_default()
468 len = cnv_from_s8(sp, len); in cnv_default()
472 len = cnv_from_ulaw(sp, len); in cnv_default()
476 len = cnv_from_alaw(sp, len); in cnv_default()
480 len = cnv_from_s16ne(sp, len); in cnv_default()
484 len = cnv_from_s16oe(sp, len); in cnv_default()
488 len = cnv_from_u16ne(sp, len); in cnv_default()
492 len = cnv_from_u16oe(sp, len); in cnv_default()
496 len = cnv_from_s32ne(sp, len); in cnv_default()
500 len = cnv_from_s32oe(sp, len); in cnv_default()
504 len = cnv_s24oe(sp, len); in cnv_default()
508 len = cnv_from_s24p(sp, len); in cnv_default()
516 if (sp->s_cnv_src_rate != sp->s_cnv_dst_rate && in cnv_default()
517 sp->s_cnv_src_nchan <= sp->s_cnv_dst_nchan) { in cnv_default()
518 int32_t *src = sp->s_cnv_src; in cnv_default()
519 int32_t *dst = sp->s_cnv_dst; in cnv_default()
521 len = do_src(sp, src, dst, len, sp->s_cnv_src_nchan); in cnv_default()
523 sp->s_cnv_src = dst; in cnv_default()
524 sp->s_cnv_dst = src; in cnv_default()
531 if (sp->s_cnv_src_nchan != sp->s_cnv_dst_nchan) { in cnv_default()
532 int32_t *src = sp->s_cnv_src; in cnv_default()
533 int32_t *dst = sp->s_cnv_dst; in cnv_default()
534 int tc = sp->s_cnv_dst_nchan; in cnv_default()
535 int sc = sp->s_cnv_src_nchan; in cnv_default()
539 sp->s_cnv_src = dst; in cnv_default()
540 sp->s_cnv_dst = src; in cnv_default()
597 if (sp->s_cnv_src_rate != sp->s_cnv_dst_rate && in cnv_default()
598 sp->s_cnv_src_nchan > sp->s_cnv_dst_nchan) { in cnv_default()
600 int32_t *src = sp->s_cnv_src; in cnv_default()
601 int32_t *dst = sp->s_cnv_dst; in cnv_default()
603 len = do_src(sp, src, dst, len, sp->s_cnv_dst_nchan); in cnv_default()
605 sp->s_cnv_src = dst; in cnv_default()
606 sp->s_cnv_dst = src; in cnv_default()
613 switch (sp->s_cnv_dst_format) { in cnv_default()
615 len = cnv_to_u8(sp, len); in cnv_default()
619 len = cnv_to_s8(sp, len); in cnv_default()
623 len = cnv_to_s16ne(sp, len); in cnv_default()
627 len = cnv_to_s16oe(sp, len); in cnv_default()
631 len = cnv_to_u16ne(sp, len); in cnv_default()
635 len = cnv_to_u16oe(sp, len); in cnv_default()
639 len = cnv_s24oe(sp, len); in cnv_default()
643 len = cnv_to_s24p(sp, len); in cnv_default()
647 len = cnv_to_s32ne(sp, len); in cnv_default()
651 len = cnv_to_s32oe(sp, len); in cnv_default()
655 len = cnv_to_ulaw(sp, len); in cnv_default()
659 len = cnv_to_alaw(sp, len); in cnv_default()
693 auimpl_format_setup(audio_stream_t *sp, audio_parms_t *parms, uint_t mask) in auimpl_format_setup() argument
710 ASSERT(mutex_owned(&sp->s_lock)); in auimpl_format_setup()
712 source = sp->s_cnv_src_parms; in auimpl_format_setup()
713 target = sp->s_cnv_dst_parms; in auimpl_format_setup()
715 if (sp == &sp->s_client->c_ostream) { in auimpl_format_setup()
771 audio_dev_warn(sp->s_client->c_dev, "invalid format selected"); in auimpl_format_setup()
825 if (sp->s_hintsz) { in auimpl_format_setup()
826 nfrags = sp->s_hintsz / fragbytes; in auimpl_format_setup()
827 } else if (sp->s_hintfrags) { in auimpl_format_setup()
828 nfrags = sp->s_hintfrags; in auimpl_format_setup()
830 nfrags = sp->s_allocsz / fragbytes; in auimpl_format_setup()
840 while ((nfrags * fragbytes) > sp->s_allocsz) { in auimpl_format_setup()
855 if (sp->s_cnv_max < cnv_max) { in auimpl_format_setup()
861 audio_dev_warn(sp->s_client->c_dev, in auimpl_format_setup()
871 if (sp->s_cnv_buf0) in auimpl_format_setup()
872 kmem_free(sp->s_cnv_buf0, sp->s_cnv_max); in auimpl_format_setup()
873 if (sp->s_cnv_buf1) in auimpl_format_setup()
874 kmem_free(sp->s_cnv_buf1, sp->s_cnv_max); in auimpl_format_setup()
876 sp->s_cnv_buf0 = buf0; in auimpl_format_setup()
877 sp->s_cnv_buf1 = buf1; in auimpl_format_setup()
878 sp->s_cnv_max = cnv_max; in auimpl_format_setup()
883 setup_src(sp, source.p_rate, target.p_rate, in auimpl_format_setup()
888 sp->s_framesz = framesz; in auimpl_format_setup()
889 sp->s_fragfr = fragfr; in auimpl_format_setup()
890 sp->s_fragbytes = fragbytes; in auimpl_format_setup()
891 sp->s_nfrags = nfrags; in auimpl_format_setup()
892 sp->s_nframes = nfrags * fragfr; in auimpl_format_setup()
893 sp->s_nbytes = sp->s_nframes * framesz; in auimpl_format_setup()
894 *sp->s_user_parms = *uparms; in auimpl_format_setup()
895 sp->s_converter = converter; in auimpl_format_setup()
907 sp->s_cnv_cnt = 0; in auimpl_format_setup()
908 sp->s_tail = sp->s_head = 0; in auimpl_format_setup()
909 sp->s_tidx = sp->s_hidx = 0; in auimpl_format_setup()
915 auimpl_format_alloc(audio_stream_t *sp) in auimpl_format_alloc() argument
919 ASSERT(mutex_owned(&sp->s_lock)); in auimpl_format_alloc()
921 sp->s_src_state[i] = in auimpl_format_alloc()
923 if (sp->s_src_state[i] == NULL) { in auimpl_format_alloc()
924 audio_dev_warn(sp->s_client->c_dev, in auimpl_format_alloc()
933 auimpl_format_free(audio_stream_t *sp) in auimpl_format_free() argument
938 if (sp->s_src_state[i] != NULL) { in auimpl_format_free()
939 kmem_free(sp->s_src_state[i], sizeof (grc3state_t)); in auimpl_format_free()
940 sp->s_src_state[i] = NULL; in auimpl_format_free()