2 * This file is part of FFmpeg.
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "libavutil/intreadwrite.h"
27 #ifdef AVCODEC_BIT_DEPTH_TEMPLATE_C
33 # undef no_rnd_avg_pixel4
34 # undef rnd_avg_pixel4
45 # undef PIXEL_SPLAT_X4
47 # define AVCODEC_BIT_DEPTH_TEMPLATE_C
51 # define pixel uint16_t
52 # define pixel2 uint32_t
53 # define pixel4 uint64_t
54 # define dctcoef int32_t
57 #if IN_IDCT_DEPTH == 32
58 # define idctin int32_t
60 # define idctin int16_t
63 # define idctin int16_t
66 # define no_rnd_avg_pixel4 no_rnd_avg64
67 # define rnd_avg_pixel4 rnd_avg64
68 # define AV_RN2P AV_RN32
69 # define AV_RN4P AV_RN64
70 # define AV_RN4PA AV_RN64A
71 # define AV_WN2P AV_WN32
72 # define AV_WN4P AV_WN64
73 # define AV_WN4PA AV_WN64A
74 # define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL)
76 # define av_clip_pixel(a) av_clip_uintp2(a, BIT_DEPTH)
77 # define CLIP(a) av_clip_uintp2(a, BIT_DEPTH)
79 # define pixel uint8_t
80 # define pixel2 uint16_t
81 # define pixel4 uint32_t
82 # define dctcoef int16_t
83 # define idctin int16_t
85 # define no_rnd_avg_pixel4 no_rnd_avg32
86 # define rnd_avg_pixel4 rnd_avg32
87 # define AV_RN2P AV_RN16
88 # define AV_RN4P AV_RN32
89 # define AV_RN4PA AV_RN32A
90 # define AV_WN2P AV_WN16
91 # define AV_WN4P AV_WN32
92 # define AV_WN4PA AV_WN32A
93 # define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
95 # define av_clip_pixel(a) av_clip_uint8(a)
96 # define CLIP(a) av_clip_uint8(a)
99 #define FUNC3(a, b, c) a ## _ ## b ## c
100 #define FUNC2(a, b, c) FUNC3(a, b, c)
101 #define FUNC(a) FUNC2(a, BIT_DEPTH,)
102 #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
103 #define FUNC4(a, b, c) a ## _int ## b ## _ ## c ## bit
104 #define FUNC5(a, b, c) FUNC4(a, b, c)
105 #define FUNC6(a) FUNC5(a, IN_IDCT_DEPTH, BIT_DEPTH)