| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: linear.c,v 1.4 2021/07/21 06:35:44 skrll Exp $ */ | | 1 | /* $NetBSD: linear.c,v 1.5 2024/04/20 05:38:40 isaki Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 2017 Tetsuya Isaki. All rights reserved. | | 4 | * Copyright (C) 2017 Tetsuya Isaki. All rights reserved. |
5 | * Copyright (C) 2017 Y.Sugahara (moveccr). All rights reserved. | | 5 | * Copyright (C) 2017 Y.Sugahara (moveccr). All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: linear.c,v 1.4 2021/07/21 06:35:44 skrll Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: linear.c,v 1.5 2024/04/20 05:38:40 isaki Exp $"); |
31 | | | 31 | |
32 | #include <sys/param.h> | | 32 | #include <sys/param.h> |
33 | #include <sys/types.h> | | 33 | #include <sys/types.h> |
34 | #include <sys/systm.h> | | 34 | #include <sys/systm.h> |
35 | #include <sys/device.h> | | 35 | #include <sys/device.h> |
36 | #include <dev/audio/audiovar.h> | | 36 | #include <dev/audio/audiovar.h> |
37 | #include <dev/audio/linear.h> | | 37 | #include <dev/audio/linear.h> |
38 | | | 38 | |
39 | /* | | 39 | /* |
40 | * audio_linear8_to_internal: | | 40 | * audio_linear8_to_internal: |
41 | * This filter performs conversion from [US]LINEAR8 to internal format. | | 41 | * This filter performs conversion from [US]LINEAR8 to internal format. |
42 | */ | | 42 | */ |
43 | void | | 43 | void |
| @@ -212,27 +212,27 @@ audio_internal_to_linear16(audio_filter_ | | | @@ -212,27 +212,27 @@ audio_internal_to_linear16(audio_filter_ |
212 | val = (*s++) >> shift; | | 212 | val = (*s++) >> shift; |
213 | val ^= xor; | | 213 | val ^= xor; |
214 | if (!is_dst_NE) | | 214 | if (!is_dst_NE) |
215 | val = bswap16(val); | | 215 | val = bswap16(val); |
216 | *d++ = val; | | 216 | *d++ = val; |
217 | } | | 217 | } |
218 | } | | 218 | } |
219 | } | | 219 | } |
220 | | | 220 | |
221 | #if defined(AUDIO_SUPPORT_LINEAR24) | | 221 | #if defined(AUDIO_SUPPORT_LINEAR24) |
222 | /* | | 222 | /* |
223 | * audio_linear24_to_internal: | | 223 | * audio_linear24_to_internal: |
224 | * This filter performs conversion from [US]LINEAR24/24{LE,BE} to | | 224 | * This filter performs conversion from [US]LINEAR24/24{LE,BE} to |
225 | * internal format. Since it's rerely used, it's size optimized. | | 225 | * internal format. Since it's rarely used, it's size optimized. |
226 | */ | | 226 | */ |
227 | void | | 227 | void |
228 | audio_linear24_to_internal(audio_filter_arg_t *arg) | | 228 | audio_linear24_to_internal(audio_filter_arg_t *arg) |
229 | { | | 229 | { |
230 | const uint8_t *s; | | 230 | const uint8_t *s; |
231 | aint_t *d; | | 231 | aint_t *d; |
232 | auint_t xor; | | 232 | auint_t xor; |
233 | u_int sample_count; | | 233 | u_int sample_count; |
234 | u_int i; | | 234 | u_int i; |
235 | bool is_src_LE; | | 235 | bool is_src_LE; |
236 | | | 236 | |
237 | DIAGNOSTIC_filter_arg(arg); | | 237 | DIAGNOSTIC_filter_arg(arg); |
238 | KASSERT(audio_format2_is_linear(arg->srcfmt)); | | 238 | KASSERT(audio_format2_is_linear(arg->srcfmt)); |