/src/ffmpeg/libavcodec/bitpacked_dec_init.h
Line | Count | Source |
1 | | /* |
2 | | * Bitpacked decoder DSP init |
3 | | * Copyright (c) 2017 Savoir-faire Linux, Inc |
4 | | * Copyright (c) 2026 Devin Heitmueller <dheitmueller@ltnglobal.com> |
5 | | * |
6 | | * This file is part of FFmpeg. |
7 | | * |
8 | | * FFmpeg is free software; you can redistribute it and/or |
9 | | * modify it under the terms of the GNU Lesser General Public |
10 | | * License as published by the Free Software Foundation; either |
11 | | * version 2.1 of the License, or (at your option) any later version. |
12 | | * |
13 | | * FFmpeg is distributed in the hope that it will be useful, |
14 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | | * Lesser General Public License for more details. |
17 | | * |
18 | | * You should have received a copy of the GNU Lesser General Public |
19 | | * License along with FFmpeg; if not, write to the Free Software |
20 | | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21 | | */ |
22 | | |
23 | | #ifndef AVCODEC_BITPACKED_DEC_INIT_H |
24 | | #define AVCODEC_BITPACKED_DEC_INIT_H |
25 | | |
26 | | #include <stdint.h> |
27 | | |
28 | | #include "config.h" |
29 | | #include "libavutil/attributes.h" |
30 | | #include "bitpacked_dec.h" |
31 | | |
32 | | static void bitpacked_unpack_yuv422p10_c(const uint8_t *src, |
33 | | uint16_t *y, uint16_t *u, uint16_t *v, |
34 | | int width) |
35 | 0 | { |
36 | 0 | for (int i = 0; i < width; i += 2) { |
37 | 0 | *u++ = (src[0] << 2) | (src[1] >> 6); |
38 | 0 | *v++ = ((src[2] << 6) | (src[3] >> 2)) & 0x3ff; |
39 | 0 | *y++ = ((src[1] << 4) | (src[2] >> 4)) & 0x3ff; |
40 | 0 | *y++ = ((src[3] << 8) | src[4]) & 0x3ff; |
41 | 0 | src += 5; |
42 | 0 | } |
43 | 0 | } |
44 | | |
45 | | av_unused static av_cold void ff_bitpackeddec_init(struct BitpackedContext *s) |
46 | 65 | { |
47 | 65 | s->unpack_yuv422p10 = bitpacked_unpack_yuv422p10_c; |
48 | | |
49 | | #if ARCH_AARCH64 |
50 | | ff_bitpacked_init_aarch64(s); |
51 | | #elif ARCH_X86 && HAVE_X86ASM |
52 | | ff_bitpacked_init_x86(s); |
53 | | #endif |
54 | 65 | } |
55 | | |
56 | | #endif /* AVCODEC_BITPACKED_DEC_INIT_H */ |