Mercurial > libavcodec.hg
annotate mlib/dsputil_mlib.c @ 905:2b93dc762f9a libavcodec
fixing illegal 3. esc bug (the mpeg4 std only requires encoders to use unescaped symbols but not esc1 or esc2 if they are shorter than esc3, andjust beause its logical to use the shortest possible vlc doesnt mean encoders do that)
author | michaelni |
---|---|
date | Wed, 04 Dec 2002 11:47:24 +0000 |
parents | 3c6df37177dd |
children | c35f06d95e64 |
rev | line source |
---|---|
88 | 1 /* |
2 * Sun mediaLib optimized DSP utils | |
429 | 3 * Copyright (c) 2001 Fabrice Bellard. |
88 | 4 * |
429 | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2 of the License, or (at your option) any later version. | |
88 | 9 * |
429 | 10 * This library is distributed in the hope that it will be useful, |
88 | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Lesser General Public License for more details. | |
88 | 14 * |
429 | 15 * You should have received a copy of the GNU Lesser General Public |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
88 | 18 */ |
19 | |
20 #include "../dsputil.h" | |
628
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
21 #include "../mpegvideo.h" |
88 | 22 |
23 #include <mlib_types.h> | |
24 #include <mlib_status.h> | |
25 #include <mlib_sys.h> | |
26 #include <mlib_video.h> | |
27 | |
28 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
29 /* copy block, width 16 pixel, height 8/16 */ |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
30 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
31 static void put_pixels16_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
32 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
33 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
34 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
35 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
36 mlib_VideoCopyRef_U8_U8_16x16(dest, (uint8_t *)ref, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
37 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
38 mlib_VideoCopyRef_U8_U8_16x8 (dest, (uint8_t *)ref, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
39 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
40 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
41 static void put_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
42 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
43 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
44 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
45 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
46 mlib_VideoInterpX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
47 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
48 mlib_VideoInterpX_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
49 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
50 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
51 static void put_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
52 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
53 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
54 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
55 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
56 mlib_VideoInterpY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
57 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
58 mlib_VideoInterpY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
59 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
60 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
61 static void put_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
62 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
63 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
64 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
65 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
66 mlib_VideoInterpXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
67 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
68 mlib_VideoInterpXY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
69 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
70 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
71 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
72 /* copy block, width 8 pixel, height 8/16 */ |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
73 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
74 static void put_pixels8_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
75 int stride, int height) |
88 | 76 { |
77 assert(height == 16 || height == 8); | |
78 if (height == 16) | |
79 mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride); | |
80 else | |
81 mlib_VideoCopyRef_U8_U8_8x8 (dest, (uint8_t *)ref, stride); | |
82 } | |
83 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
84 static void put_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
85 int stride, int height) |
88 | 86 { |
87 assert(height == 16 || height == 8); | |
88 if (height == 16) | |
89 mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
90 else | |
91 mlib_VideoInterpX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
92 } | |
93 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
94 static void put_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
95 int stride, int height) |
88 | 96 { |
97 assert(height == 16 || height == 8); | |
98 if (height == 16) | |
99 mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
100 else | |
101 mlib_VideoInterpY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
102 } | |
103 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
104 static void put_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
105 int stride, int height) |
88 | 106 { |
107 assert(height == 16 || height == 8); | |
108 if (height == 16) | |
109 mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
110 else | |
111 mlib_VideoInterpXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
112 } | |
113 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
114 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
115 /* average/merge dest+source block, width 16 pixel, height 8/16 */ |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
116 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
117 static void avg_pixels16_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
118 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
119 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
120 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
121 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
122 mlib_VideoCopyRefAve_U8_U8_16x16(dest, (uint8_t *)ref, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
123 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
124 mlib_VideoCopyRefAve_U8_U8_16x8 (dest, (uint8_t *)ref, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
125 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
126 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
127 static void avg_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
128 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
129 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
130 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
131 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
132 mlib_VideoInterpAveX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
133 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
134 mlib_VideoInterpAveX_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
135 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
136 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
137 static void avg_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
138 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
139 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
140 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
141 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
142 mlib_VideoInterpAveY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
143 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
144 mlib_VideoInterpAveY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
145 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
146 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
147 static void avg_pixels16_xy2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
148 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
149 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
150 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
151 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
152 mlib_VideoInterpAveXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
153 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
154 mlib_VideoInterpAveXY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
155 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
156 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
157 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
158 /* average/merge dest+source block, width 8 pixel, height 8/16 */ |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
159 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
160 static void avg_pixels8_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
161 int stride, int height) |
88 | 162 { |
163 assert(height == 16 || height == 8); | |
164 if (height == 16) | |
165 mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride); | |
166 else | |
167 mlib_VideoCopyRefAve_U8_U8_8x8 (dest, (uint8_t *)ref, stride); | |
168 } | |
169 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
170 static void avg_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
171 int stride, int height) |
88 | 172 { |
173 assert(height == 16 || height == 8); | |
174 if (height == 16) | |
175 mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
176 else | |
177 mlib_VideoInterpAveX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
178 } | |
179 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
180 static void avg_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
181 int stride, int height) |
88 | 182 { |
183 assert(height == 16 || height == 8); | |
184 if (height == 16) | |
185 mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
186 else | |
187 mlib_VideoInterpAveY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
188 } | |
189 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
190 static void avg_pixels8_xy2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
191 int stride, int height) |
88 | 192 { |
193 assert(height == 16 || height == 8); | |
194 if (height == 16) | |
195 mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
196 else | |
197 mlib_VideoInterpAveXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
198 } | |
199 | |
200 | |
201 static void add_pixels_clamped_mlib(const DCTELEM *block, UINT8 *pixels, int line_size) | |
202 { | |
203 mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size); | |
204 } | |
205 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
206 |
730 | 207 /* XXX: those functions should be suppressed ASAP when all IDCTs are |
208 converted */ | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
209 static void ff_idct_put_mlib(UINT8 *dest, int line_size, DCTELEM *data) |
88 | 210 { |
211 mlib_VideoIDCT8x8_S16_S16 (data, data); | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
212 put_pixels_clamped(data, dest, line_size); |
88 | 213 } |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
214 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
215 static void ff_idct_add_mlib(UINT8 *dest, int line_size, DCTELEM *data) |
730 | 216 { |
217 mlib_VideoIDCT8x8_S16_S16 (data, data); | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
218 add_pixels_clamped(data, dest, line_size); |
730 | 219 } |
88 | 220 |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
221 static void ff_fdct_mlib(DCTELEM *data) |
88 | 222 { |
223 mlib_VideoDCT8x8_S16_S16 (data, data); | |
224 } | |
225 | |
856
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
226 void dsputil_init_mlib(DSPContext* c, unsigned mask) |
88 | 227 { |
856
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
228 c->put_pixels_tab[0][0] = put_pixels16_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
229 c->put_pixels_tab[0][1] = put_pixels16_x2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
230 c->put_pixels_tab[0][2] = put_pixels16_y2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
231 c->put_pixels_tab[0][3] = put_pixels16_xy2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
232 c->put_pixels_tab[1][0] = put_pixels8_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
233 c->put_pixels_tab[1][1] = put_pixels8_x2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
234 c->put_pixels_tab[1][2] = put_pixels8_y2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
235 c->put_pixels_tab[1][3] = put_pixels8_xy2_mlib; |
88 | 236 |
856
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
237 c->avg_pixels_tab[0][0] = avg_pixels16_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
238 c->avg_pixels_tab[0][1] = avg_pixels16_x2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
239 c->avg_pixels_tab[0][2] = avg_pixels16_y2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
240 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
241 c->avg_pixels_tab[1][0] = avg_pixels8_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
242 c->avg_pixels_tab[1][1] = avg_pixels8_x2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
243 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
244 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
245 |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
246 c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
247 c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
248 |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
249 c->add_pixels_clamped = add_pixels_clamped_mlib; |
88 | 250 } |
628
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
251 |
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
252 void MPV_common_init_mlib(MpegEncContext *s) |
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
253 { |
730 | 254 int i; |
255 | |
628
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
256 if(s->avctx->dct_algo==FF_DCT_AUTO || s->avctx->dct_algo==FF_DCT_MLIB){ |
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
257 s->fdct = ff_fdct_mlib; |
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
258 } |
730 | 259 |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
260 if(s->avctx->idct_algo==FF_IDCT_AUTO || s->avctx->idct_algo==FF_IDCT_MLIB){ |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
261 s->idct_put= ff_idct_put_mlib; |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
262 s->idct_add= ff_idct_add_mlib; |
768
c3fc09466f92
idct_permutation_type variable, so the permutation type can quickly be identified
michaelni
parents:
735
diff
changeset
|
263 s->idct_permutation_type= FF_NO_IDCT_PERM; |
730 | 264 } |
628
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
265 } |