This naming scheme is used elsewhere, so it's sensible to be consistent.
Diego Biurrun authored on 2011/07/06 00:33:241 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,106 @@ |
0 |
+/* |
|
1 |
+ * This file is part of Libav. |
|
2 |
+ * |
|
3 |
+ * Libav is free software; you can redistribute it and/or |
|
4 |
+ * modify it under the terms of the GNU Lesser General Public |
|
5 |
+ * License as published by the Free Software Foundation; either |
|
6 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
7 |
+ * |
|
8 |
+ * Libav is distributed in the hope that it will be useful, |
|
9 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
11 |
+ * Lesser General Public License for more details. |
|
12 |
+ * |
|
13 |
+ * You should have received a copy of the GNU Lesser General Public |
|
14 |
+ * License along with Libav; if not, write to the Free Software |
|
15 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
16 |
+ */ |
|
17 |
+ |
|
18 |
+#include "dsputil.h" |
|
19 |
+ |
|
20 |
+#ifndef BIT_DEPTH |
|
21 |
+#define BIT_DEPTH 8 |
|
22 |
+#endif |
|
23 |
+ |
|
24 |
+#ifdef AVCODEC_H264_HIGH_DEPTH_H |
|
25 |
+# undef pixel |
|
26 |
+# undef pixel2 |
|
27 |
+# undef pixel4 |
|
28 |
+# undef dctcoef |
|
29 |
+# undef INIT_CLIP |
|
30 |
+# undef no_rnd_avg_pixel4 |
|
31 |
+# undef rnd_avg_pixel4 |
|
32 |
+# undef AV_RN2P |
|
33 |
+# undef AV_RN4P |
|
34 |
+# undef AV_RN4PA |
|
35 |
+# undef AV_WN2P |
|
36 |
+# undef AV_WN4P |
|
37 |
+# undef AV_WN4PA |
|
38 |
+# undef CLIP |
|
39 |
+# undef FUNC |
|
40 |
+# undef FUNCC |
|
41 |
+# undef av_clip_pixel |
|
42 |
+# undef PIXEL_SPLAT_X4 |
|
43 |
+#else |
|
44 |
+# define AVCODEC_H264_HIGH_DEPTH_H |
|
45 |
+# define CLIP_PIXEL(depth)\ |
|
46 |
+ static inline uint16_t av_clip_pixel_ ## depth (int p)\ |
|
47 |
+ {\ |
|
48 |
+ const int pixel_max = (1 << depth)-1;\ |
|
49 |
+ return (p & ~pixel_max) ? (-p)>>31 & pixel_max : p;\ |
|
50 |
+ } |
|
51 |
+ |
|
52 |
+CLIP_PIXEL( 9) |
|
53 |
+CLIP_PIXEL(10) |
|
54 |
+#endif |
|
55 |
+ |
|
56 |
+#if BIT_DEPTH > 8 |
|
57 |
+# define pixel uint16_t |
|
58 |
+# define pixel2 uint32_t |
|
59 |
+# define pixel4 uint64_t |
|
60 |
+# define dctcoef int32_t |
|
61 |
+ |
|
62 |
+# define INIT_CLIP |
|
63 |
+# define no_rnd_avg_pixel4 no_rnd_avg64 |
|
64 |
+# define rnd_avg_pixel4 rnd_avg64 |
|
65 |
+# define AV_RN2P AV_RN32 |
|
66 |
+# define AV_RN4P AV_RN64 |
|
67 |
+# define AV_RN4PA AV_RN64A |
|
68 |
+# define AV_WN2P AV_WN32 |
|
69 |
+# define AV_WN4P AV_WN64 |
|
70 |
+# define AV_WN4PA AV_WN64A |
|
71 |
+# define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL) |
|
72 |
+#else |
|
73 |
+# define pixel uint8_t |
|
74 |
+# define pixel2 uint16_t |
|
75 |
+# define pixel4 uint32_t |
|
76 |
+# define dctcoef int16_t |
|
77 |
+ |
|
78 |
+# define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
|
79 |
+# define no_rnd_avg_pixel4 no_rnd_avg32 |
|
80 |
+# define rnd_avg_pixel4 rnd_avg32 |
|
81 |
+# define AV_RN2P AV_RN16 |
|
82 |
+# define AV_RN4P AV_RN32 |
|
83 |
+# define AV_RN4PA AV_RN32A |
|
84 |
+# define AV_WN2P AV_WN16 |
|
85 |
+# define AV_WN4P AV_WN32 |
|
86 |
+# define AV_WN4PA AV_WN32A |
|
87 |
+# define PIXEL_SPLAT_X4(x) ((x)*0x01010101U) |
|
88 |
+#endif |
|
89 |
+ |
|
90 |
+#if BIT_DEPTH == 8 |
|
91 |
+# define av_clip_pixel(a) av_clip_uint8(a) |
|
92 |
+# define CLIP(a) cm[a] |
|
93 |
+# define FUNC(a) a ## _8 |
|
94 |
+# define FUNCC(a) a ## _8_c |
|
95 |
+#elif BIT_DEPTH == 9 |
|
96 |
+# define av_clip_pixel(a) av_clip_pixel_9(a) |
|
97 |
+# define CLIP(a) av_clip_pixel_9(a) |
|
98 |
+# define FUNC(a) a ## _9 |
|
99 |
+# define FUNCC(a) a ## _9_c |
|
100 |
+#elif BIT_DEPTH == 10 |
|
101 |
+# define av_clip_pixel(a) av_clip_pixel_10(a) |
|
102 |
+# define CLIP(a) av_clip_pixel_10(a) |
|
103 |
+# define FUNC(a) a ## _10 |
|
104 |
+# define FUNCC(a) a ## _10_c |
|
105 |
+#endif |
... | ... |
@@ -25,7 +25,7 @@ |
25 | 25 |
* @author Michael Niedermayer <michaelni@gmx.at> |
26 | 26 |
*/ |
27 | 27 |
|
28 |
-#include "high_bit_depth.h" |
|
28 |
+#include "bit_depth_template.c" |
|
29 | 29 |
|
30 | 30 |
#define op_scale1(x) block[x] = av_clip_pixel( (block[x]*weight + offset) >> log2_denom ) |
31 | 31 |
#define op_scale2(x) dst[x] = av_clip_pixel( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1)) |
33 | 34 |
deleted file mode 100644 |
... | ... |
@@ -1,106 +0,0 @@ |
1 |
-/* |
|
2 |
- * This file is part of Libav. |
|
3 |
- * |
|
4 |
- * Libav 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. |
|
8 |
- * |
|
9 |
- * Libav 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. |
|
13 |
- * |
|
14 |
- * You should have received a copy of the GNU Lesser General Public |
|
15 |
- * License along with Libav; if not, write to the Free Software |
|
16 |
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
17 |
- */ |
|
18 |
- |
|
19 |
-#include "dsputil.h" |
|
20 |
- |
|
21 |
-#ifndef BIT_DEPTH |
|
22 |
-#define BIT_DEPTH 8 |
|
23 |
-#endif |
|
24 |
- |
|
25 |
-#ifdef AVCODEC_H264_HIGH_DEPTH_H |
|
26 |
-# undef pixel |
|
27 |
-# undef pixel2 |
|
28 |
-# undef pixel4 |
|
29 |
-# undef dctcoef |
|
30 |
-# undef INIT_CLIP |
|
31 |
-# undef no_rnd_avg_pixel4 |
|
32 |
-# undef rnd_avg_pixel4 |
|
33 |
-# undef AV_RN2P |
|
34 |
-# undef AV_RN4P |
|
35 |
-# undef AV_RN4PA |
|
36 |
-# undef AV_WN2P |
|
37 |
-# undef AV_WN4P |
|
38 |
-# undef AV_WN4PA |
|
39 |
-# undef CLIP |
|
40 |
-# undef FUNC |
|
41 |
-# undef FUNCC |
|
42 |
-# undef av_clip_pixel |
|
43 |
-# undef PIXEL_SPLAT_X4 |
|
44 |
-#else |
|
45 |
-# define AVCODEC_H264_HIGH_DEPTH_H |
|
46 |
-# define CLIP_PIXEL(depth)\ |
|
47 |
- static inline uint16_t av_clip_pixel_ ## depth (int p)\ |
|
48 |
- {\ |
|
49 |
- const int pixel_max = (1 << depth)-1;\ |
|
50 |
- return (p & ~pixel_max) ? (-p)>>31 & pixel_max : p;\ |
|
51 |
- } |
|
52 |
- |
|
53 |
-CLIP_PIXEL( 9) |
|
54 |
-CLIP_PIXEL(10) |
|
55 |
-#endif |
|
56 |
- |
|
57 |
-#if BIT_DEPTH > 8 |
|
58 |
-# define pixel uint16_t |
|
59 |
-# define pixel2 uint32_t |
|
60 |
-# define pixel4 uint64_t |
|
61 |
-# define dctcoef int32_t |
|
62 |
- |
|
63 |
-# define INIT_CLIP |
|
64 |
-# define no_rnd_avg_pixel4 no_rnd_avg64 |
|
65 |
-# define rnd_avg_pixel4 rnd_avg64 |
|
66 |
-# define AV_RN2P AV_RN32 |
|
67 |
-# define AV_RN4P AV_RN64 |
|
68 |
-# define AV_RN4PA AV_RN64A |
|
69 |
-# define AV_WN2P AV_WN32 |
|
70 |
-# define AV_WN4P AV_WN64 |
|
71 |
-# define AV_WN4PA AV_WN64A |
|
72 |
-# define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL) |
|
73 |
-#else |
|
74 |
-# define pixel uint8_t |
|
75 |
-# define pixel2 uint16_t |
|
76 |
-# define pixel4 uint32_t |
|
77 |
-# define dctcoef int16_t |
|
78 |
- |
|
79 |
-# define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
|
80 |
-# define no_rnd_avg_pixel4 no_rnd_avg32 |
|
81 |
-# define rnd_avg_pixel4 rnd_avg32 |
|
82 |
-# define AV_RN2P AV_RN16 |
|
83 |
-# define AV_RN4P AV_RN32 |
|
84 |
-# define AV_RN4PA AV_RN32A |
|
85 |
-# define AV_WN2P AV_WN16 |
|
86 |
-# define AV_WN4P AV_WN32 |
|
87 |
-# define AV_WN4PA AV_WN32A |
|
88 |
-# define PIXEL_SPLAT_X4(x) ((x)*0x01010101U) |
|
89 |
-#endif |
|
90 |
- |
|
91 |
-#if BIT_DEPTH == 8 |
|
92 |
-# define av_clip_pixel(a) av_clip_uint8(a) |
|
93 |
-# define CLIP(a) cm[a] |
|
94 |
-# define FUNC(a) a ## _8 |
|
95 |
-# define FUNCC(a) a ## _8_c |
|
96 |
-#elif BIT_DEPTH == 9 |
|
97 |
-# define av_clip_pixel(a) av_clip_pixel_9(a) |
|
98 |
-# define CLIP(a) av_clip_pixel_9(a) |
|
99 |
-# define FUNC(a) a ## _9 |
|
100 |
-# define FUNCC(a) a ## _9_c |
|
101 |
-#elif BIT_DEPTH == 10 |
|
102 |
-# define av_clip_pixel(a) av_clip_pixel_10(a) |
|
103 |
-# define CLIP(a) av_clip_pixel_10(a) |
|
104 |
-# define FUNC(a) a ## _10 |
|
105 |
-# define FUNCC(a) a ## _10_c |
|
106 |
-#endif |