summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/src/hermes
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2018-02-07 20:04:46 -0500
committerFranklin Wei <git@fwei.tk>2018-03-12 20:52:01 -0400
commit6039eb05ba6d82ef56f2868c96654c552d117bf9 (patch)
tree9db7016bcbf66cfdf7b9bc998d84c6eaff9c8378 /apps/plugins/sdl/src/hermes
parentef373c03b96b0be08babca581d9f10bccfd4931f (diff)
downloadrockbox-6039eb05ba6d82ef56f2868c96654c552d117bf9.tar.gz
rockbox-6039eb05ba6d82ef56f2868c96654c552d117bf9.zip
sdl: remove non-rockbox drivers
We never use any of these other drivers, so having them around just takes up space. Change-Id: Iced812162df1fef3fd55522b7e700acb6c3bcd41
Diffstat (limited to 'apps/plugins/sdl/src/hermes')
-rw-r--r--apps/plugins/sdl/src/hermes/COPYING.LIB438
-rw-r--r--apps/plugins/sdl/src/hermes/HeadMMX.h100
-rw-r--r--apps/plugins/sdl/src/hermes/HeadX86.h186
-rw-r--r--apps/plugins/sdl/src/hermes/README13
-rw-r--r--apps/plugins/sdl/src/hermes/common.inc9
-rw-r--r--apps/plugins/sdl/src/hermes/mmx_main.asm74
-rw-r--r--apps/plugins/sdl/src/hermes/mmxp2_32.asm405
-rw-r--r--apps/plugins/sdl/src/hermes/x86_main.asm75
-rw-r--r--apps/plugins/sdl/src/hermes/x86p_16.asm490
-rw-r--r--apps/plugins/sdl/src/hermes/x86p_32.asm1044
10 files changed, 0 insertions, 2834 deletions
diff --git a/apps/plugins/sdl/src/hermes/COPYING.LIB b/apps/plugins/sdl/src/hermes/COPYING.LIB
deleted file mode 100644
index 69679a5636..0000000000
--- a/apps/plugins/sdl/src/hermes/COPYING.LIB
+++ /dev/null
@@ -1,438 +0,0 @@
1 GNU LIBRARY GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1991 Free Software Foundation, Inc.
5 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9[This is the first released version of the library GPL. It is
10 numbered 2 because it goes with version 2 of the ordinary GPL.]
11
12 Preamble
13
14 The licenses for most software are designed to take away your
15freedom to share and change it. By contrast, the GNU General Public
16Licenses are intended to guarantee your freedom to share and change
17free software--to make sure the software is free for all its users.
18
19 This license, the Library General Public License, applies to some
20specially designated Free Software Foundation software, and to any
21other libraries whose authors decide to use it. You can use it for
22your libraries, too.
23
24 When we speak of free software, we are referring to freedom, not
25price. Our General Public Licenses are designed to make sure that you
26have the freedom to distribute copies of free software (and charge for
27this service if you wish), that you receive source code or can get it
28if you want it, that you can change the software or use pieces of it
29in new free programs; and that you know you can do these things.
30
31 To protect your rights, we need to make restrictions that forbid
32anyone to deny you these rights or to ask you to surrender the rights.
33These restrictions translate to certain responsibilities for you if
34you distribute copies of the library, or if you modify it.
35
36 For example, if you distribute copies of the library, whether gratis
37or for a fee, you must give the recipients all the rights that we gave
38you. You must make sure that they, too, receive or can get the source
39code. If you link a program with the library, you must provide
40complete object files to the recipients so that they can relink them
41with the library, after making changes to the library and recompiling
42it. And you must show them these terms so they know their rights.
43
44 Our method of protecting your rights has two steps: (1) copyright
45the library, and (2) offer you this license which gives you legal
46permission to copy, distribute and/or modify the library.
47
48 Also, for each distributor's protection, we want to make certain
49that everyone understands that there is no warranty for this free
50library. If the library is modified by someone else and passed on, we
51want its recipients to know that what they have is not the original
52version, so that any problems introduced by others will not reflect on
53the original authors' reputations.
54
55 Finally, any free program is threatened constantly by software
56patents. We wish to avoid the danger that companies distributing free
57software will individually obtain patent licenses, thus in effect
58transforming the program into proprietary software. To prevent this,
59we have made it clear that any patent must be licensed for everyone's
60free use or not licensed at all.
61
62 Most GNU software, including some libraries, is covered by the ordinary
63GNU General Public License, which was designed for utility programs. This
64license, the GNU Library General Public License, applies to certain
65designated libraries. This license is quite different from the ordinary
66one; be sure to read it in full, and don't assume that anything in it is
67the same as in the ordinary license.
68
69 The reason we have a separate public license for some libraries is that
70they blur the distinction we usually make between modifying or adding to a
71program and simply using it. Linking a program with a library, without
72changing the library, is in some sense simply using the library, and is
73analogous to running a utility program or application program. However, in
74a textual and legal sense, the linked executable is a combined work, a
75derivative of the original library, and the ordinary General Public License
76treats it as such.
77
78 Because of this blurred distinction, using the ordinary General
79Public License for libraries did not effectively promote software
80sharing, because most developers did not use the libraries. We
81concluded that weaker conditions might promote sharing better.
82
83 However, unrestricted linking of non-free programs would deprive the
84users of those programs of all benefit from the free status of the
85libraries themselves. This Library General Public License is intended to
86permit developers of non-free programs to use free libraries, while
87preserving your freedom as a user of such programs to change the free
88libraries that are incorporated in them. (We have not seen how to achieve
89this as regards changes in header files, but we have achieved it as regards
90changes in the actual functions of the Library.) The hope is that this
91will lead to faster development of free libraries.
92
93 The precise terms and conditions for copying, distribution and
94modification follow. Pay close attention to the difference between a
95"work based on the library" and a "work that uses the library". The
96former contains code derived from the library, while the latter only
97works together with the library.
98
99 Note that it is possible for a library to be covered by the ordinary
100General Public License rather than by this special one.
101
102 GNU LIBRARY GENERAL PUBLIC LICENSE
103 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
104
105 0. This License Agreement applies to any software library which
106contains a notice placed by the copyright holder or other authorized
107party saying it may be distributed under the terms of this Library
108General Public License (also called "this License"). Each licensee is
109addressed as "you".
110
111 A "library" means a collection of software functions and/or data
112prepared so as to be conveniently linked with application programs
113(which use some of those functions and data) to form executables.
114
115 The "Library", below, refers to any such software library or work
116which has been distributed under these terms. A "work based on the
117Library" means either the Library or any derivative work under
118copyright law: that is to say, a work containing the Library or a
119portion of it, either verbatim or with modifications and/or translated
120straightforwardly into another language. (Hereinafter, translation is
121included without limitation in the term "modification".)
122
123 "Source code" for a work means the preferred form of the work for
124making modifications to it. For a library, complete source code means
125all the source code for all modules it contains, plus any associated
126interface definition files, plus the scripts used to control compilation
127and installation of the library.
128
129 Activities other than copying, distribution and modification are not
130covered by this License; they are outside its scope. The act of
131running a program using the Library is not restricted, and output from
132such a program is covered only if its contents constitute a work based
133on the Library (independent of the use of the Library in a tool for
134writing it). Whether that is true depends on what the Library does
135and what the program that uses the Library does.
136
137 1. You may copy and distribute verbatim copies of the Library's
138complete source code as you receive it, in any medium, provided that
139you conspicuously and appropriately publish on each copy an
140appropriate copyright notice and disclaimer of warranty; keep intact
141all the notices that refer to this License and to the absence of any
142warranty; and distribute a copy of this License along with the
143Library.
144
145 You may charge a fee for the physical act of transferring a copy,
146and you may at your option offer warranty protection in exchange for a
147fee.
148
149 2. You may modify your copy or copies of the Library or any portion
150of it, thus forming a work based on the Library, and copy and
151distribute such modifications or work under the terms of Section 1
152above, provided that you also meet all of these conditions:
153
154 a) The modified work must itself be a software library.
155
156 b) You must cause the files modified to carry prominent notices
157 stating that you changed the files and the date of any change.
158
159 c) You must cause the whole of the work to be licensed at no
160 charge to all third parties under the terms of this License.
161
162 d) If a facility in the modified Library refers to a function or a
163 table of data to be supplied by an application program that uses
164 the facility, other than as an argument passed when the facility
165 is invoked, then you must make a good faith effort to ensure that,
166 in the event an application does not supply such function or
167 table, the facility still operates, and performs whatever part of
168 its purpose remains meaningful.
169
170 (For example, a function in a library to compute square roots has
171 a purpose that is entirely well-defined independent of the
172 application. Therefore, Subsection 2d requires that any
173 application-supplied function or table used by this function must
174 be optional: if the application does not supply it, the square
175 root function must still compute square roots.)
176
177These requirements apply to the modified work as a whole. If
178identifiable sections of that work are not derived from the Library,
179and can be reasonably considered independent and separate works in
180themselves, then this License, and its terms, do not apply to those
181sections when you distribute them as separate works. But when you
182distribute the same sections as part of a whole which is a work based
183on the Library, the distribution of the whole must be on the terms of
184this License, whose permissions for other licensees extend to the
185entire whole, and thus to each and every part regardless of who wrote
186it.
187
188Thus, it is not the intent of this section to claim rights or contest
189your rights to work written entirely by you; rather, the intent is to
190exercise the right to control the distribution of derivative or
191collective works based on the Library.
192
193In addition, mere aggregation of another work not based on the Library
194with the Library (or with a work based on the Library) on a volume of
195a storage or distribution medium does not bring the other work under
196the scope of this License.
197
198 3. You may opt to apply the terms of the ordinary GNU General Public
199License instead of this License to a given copy of the Library. To do
200this, you must alter all the notices that refer to this License, so
201that they refer to the ordinary GNU General Public License, version 2,
202instead of to this License. (If a newer version than version 2 of the
203ordinary GNU General Public License has appeared, then you can specify
204that version instead if you wish.) Do not make any other change in
205these notices.
206
207 Once this change is made in a given copy, it is irreversible for
208that copy, so the ordinary GNU General Public License applies to all
209subsequent copies and derivative works made from that copy.
210
211 This option is useful when you wish to copy part of the code of
212the Library into a program that is not a library.
213
214 4. You may copy and distribute the Library (or a portion or
215derivative of it, under Section 2) in object code or executable form
216under the terms of Sections 1 and 2 above provided that you accompany
217it with the complete corresponding machine-readable source code, which
218must be distributed under the terms of Sections 1 and 2 above on a
219medium customarily used for software interchange.
220
221 If distribution of object code is made by offering access to copy
222from a designated place, then offering equivalent access to copy the
223source code from the same place satisfies the requirement to
224distribute the source code, even though third parties are not
225compelled to copy the source along with the object code.
226
227 5. A program that contains no derivative of any portion of the
228Library, but is designed to work with the Library by being compiled or
229linked with it, is called a "work that uses the Library". Such a
230work, in isolation, is not a derivative work of the Library, and
231therefore falls outside the scope of this License.
232
233 However, linking a "work that uses the Library" with the Library
234creates an executable that is a derivative of the Library (because it
235contains portions of the Library), rather than a "work that uses the
236library". The executable is therefore covered by this License.
237Section 6 states terms for distribution of such executables.
238
239 When a "work that uses the Library" uses material from a header file
240that is part of the Library, the object code for the work may be a
241derivative work of the Library even though the source code is not.
242Whether this is true is especially significant if the work can be
243linked without the Library, or if the work is itself a library. The
244threshold for this to be true is not precisely defined by law.
245
246 If such an object file uses only numerical parameters, data
247structure layouts and accessors, and small macros and small inline
248functions (ten lines or less in length), then the use of the object
249file is unrestricted, regardless of whether it is legally a derivative
250work. (Executables containing this object code plus portions of the
251Library will still fall under Section 6.)
252
253 Otherwise, if the work is a derivative of the Library, you may
254distribute the object code for the work under the terms of Section 6.
255Any executables containing that work also fall under Section 6,
256whether or not they are linked directly with the Library itself.
257
258 6. As an exception to the Sections above, you may also compile or
259link a "work that uses the Library" with the Library to produce a
260work containing portions of the Library, and distribute that work
261under terms of your choice, provided that the terms permit
262modification of the work for the customer's own use and reverse
263engineering for debugging such modifications.
264
265 You must give prominent notice with each copy of the work that the
266Library is used in it and that the Library and its use are covered by
267this License. You must supply a copy of this License. If the work
268during execution displays copyright notices, you must include the
269copyright notice for the Library among them, as well as a reference
270directing the user to the copy of this License. Also, you must do one
271of these things:
272
273 a) Accompany the work with the complete corresponding
274 machine-readable source code for the Library including whatever
275 changes were used in the work (which must be distributed under
276 Sections 1 and 2 above); and, if the work is an executable linked
277 with the Library, with the complete machine-readable "work that
278 uses the Library", as object code and/or source code, so that the
279 user can modify the Library and then relink to produce a modified
280 executable containing the modified Library. (It is understood
281 that the user who changes the contents of definitions files in the
282 Library will not necessarily be able to recompile the application
283 to use the modified definitions.)
284
285 b) Accompany the work with a written offer, valid for at
286 least three years, to give the same user the materials
287 specified in Subsection 6a, above, for a charge no more
288 than the cost of performing this distribution.
289
290 c) If distribution of the work is made by offering access to copy
291 from a designated place, offer equivalent access to copy the above
292 specified materials from the same place.
293
294 d) Verify that the user has already received a copy of these
295 materials or that you have already sent this user a copy.
296
297 For an executable, the required form of the "work that uses the
298Library" must include any data and utility programs needed for
299reproducing the executable from it. However, as a special exception,
300the source code distributed need not include anything that is normally
301distributed (in either source or binary form) with the major
302components (compiler, kernel, and so on) of the operating system on
303which the executable runs, unless that component itself accompanies
304the executable.
305
306 It may happen that this requirement contradicts the license
307restrictions of other proprietary libraries that do not normally
308accompany the operating system. Such a contradiction means you cannot
309use both them and the Library together in an executable that you
310distribute.
311
312 7. You may place library facilities that are a work based on the
313Library side-by-side in a single library together with other library
314facilities not covered by this License, and distribute such a combined
315library, provided that the separate distribution of the work based on
316the Library and of the other library facilities is otherwise
317permitted, and provided that you do these two things:
318
319 a) Accompany the combined library with a copy of the same work
320 based on the Library, uncombined with any other library
321 facilities. This must be distributed under the terms of the
322 Sections above.
323
324 b) Give prominent notice with the combined library of the fact
325 that part of it is a work based on the Library, and explaining
326 where to find the accompanying uncombined form of the same work.
327
328 8. You may not copy, modify, sublicense, link with, or distribute
329the Library except as expressly provided under this License. Any
330attempt otherwise to copy, modify, sublicense, link with, or
331distribute the Library is void, and will automatically terminate your
332rights under this License. However, parties who have received copies,
333or rights, from you under this License will not have their licenses
334terminated so long as such parties remain in full compliance.
335
336 9. You are not required to accept this License, since you have not
337signed it. However, nothing else grants you permission to modify or
338distribute the Library or its derivative works. These actions are
339prohibited by law if you do not accept this License. Therefore, by
340modifying or distributing the Library (or any work based on the
341Library), you indicate your acceptance of this License to do so, and
342all its terms and conditions for copying, distributing or modifying
343the Library or works based on it.
344
345 10. Each time you redistribute the Library (or any work based on the
346Library), the recipient automatically receives a license from the
347original licensor to copy, distribute, link with or modify the Library
348subject to these terms and conditions. You may not impose any further
349restrictions on the recipients' exercise of the rights granted herein.
350You are not responsible for enforcing compliance by third parties to
351this License.
352
353 11. If, as a consequence of a court judgment or allegation of patent
354infringement or for any other reason (not limited to patent issues),
355conditions are imposed on you (whether by court order, agreement or
356otherwise) that contradict the conditions of this License, they do not
357excuse you from the conditions of this License. If you cannot
358distribute so as to satisfy simultaneously your obligations under this
359License and any other pertinent obligations, then as a consequence you
360may not distribute the Library at all. For example, if a patent
361license would not permit royalty-free redistribution of the Library by
362all those who receive copies directly or indirectly through you, then
363the only way you could satisfy both it and this License would be to
364refrain entirely from distribution of the Library.
365
366If any portion of this section is held invalid or unenforceable under any
367particular circumstance, the balance of the section is intended to apply,
368and the section as a whole is intended to apply in other circumstances.
369
370It is not the purpose of this section to induce you to infringe any
371patents or other property right claims or to contest validity of any
372such claims; this section has the sole purpose of protecting the
373integrity of the free software distribution system which is
374implemented by public license practices. Many people have made
375generous contributions to the wide range of software distributed
376through that system in reliance on consistent application of that
377system; it is up to the author/donor to decide if he or she is willing
378to distribute software through any other system and a licensee cannot
379impose that choice.
380
381This section is intended to make thoroughly clear what is believed to
382be a consequence of the rest of this License.
383
384 12. If the distribution and/or use of the Library is restricted in
385certain countries either by patents or by copyrighted interfaces, the
386original copyright holder who places the Library under this License may add
387an explicit geographical distribution limitation excluding those countries,
388so that distribution is permitted only in or among countries not thus
389excluded. In such case, this License incorporates the limitation as if
390written in the body of this License.
391
392 13. The Free Software Foundation may publish revised and/or new
393versions of the Library General Public License from time to time.
394Such new versions will be similar in spirit to the present version,
395but may differ in detail to address new problems or concerns.
396
397Each version is given a distinguishing version number. If the Library
398specifies a version number of this License which applies to it and
399"any later version", you have the option of following the terms and
400conditions either of that version or of any later version published by
401the Free Software Foundation. If the Library does not specify a
402license version number, you may choose any version ever published by
403the Free Software Foundation.
404
405 14. If you wish to incorporate parts of the Library into other free
406programs whose distribution conditions are incompatible with these,
407write to the author to ask for permission. For software which is
408copyrighted by the Free Software Foundation, write to the Free
409Software Foundation; we sometimes make exceptions for this. Our
410decision will be guided by the two goals of preserving the free status
411of all derivatives of our free software and of promoting the sharing
412and reuse of software generally.
413
414 NO WARRANTY
415
416 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
417WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
418EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
419OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
420KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
421IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
422PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
423LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
424THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
425
426 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
427WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
428AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
429FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
430CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
431LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
432RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
433FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
434SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
435DAMAGES.
436
437 END OF TERMS AND CONDITIONS
438
diff --git a/apps/plugins/sdl/src/hermes/HeadMMX.h b/apps/plugins/sdl/src/hermes/HeadMMX.h
deleted file mode 100644
index 5d9850cca9..0000000000
--- a/apps/plugins/sdl/src/hermes/HeadMMX.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 Header definitions for the MMX routines for the HERMES library
3 Copyright (c) 1998 Christian Nentwich (c.nentwich@cs.ucl.ac.uk)
4 This source code is licensed under the GNU LGPL
5
6 Please refer to the file COPYING.LIB contained in the distribution for
7 licensing conditions
8*/
9#include "SDL_config.h"
10
11#ifndef __HERMES_HEAD_MMX__
12#define __HERMES_HEAD_MMX__
13
14
15/* If you cannot stand ifdefs, then please do not look into this file, it's
16 going to end your life :) */
17
18#ifdef X86_ASSEMBLER
19
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25void STACKCALL ConvertMMX(HermesConverterInterface *);
26
27void STACKCALL ClearMMX_32(HermesClearInterface *);
28void STACKCALL ClearMMX_24(HermesClearInterface *);
29void STACKCALL ClearMMX_16(HermesClearInterface *);
30void STACKCALL ClearMMX_8(HermesClearInterface *);
31
32void ConvertMMXpII32_24RGB888();
33void ConvertMMXpII32_16RGB565();
34void ConvertMMXpII32_16BGR565();
35void ConvertMMXpII32_16RGB555();
36void ConvertMMXpII32_16BGR565();
37void ConvertMMXpII32_16BGR555();
38
39void ConvertMMXp32_16RGB555();
40
41#ifdef __cplusplus
42}
43#endif
44
45
46
47/* Fix the underscore business with ELF compilers */
48
49#if (defined(__ELF__) && defined(__GNUC__)) || defined(__SUNPRO_C)
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54 extern void _ConvertMMX(HermesConverterInterface *);
55 extern void _ConvertMMXpII32_24RGB888();
56 extern void _ConvertMMXpII32_16RGB565();
57 extern void _ConvertMMXpII32_16BGR565();
58 extern void _ConvertMMXpII32_16RGB555();
59 extern void _ConvertMMXpII32_16BGR555();
60
61 #define ConvertMMX _ConvertMMX
62 #define ConvertMMXpII32_24RGB888 _ConvertMMXpII32_24RGB888
63 #define ConvertMMXpII32_16RGB565 _ConvertMMXpII32_16RGB565
64 #define ConvertMMXpII32_16BGR565 _ConvertMMXpII32_16BGR565
65 #define ConvertMMXpII32_16RGB555 _ConvertMMXpII32_16RGB555
66 #define ConvertMMXpII32_16BGR555 _ConvertMMXpII32_16BGR555
67
68 #ifdef __cplusplus
69 }
70 #endif
71
72#endif /* ELF and GNUC */
73
74
75
76
77/* Make it work with Watcom */
78#ifdef __WATCOMC__
79#pragma warning 601 9
80
81#pragma aux ConvertMMX "_*" modify [EAX EBX ECX EDX ESI EDI]
82
83#pragma aux ClearMMX_32 "_*" modify [EAX EBX ECX EDX ESI EDI]
84#pragma aux ClearMMX_24 "_*" modify [EAX EBX ECX EDX ESI EDI]
85#pragma aux ClearMMX_16 "_*" modify [EAX EBX ECX EDX ESI EDI]
86#pragma aux ClearMMX_8 "_*" modify [EAX EBX ECX EDX ESI EDI]
87
88#pragma aux ConvertMMXpII32_24RGB888 "_*"
89#pragma aux ConvertMMXpII32_16RGB565 "_*"
90#pragma aux ConvertMMXpII32_16BGR565 "_*"
91#pragma aux ConvertMMXpII32_16RGB555 "_*"
92#pragma aux ConvertMMXpII32_16BGR555 "_*"
93#pragma aux ConvertMMXp32_16RGB555 "_*"
94
95#endif /* WATCOM */
96
97#endif /* X86_ASSEMBLER */
98
99
100#endif
diff --git a/apps/plugins/sdl/src/hermes/HeadX86.h b/apps/plugins/sdl/src/hermes/HeadX86.h
deleted file mode 100644
index fc6b6ddddf..0000000000
--- a/apps/plugins/sdl/src/hermes/HeadX86.h
+++ /dev/null
@@ -1,186 +0,0 @@
1/*
2 Header definitions for the x86 routines for the HERMES library
3 Copyright (c) 1998 Christian Nentwich (brn@eleet.mcb.at)
4 This source code is licensed under the GNU LGPL
5
6 Please refer to the file COPYING.LIB contained in the distribution for
7 licensing conditions
8*/
9
10#ifndef __HERMES_HEAD_X86__
11#define __HERMES_HEAD_X86__
12
13
14#ifdef X86_ASSEMBLER
15
16/* If you can't stand IFDEFS, then close your eyes now, please :) */
17
18/* Ok, we start with normal function definitions */
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23
24void STACKCALL ConvertX86(HermesConverterInterface *);
25void STACKCALL ClearX86_32(HermesClearInterface *);
26void STACKCALL ClearX86_24(HermesClearInterface *);
27void STACKCALL ClearX86_16(HermesClearInterface *);
28void STACKCALL ClearX86_8(HermesClearInterface *);
29
30int STACKCALL Hermes_X86_CPU();
31
32void ConvertX86p32_32BGR888();
33void ConvertX86p32_32RGBA888();
34void ConvertX86p32_32BGRA888();
35void ConvertX86p32_24RGB888();
36void ConvertX86p32_24BGR888();
37void ConvertX86p32_16RGB565();
38void ConvertX86p32_16BGR565();
39void ConvertX86p32_16RGB555();
40void ConvertX86p32_16BGR555();
41void ConvertX86p32_8RGB332();
42
43void ConvertX86p16_32RGB888();
44void ConvertX86p16_32BGR888();
45void ConvertX86p16_32RGBA888();
46void ConvertX86p16_32BGRA888();
47void ConvertX86p16_24RGB888();
48void ConvertX86p16_24BGR888();
49void ConvertX86p16_16BGR565();
50void ConvertX86p16_16RGB555();
51void ConvertX86p16_16BGR555();
52void ConvertX86p16_8RGB332();
53
54void CopyX86p_4byte();
55void CopyX86p_3byte();
56void CopyX86p_2byte();
57void CopyX86p_1byte();
58
59void ConvertX86pI8_32();
60void ConvertX86pI8_24();
61void ConvertX86pI8_16();
62
63extern int ConvertX86p16_32RGB888_LUT_X86[512];
64extern int ConvertX86p16_32BGR888_LUT_X86[512];
65extern int ConvertX86p16_32RGBA888_LUT_X86[512];
66extern int ConvertX86p16_32BGRA888_LUT_X86[512];
67
68#ifdef __cplusplus
69}
70#endif
71
72
73
74
75/* Now fix up the ELF underscore problem */
76
77#if (defined(__ELF__) && defined(__GNUC__)) || defined(__SUNPRO_C)
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81
82 extern int _Hermes_X86_CPU();
83
84 extern void _ConvertX86(HermesConverterInterface *);
85
86 extern void _ConvertX86p32_32BGR888();
87 extern void _ConvertX86p32_32RGBA888();
88 extern void _ConvertX86p32_32BGRA888();
89 extern void _ConvertX86p32_24RGB888();
90 extern void _ConvertX86p32_24BGR888();
91 extern void _ConvertX86p32_16RGB565();
92 extern void _ConvertX86p32_16BGR565();
93 extern void _ConvertX86p32_16RGB555();
94 extern void _ConvertX86p32_16BGR555();
95 extern void _ConvertX86p32_8RGB332();
96
97 extern void _ConvertX86p16_16BGR565();
98 extern void _ConvertX86p16_16RGB555();
99 extern void _ConvertX86p16_16BGR555();
100 extern void _ConvertX86p16_8RGB332();
101
102
103 #define Hermes_X86_CPU _Hermes_X86_CPU
104
105 #define ConvertX86 _ConvertX86
106
107 #define ConvertX86p32_32BGR888 _ConvertX86p32_32BGR888
108 #define ConvertX86p32_32RGBA888 _ConvertX86p32_32RGBA888
109 #define ConvertX86p32_32BGRA888 _ConvertX86p32_32BGRA888
110 #define ConvertX86p32_24RGB888 _ConvertX86p32_24RGB888
111 #define ConvertX86p32_24BGR888 _ConvertX86p32_24BGR888
112 #define ConvertX86p32_16RGB565 _ConvertX86p32_16RGB565
113 #define ConvertX86p32_16BGR565 _ConvertX86p32_16BGR565
114 #define ConvertX86p32_16RGB555 _ConvertX86p32_16RGB555
115 #define ConvertX86p32_16BGR555 _ConvertX86p32_16BGR555
116 #define ConvertX86p32_8RGB332 _ConvertX86p32_8RGB332
117
118 #define ConvertX86p16_16BGR565 _ConvertX86p16_16BGR565
119 #define ConvertX86p16_16RGB555 _ConvertX86p16_16RGB555
120 #define ConvertX86p16_16BGR555 _ConvertX86p16_16BGR555
121 #define ConvertX86p16_8RGB332 _ConvertX86p16_8RGB332
122
123
124 #ifdef __cplusplus
125 }
126 #endif
127
128#endif /* ELF & GNU */
129
130
131
132/* Make it run with WATCOM C */
133#ifdef __WATCOMC__
134#pragma warning 601 9
135
136#pragma aux Hermes_X86_CPU "_*"
137
138#pragma aux ConvertX86 "_*" modify [EAX EBX ECX EDX ESI EDI]
139#pragma aux ClearX86_32 "_*" modify [EAX EBX ECX EDX ESI EDI]
140#pragma aux ClearX86_24 "_*" modify [EAX EBX ECX EDX ESI EDI]
141#pragma aux ClearX86_16 "_*" modify [EAX EBX ECX EDX ESI EDI]
142#pragma aux ClearX86_8 "_*" modify [EAX EBX ECX EDX ESI EDI]
143
144#pragma aux ConvertX86p32_32BGR888 "_*"
145#pragma aux ConvertX86p32_32RGBA888 "_*"
146#pragma aux ConvertX86p32_32BGRA888 "_*"
147#pragma aux ConvertX86p32_24RGB888 "_*"
148#pragma aux ConvertX86p32_24BGR888 "_*"
149#pragma aux ConvertX86p32_16RGB565 "_*"
150#pragma aux ConvertX86p32_16BGR565 "_*"
151#pragma aux ConvertX86p32_16RGB555 "_*"
152#pragma aux ConvertX86p32_16BGR555 "_*"
153#pragma aux ConvertX86p32_8RGB332 "_*"
154
155#pragma aux ConvertX86p16_32RGB888 "_*"
156#pragma aux ConvertX86p16_32BGR888 "_*"
157#pragma aux ConvertX86p16_32RGBA888 "_*"
158#pragma aux ConvertX86p16_32BGRA888 "_*"
159#pragma aux ConvertX86p16_24RGB888 "_*"
160#pragma aux ConvertX86p16_24BGR888 "_*"
161#pragma aux ConvertX86p16_16BGR565 "_*"
162#pragma aux ConvertX86p16_16RGB555 "_*"
163#pragma aux ConvertX86p16_16BGR555 "_*"
164#pragma aux ConvertX86p16_8RGB332 "_*"
165
166#pragma aux CopyX86p_4byte "_*"
167#pragma aux CopyX86p_3byte "_*"
168#pragma aux CopyX86p_2byte "_*"
169#pragma aux CopyX86p_1byte "_*"
170
171#pragma aux ConvertX86pI8_32 "_*"
172#pragma aux ConvertX86pI8_24 "_*"
173#pragma aux ConvertX86pI8_16 "_*"
174
175#pragma aux ConvertX86p16_32RGB888_LUT_X86 "_*"
176#pragma aux ConvertX86p16_32BGR888_LUT_X86 "_*"
177#pragma aux ConvertX86p16_32RGBA888_LUT_X86 "_*"
178#pragma aux ConvertX86p16_32BGRA888_LUT_X86 "_*"
179
180#endif /* __WATCOMC__ */
181
182
183#endif /* X86_ASSEMBLER */
184
185
186#endif
diff --git a/apps/plugins/sdl/src/hermes/README b/apps/plugins/sdl/src/hermes/README
deleted file mode 100644
index a03b6cfda4..0000000000
--- a/apps/plugins/sdl/src/hermes/README
+++ /dev/null
@@ -1,13 +0,0 @@
1HERMES 1.2.4 (c)1998 Christian Nentwich (brn) (c.nentwich@cs.ucl.ac.uk)
2and quite a few assembler routines (c) Glenn Fielder (gaffer@gaffer.org)
3
4This library and all the files enclosed in this package are free software
5under the terms of the GNU Library General Public License (LGPL). Please
6refer to the included file COPYING.LIB for the exact terms.
7----------------------------------------------------------------------------
8
9This is a stripped down version of HERMES, including only the x86 assembler
10converters, for use with Simple DirectMedia Layer.
11
12The full HERMES library is available at: http://hermes.terminal.at/
13
diff --git a/apps/plugins/sdl/src/hermes/common.inc b/apps/plugins/sdl/src/hermes/common.inc
deleted file mode 100644
index 9587e6ffbd..0000000000
--- a/apps/plugins/sdl/src/hermes/common.inc
+++ /dev/null
@@ -1,9 +0,0 @@
1; Some common macros for hermes nasm code
2
3%macro SDL_FUNC 1
4%ifdef HIDDEN_VISIBILITY
5GLOBAL %1:function hidden
6%else
7GLOBAL %1
8%endif
9%endmacro
diff --git a/apps/plugins/sdl/src/hermes/mmx_main.asm b/apps/plugins/sdl/src/hermes/mmx_main.asm
deleted file mode 100644
index 00032b95c6..0000000000
--- a/apps/plugins/sdl/src/hermes/mmx_main.asm
+++ /dev/null
@@ -1,74 +0,0 @@
1;
2; mmx format converter main loops for HERMES
3; Some routines Copyright (c) 1998 Christian Nentwich (c.nentwich@cs.ucl.ac.uk)
4; This source code is licensed under the GNU LGPL
5;
6; Please refer to the file COPYING.LIB contained in the distribution for
7; licensing conditions
8;
9
10BITS 32
11
12%include "common.inc"
13
14SDL_FUNC _ConvertMMX
15
16SECTION .text
17
18;; _ConvertMMX:
19;; [ESP+8] ConverterInfo*
20;; --------------------------------------------------------------------------
21;; ConverterInfo (ebp+..)
22;; 0: void *s_pixels
23;; 4: int s_width
24;; 8: int s_height
25;; 12: int s_add
26;; 16: void *d_pixels
27;; 20: int d_width
28;; 24: int d_height
29;; 28: int d_add
30;; 32: void (*converter_function)()
31;; 36: int32 *lookup
32
33_ConvertMMX:
34 push ebp
35 mov ebp,esp
36
37; Save the registers used by the blitters, necessary for optimized code
38 pusha
39
40 mov eax,[ebp+8]
41
42 cmp dword [eax+4],BYTE 0
43 je endconvert
44
45 mov ebp,eax
46
47 mov esi,[ebp+0]
48 mov edi,[ebp+16]
49
50y_loop:
51 mov ecx,[ebp+4]
52
53 call [ebp+32]
54
55 add esi,[ebp+12]
56 add edi,[ebp+28]
57
58 dec dword [ebp+8]
59 jnz y_loop
60
61
62; Restore the registers used by the blitters, necessary for optimized code
63 popa
64
65 pop ebp
66
67endconvert:
68 emms
69
70 ret
71
72%ifidn __OUTPUT_FORMAT__,elf32
73section .note.GNU-stack noalloc noexec nowrite progbits
74%endif
diff --git a/apps/plugins/sdl/src/hermes/mmxp2_32.asm b/apps/plugins/sdl/src/hermes/mmxp2_32.asm
deleted file mode 100644
index 20c3277a26..0000000000
--- a/apps/plugins/sdl/src/hermes/mmxp2_32.asm
+++ /dev/null
@@ -1,405 +0,0 @@
1;
2; pII-optimised MMX format converters for HERMES
3; Copyright (c) 1998 Christian Nentwich (c.nentwich@cs.ucl.ac.uk)
4; and (c) 1999 Jonathan Matthew (jmatthew@uq.net.au)
5; This source code is licensed under the GNU LGPL
6;
7; Please refer to the file COPYING.LIB contained in the distribution for
8; licensing conditions
9;
10; COPYRIGHT NOTICE
11;
12; This file partly contains code that is (c) Intel Corporation, specifically
13; the mode detection routine, and the converter to 15 bit (8 pixel
14; conversion routine from the mmx programming tutorial pages).
15;
16;
17; These routines aren't exactly pII optimised - it's just that as they
18; are, they're terrible on p5 MMXs, but less so on pIIs. Someone needs to
19; optimise them for p5 MMXs..
20
21BITS 32
22
23%include "common.inc"
24
25SDL_FUNC _ConvertMMXpII32_24RGB888
26SDL_FUNC _ConvertMMXpII32_16RGB565
27SDL_FUNC _ConvertMMXpII32_16BGR565
28SDL_FUNC _ConvertMMXpII32_16RGB555
29SDL_FUNC _ConvertMMXpII32_16BGR555
30
31;; Macros for conversion routines
32
33%macro _push_immq_mask 1
34 push dword %1
35 push dword %1
36%endmacro
37
38%macro load_immq 2
39 _push_immq_mask %2
40 movq %1, [esp]
41%endmacro
42
43%macro pand_immq 2
44 _push_immq_mask %2
45 pand %1, [esp]
46%endmacro
47
48%define CLEANUP_IMMQ_LOADS(num) \
49 add esp, byte 8 * num
50
51%define mmx32_rgb888_mask 00ffffffh
52%define mmx32_rgb565_b 000000f8h
53%define mmx32_rgb565_g 0000fc00h
54%define mmx32_rgb565_r 00f80000h
55
56%define mmx32_rgb555_rb 00f800f8h
57%define mmx32_rgb555_g 0000f800h
58%define mmx32_rgb555_mul 20000008h
59%define mmx32_bgr555_mul 00082000h
60
61SECTION .text
62
63_ConvertMMXpII32_24RGB888:
64
65 ; set up mm6 as the mask, mm7 as zero
66 load_immq mm6, mmx32_rgb888_mask
67 CLEANUP_IMMQ_LOADS(1)
68 pxor mm7, mm7
69
70 mov edx, ecx ; save ecx
71 and ecx, 0fffffffch ; clear lower two bits
72 jnz .L1
73 jmp .L2
74
75.L1:
76
77 movq mm0, [esi] ; A R G B a r g b
78 pand mm0, mm6 ; 0 R G B 0 r g b
79 movq mm1, [esi+8] ; A R G B a r g b
80 pand mm1, mm6 ; 0 R G B 0 r g b
81
82 movq mm2, mm0 ; 0 R G B 0 r g b
83 punpckhdq mm2, mm7 ; 0 0 0 0 0 R G B
84 punpckldq mm0, mm7 ; 0 0 0 0 0 r g b
85 psllq mm2, 24 ; 0 0 R G B 0 0 0
86 por mm0, mm2 ; 0 0 R G B r g b
87
88 movq mm3, mm1 ; 0 R G B 0 r g b
89 psllq mm3, 48 ; g b 0 0 0 0 0 0
90 por mm0, mm3 ; g b R G B r g b
91
92 movq mm4, mm1 ; 0 R G B 0 r g b
93 punpckhdq mm4, mm7 ; 0 0 0 0 0 R G B
94 punpckldq mm1, mm7 ; 0 0 0 0 0 r g b
95 psrlq mm1, 16 ; 0 0 0 R G B 0 r
96 psllq mm4, 8 ; 0 0 0 0 R G B 0
97 por mm1, mm4 ; 0 0 0 0 R G B r
98
99 movq [edi], mm0
100 add esi, BYTE 16
101 movd [edi+8], mm1
102 add edi, BYTE 12
103 sub ecx, BYTE 4
104 jnz .L1
105
106.L2:
107 mov ecx, edx
108 and ecx, BYTE 3
109 jz .L4
110.L3:
111 mov al, [esi]
112 mov bl, [esi+1]
113 mov dl, [esi+2]
114 mov [edi], al
115 mov [edi+1], bl
116 mov [edi+2], dl
117 add esi, BYTE 4
118 add edi, BYTE 3
119 dec ecx
120 jnz .L3
121.L4:
122 retn
123
124
125
126_ConvertMMXpII32_16RGB565:
127
128 ; set up masks
129 load_immq mm5, mmx32_rgb565_b
130 load_immq mm6, mmx32_rgb565_g
131 load_immq mm7, mmx32_rgb565_r
132 CLEANUP_IMMQ_LOADS(3)
133
134 mov edx, ecx
135 shr ecx, 2
136 jnz .L1
137 jmp .L2 ; not necessary at the moment, but doesn't hurt (much)
138
139.L1:
140 movq mm0, [esi] ; argb
141 movq mm1, mm0 ; argb
142 pand mm0, mm6 ; 00g0
143 movq mm3, mm1 ; argb
144 pand mm1, mm5 ; 000b
145 pand mm3, mm7 ; 0r00
146 pslld mm1, 2 ; 0 0 000000bb bbb00000
147 por mm0, mm1 ; 0 0 ggggggbb bbb00000
148 psrld mm0, 5 ; 0 0 00000ggg gggbbbbb
149
150 movq mm4, [esi+8] ; argb
151 movq mm2, mm4 ; argb
152 pand mm4, mm6 ; 00g0
153 movq mm1, mm2 ; argb
154 pand mm2, mm5 ; 000b
155 pand mm1, mm7 ; 0r00
156 pslld mm2, 2 ; 0 0 000000bb bbb00000
157 por mm4, mm2 ; 0 0 ggggggbb bbb00000
158 psrld mm4, 5 ; 0 0 00000ggg gggbbbbb
159
160 packuswb mm3, mm1 ; R 0 r 0
161 packssdw mm0, mm4 ; as above.. ish
162 por mm0, mm3 ; done.
163 movq [edi], mm0
164
165 add esi, 16
166 add edi, 8
167 dec ecx
168 jnz .L1
169
170.L2:
171 mov ecx, edx
172 and ecx, BYTE 3
173 jz .L4
174.L3:
175 mov al, [esi]
176 mov bh, [esi+1]
177 mov ah, [esi+2]
178 shr al, 3
179 and eax, 0F81Fh ; BYTE?
180 shr ebx, 5
181 and ebx, 07E0h ; BYTE?
182 add eax, ebx
183 mov [edi], al
184 mov [edi+1], ah
185 add esi, BYTE 4
186 add edi, BYTE 2
187 dec ecx
188 jnz .L3
189
190.L4:
191 retn
192
193
194_ConvertMMXpII32_16BGR565:
195
196 load_immq mm5, mmx32_rgb565_r
197 load_immq mm6, mmx32_rgb565_g
198 load_immq mm7, mmx32_rgb565_b
199 CLEANUP_IMMQ_LOADS(3)
200
201 mov edx, ecx
202 shr ecx, 2
203 jnz .L1
204 jmp .L2
205
206.L1:
207 movq mm0, [esi] ; a r g b
208 movq mm1, mm0 ; a r g b
209 pand mm0, mm6 ; 0 0 g 0
210 movq mm3, mm1 ; a r g b
211 pand mm1, mm5 ; 0 r 0 0
212 pand mm3, mm7 ; 0 0 0 b
213
214 psllq mm3, 16 ; 0 b 0 0
215 psrld mm1, 14 ; 0 0 000000rr rrr00000
216 por mm0, mm1 ; 0 0 ggggggrr rrr00000
217 psrld mm0, 5 ; 0 0 00000ggg gggrrrrr
218
219 movq mm4, [esi+8] ; a r g b
220 movq mm2, mm4 ; a r g b
221 pand mm4, mm6 ; 0 0 g 0
222 movq mm1, mm2 ; a r g b
223 pand mm2, mm5 ; 0 r 0 0
224 pand mm1, mm7 ; 0 0 0 b
225
226 psllq mm1, 16 ; 0 b 0 0
227 psrld mm2, 14 ; 0 0 000000rr rrr00000
228 por mm4, mm2 ; 0 0 ggggggrr rrr00000
229 psrld mm4, 5 ; 0 0 00000ggg gggrrrrr
230
231 packuswb mm3, mm1 ; BBBBB000 00000000 bbbbb000 00000000
232 packssdw mm0, mm4 ; 00000GGG GGGRRRRR 00000GGG GGGRRRRR
233 por mm0, mm3 ; BBBBBGGG GGGRRRRR bbbbbggg gggrrrrr
234 movq [edi], mm0
235
236 add esi, BYTE 16
237 add edi, BYTE 8
238 dec ecx
239 jnz .L1
240
241.L2:
242 and edx, BYTE 3
243 jz .L4
244.L3:
245 mov al, [esi+2]
246 mov bh, [esi+1]
247 mov ah, [esi]
248 shr al, 3
249 and eax, 0F81Fh ; BYTE ?
250 shr ebx, 5
251 and ebx, 07E0h ; BYTE ?
252 add eax, ebx
253 mov [edi], al
254 mov [edi+1], ah
255 add esi, BYTE 4
256 add edi, BYTE 2
257 dec edx
258 jnz .L3
259
260.L4:
261 retn
262
263_ConvertMMXpII32_16BGR555:
264
265 ; the 16BGR555 converter is identical to the RGB555 one,
266 ; except it uses a different multiplier for the pmaddwd
267 ; instruction. cool huh.
268
269 load_immq mm7, mmx32_bgr555_mul
270 jmp _convert_bgr555_cheat
271
272; This is the same as the Intel version.. they obviously went to
273; much more trouble to expand/coil the loop than I did, so theirs
274; would almost certainly be faster, even if only a little.
275; I did rename 'mmx32_rgb555_add' to 'mmx32_rgb555_mul', which is
276; (I think) a more accurate name..
277_ConvertMMXpII32_16RGB555:
278
279 load_immq mm7, mmx32_rgb555_mul
280_convert_bgr555_cheat:
281 load_immq mm6, mmx32_rgb555_g
282 CLEANUP_IMMQ_LOADS(2)
283
284 mov edx,ecx ; Save ecx
285
286 and ecx,DWORD 0fffffff8h ; clear lower three bits
287 jnz .L_OK
288 jmp near .L2
289
290.L_OK:
291
292 movq mm2,[esi+8]
293
294 movq mm0,[esi]
295 movq mm3,mm2
296
297 pand_immq mm3, mmx32_rgb555_rb
298 movq mm1,mm0
299
300 pand_immq mm1, mmx32_rgb555_rb
301 pmaddwd mm3,mm7
302
303 CLEANUP_IMMQ_LOADS(2)
304
305 pmaddwd mm1,mm7
306 pand mm2,mm6
307
308.L1:
309 movq mm4,[esi+24]
310 pand mm0,mm6
311
312 movq mm5,[esi+16]
313 por mm3,mm2
314
315 psrld mm3,6
316 por mm1,mm0
317
318 movq mm0,mm4
319 psrld mm1,6
320
321 pand_immq mm0, mmx32_rgb555_rb
322 packssdw mm1,mm3
323
324 movq mm3,mm5
325 pmaddwd mm0,mm7
326
327 pand_immq mm3, mmx32_rgb555_rb
328 pand mm4,mm6
329
330 movq [edi],mm1
331 pmaddwd mm3,mm7
332
333 add esi,BYTE 32
334 por mm4,mm0
335
336 pand mm5,mm6
337 psrld mm4,6
338
339 movq mm2,[esi+8]
340 por mm5,mm3
341
342 movq mm0,[esi]
343 psrld mm5,6
344
345 movq mm3,mm2
346 movq mm1,mm0
347
348 pand_immq mm3, mmx32_rgb555_rb
349 packssdw mm5,mm4
350
351 pand_immq mm1, mmx32_rgb555_rb
352 pand mm2,mm6
353
354 CLEANUP_IMMQ_LOADS(4)
355
356 movq [edi+8],mm5
357 pmaddwd mm3,mm7
358
359 pmaddwd mm1,mm7
360 add edi,BYTE 16
361
362 sub ecx,BYTE 8
363 jz .L2
364 jmp .L1
365
366
367.L2:
368 mov ecx,edx
369
370 and ecx,BYTE 7
371 jz .L4
372
373.L3:
374 mov ebx,[esi]
375 add esi,BYTE 4
376
377 mov eax,ebx
378 mov edx,ebx
379
380 shr eax,3
381 shr edx,6
382
383 and eax,BYTE 0000000000011111b
384 and edx, 0000001111100000b
385
386 shr ebx,9
387
388 or eax,edx
389
390 and ebx, 0111110000000000b
391
392 or eax,ebx
393
394 mov [edi],ax
395 add edi,BYTE 2
396
397 dec ecx
398 jnz .L3
399
400.L4:
401 retn
402
403%ifidn __OUTPUT_FORMAT__,elf32
404section .note.GNU-stack noalloc noexec nowrite progbits
405%endif
diff --git a/apps/plugins/sdl/src/hermes/x86_main.asm b/apps/plugins/sdl/src/hermes/x86_main.asm
deleted file mode 100644
index f7dd3db70c..0000000000
--- a/apps/plugins/sdl/src/hermes/x86_main.asm
+++ /dev/null
@@ -1,75 +0,0 @@
1;
2; x86 format converters for HERMES
3; Some routines Copyright (c) 1998 Christian Nentwich (brn@eleet.mcb.at)
4; This source code is licensed under the GNU LGPL
5;
6; Please refer to the file COPYING.LIB contained in the distribution for
7; licensing conditions
8;
9; Most routines are (c) Glenn Fiedler (ptc@gaffer.org), used with permission
10;
11
12BITS 32
13
14%include "common.inc"
15
16SDL_FUNC _ConvertX86
17
18SECTION .text
19
20;; _ConvertX86:
21;; [ESP+8] ConverterInfo*
22;; --------------------------------------------------------------------------
23;; ConverterInfo (ebp+..)
24;; 0: void *s_pixels
25;; 4: int s_width
26;; 8: int s_height
27;; 12: int s_add
28;; 16: void *d_pixels
29;; 20: int d_width
30;; 24: int d_height
31;; 28: int d_add
32;; 32: void (*converter_function)()
33;; 36: int32 *lookup
34
35_ConvertX86:
36 push ebp
37 mov ebp,esp
38
39; Save the registers used by the blitters, necessary for optimized code
40 pusha
41
42 mov eax,[ebp+8]
43
44 cmp dword [eax+4],BYTE 0
45 je endconvert
46
47 mov ebp,eax
48
49 mov esi,[ebp+0]
50 mov edi,[ebp+16]
51
52y_loop:
53 mov ecx,[ebp+4]
54
55 call [ebp+32]
56
57 add esi,[ebp+12]
58 add edi,[ebp+28]
59
60 dec dword [ebp+8]
61 jnz y_loop
62
63; Restore the registers used by the blitters, necessary for optimized code
64 popa
65
66 pop ebp
67
68endconvert:
69 ret
70
71
72
73%ifidn __OUTPUT_FORMAT__,elf32
74section .note.GNU-stack noalloc noexec nowrite progbits
75%endif
diff --git a/apps/plugins/sdl/src/hermes/x86p_16.asm b/apps/plugins/sdl/src/hermes/x86p_16.asm
deleted file mode 100644
index 1801bcd153..0000000000
--- a/apps/plugins/sdl/src/hermes/x86p_16.asm
+++ /dev/null
@@ -1,490 +0,0 @@
1;
2; x86 format converters for HERMES
3; Copyright (c) 1998 Glenn Fielder (gaffer@gaffer.org)
4; This source code is licensed under the GNU LGPL
5;
6; Please refer to the file COPYING.LIB contained in the distribution for
7; licensing conditions
8;
9; Routines adjusted for Hermes by Christian Nentwich (brn@eleet.mcb.at)
10; Used with permission.
11;
12
13BITS 32
14
15%include "common.inc"
16
17SDL_FUNC _ConvertX86p16_16BGR565
18SDL_FUNC _ConvertX86p16_16RGB555
19SDL_FUNC _ConvertX86p16_16BGR555
20SDL_FUNC _ConvertX86p16_8RGB332
21
22EXTERN _ConvertX86
23
24SECTION .text
25
26_ConvertX86p16_16BGR565:
27
28 ; check short
29 cmp ecx,BYTE 16
30 ja .L3
31
32
33.L1: ; short loop
34 mov al,[esi]
35 mov ah,[esi+1]
36 mov ebx,eax
37 mov edx,eax
38 shr eax,11
39 and eax,BYTE 11111b
40 and ebx,11111100000b
41 shl edx,11
42 add eax,ebx
43 add eax,edx
44 mov [edi],al
45 mov [edi+1],ah
46 add esi,BYTE 2
47 add edi,BYTE 2
48 dec ecx
49 jnz .L1
50.L2:
51 retn
52
53.L3: ; head
54 mov eax,edi
55 and eax,BYTE 11b
56 jz .L4
57 mov al,[esi]
58 mov ah,[esi+1]
59 mov ebx,eax
60 mov edx,eax
61 shr eax,11
62 and eax,BYTE 11111b
63 and ebx,11111100000b
64 shl edx,11
65 add eax,ebx
66 add eax,edx
67 mov [edi],al
68 mov [edi+1],ah
69 add esi,BYTE 2
70 add edi,BYTE 2
71 dec ecx
72
73.L4: ; save count
74 push ecx
75
76 ; unroll twice
77 shr ecx,1
78
79 ; point arrays to end
80 lea esi,[esi+ecx*4]
81 lea edi,[edi+ecx*4]
82
83 ; negative counter
84 neg ecx
85 jmp SHORT .L6
86
87.L5: mov [edi+ecx*4-4],eax
88.L6: mov eax,[esi+ecx*4]
89
90 mov ebx,[esi+ecx*4]
91 and eax,07E007E0h
92
93 mov edx,[esi+ecx*4]
94 and ebx,0F800F800h
95
96 shr ebx,11
97 and edx,001F001Fh
98
99 shl edx,11
100 add eax,ebx
101
102 add eax,edx
103 inc ecx
104
105 jnz .L5
106
107 mov [edi+ecx*4-4],eax
108
109 ; tail
110 pop ecx
111 and ecx,BYTE 1
112 jz .L7
113 mov al,[esi]
114 mov ah,[esi+1]
115 mov ebx,eax
116 mov edx,eax
117 shr eax,11
118 and eax,BYTE 11111b
119 and ebx,11111100000b
120 shl edx,11
121 add eax,ebx
122 add eax,edx
123 mov [edi],al
124 mov [edi+1],ah
125 add esi,BYTE 2
126 add edi,BYTE 2
127
128.L7:
129 retn
130
131
132
133
134
135
136_ConvertX86p16_16RGB555:
137
138 ; check short
139 cmp ecx,BYTE 32
140 ja .L3
141
142
143.L1: ; short loop
144 mov al,[esi]
145 mov ah,[esi+1]
146 mov ebx,eax
147 shr ebx,1
148 and ebx, 0111111111100000b
149 and eax,BYTE 0000000000011111b
150 add eax,ebx
151 mov [edi],al
152 mov [edi+1],ah
153 add esi,BYTE 2
154 add edi,BYTE 2
155 dec ecx
156 jnz .L1
157.L2:
158 retn
159
160.L3: ; head
161 mov eax,edi
162 and eax,BYTE 11b
163 jz .L4
164 mov al,[esi]
165 mov ah,[esi+1]
166 mov ebx,eax
167 shr ebx,1
168 and ebx, 0111111111100000b
169 and eax,BYTE 0000000000011111b
170 add eax,ebx
171 mov [edi],al
172 mov [edi+1],ah
173 add esi,BYTE 2
174 add edi,BYTE 2
175 dec ecx
176
177.L4: ; save ebp
178 push ebp
179
180 ; save count
181 push ecx
182
183 ; unroll four times
184 shr ecx,2
185
186 ; point arrays to end
187 lea esi,[esi+ecx*8]
188 lea edi,[edi+ecx*8]
189
190 ; negative counter
191 xor ebp,ebp
192 sub ebp,ecx
193
194.L5: mov eax,[esi+ebp*8] ; agi?
195 mov ecx,[esi+ebp*8+4]
196
197 mov ebx,eax
198 mov edx,ecx
199
200 and eax,0FFC0FFC0h
201 and ecx,0FFC0FFC0h
202
203 shr eax,1
204 and ebx,001F001Fh
205
206 shr ecx,1
207 and edx,001F001Fh
208
209 add eax,ebx
210 add ecx,edx
211
212 mov [edi+ebp*8],eax
213 mov [edi+ebp*8+4],ecx
214
215 inc ebp
216 jnz .L5
217
218 ; tail
219 pop ecx
220.L6: and ecx,BYTE 11b
221 jz .L7
222 mov al,[esi]
223 mov ah,[esi+1]
224 mov ebx,eax
225 shr ebx,1
226 and ebx, 0111111111100000b
227 and eax,BYTE 0000000000011111b
228 add eax,ebx
229 mov [edi],al
230 mov [edi+1],ah
231 add esi,BYTE 2
232 add edi,BYTE 2
233 dec ecx
234 jmp SHORT .L6
235
236.L7: pop ebp
237 retn
238
239
240
241
242
243
244_ConvertX86p16_16BGR555:
245
246 ; check short
247 cmp ecx,BYTE 16
248 ja .L3
249
250
251.L1: ; short loop
252 mov al,[esi]
253 mov ah,[esi+1]
254 mov ebx,eax
255 mov edx,eax
256 shr eax,11
257 and eax,BYTE 11111b
258 shr ebx,1
259 and ebx,1111100000b
260 shl edx,10
261 and edx,0111110000000000b
262 add eax,ebx
263 add eax,edx
264 mov [edi],al
265 mov [edi+1],ah
266 add esi,BYTE 2
267 add edi,BYTE 2
268 dec ecx
269 jnz .L1
270.L2:
271 retn
272
273.L3: ; head
274 mov eax,edi
275 and eax,BYTE 11b
276 jz .L4
277 mov al,[esi]
278 mov ah,[esi+1]
279 mov ebx,eax
280 mov edx,eax
281 shr eax,11
282 and eax,BYTE 11111b
283 shr ebx,1
284 and ebx,1111100000b
285 shl edx,10
286 and edx,0111110000000000b
287 add eax,ebx
288 add eax,edx
289 mov [edi],al
290 mov [edi+1],ah
291 add esi,BYTE 2
292 add edi,BYTE 2
293 dec ecx
294
295.L4: ; save count
296 push ecx
297
298 ; unroll twice
299 shr ecx,1
300
301 ; point arrays to end
302 lea esi,[esi+ecx*4]
303 lea edi,[edi+ecx*4]
304
305 ; negative counter
306 neg ecx
307 jmp SHORT .L6
308
309.L5: mov [edi+ecx*4-4],eax
310.L6: mov eax,[esi+ecx*4]
311
312 shr eax,1
313 mov ebx,[esi+ecx*4]
314
315 and eax,03E003E0h
316 mov edx,[esi+ecx*4]
317
318 and ebx,0F800F800h
319
320 shr ebx,11
321 and edx,001F001Fh
322
323 shl edx,10
324 add eax,ebx
325
326 add eax,edx
327 inc ecx
328
329 jnz .L5
330
331 mov [edi+ecx*4-4],eax
332
333 ; tail
334 pop ecx
335 and ecx,BYTE 1
336 jz .L7
337 mov al,[esi]
338 mov ah,[esi+1]
339 mov ebx,eax
340 mov edx,eax
341 shr eax,11
342 and eax,BYTE 11111b
343 shr ebx,1
344 and ebx,1111100000b
345 shl edx,10
346 and edx,0111110000000000b
347 add eax,ebx
348 add eax,edx
349 mov [edi],al
350 mov [edi+1],ah
351 add esi,BYTE 2
352 add edi,BYTE 2
353
354.L7:
355 retn
356
357
358
359
360
361
362_ConvertX86p16_8RGB332:
363
364 ; check short
365 cmp ecx,BYTE 16
366 ja .L3
367
368
369.L1: ; short loop
370 mov al,[esi+0]
371 mov ah,[esi+1]
372 mov ebx,eax
373 mov edx,eax
374 and eax,BYTE 11000b ; blue
375 shr eax,3
376 and ebx,11100000000b ; green
377 shr ebx,6
378 and edx,1110000000000000b ; red
379 shr edx,8
380 add eax,ebx
381 add eax,edx
382 mov [edi],al
383 add esi,BYTE 2
384 inc edi
385 dec ecx
386 jnz .L1
387.L2:
388 retn
389
390.L3: mov eax,edi
391 and eax,BYTE 11b
392 jz .L4
393 mov al,[esi+0]
394 mov ah,[esi+1]
395 mov ebx,eax
396 mov edx,eax
397 and eax,BYTE 11000b ; blue
398 shr eax,3
399 and ebx,11100000000b ; green
400 shr ebx,6
401 and edx,1110000000000000b ; red
402 shr edx,8
403 add eax,ebx
404 add eax,edx
405 mov [edi],al
406 add esi,BYTE 2
407 inc edi
408 dec ecx
409 jmp SHORT .L3
410
411.L4: ; save ebp
412 push ebp
413
414 ; save count
415 push ecx
416
417 ; unroll 4 times
418 shr ecx,2
419
420 ; prestep
421 mov dl,[esi+0]
422 mov bl,[esi+1]
423 mov dh,[esi+2]
424
425.L5: shl edx,16
426 mov bh,[esi+3]
427
428 shl ebx,16
429 mov dl,[esi+4]
430
431 mov dh,[esi+6]
432 mov bl,[esi+5]
433
434 and edx,00011000000110000001100000011000b
435 mov bh,[esi+7]
436
437 ror edx,16+3
438 mov eax,ebx ; setup eax for reds
439
440 and ebx,00000111000001110000011100000111b
441 and eax,11100000111000001110000011100000b ; reds
442
443 ror ebx,16-2
444 add esi,BYTE 8
445
446 ror eax,16
447 add edi,BYTE 4
448
449 add eax,ebx
450 mov bl,[esi+1] ; greens
451
452 add eax,edx
453 mov dl,[esi+0] ; blues
454
455 mov [edi-4],eax
456 mov dh,[esi+2]
457
458 dec ecx
459 jnz .L5
460
461 ; check tail
462 pop ecx
463 and ecx,BYTE 11b
464 jz .L7
465
466.L6: ; tail
467 mov al,[esi+0]
468 mov ah,[esi+1]
469 mov ebx,eax
470 mov edx,eax
471 and eax,BYTE 11000b ; blue
472 shr eax,3
473 and ebx,11100000000b ; green
474 shr ebx,6
475 and edx,1110000000000000b ; red
476 shr edx,8
477 add eax,ebx
478 add eax,edx
479 mov [edi],al
480 add esi,BYTE 2
481 inc edi
482 dec ecx
483 jnz .L6
484
485.L7: pop ebp
486 retn
487
488%ifidn __OUTPUT_FORMAT__,elf32
489section .note.GNU-stack noalloc noexec nowrite progbits
490%endif
diff --git a/apps/plugins/sdl/src/hermes/x86p_32.asm b/apps/plugins/sdl/src/hermes/x86p_32.asm
deleted file mode 100644
index 2b478802d1..0000000000
--- a/apps/plugins/sdl/src/hermes/x86p_32.asm
+++ /dev/null
@@ -1,1044 +0,0 @@
1;
2; x86 format converters for HERMES
3; Some routines Copyright (c) 1998 Christian Nentwich (brn@eleet.mcb.at)
4; This source code is licensed under the GNU LGPL
5;
6; Please refer to the file COPYING.LIB contained in the distribution for
7; licensing conditions
8;
9; Most routines are (c) Glenn Fiedler (ptc@gaffer.org), used with permission
10;
11
12BITS 32
13
14%include "common.inc"
15
16SDL_FUNC _ConvertX86p32_32BGR888
17SDL_FUNC _ConvertX86p32_32RGBA888
18SDL_FUNC _ConvertX86p32_32BGRA888
19SDL_FUNC _ConvertX86p32_24RGB888
20SDL_FUNC _ConvertX86p32_24BGR888
21SDL_FUNC _ConvertX86p32_16RGB565
22SDL_FUNC _ConvertX86p32_16BGR565
23SDL_FUNC _ConvertX86p32_16RGB555
24SDL_FUNC _ConvertX86p32_16BGR555
25SDL_FUNC _ConvertX86p32_8RGB332
26
27SECTION .text
28
29;; _Convert_*
30;; Paramters:
31;; ESI = source
32;; EDI = dest
33;; ECX = amount (NOT 0!!! (the _ConvertX86 routine checks for that though))
34;; Destroys:
35;; EAX, EBX, EDX
36
37
38_ConvertX86p32_32BGR888:
39
40 ; check short
41 cmp ecx,BYTE 32
42 ja .L3
43
44.L1: ; short loop
45 mov edx,[esi]
46 bswap edx
47 ror edx,8
48 mov [edi],edx
49 add esi,BYTE 4
50 add edi,BYTE 4
51 dec ecx
52 jnz .L1
53.L2:
54 retn
55
56.L3: ; save ebp
57 push ebp
58
59 ; unroll four times
60 mov ebp,ecx
61 shr ebp,2
62
63 ; save count
64 push ecx
65
66.L4: mov eax,[esi]
67 mov ebx,[esi+4]
68
69 bswap eax
70
71 bswap ebx
72
73 ror eax,8
74 mov ecx,[esi+8]
75
76 ror ebx,8
77 mov edx,[esi+12]
78
79 bswap ecx
80
81 bswap edx
82
83 ror ecx,8
84 mov [edi+0],eax
85
86 ror edx,8
87 mov [edi+4],ebx
88
89 mov [edi+8],ecx
90 mov [edi+12],edx
91
92 add esi,BYTE 16
93 add edi,BYTE 16
94
95 dec ebp
96 jnz .L4
97
98 ; check tail
99 pop ecx
100 and ecx,BYTE 11b
101 jz .L6
102
103.L5: ; tail loop
104 mov edx,[esi]
105 bswap edx
106 ror edx,8
107 mov [edi],edx
108 add esi,BYTE 4
109 add edi,BYTE 4
110 dec ecx
111 jnz .L5
112
113.L6: pop ebp
114 retn
115
116
117
118
119_ConvertX86p32_32RGBA888:
120
121 ; check short
122 cmp ecx,BYTE 32
123 ja .L3
124
125.L1: ; short loop
126 mov edx,[esi]
127 rol edx,8
128 mov [edi],edx
129 add esi,BYTE 4
130 add edi,BYTE 4
131 dec ecx
132 jnz .L1
133.L2:
134 retn
135
136.L3: ; save ebp
137 push ebp
138
139 ; unroll four times
140 mov ebp,ecx
141 shr ebp,2
142
143 ; save count
144 push ecx
145
146.L4: mov eax,[esi]
147 mov ebx,[esi+4]
148
149 rol eax,8
150 mov ecx,[esi+8]
151
152 rol ebx,8
153 mov edx,[esi+12]
154
155 rol ecx,8
156 mov [edi+0],eax
157
158 rol edx,8
159 mov [edi+4],ebx
160
161 mov [edi+8],ecx
162 mov [edi+12],edx
163
164 add esi,BYTE 16
165 add edi,BYTE 16
166
167 dec ebp
168 jnz .L4
169
170 ; check tail
171 pop ecx
172 and ecx,BYTE 11b
173 jz .L6
174
175.L5: ; tail loop
176 mov edx,[esi]
177 rol edx,8
178 mov [edi],edx
179 add esi,BYTE 4
180 add edi,BYTE 4
181 dec ecx
182 jnz .L5
183
184.L6: pop ebp
185 retn
186
187
188
189
190_ConvertX86p32_32BGRA888:
191
192 ; check short
193 cmp ecx,BYTE 32
194 ja .L3
195
196.L1: ; short loop
197 mov edx,[esi]
198 bswap edx
199 mov [edi],edx
200 add esi,BYTE 4
201 add edi,BYTE 4
202 dec ecx
203 jnz .L1
204.L2:
205 retn
206
207.L3: ; save ebp
208 push ebp
209
210 ; unroll four times
211 mov ebp,ecx
212 shr ebp,2
213
214 ; save count
215 push ecx
216
217.L4: mov eax,[esi]
218 mov ebx,[esi+4]
219
220 mov ecx,[esi+8]
221 mov edx,[esi+12]
222
223 bswap eax
224
225 bswap ebx
226
227 bswap ecx
228
229 bswap edx
230
231 mov [edi+0],eax
232 mov [edi+4],ebx
233
234 mov [edi+8],ecx
235 mov [edi+12],edx
236
237 add esi,BYTE 16
238 add edi,BYTE 16
239
240 dec ebp
241 jnz .L4
242
243 ; check tail
244 pop ecx
245 and ecx,BYTE 11b
246 jz .L6
247
248.L5: ; tail loop
249 mov edx,[esi]
250 bswap edx
251 mov [edi],edx
252 add esi,BYTE 4
253 add edi,BYTE 4
254 dec ecx
255 jnz .L5
256
257.L6: pop ebp
258 retn
259
260
261
262
263;; 32 bit RGB 888 to 24 BIT RGB 888
264
265_ConvertX86p32_24RGB888:
266
267 ; check short
268 cmp ecx,BYTE 32
269 ja .L3
270
271.L1: ; short loop
272 mov al,[esi]
273 mov bl,[esi+1]
274 mov dl,[esi+2]
275 mov [edi],al
276 mov [edi+1],bl
277 mov [edi+2],dl
278 add esi,BYTE 4
279 add edi,BYTE 3
280 dec ecx
281 jnz .L1
282.L2:
283 retn
284
285.L3: ; head
286 mov edx,edi
287 and edx,BYTE 11b
288 jz .L4
289 mov al,[esi]
290 mov bl,[esi+1]
291 mov dl,[esi+2]
292 mov [edi],al
293 mov [edi+1],bl
294 mov [edi+2],dl
295 add esi,BYTE 4
296 add edi,BYTE 3
297 dec ecx
298 jmp SHORT .L3
299
300.L4: ; unroll 4 times
301 push ebp
302 mov ebp,ecx
303 shr ebp,2
304
305 ; save count
306 push ecx
307
308.L5: mov eax,[esi] ; first dword eax = [A][R][G][B]
309 mov ebx,[esi+4] ; second dword ebx = [a][r][g][b]
310
311 shl eax,8 ; eax = [R][G][B][.]
312 mov ecx,[esi+12] ; third dword ecx = [a][r][g][b]
313
314 shl ebx,8 ; ebx = [r][g][b][.]
315 mov al,[esi+4] ; eax = [R][G][B][b]
316
317 ror eax,8 ; eax = [b][R][G][B] (done)
318 mov bh,[esi+8+1] ; ebx = [r][g][G][.]
319
320 mov [edi],eax
321 add edi,BYTE 3*4
322
323 shl ecx,8 ; ecx = [r][g][b][.]
324 mov bl,[esi+8+0] ; ebx = [r][g][G][B]
325
326 rol ebx,16 ; ebx = [G][B][r][g] (done)
327 mov cl,[esi+8+2] ; ecx = [r][g][b][R] (done)
328
329 mov [edi+4-3*4],ebx
330 add esi,BYTE 4*4
331
332 mov [edi+8-3*4],ecx
333 dec ebp
334
335 jnz .L5
336
337 ; check tail
338 pop ecx
339 and ecx,BYTE 11b
340 jz .L7
341
342.L6: ; tail loop
343 mov al,[esi]
344 mov bl,[esi+1]
345 mov dl,[esi+2]
346 mov [edi],al
347 mov [edi+1],bl
348 mov [edi+2],dl
349 add esi,BYTE 4
350 add edi,BYTE 3
351 dec ecx
352 jnz .L6
353
354.L7: pop ebp
355 retn
356
357
358
359
360;; 32 bit RGB 888 to 24 bit BGR 888
361
362_ConvertX86p32_24BGR888:
363
364 ; check short
365 cmp ecx,BYTE 32
366 ja .L3
367
368.L1: ; short loop
369 mov dl,[esi]
370 mov bl,[esi+1]
371 mov al,[esi+2]
372 mov [edi],al
373 mov [edi+1],bl
374 mov [edi+2],dl
375 add esi,BYTE 4
376 add edi,BYTE 3
377 dec ecx
378 jnz .L1
379.L2:
380 retn
381
382.L3: ; head
383 mov edx,edi
384 and edx,BYTE 11b
385 jz .L4
386 mov dl,[esi]
387 mov bl,[esi+1]
388 mov al,[esi+2]
389 mov [edi],al
390 mov [edi+1],bl
391 mov [edi+2],dl
392 add esi,BYTE 4
393 add edi,BYTE 3
394 dec ecx
395 jmp SHORT .L3
396
397.L4: ; unroll 4 times
398 push ebp
399 mov ebp,ecx
400 shr ebp,2
401
402 ; save count
403 push ecx
404
405.L5:
406 mov eax,[esi] ; first dword eax = [A][R][G][B]
407 mov ebx,[esi+4] ; second dword ebx = [a][r][g][b]
408
409 bswap eax ; eax = [B][G][R][A]
410
411 bswap ebx ; ebx = [b][g][r][a]
412
413 mov al,[esi+4+2] ; eax = [B][G][R][r]
414 mov bh,[esi+4+4+1] ; ebx = [b][g][G][a]
415
416 ror eax,8 ; eax = [r][B][G][R] (done)
417 mov bl,[esi+4+4+2] ; ebx = [b][g][G][R]
418
419 ror ebx,16 ; ebx = [G][R][b][g] (done)
420 mov [edi],eax
421
422 mov [edi+4],ebx
423 mov ecx,[esi+12] ; third dword ecx = [a][r][g][b]
424
425 bswap ecx ; ecx = [b][g][r][a]
426
427 mov cl,[esi+8] ; ecx = [b][g][r][B] (done)
428 add esi,BYTE 4*4
429
430 mov [edi+8],ecx
431 add edi,BYTE 3*4
432
433 dec ebp
434 jnz .L5
435
436 ; check tail
437 pop ecx
438 and ecx,BYTE 11b
439 jz .L7
440
441.L6: ; tail loop
442 mov dl,[esi]
443 mov bl,[esi+1]
444 mov al,[esi+2]
445 mov [edi],al
446 mov [edi+1],bl
447 mov [edi+2],dl
448 add esi,BYTE 4
449 add edi,BYTE 3
450 dec ecx
451 jnz .L6
452
453.L7:
454 pop ebp
455 retn
456
457
458
459
460;; 32 bit RGB 888 to 16 BIT RGB 565
461
462_ConvertX86p32_16RGB565:
463 ; check short
464 cmp ecx,BYTE 16
465 ja .L3
466
467.L1: ; short loop
468 mov bl,[esi+0] ; blue
469 mov al,[esi+1] ; green
470 mov ah,[esi+2] ; red
471 shr ah,3
472 and al,11111100b
473 shl eax,3
474 shr bl,3
475 add al,bl
476 mov [edi+0],al
477 mov [edi+1],ah
478 add esi,BYTE 4
479 add edi,BYTE 2
480 dec ecx
481 jnz .L1
482
483.L2: ; End of short loop
484 retn
485
486
487.L3: ; head
488 mov ebx,edi
489 and ebx,BYTE 11b
490 jz .L4
491
492 mov bl,[esi+0] ; blue
493 mov al,[esi+1] ; green
494 mov ah,[esi+2] ; red
495 shr ah,3
496 and al,11111100b
497 shl eax,3
498 shr bl,3
499 add al,bl
500 mov [edi+0],al
501 mov [edi+1],ah
502 add esi,BYTE 4
503 add edi,BYTE 2
504 dec ecx
505
506.L4:
507 ; save count
508 push ecx
509
510 ; unroll twice
511 shr ecx,1
512
513 ; point arrays to end
514 lea esi,[esi+ecx*8]
515 lea edi,[edi+ecx*4]
516
517 ; negative counter
518 neg ecx
519 jmp SHORT .L6
520
521.L5:
522 mov [edi+ecx*4-4],eax
523.L6:
524 mov eax,[esi+ecx*8]
525
526 shr ah,2
527 mov ebx,[esi+ecx*8+4]
528
529 shr eax,3
530 mov edx,[esi+ecx*8+4]
531
532 shr bh,2
533 mov dl,[esi+ecx*8+2]
534
535 shl ebx,13
536 and eax,000007FFh
537
538 shl edx,8
539 and ebx,07FF0000h
540
541 and edx,0F800F800h
542 add eax,ebx
543
544 add eax,edx
545 inc ecx
546
547 jnz .L5
548
549 mov [edi+ecx*4-4],eax
550
551 ; tail
552 pop ecx
553 test cl,1
554 jz .L7
555
556 mov bl,[esi+0] ; blue
557 mov al,[esi+1] ; green
558 mov ah,[esi+2] ; red
559 shr ah,3
560 and al,11111100b
561 shl eax,3
562 shr bl,3
563 add al,bl
564 mov [edi+0],al
565 mov [edi+1],ah
566 add esi,BYTE 4
567 add edi,BYTE 2
568
569.L7:
570 retn
571
572
573
574
575;; 32 bit RGB 888 to 16 BIT BGR 565
576
577_ConvertX86p32_16BGR565:
578
579 ; check short
580 cmp ecx,BYTE 16
581 ja .L3
582
583.L1: ; short loop
584 mov ah,[esi+0] ; blue
585 mov al,[esi+1] ; green
586 mov bl,[esi+2] ; red
587 shr ah,3
588 and al,11111100b
589 shl eax,3
590 shr bl,3
591 add al,bl
592 mov [edi+0],al
593 mov [edi+1],ah
594 add esi,BYTE 4
595 add edi,BYTE 2
596 dec ecx
597 jnz .L1
598.L2:
599 retn
600
601.L3: ; head
602 mov ebx,edi
603 and ebx,BYTE 11b
604 jz .L4
605 mov ah,[esi+0] ; blue
606 mov al,[esi+1] ; green
607 mov bl,[esi+2] ; red
608 shr ah,3
609 and al,11111100b
610 shl eax,3
611 shr bl,3
612 add al,bl
613 mov [edi+0],al
614 mov [edi+1],ah
615 add esi,BYTE 4
616 add edi,BYTE 2
617 dec ecx
618
619.L4: ; save count
620 push ecx
621
622 ; unroll twice
623 shr ecx,1
624
625 ; point arrays to end
626 lea esi,[esi+ecx*8]
627 lea edi,[edi+ecx*4]
628
629 ; negative count
630 neg ecx
631 jmp SHORT .L6
632
633.L5:
634 mov [edi+ecx*4-4],eax
635.L6:
636 mov edx,[esi+ecx*8+4]
637
638 mov bh,[esi+ecx*8+4]
639 mov ah,[esi+ecx*8]
640
641 shr bh,3
642 mov al,[esi+ecx*8+1]
643
644 shr ah,3
645 mov bl,[esi+ecx*8+5]
646
647 shl eax,3
648 mov dl,[esi+ecx*8+2]
649
650 shl ebx,19
651 and eax,0000FFE0h
652
653 shr edx,3
654 and ebx,0FFE00000h
655
656 and edx,001F001Fh
657 add eax,ebx
658
659 add eax,edx
660 inc ecx
661
662 jnz .L5
663
664 mov [edi+ecx*4-4],eax
665
666 ; tail
667 pop ecx
668 and ecx,BYTE 1
669 jz .L7
670 mov ah,[esi+0] ; blue
671 mov al,[esi+1] ; green
672 mov bl,[esi+2] ; red
673 shr ah,3
674 and al,11111100b
675 shl eax,3
676 shr bl,3
677 add al,bl
678 mov [edi+0],al
679 mov [edi+1],ah
680 add esi,BYTE 4
681 add edi,BYTE 2
682
683.L7:
684 retn
685
686
687
688
689;; 32 BIT RGB TO 16 BIT RGB 555
690
691_ConvertX86p32_16RGB555:
692
693 ; check short
694 cmp ecx,BYTE 16
695 ja .L3
696
697.L1: ; short loop
698 mov bl,[esi+0] ; blue
699 mov al,[esi+1] ; green
700 mov ah,[esi+2] ; red
701 shr ah,3
702 and al,11111000b
703 shl eax,2
704 shr bl,3
705 add al,bl
706 mov [edi+0],al
707 mov [edi+1],ah
708 add esi,BYTE 4
709 add edi,BYTE 2
710 dec ecx
711 jnz .L1
712.L2:
713 retn
714
715.L3: ; head
716 mov ebx,edi
717 and ebx,BYTE 11b
718 jz .L4
719 mov bl,[esi+0] ; blue
720 mov al,[esi+1] ; green
721 mov ah,[esi+2] ; red
722 shr ah,3
723 and al,11111000b
724 shl eax,2
725 shr bl,3
726 add al,bl
727 mov [edi+0],al
728 mov [edi+1],ah
729 add esi,BYTE 4
730 add edi,BYTE 2
731 dec ecx
732
733.L4: ; save count
734 push ecx
735
736 ; unroll twice
737 shr ecx,1
738
739 ; point arrays to end
740 lea esi,[esi+ecx*8]
741 lea edi,[edi+ecx*4]
742
743 ; negative counter
744 neg ecx
745 jmp SHORT .L6
746
747.L5:
748 mov [edi+ecx*4-4],eax
749.L6:
750 mov eax,[esi+ecx*8]
751
752 shr ah,3
753 mov ebx,[esi+ecx*8+4]
754
755 shr eax,3
756 mov edx,[esi+ecx*8+4]
757
758 shr bh,3
759 mov dl,[esi+ecx*8+2]
760
761 shl ebx,13
762 and eax,000007FFh
763
764 shl edx,7
765 and ebx,07FF0000h
766
767 and edx,07C007C00h
768 add eax,ebx
769
770 add eax,edx
771 inc ecx
772
773 jnz .L5
774
775 mov [edi+ecx*4-4],eax
776
777 ; tail
778 pop ecx
779 and ecx,BYTE 1
780 jz .L7
781 mov bl,[esi+0] ; blue
782 mov al,[esi+1] ; green
783 mov ah,[esi+2] ; red
784 shr ah,3
785 and al,11111000b
786 shl eax,2
787 shr bl,3
788 add al,bl
789 mov [edi+0],al
790 mov [edi+1],ah
791 add esi,BYTE 4
792 add edi,BYTE 2
793
794.L7:
795 retn
796
797
798
799
800;; 32 BIT RGB TO 16 BIT BGR 555
801
802_ConvertX86p32_16BGR555:
803
804 ; check short
805 cmp ecx,BYTE 16
806 ja .L3
807
808
809.L1: ; short loop
810 mov ah,[esi+0] ; blue
811 mov al,[esi+1] ; green
812 mov bl,[esi+2] ; red
813 shr ah,3
814 and al,11111000b
815 shl eax,2
816 shr bl,3
817 add al,bl
818 mov [edi+0],al
819 mov [edi+1],ah
820 add esi,BYTE 4
821 add edi,BYTE 2
822 dec ecx
823 jnz .L1
824.L2:
825 retn
826
827.L3: ; head
828 mov ebx,edi
829 and ebx,BYTE 11b
830 jz .L4
831 mov ah,[esi+0] ; blue
832 mov al,[esi+1] ; green
833 mov bl,[esi+2] ; red
834 shr ah,3
835 and al,11111000b
836 shl eax,2
837 shr bl,3
838 add al,bl
839 mov [edi+0],al
840 mov [edi+1],ah
841 add esi,BYTE 4
842 add edi,BYTE 2
843 dec ecx
844
845.L4: ; save count
846 push ecx
847
848 ; unroll twice
849 shr ecx,1
850
851 ; point arrays to end
852 lea esi,[esi+ecx*8]
853 lea edi,[edi+ecx*4]
854
855 ; negative counter
856 neg ecx
857 jmp SHORT .L6
858
859.L5:
860 mov [edi+ecx*4-4],eax
861.L6:
862 mov edx,[esi+ecx*8+4]
863
864 mov bh,[esi+ecx*8+4]
865 mov ah,[esi+ecx*8]
866
867 shr bh,3
868 mov al,[esi+ecx*8+1]
869
870 shr ah,3
871 mov bl,[esi+ecx*8+5]
872
873 shl eax,2
874 mov dl,[esi+ecx*8+2]
875
876 shl ebx,18
877 and eax,00007FE0h
878
879 shr edx,3
880 and ebx,07FE00000h
881
882 and edx,001F001Fh
883 add eax,ebx
884
885 add eax,edx
886 inc ecx
887
888 jnz .L5
889
890 mov [edi+ecx*4-4],eax
891
892 ; tail
893 pop ecx
894 and ecx,BYTE 1
895 jz .L7
896 mov ah,[esi+0] ; blue
897 mov al,[esi+1] ; green
898 mov bl,[esi+2] ; red
899 shr ah,3
900 and al,11111000b
901 shl eax,2
902 shr bl,3
903 add al,bl
904 mov [edi+0],al
905 mov [edi+1],ah
906 add esi,BYTE 4
907 add edi,BYTE 2
908
909.L7:
910 retn
911
912
913
914
915
916;; FROM 32 BIT RGB to 8 BIT RGB (rrrgggbbb)
917;; This routine writes FOUR pixels at once (dword) and then, if they exist
918;; the trailing three pixels
919_ConvertX86p32_8RGB332:
920
921
922.L_ALIGNED:
923 push ecx
924
925 shr ecx,2 ; We will draw 4 pixels at once
926 jnz .L1
927
928 jmp .L2 ; short jump out of range :(
929
930.L1:
931 mov eax,[esi] ; first pair of pixels
932 mov edx,[esi+4]
933
934 shr dl,6
935 mov ebx,eax
936
937 shr al,6
938 and ah,0e0h
939
940 shr ebx,16
941 and dh,0e0h
942
943 shr ah,3
944 and bl,0e0h
945
946 shr dh,3
947
948 or al,bl
949
950 mov ebx,edx
951 or al,ah
952
953 shr ebx,16
954 or dl,dh
955
956 and bl,0e0h
957
958 or dl,bl
959
960 mov ah,dl
961
962
963
964 mov ebx,[esi+8] ; second pair of pixels
965
966 mov edx,ebx
967 and bh,0e0h
968
969 shr bl,6
970 and edx,0e00000h
971
972 shr edx,16
973
974 shr bh,3
975
976 ror eax,16
977 or bl,dl
978
979 mov edx,[esi+12]
980 or bl,bh
981
982 mov al,bl
983
984 mov ebx,edx
985 and dh,0e0h
986
987 shr dl,6
988 and ebx,0e00000h
989
990 shr dh,3
991 mov ah,dl
992
993 shr ebx,16
994 or ah,dh
995
996 or ah,bl
997
998 rol eax,16
999 add esi,BYTE 16
1000
1001 mov [edi],eax
1002 add edi,BYTE 4
1003
1004 dec ecx
1005 jz .L2 ; L1 out of range for short jump :(
1006
1007 jmp .L1
1008.L2:
1009
1010 pop ecx
1011 and ecx,BYTE 3 ; mask out number of pixels to draw
1012
1013 jz .L4 ; Nothing to do anymore
1014
1015.L3:
1016 mov eax,[esi] ; single pixel conversion for trailing pixels
1017
1018 mov ebx,eax
1019
1020 shr al,6
1021 and ah,0e0h
1022
1023 shr ebx,16
1024
1025 shr ah,3
1026 and bl,0e0h
1027
1028 or al,ah
1029 or al,bl
1030
1031 mov [edi],al
1032
1033 inc edi
1034 add esi,BYTE 4
1035
1036 dec ecx
1037 jnz .L3
1038
1039.L4:
1040 retn
1041
1042%ifidn __OUTPUT_FORMAT__,elf32
1043section .note.GNU-stack noalloc noexec nowrite progbits
1044%endif