18292
|
1 |
diff --git a/configure.in b/configure.in
|
|
2 |
index 7614ea8..b36d45a 100644
|
|
3 |
--- a/configure.in
|
|
4 |
+++ b/configure.in
|
|
5 |
@@ -1200,27 +1200,18 @@ AC_CHECK_HEADER(sys/sysinfo.h,
|
|
6 |
AC_DEFINE(HAVE_SYS_SYSINFO_H, 1,
|
|
7 |
[Define to 1 if sys/sysinfo.h is available]))
|
|
8 |
|
|
9 |
-AC_MSG_CHECKING(for mediaLib 2.3)
|
|
10 |
-use_mlib25=no
|
|
11 |
-# Check for a mediaLib 2.3 function since that is what the GTK+ mediaLib
|
|
12 |
+# Check for a mediaLib 2.5 function since that is what the GTK+ mediaLib
|
|
13 |
# patch requires.
|
|
14 |
-AC_CHECK_LIB(mlib, mlib_ImageSetStruct, use_mlib=yes, use_mlib=no)
|
|
15 |
+AC_MSG_CHECKING(for mediaLib 2.5)
|
|
16 |
+use_mlib=no
|
|
17 |
+# Check for a mediaLib 2.5 function since that is what is needed for
|
|
18 |
+# gdk_rgb_convert integration.
|
|
19 |
+AC_CHECK_LIB(mlib, mlib_VideoColorRGBint_to_BGRAint, use_mlib=yes, use_mlib=no)
|
|
20 |
if test $use_mlib = yes; then
|
|
21 |
AC_DEFINE(USE_MEDIALIB, 1,
|
|
22 |
- [Define to 1 if medialib is available and should be used])
|
|
23 |
- MEDIA_LIB=-lmlib
|
|
24 |
-
|
|
25 |
- AC_MSG_CHECKING(for mediaLib 2.5)
|
|
26 |
- # Check for a mediaLib 2.5 function since that is what is needed for
|
|
27 |
- # gdk_rgb_convert integration.
|
|
28 |
- AC_CHECK_LIB(mlib, mlib_VideoColorRGBint_to_BGRAint, use_mlib25=yes, use_mlib25=no)
|
|
29 |
- if test $use_mlib25 = yes; then
|
|
30 |
- AC_DEFINE(USE_MEDIALIB25, 1,
|
|
31 |
- [Define to 1 if medialib 2.5 is available])
|
|
32 |
- fi
|
|
33 |
+ [Define to 1 if medialib 2.5 is available])
|
|
34 |
fi
|
|
35 |
AM_CONDITIONAL(USE_MEDIALIB, test $use_mlib = yes)
|
|
36 |
-AM_CONDITIONAL(USE_MEDIALIB25, test $use_mlib25 = yes)
|
|
37 |
|
|
38 |
# Checks to see if we should compile in MMX support (there will be
|
|
39 |
# a runtime test when the code is actually run to see if it should
|
|
40 |
@@ -1291,7 +1282,7 @@ fi
|
|
41 |
AC_SUBST(REBUILD_PNGS)
|
|
42 |
|
|
43 |
GDK_PIXBUF_PACKAGES="gmodule-no-export-2.0 gobject-2.0 gio-2.0"
|
|
44 |
-GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB $MEDIA_LIB"
|
|
45 |
+GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB"
|
|
46 |
GDK_PIXBUF_EXTRA_CFLAGS=
|
|
47 |
GDK_PIXBUF_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
|
|
48 |
GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $PNG_DEP_CFLAGS_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"
|
|
49 |
diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
|
|
50 |
index 513d16f..06598d1 100644
|
|
51 |
--- a/gdk-pixbuf/pixops/pixops.c
|
|
52 |
+++ b/gdk-pixbuf/pixops/pixops.c
|
|
53 |
@@ -146,6 +146,89 @@ static void pixops_medialib_scale (guchar *dest_buf,
|
|
54 |
|
|
55 |
typedef struct _mlInterp mlInterp;
|
|
56 |
|
|
57 |
+typedef mlib_image* (*ml_ImageSetStruct) (mlib_image *image,
|
|
58 |
+ mlib_type type,
|
|
59 |
+ mlib_s32 channels,
|
|
60 |
+ mlib_s32 width,
|
|
61 |
+ mlib_s32 height,
|
|
62 |
+ mlib_s32 stride,
|
|
63 |
+ const void *data);
|
|
64 |
+typedef mlib_status (*ml_ImageChannelExtract) (mlib_image *dst,
|
|
65 |
+ mlib_image *src,
|
|
66 |
+ mlib_s32 cmask);
|
|
67 |
+typedef void * (*ml_InterpTableCreate) (mlib_type type,
|
|
68 |
+ mlib_s32 width,
|
|
69 |
+ mlib_s32 height,
|
|
70 |
+ mlib_s32 leftPadding,
|
|
71 |
+ mlib_s32 topPadding,
|
|
72 |
+ mlib_s32 subsampleBitsH,
|
|
73 |
+ mlib_s32 subsampleBitsV,
|
|
74 |
+ mlib_s32 precisionBits,
|
|
75 |
+ void * dataH,
|
|
76 |
+ void * dataV);
|
|
77 |
+typedef void (*ml_InterpTableDelete) (void *);
|
|
78 |
+typedef mlib_status (*ml_ZoomTranslateTable)(mlib_image * dst,
|
|
79 |
+ mlib_image * src,
|
|
80 |
+ mlib_d64 zoomx,
|
|
81 |
+ mlib_d64 zoomy,
|
|
82 |
+ mlib_d64 tx,
|
|
83 |
+ mlib_d64 ty,
|
|
84 |
+ void *interp_table,
|
|
85 |
+ mlib_edge edge);
|
|
86 |
+typedef mlib_status (*ml_ZoomTranslate) (mlib_image * dst,
|
|
87 |
+ mlib_image * src,
|
|
88 |
+ mlib_d64 zoomx,
|
|
89 |
+ mlib_d64 zoomy,
|
|
90 |
+ mlib_d64 tx,
|
|
91 |
+ mlib_d64 ty,
|
|
92 |
+ mlib_filter filter,
|
|
93 |
+ mlib_edge edge);
|
|
94 |
+typedef mlib_status (*ml_ZoomTranslateBlend) (mlib_image *dst,
|
|
95 |
+ const mlib_image *src,
|
|
96 |
+ mlib_d64 zoomx,
|
|
97 |
+ mlib_d64 zoomy,
|
|
98 |
+ mlib_d64 tx,
|
|
99 |
+ mlib_d64 ty,
|
|
100 |
+ mlib_filter filter,
|
|
101 |
+ mlib_edge edge,
|
|
102 |
+ mlib_blend blend,
|
|
103 |
+ mlib_s32 alpha,
|
|
104 |
+ mlib_s32 cmask);
|
|
105 |
+typedef mlib_status (*ml_ZoomTranslateTableBlend) (mlib_image *dst,
|
|
106 |
+ const mlib_image *src,
|
|
107 |
+ mlib_d64 zoomx,
|
|
108 |
+ mlib_d64 zoomy,
|
|
109 |
+ mlib_d64 tx,
|
|
110 |
+ mlib_d64 ty,
|
|
111 |
+ const void *table,
|
|
112 |
+ mlib_edge edge,
|
|
113 |
+ mlib_blend blend,
|
|
114 |
+ mlib_s32 cmask);
|
|
115 |
+typedef void (*ml_ColorRGBint_to_BGRAint) (mlib_u8 *bgra,
|
|
116 |
+ const mlib_u8 *rgb,
|
|
117 |
+ const mlib_u8 *a_array,
|
|
118 |
+ mlib_u8 a_const,
|
|
119 |
+ mlib_s32 w,
|
|
120 |
+ mlib_s32 h,
|
|
121 |
+ mlib_s32 dlb,
|
|
122 |
+ mlib_s32 slb,
|
|
123 |
+ mlib_s32 alb);
|
|
124 |
+
|
|
125 |
+
|
|
126 |
+
|
|
127 |
+static ml_ImageSetStruct _medialib_ImageSetStruct = NULL;
|
|
128 |
+static ml_ImageChannelExtract _medialib_ImageChannelExtract = NULL;
|
|
129 |
+static ml_ZoomTranslate _medialib_ZoomTranslate = NULL;
|
|
130 |
+static ml_InterpTableCreate _medialib_InterpTableCreate = NULL;
|
|
131 |
+static ml_InterpTableDelete _medialib_InterpTableDelete = NULL;
|
|
132 |
+static ml_ZoomTranslateTable _medialib_ZoomTranslateTable = NULL;
|
|
133 |
+static ml_ZoomTranslateBlend _medialib_ZoomTranslateBlend = NULL;
|
|
134 |
+static ml_ZoomTranslateTableBlend _medialib_ZoomTranslateTableBlend = NULL;
|
|
135 |
+static ml_ColorRGBint_to_BGRAint _medialib_ColorRGBint_to_BGRAint = NULL;
|
|
136 |
+
|
|
137 |
+static gboolean medialib_initialized = FALSE;
|
|
138 |
+static gboolean use_medialib = TRUE;
|
|
139 |
+
|
|
140 |
struct _mlInterp
|
|
141 |
{
|
|
142 |
double tx;
|
|
143 |
@@ -154,82 +237,152 @@ struct _mlInterp
|
|
144 |
void *interp_table;
|
|
145 |
};
|
|
146 |
|
|
147 |
-static gboolean medialib_initialized = FALSE;
|
|
148 |
-static gboolean use_medialib = TRUE;
|
|
149 |
+static void *
|
|
150 |
+dlopen_mlib (void)
|
|
151 |
+{
|
|
152 |
+ void *handle = NULL;
|
|
153 |
|
|
154 |
-/*
|
|
155 |
- * Sun mediaLib(tm) support.
|
|
156 |
- *
|
|
157 |
- * http://www.sun.com/processors/vis/mlib.html
|
|
158 |
- *
|
|
159 |
- */
|
|
160 |
-static void
|
|
161 |
-_pixops_use_medialib ()
|
|
162 |
+ if ((handle = dlopen ("libmlib.so.2", RTLD_LAZY)) != NULL)
|
|
163 |
+ return handle;
|
|
164 |
+ if ((handle = dlopen ("/usr/lib/libmlib.so.2", RTLD_LAZY)) != NULL)
|
|
165 |
+ return handle;
|
|
166 |
+
|
|
167 |
+ return NULL;
|
|
168 |
+}
|
|
169 |
+
|
|
170 |
+static gboolean
|
|
171 |
+initialize_mediaLib (void *handle)
|
|
172 |
+{
|
|
173 |
+ _medialib_ImageSetStruct = (ml_ImageSetStruct)dlsym (handle,
|
|
174 |
+ "mlib_ImageSetStruct");
|
|
175 |
+ _medialib_ImageChannelExtract = (ml_ImageChannelExtract)dlsym (
|
|
176 |
+ handle,
|
|
177 |
+ "mlib_ImageChannelExtract");
|
|
178 |
+ _medialib_ZoomTranslate = (ml_ZoomTranslate)dlsym (handle,
|
|
179 |
+ "mlib_ImageZoomTranslate");
|
|
180 |
+
|
|
181 |
+ _medialib_InterpTableCreate = (ml_InterpTableCreate)dlsym (handle,
|
|
182 |
+ "mlib_ImageInterpTableCreate");
|
|
183 |
+ _medialib_InterpTableDelete = (ml_InterpTableDelete)dlsym (handle,
|
|
184 |
+ "mlib_ImageInterpTableDelete");
|
|
185 |
+ _medialib_ZoomTranslateTable = (ml_ZoomTranslateTable)dlsym (handle,
|
|
186 |
+ "mlib_ImageZoomTranslateTable");
|
|
187 |
+
|
|
188 |
+ _medialib_ZoomTranslateBlend = (ml_ZoomTranslateBlend)dlsym (handle,
|
|
189 |
+ "mlib_ImageZoomTranslateBlend");
|
|
190 |
+ _medialib_ZoomTranslateTableBlend = (ml_ZoomTranslateTableBlend)dlsym (
|
|
191 |
+ handle,
|
|
192 |
+ "mlib_ImageZoomTranslateTableBlend");
|
|
193 |
+
|
|
194 |
+ if (_medialib_ImageSetStruct == NULL || _medialib_ImageChannelExtract == NULL ||
|
|
195 |
+ _medialib_ZoomTranslate == NULL || _medialib_InterpTableCreate == NULL ||
|
|
196 |
+ _medialib_InterpTableDelete == NULL || _medialib_ZoomTranslateTable == NULL ||
|
|
197 |
+ _medialib_ZoomTranslateBlend == NULL ||
|
|
198 |
+ _medialib_ZoomTranslateTableBlend == NULL)
|
|
199 |
+ return FALSE;
|
|
200 |
+
|
|
201 |
+ return TRUE;
|
|
202 |
+}
|
|
203 |
+
|
|
204 |
+static gboolean
|
|
205 |
+mlib_x86_checks (void *handle)
|
|
206 |
{
|
|
207 |
+ typedef char * (*ml_version) (void);
|
|
208 |
+ ml_version medialib_version;
|
|
209 |
char *mlib_version_string;
|
|
210 |
- char sys_info[257];
|
|
211 |
- long count;
|
|
212 |
+ char *mlib_target_isa;
|
|
213 |
|
|
214 |
- medialib_initialized = TRUE;
|
|
215 |
-
|
|
216 |
- if (getenv ("GDK_DISABLE_MEDIALIB"))
|
|
217 |
- {
|
|
218 |
- use_medialib = FALSE;
|
|
219 |
- return;
|
|
220 |
- }
|
|
221 |
+ medialib_version = (ml_version)dlsym (handle, "mlib_version");
|
|
222 |
+ if (medialib_version == NULL)
|
|
223 |
+ return FALSE;
|
|
224 |
|
|
225 |
/*
|
|
226 |
- * The imaging functions we want to use were added in mediaLib version 2.
|
|
227 |
- * So turn off mediaLib support if the user has an older version.
|
|
228 |
* mlib_version returns a string in this format:
|
|
229 |
*
|
|
230 |
* mediaLib:0210:20011101:v8plusa
|
|
231 |
* ^^^^^^^^ ^^^^ ^^^^^^^^ ^^^^^^^
|
|
232 |
* libname vers build ISALIST identifier
|
|
233 |
* date (in this case sparcv8plus+vis)
|
|
234 |
- *
|
|
235 |
+ *
|
|
236 |
* The first 2 digits of the version are the major version. The 3rd digit
|
|
237 |
* is the minor version, and the 4th digit is the micro version. So the
|
|
238 |
- * above string corresponds to version 2.1.0. In the following test we only
|
|
239 |
- * care about the major version.
|
|
240 |
+ * above string corresponds to version 2.1.0.
|
|
241 |
*/
|
|
242 |
- mlib_version_string = mlib_version ();
|
|
243 |
+ mlib_version_string = medialib_version ();
|
|
244 |
+ mlib_target_isa = &mlib_version_string[23];
|
|
245 |
|
|
246 |
- count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
|
|
247 |
+ /*
|
|
248 |
+ * For x86 processors mediaLib generic C implementation
|
|
249 |
+ * does not give any performance advantage so disable it.
|
|
250 |
+ */
|
|
251 |
+ if (strncmp (mlib_target_isa, "sse", 3) != 0)
|
|
252 |
+ return FALSE;
|
|
253 |
+
|
|
254 |
+ /*
|
|
255 |
+ * For x86 processors use of libumem conflicts with
|
|
256 |
+ * mediaLib, so avoid using it.
|
|
257 |
+ */
|
|
258 |
+ if (dlsym (RTLD_PROBE, "umem_alloc") != NULL)
|
|
259 |
+ return FALSE;
|
|
260 |
+
|
|
261 |
+ return TRUE;
|
|
262 |
+}
|
|
263 |
+
|
|
264 |
+/*
|
|
265 |
+ * Sun mediaLib(tm) support.
|
|
266 |
+ *
|
|
267 |
+ * http://www.sun.com/processors/vis/mlib.html
|
|
268 |
+ *
|
|
269 |
+ */
|
|
270 |
+gboolean
|
|
271 |
+_pixops_use_medialib (void)
|
|
272 |
+{
|
|
273 |
+ void *medialib_handle = NULL;
|
|
274 |
+ char sys_info[257];
|
|
275 |
+ long count;
|
|
276 |
|
|
277 |
+ if (medialib_initialized == TRUE)
|
|
278 |
+ return TRUE;
|
|
279 |
+
|
|
280 |
+ if (use_medialib == FALSE)
|
|
281 |
+ return FALSE;
|
|
282 |
+
|
|
283 |
+ if (getenv ("GDK_DISABLE_MEDIALIB"))
|
|
284 |
+ {
|
|
285 |
+ use_medialib = FALSE;
|
|
286 |
+ return FALSE;
|
|
287 |
+ }
|
|
288 |
+
|
|
289 |
+ medialib_handle = dlopen_mlib ();
|
|
290 |
+ if (medialib_handle == NULL)
|
|
291 |
+ goto fail;
|
|
292 |
+
|
|
293 |
+ count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
|
|
294 |
+
|
|
295 |
if (count != -1)
|
|
296 |
{
|
|
297 |
if (strcmp (sys_info, "i386") == 0)
|
|
298 |
{
|
|
299 |
- char *mlib_target_isa = &mlib_version_string[23];
|
|
300 |
-
|
|
301 |
- /*
|
|
302 |
- * For x86 processors mediaLib generic C implementation
|
|
303 |
- * does not give any performance advantage so disable it
|
|
304 |
- */
|
|
305 |
- if (strncmp (mlib_target_isa, "sse", 3) != 0)
|
|
306 |
- {
|
|
307 |
- use_medialib = FALSE;
|
|
308 |
- return;
|
|
309 |
- }
|
|
310 |
-
|
|
311 |
- /*
|
|
312 |
- * For x86 processors use of libumem conflicts with
|
|
313 |
- * mediaLib, so avoid using it.
|
|
314 |
- */
|
|
315 |
- if (dlsym (RTLD_PROBE, "umem_alloc") != NULL)
|
|
316 |
- {
|
|
317 |
- use_medialib = FALSE;
|
|
318 |
- return;
|
|
319 |
- }
|
|
320 |
+ if (mlib_x86_checks (medialib_handle) == FALSE)
|
|
321 |
+ goto fail;
|
|
322 |
}
|
|
323 |
}
|
|
324 |
else
|
|
325 |
{
|
|
326 |
- /* Failed to get system architecture, disable mediaLib anyway */
|
|
327 |
- use_medialib = FALSE;
|
|
328 |
- return;
|
|
329 |
+ /* Failed to get system architecture, disable mediaLib */
|
|
330 |
+ goto fail;
|
|
331 |
}
|
|
332 |
+
|
|
333 |
+ if (initialize_mediaLib (medialib_handle) == FALSE)
|
|
334 |
+ goto fail;
|
|
335 |
+
|
|
336 |
+ medialib_initialized = TRUE;
|
|
337 |
+ return TRUE;
|
|
338 |
+
|
|
339 |
+fail:
|
|
340 |
+ dlclose (medialib_handle);
|
|
341 |
+ use_medialib = FALSE;
|
|
342 |
+ return FALSE;
|
|
343 |
}
|
|
344 |
#endif
|
|
345 |
|
|
346 |
@@ -1850,9 +2003,7 @@ _pixops_composite (guchar *dest_buf,
|
|
347 |
dest_region_width, dest_region_height, offset_x,
|
|
348 |
offset_y, scale_x, scale_y,
|
|
349 |
(PixopsInterpType)interp_type, overall_alpha);
|
|
350 |
- return;
|
|
351 |
-#endif
|
|
352 |
-
|
|
353 |
+#else
|
|
354 |
new_dest_buf = dest_buf + dest_y * dest_rowstride + dest_x * dest_channels;
|
|
355 |
render_x0 = dest_x - offset_x;
|
|
356 |
render_y0 = dest_y - offset_y;
|
|
357 |
@@ -1865,6 +2016,7 @@ _pixops_composite (guchar *dest_buf,
|
|
358 |
src_rowstride, src_channels, src_has_alpha, scale_x,
|
|
359 |
scale_y, (PixopsInterpType)interp_type,
|
|
360 |
overall_alpha);
|
|
361 |
+#endif
|
|
362 |
}
|
|
363 |
|
|
364 |
#ifdef USE_MEDIALIB
|
|
365 |
@@ -1967,7 +2119,7 @@ medialib_get_interpolation (mlInterp * ml_interp,
|
|
366 |
ml_interp->po_filter.y.weights[i] *= sqrt_alpha;
|
|
367 |
}
|
|
368 |
|
|
369 |
- ml_interp->interp_table = (void *) mlib_ImageInterpTableCreate (MLIB_DOUBLE,
|
|
370 |
+ ml_interp->interp_table = (void *) _medialib_InterpTableCreate (MLIB_DOUBLE,
|
|
371 |
ml_interp->po_filter.x.n, ml_interp->po_filter.y.n, leftPadding,
|
|
372 |
topPadding, SUBSAMPLE_BITS, SUBSAMPLE_BITS, 8,
|
|
373 |
ml_interp->po_filter.x.weights, ml_interp->po_filter.y.weights);
|
|
374 |
@@ -2042,25 +2194,25 @@ pixops_medialib_composite (guchar *dest_buf,
|
|
375 |
return;
|
|
376 |
}
|
|
377 |
|
|
378 |
- mlib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels,
|
|
379 |
- src_width, src_height, src_rowstride, src_buf);
|
|
380 |
+ _medialib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels,
|
|
381 |
+ src_width, src_height, src_rowstride, src_buf);
|
|
382 |
|
|
383 |
if (dest_x == 0 && dest_y == 0 &&
|
|
384 |
dest_width == dest_region_width &&
|
|
385 |
dest_height == dest_region_height)
|
|
386 |
{
|
|
387 |
- mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
|
|
388 |
- dest_width, dest_height, dest_rowstride,
|
|
389 |
- dest_buf);
|
|
390 |
+ _medialib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
|
|
391 |
+ dest_width, dest_height, dest_rowstride,
|
|
392 |
+ dest_buf);
|
|
393 |
}
|
|
394 |
else
|
|
395 |
{
|
|
396 |
mlib_u8 *data = dest_buf + (dest_y * dest_rowstride) +
|
|
397 |
(dest_x * dest_channels);
|
|
398 |
|
|
399 |
- mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
|
|
400 |
- dest_region_width, dest_region_height,
|
|
401 |
- dest_rowstride, data);
|
|
402 |
+ _medialib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
|
|
403 |
+ dest_region_width, dest_region_height,
|
|
404 |
+ dest_rowstride, data);
|
|
405 |
}
|
|
406 |
|
|
407 |
ml_offset_x = floor (offset_x) - dest_x;
|
|
408 |
@@ -2070,7 +2222,7 @@ pixops_medialib_composite (guchar *dest_buf,
|
|
409 |
{
|
|
410 |
blend = src_has_alpha ? MLIB_BLEND_GTK_SRC_OVER2 : MLIB_BLEND_GTK_SRC;
|
|
411 |
|
|
412 |
- mlib_ImageZoomTranslateBlend (&img_dest,
|
|
413 |
+ _medialib_ZoomTranslateBlend (&img_dest,
|
|
414 |
&img_src,
|
|
415 |
scale_x,
|
|
416 |
scale_y,
|
|
417 |
@@ -2089,7 +2241,7 @@ pixops_medialib_composite (guchar *dest_buf,
|
|
418 |
if (interp_type == PIXOPS_INTERP_BILINEAR &&
|
|
419 |
scale_x > 1.0 && scale_y > 1.0)
|
|
420 |
{
|
|
421 |
- mlib_ImageZoomTranslateBlend (&img_dest,
|
|
422 |
+ _medialib_ZoomTranslateBlend (&img_dest,
|
|
423 |
&img_src,
|
|
424 |
scale_x,
|
|
425 |
scale_y,
|
|
426 |
@@ -2108,7 +2260,7 @@ pixops_medialib_composite (guchar *dest_buf,
|
|
427 |
|
|
428 |
if (ml_interp.interp_table != NULL)
|
|
429 |
{
|
|
430 |
- mlib_ImageZoomTranslateTableBlend (&img_dest,
|
|
431 |
+ _medialib_ZoomTranslateTableBlend (&img_dest,
|
|
432 |
&img_src,
|
|
433 |
scale_x,
|
|
434 |
scale_y,
|
|
435 |
@@ -2118,7 +2270,7 @@ pixops_medialib_composite (guchar *dest_buf,
|
|
436 |
MLIB_EDGE_SRC_EXTEND_INDEF,
|
|
437 |
blend,
|
|
438 |
1);
|
|
439 |
- mlib_ImageInterpTableDelete (ml_interp.interp_table);
|
|
440 |
+ _medialib_InterpTableDelete (ml_interp.interp_table);
|
|
441 |
}
|
|
442 |
else
|
|
443 |
{
|
|
444 |
@@ -2231,12 +2383,6 @@ _pixops_scale (guchar *dest_buf,
|
|
445 |
double scale_y,
|
|
446 |
PixopsInterpType interp_type)
|
|
447 |
{
|
|
448 |
- guchar *new_dest_buf;
|
|
449 |
- int render_x0;
|
|
450 |
- int render_y0;
|
|
451 |
- int render_x1;
|
|
452 |
- int render_y1;
|
|
453 |
-
|
|
454 |
#ifdef USE_MEDIALIB
|
|
455 |
pixops_medialib_scale (dest_buf, dest_width, dest_height, dest_rowstride,
|
|
456 |
dest_channels, dest_has_alpha, src_buf, src_width,
|
|
457 |
@@ -2244,8 +2390,12 @@ _pixops_scale (guchar *dest_buf,
|
|
458 |
src_has_alpha, dest_x, dest_y, dest_region_width,
|
|
459 |
dest_region_height, offset_x, offset_y, scale_x,
|
|
460 |
scale_y, (PixopsInterpType)interp_type);
|
|
461 |
- return;
|
|
462 |
-#endif
|
|
463 |
+#else
|
|
464 |
+ guchar *new_dest_buf;
|
|
465 |
+ int render_x0;
|
|
466 |
+ int render_y0;
|
|
467 |
+ int render_x1;
|
|
468 |
+ int render_y1;
|
|
469 |
|
|
470 |
new_dest_buf = dest_buf + dest_y * dest_rowstride + dest_x * dest_channels;
|
|
471 |
render_x0 = dest_x - offset_x;
|
|
472 |
@@ -2258,6 +2408,7 @@ _pixops_scale (guchar *dest_buf,
|
|
473 |
dest_has_alpha, src_buf, src_width, src_height,
|
|
474 |
src_rowstride, src_channels, src_has_alpha,
|
|
475 |
scale_x, scale_y, (PixopsInterpType)interp_type);
|
|
476 |
+#endif
|
|
477 |
}
|
|
478 |
|
|
479 |
#ifdef USE_MEDIALIB
|
|
480 |
@@ -2290,15 +2441,6 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
481 |
if (!medialib_initialized)
|
|
482 |
_pixops_use_medialib ();
|
|
483 |
|
|
484 |
- /*
|
|
485 |
- * We no longer support mediaLib 2.1 because it has a core dumping problem
|
|
486 |
- * in the mlib_ImageZoomTranslateTable function that has been corrected in
|
|
487 |
- * 2.2. Although the mediaLib_zoom function could be used, it does not
|
|
488 |
- * work properly if the source and destination images have different
|
|
489 |
- * values for "has_alpha" or "num_channels". The complicated if-logic
|
|
490 |
- * required to support both versions is not worth supporting
|
|
491 |
- * mediaLib 2.1 moving forward.
|
|
492 |
- */
|
|
493 |
if (!use_medialib)
|
|
494 |
{
|
|
495 |
_pixops_scale_real (dest_buf + dest_y * dest_rowstride + dest_x *
|
|
496 |
@@ -2317,25 +2459,25 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
497 |
double ml_offset_x, ml_offset_y;
|
|
498 |
guchar *tmp_buf = NULL;
|
|
499 |
|
|
500 |
- mlib_ImageSetStruct (&img_orig_src, MLIB_BYTE, src_channels, src_width,
|
|
501 |
- src_height, src_rowstride, src_buf);
|
|
502 |
+ _medialib_ImageSetStruct (&img_orig_src, MLIB_BYTE, src_channels, src_width,
|
|
503 |
+ src_height, src_rowstride, src_buf);
|
|
504 |
|
|
505 |
if (dest_x == 0 && dest_y == 0 &&
|
|
506 |
dest_width == dest_region_width &&
|
|
507 |
dest_height == dest_region_height)
|
|
508 |
{
|
|
509 |
- mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
|
|
510 |
- dest_width, dest_height, dest_rowstride,
|
|
511 |
- dest_buf);
|
|
512 |
+ _medialib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
|
|
513 |
+ dest_width, dest_height, dest_rowstride,
|
|
514 |
+ dest_buf);
|
|
515 |
}
|
|
516 |
else
|
|
517 |
{
|
|
518 |
mlib_u8 *data = dest_buf + (dest_y * dest_rowstride) +
|
|
519 |
(dest_x * dest_channels);
|
|
520 |
|
|
521 |
- mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
|
|
522 |
- dest_region_width, dest_region_height,
|
|
523 |
- dest_rowstride, data);
|
|
524 |
+ _medialib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
|
|
525 |
+ dest_region_width, dest_region_height,
|
|
526 |
+ dest_rowstride, data);
|
|
527 |
}
|
|
528 |
|
|
529 |
ml_offset_x = floor (offset_x) - dest_x;
|
|
530 |
@@ -2373,10 +2515,10 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
531 |
src_channels = channels;
|
|
532 |
src_rowstride = rowstride;
|
|
533 |
|
|
534 |
- mlib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels,
|
|
535 |
- src_width, src_height, src_rowstride,
|
|
536 |
- tmp_buf);
|
|
537 |
- mlib_ImageChannelExtract (&img_src, &img_orig_src, 0xE);
|
|
538 |
+ _medialib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels,
|
|
539 |
+ src_width, src_height, src_rowstride,
|
|
540 |
+ tmp_buf);
|
|
541 |
+ _medialib_ImageChannelExtract (&img_src, &img_orig_src, 0xE);
|
|
542 |
}
|
|
543 |
}
|
|
544 |
}
|
|
545 |
@@ -2385,7 +2527,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
546 |
{
|
|
547 |
if (src_channels == dest_channels)
|
|
548 |
{
|
|
549 |
- mlib_ImageZoomTranslate (&img_dest,
|
|
550 |
+ _medialib_ZoomTranslate (&img_dest,
|
|
551 |
&img_src,
|
|
552 |
scale_x,
|
|
553 |
scale_y,
|
|
554 |
@@ -2396,7 +2538,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
555 |
}
|
|
556 |
else
|
|
557 |
{
|
|
558 |
- mlib_ImageZoomTranslateBlend (&img_dest,
|
|
559 |
+ _medialib_ZoomTranslateBlend (&img_dest,
|
|
560 |
&img_src,
|
|
561 |
scale_x,
|
|
562 |
scale_y,
|
|
563 |
@@ -2414,7 +2556,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
564 |
if (interp_type == PIXOPS_INTERP_BILINEAR &&
|
|
565 |
scale_x > 1.0 && scale_y > 1.0)
|
|
566 |
{
|
|
567 |
- mlib_ImageZoomTranslate (&img_dest,
|
|
568 |
+ _medialib_ZoomTranslate (&img_dest,
|
|
569 |
&img_src,
|
|
570 |
scale_x,
|
|
571 |
scale_y,
|
|
572 |
@@ -2430,7 +2572,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
573 |
|
|
574 |
if (ml_interp.interp_table != NULL)
|
|
575 |
{
|
|
576 |
- mlib_ImageZoomTranslateTable (&img_dest,
|
|
577 |
+ _medialib_ZoomTranslateTable (&img_dest,
|
|
578 |
&img_src,
|
|
579 |
scale_x,
|
|
580 |
scale_y,
|
|
581 |
@@ -2439,7 +2581,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
582 |
ml_interp.interp_table,
|
|
583 |
MLIB_EDGE_SRC_EXTEND_INDEF);
|
|
584 |
|
|
585 |
- mlib_ImageInterpTableDelete (ml_interp.interp_table);
|
|
586 |
+ _medialib_InterpTableDelete (ml_interp.interp_table);
|
|
587 |
}
|
|
588 |
else
|
|
589 |
{
|
|
590 |
@@ -2461,7 +2603,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
591 |
break;
|
|
592 |
}
|
|
593 |
|
|
594 |
- mlib_ImageZoomTranslate (&img_dest,
|
|
595 |
+ _medialib_ZoomTranslate (&img_dest,
|
|
596 |
&img_src,
|
|
597 |
scale_x,
|
|
598 |
scale_y,
|
|
599 |
@@ -2477,7 +2619,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
600 |
else if (interp_type == PIXOPS_INTERP_BILINEAR &&
|
|
601 |
scale_x > 1.0 && scale_y > 1.0)
|
|
602 |
{
|
|
603 |
- mlib_ImageZoomTranslateBlend (&img_dest,
|
|
604 |
+ _medialib_ZoomTranslateBlend (&img_dest,
|
|
605 |
&img_src,
|
|
606 |
scale_x,
|
|
607 |
scale_y,
|
|
608 |
@@ -2496,7 +2638,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
609 |
|
|
610 |
if (ml_interp.interp_table != NULL)
|
|
611 |
{
|
|
612 |
- mlib_ImageZoomTranslateTableBlend (&img_dest,
|
|
613 |
+ _medialib_ZoomTranslateTableBlend (&img_dest,
|
|
614 |
&img_src,
|
|
615 |
scale_x,
|
|
616 |
scale_y,
|
|
617 |
@@ -2506,7 +2648,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
618 |
MLIB_EDGE_SRC_EXTEND_INDEF,
|
|
619 |
MLIB_BLEND_GTK_SRC,
|
|
620 |
1);
|
|
621 |
- mlib_ImageInterpTableDelete (ml_interp.interp_table);
|
|
622 |
+ _medialib_InterpTableDelete (ml_interp.interp_table);
|
|
623 |
}
|
|
624 |
else
|
|
625 |
{
|
|
626 |
@@ -2517,7 +2659,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
627 |
case PIXOPS_INTERP_BILINEAR:
|
|
628 |
ml_filter = MLIB_BILINEAR;
|
|
629 |
break;
|
|
630 |
-
|
|
631 |
+
|
|
632 |
case PIXOPS_INTERP_TILES:
|
|
633 |
ml_filter = MLIB_BILINEAR;
|
|
634 |
break;
|
|
635 |
@@ -2527,7 +2669,7 @@ pixops_medialib_scale (guchar *dest_buf,
|
|
636 |
break;
|
|
637 |
}
|
|
638 |
|
|
639 |
- mlib_ImageZoomTranslate (&img_dest,
|
|
640 |
+ _medialib_ZoomTranslate (&img_dest,
|
|
641 |
&img_src,
|
|
642 |
scale_x,
|
|
643 |
scale_y,
|
16520
|
644 |
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
|
|
645 |
index 81e6e08..d659480 100644
|
|
646 |
--- a/gdk/gdkdraw.c
|
|
647 |
+++ b/gdk/gdkdraw.c
|
|
648 |
@@ -1385,26 +1385,26 @@ composite_0888_medialib (guchar *src_buf,
|
|
649 |
|
|
650 |
mlib_image img_src, img_dst;
|
|
651 |
|
|
652 |
- mlib_ImageSetStruct (&img_dst,
|
|
653 |
- MLIB_BYTE,
|
|
654 |
- 4,
|
|
655 |
- width,
|
|
656 |
- height,
|
|
657 |
- dest_rowstride,
|
|
658 |
- dest_buf);
|
|
659 |
-
|
|
660 |
- mlib_ImageSetStruct (&img_src,
|
|
661 |
- MLIB_BYTE,
|
|
662 |
- 4,
|
|
663 |
- width,
|
|
664 |
- height,
|
|
665 |
- src_rowstride,
|
|
666 |
- src_buf);
|
|
667 |
+ medialib_ImageSetStruct (&img_dst,
|
|
668 |
+ MLIB_BYTE,
|
|
669 |
+ 4,
|
|
670 |
+ width,
|
|
671 |
+ height,
|
|
672 |
+ dest_rowstride,
|
|
673 |
+ dest_buf);
|
|
674 |
+
|
|
675 |
+ medialib_ImageSetStruct (&img_src,
|
|
676 |
+ MLIB_BYTE,
|
|
677 |
+ 4,
|
|
678 |
+ width,
|
|
679 |
+ height,
|
|
680 |
+ src_rowstride,
|
|
681 |
+ src_buf);
|
|
682 |
|
|
683 |
if (dest_byte_order == GDK_LSB_FIRST)
|
|
684 |
- mlib_ImageBlendRGBA2BGRA (&img_dst, &img_src);
|
|
685 |
+ medialib_BlendRGBA2BGRA (&img_dst, &img_src);
|
|
686 |
else
|
|
687 |
- mlib_ImageBlendRGBA2ARGB (&img_dst, &img_src);
|
|
688 |
+ medialib_BlendRGBA2ARGB (&img_dst, &img_src);
|
|
689 |
}
|
|
690 |
#endif
|
|
691 |
|
|
692 |
diff --git a/gdk/gdkmedialib.c b/gdk/gdkmedialib.c
|
|
693 |
index effb89d..ae01bfb 100644
|
|
694 |
--- a/gdk/gdkmedialib.c
|
|
695 |
+++ b/gdk/gdkmedialib.c
|
|
696 |
@@ -46,29 +46,56 @@
|
|
697 |
|
|
698 |
#include "gdkmedialib.h"
|
|
699 |
|
|
700 |
-typedef char * (*ml_version) (void);
|
|
701 |
+ml_ImageSetStruct medialib_ImageSetStruct = NULL;
|
|
702 |
+ml_BlendRGBA2BGRA medialib_BlendRGBA2BGRA = NULL;
|
|
703 |
+ml_BlendRGBA2ARGB medialib_BlendRGBA2ARGB = NULL;
|
|
704 |
+ml_ColorRGBint_to_BGRAint medialib_ColorRGBint_to_BGRAint = NULL;
|
|
705 |
|
|
706 |
-static ml_version medialib_version = mlib_version;
|
|
707 |
+static void *
|
|
708 |
+dlopen_mlib (void)
|
|
709 |
+{
|
|
710 |
+ void *handle = NULL;
|
|
711 |
|
|
712 |
-gboolean
|
|
713 |
-_gdk_use_medialib (void)
|
|
714 |
+ if ((handle = dlopen ("libmlib.so.2", RTLD_LAZY)) != NULL)
|
|
715 |
+ return handle;
|
|
716 |
+ if ((handle = dlopen ("/usr/lib/libmlib.so.2", RTLD_LAZY)) != NULL)
|
|
717 |
+ return handle;
|
|
718 |
+
|
|
719 |
+ return NULL;
|
|
720 |
+}
|
|
721 |
+
|
|
722 |
+static gboolean
|
|
723 |
+initialize_mediaLib (void *handle)
|
|
724 |
+{
|
|
725 |
+ medialib_ImageSetStruct = (ml_ImageSetStruct)dlsym (handle,
|
|
726 |
+ "mlib_ImageSetStruct");
|
|
727 |
+ medialib_BlendRGBA2BGRA = (ml_BlendRGBA2BGRA)dlsym (handle,
|
|
728 |
+ "mlib_ImageBlendRGBA2BGRA");
|
|
729 |
+ medialib_BlendRGBA2ARGB = (ml_BlendRGBA2ARGB)dlsym (handle,
|
|
730 |
+ "mlib_ImageBlendRGBA2ARGB");
|
|
731 |
+ medialib_ColorRGBint_to_BGRAint = (ml_ColorRGBint_to_BGRAint)dlsym (
|
|
732 |
+ handle,
|
|
733 |
+ "mlib_VideoColorRGBint_to_BGRAint");
|
|
734 |
+ if (medialib_ImageSetStruct == NULL || medialib_BlendRGBA2BGRA == NULL ||
|
|
735 |
+ medialib_BlendRGBA2ARGB == NULL || medialib_ColorRGBint_to_BGRAint == NULL)
|
|
736 |
+ return FALSE;
|
|
737 |
+
|
|
738 |
+ return TRUE;
|
|
739 |
+}
|
|
740 |
+
|
|
741 |
+static gboolean
|
|
742 |
+mlib_x86_checks (void *handle)
|
|
743 |
{
|
|
744 |
+ typedef char * (*ml_version) (void);
|
|
745 |
+ ml_version medialib_version;
|
|
746 |
char *mlib_version_string;
|
|
747 |
- char sys_info[257];
|
|
748 |
- long count;
|
|
749 |
+ char *mlib_target_isa;
|
|
750 |
|
|
751 |
- /*
|
|
752 |
- * Sun mediaLib(tm) support.
|
|
753 |
- *
|
|
754 |
- * http://www.sun.com/processors/vis/mlib.html
|
|
755 |
- *
|
|
756 |
- */
|
|
757 |
- if (getenv ("GDK_DISABLE_MEDIALIB"))
|
|
758 |
+ medialib_version = (ml_version)dlsym (handle, "mlib_version");
|
|
759 |
+ if (medialib_version == NULL)
|
|
760 |
return FALSE;
|
|
761 |
|
|
762 |
/*
|
|
763 |
- * The imaging functions we want to use were added in mediaLib version 2.
|
|
764 |
- * So turn off mediaLib support if the user has an older version.
|
|
765 |
* mlib_version returns a string in this format:
|
|
766 |
*
|
|
767 |
* mediaLib:0210:20011101:v8plusa
|
|
768 |
@@ -78,43 +105,83 @@ _gdk_use_medialib (void)
|
|
769 |
*
|
|
770 |
* The first 2 digits of the version are the major version. The 3rd digit
|
|
771 |
* is the minor version, and the 4th digit is the micro version. So the
|
|
772 |
- * above string corresponds to version 2.1.0.In the following test we only
|
|
773 |
- * care about the major version.
|
|
774 |
+ * above string corresponds to version 2.1.0.
|
|
775 |
+ */
|
|
776 |
+ mlib_version_string = medialib_version ();
|
|
777 |
+ mlib_target_isa = &mlib_version_string[23];
|
|
778 |
+
|
|
779 |
+ /*
|
|
780 |
+ * For x86 processors mediaLib generic C implementation
|
|
781 |
+ * does not give any performance advantage so disable it.
|
|
782 |
+ */
|
|
783 |
+ if (strncmp (mlib_target_isa, "sse", 3) != 0)
|
|
784 |
+ return FALSE;
|
|
785 |
+
|
|
786 |
+ /*
|
|
787 |
+ * For x86 processors use of libumem conflicts with
|
|
788 |
+ * mediaLib, so avoid using it.
|
|
789 |
*/
|
|
790 |
- mlib_version_string = medialib_version ();
|
|
791 |
+ if (dlsym (RTLD_PROBE, "umem_alloc") != NULL)
|
|
792 |
+ return FALSE;
|
|
793 |
+
|
|
794 |
+ return TRUE;
|
|
795 |
+}
|
|
796 |
|
|
797 |
- count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
|
|
798 |
+/*
|
|
799 |
+ * Sun mediaLib(tm) support.
|
|
800 |
+ *
|
|
801 |
+ * http://www.sun.com/processors/vis/mlib.html
|
|
802 |
+ *
|
|
803 |
+ */
|
|
804 |
+gboolean
|
|
805 |
+_gdk_use_medialib (void)
|
|
806 |
+{
|
|
807 |
+ static gboolean medialib_initialized = FALSE;
|
|
808 |
+ static gboolean use_medialib = TRUE;
|
|
809 |
+ void *medialib_handle = NULL;
|
|
810 |
+ char sys_info[257];
|
|
811 |
+ long count;
|
|
812 |
+
|
|
813 |
+ if (medialib_initialized == TRUE)
|
|
814 |
+ return TRUE;
|
|
815 |
+
|
|
816 |
+ if (use_medialib == FALSE)
|
|
817 |
+ return FALSE;
|
|
818 |
+
|
|
819 |
+ if (getenv ("GDK_DISABLE_MEDIALIB"))
|
|
820 |
+ {
|
|
821 |
+ use_medialib = FALSE;
|
|
822 |
+ return FALSE;
|
|
823 |
+ }
|
|
824 |
+
|
|
825 |
+ medialib_handle = dlopen_mlib ();
|
|
826 |
+ if (medialib_handle == NULL)
|
|
827 |
+ goto fail;
|
|
828 |
+
|
|
829 |
+ count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
|
|
830 |
|
|
831 |
- if (count != -1)
|
|
832 |
- {
|
|
833 |
- if (strcmp (sys_info, "i386") == 0)
|
|
834 |
- {
|
|
835 |
- char *mlib_target_isa = &mlib_version_string[23];
|
|
836 |
-
|
|
837 |
- /*
|
|
838 |
- * For x86 processors mediaLib generic C implementation
|
|
839 |
- * does not give any performance advantage so disable it.
|
|
840 |
- */
|
|
841 |
- if (strncmp (mlib_target_isa, "sse", 3) != 0)
|
|
842 |
- {
|
|
843 |
- return FALSE;
|
|
844 |
- }
|
|
845 |
-
|
|
846 |
- /*
|
|
847 |
- * For x86 processors use of libumem conflicts with
|
|
848 |
- * mediaLib, so avoid using it.
|
|
849 |
- */
|
|
850 |
- if (dlsym (RTLD_PROBE, "umem_alloc") != NULL)
|
|
851 |
- {
|
|
852 |
- return FALSE;
|
|
853 |
- }
|
|
854 |
- }
|
|
855 |
- }
|
|
856 |
- else
|
|
857 |
- {
|
|
858 |
- /* Failed to get system architecture, disable mediaLib */
|
|
859 |
- return FALSE;
|
|
860 |
- }
|
|
861 |
+ if (count != -1)
|
|
862 |
+ {
|
|
863 |
+ if (strcmp (sys_info, "i386") == 0)
|
|
864 |
+ {
|
|
865 |
+ if (mlib_x86_checks (medialib_handle) == FALSE)
|
|
866 |
+ goto fail;
|
|
867 |
+ }
|
|
868 |
+ }
|
|
869 |
+ else
|
|
870 |
+ {
|
|
871 |
+ /* Failed to get system architecture, disable mediaLib */
|
|
872 |
+ goto fail;
|
|
873 |
+ }
|
|
874 |
|
|
875 |
+ if (initialize_mediaLib (medialib_handle) == FALSE)
|
|
876 |
+ goto fail;
|
|
877 |
+
|
|
878 |
+ medialib_initialized = TRUE;
|
|
879 |
return TRUE;
|
|
880 |
+
|
|
881 |
+fail:
|
|
882 |
+ dlclose (medialib_handle);
|
|
883 |
+ use_medialib = FALSE;
|
|
884 |
+ return FALSE;
|
|
885 |
}
|
|
886 |
diff --git a/gdk/gdkmedialib.h b/gdk/gdkmedialib.h
|
|
887 |
index 1912e9d..1306277 100644
|
|
888 |
--- a/gdk/gdkmedialib.h
|
|
889 |
+++ b/gdk/gdkmedialib.h
|
|
890 |
@@ -36,6 +36,32 @@
|
|
891 |
|
|
892 |
G_BEGIN_DECLS
|
|
893 |
|
|
894 |
+typedef mlib_image* (*ml_ImageSetStruct) (mlib_image *image,
|
|
895 |
+ mlib_type type,
|
|
896 |
+ mlib_s32 channels,
|
|
897 |
+ mlib_s32 width,
|
|
898 |
+ mlib_s32 height,
|
|
899 |
+ mlib_s32 stride,
|
|
900 |
+ const void *data);
|
|
901 |
+typedef mlib_status (*ml_BlendRGBA2BGRA) (mlib_image *dst,
|
|
902 |
+ const mlib_image *src);
|
|
903 |
+typedef mlib_status (*ml_BlendRGBA2ARGB) (mlib_image *dst,
|
|
904 |
+ const mlib_image *src);
|
|
905 |
+typedef void (*ml_ColorRGBint_to_BGRAint) (mlib_u8 *bgra,
|
|
906 |
+ const mlib_u8 *rgb,
|
|
907 |
+ const mlib_u8 *a_array,
|
|
908 |
+ mlib_u8 a_const,
|
|
909 |
+ mlib_s32 w,
|
|
910 |
+ mlib_s32 h,
|
|
911 |
+ mlib_s32 dlb,
|
|
912 |
+ mlib_s32 slb,
|
|
913 |
+ mlib_s32 alb);
|
|
914 |
+
|
|
915 |
+extern ml_ColorRGBint_to_BGRAint medialib_ColorRGBint_to_BGRAint;
|
|
916 |
+extern ml_ImageSetStruct medialib_ImageSetStruct;
|
|
917 |
+extern ml_BlendRGBA2BGRA medialib_BlendRGBA2BGRA;
|
|
918 |
+extern ml_BlendRGBA2ARGB medialib_BlendRGBA2ARGB;
|
|
919 |
+
|
|
920 |
gboolean _gdk_use_medialib (void);
|
|
921 |
|
|
922 |
G_END_DECLS
|
|
923 |
diff --git a/gdk/gdkrgb.c b/gdk/gdkrgb.c
|
|
924 |
index 347ff59..9f34366 100644
|
|
925 |
--- a/gdk/gdkrgb.c
|
|
926 |
+++ b/gdk/gdkrgb.c
|
|
927 |
@@ -2154,7 +2154,7 @@ gdk_rgb_convert_0888 (GdkRgbInfo *image_info, GdkImage *image,
|
|
928 |
}
|
|
929 |
}
|
|
930 |
|
|
931 |
-#ifdef USE_MEDIALIB25
|
|
932 |
+#ifdef USE_MEDIALIB
|
|
933 |
/* convert 24-bit packed to 32-bit unpacked */
|
|
934 |
static void
|
|
935 |
gdk_rgb_convert_0888_medialib (GdkRgbInfo *image_info, GdkImage *image,
|
|
936 |
@@ -2171,9 +2171,9 @@ gdk_rgb_convert_0888_medialib (GdkRgbInfo *image_info, GdkImage *image,
|
|
937 |
bpl = image->bpl;
|
|
938 |
obuf = ((guchar *)image->mem) + y0 * bpl + x0 * 4;
|
|
939 |
|
|
940 |
- mlib_VideoColorRGBint_to_BGRAint (obuf, bptr, NULL, 0xff,
|
|
941 |
- width, height, bpl,
|
|
942 |
- rowstride, 0);
|
|
943 |
+ medialib_ColorRGBint_to_BGRAint (obuf, bptr, NULL, 0xff,
|
|
944 |
+ width, height, bpl,
|
|
945 |
+ rowstride, 0);
|
|
946 |
}
|
|
947 |
#endif
|
|
948 |
|
|
949 |
@@ -3157,7 +3157,7 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info)
|
|
950 |
vtype == GDK_VISUAL_TRUE_COLOR &&
|
|
951 |
(mask_rgb && byte_order == GDK_LSB_FIRST))
|
|
952 |
{
|
|
953 |
-#ifdef USE_MEDIALIB25
|
|
954 |
+#ifdef USE_MEDIALIB
|
|
955 |
if (_gdk_use_medialib ())
|
|
956 |
conv = gdk_rgb_convert_0888_medialib;
|
|
957 |
else
|
|
958 |
@@ -3184,7 +3184,7 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info)
|
|
959 |
else if (bpp == 32 && depth == 32 && vtype == GDK_VISUAL_TRUE_COLOR &&
|
|
960 |
(mask_rgb && byte_order == GDK_LSB_FIRST))
|
|
961 |
{
|
|
962 |
-#ifdef USE_MEDIALIB25
|
|
963 |
+#ifdef USE_MEDIALIB
|
|
964 |
if (_gdk_use_medialib ())
|
|
965 |
conv = gdk_rgb_convert_0888_medialib;
|
|
966 |
else
|
|
967 |
|