summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libflash
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/libflash') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libflash/Makefile.in644
-rw-r--r--core/multimedia/opieplayer/libflash/README191
-rw-r--r--core/multimedia/opieplayer/libflash/adpcm.cc235
-rw-r--r--core/multimedia/opieplayer/libflash/adpcm.h36
-rw-r--r--core/multimedia/opieplayer/libflash/bitmap.cc606
-rw-r--r--core/multimedia/opieplayer/libflash/bitmap.h72
-rw-r--r--core/multimedia/opieplayer/libflash/button.cc328
-rw-r--r--core/multimedia/opieplayer/libflash/button.h88
-rw-r--r--core/multimedia/opieplayer/libflash/character.cc233
-rw-r--r--core/multimedia/opieplayer/libflash/character.h90
-rw-r--r--core/multimedia/opieplayer/libflash/cxform.cc79
-rw-r--r--core/multimedia/opieplayer/libflash/cxform.h46
-rw-r--r--core/multimedia/opieplayer/libflash/displaylist.cc708
-rw-r--r--core/multimedia/opieplayer/libflash/displaylist.h80
-rw-r--r--core/multimedia/opieplayer/libflash/flash.cc275
-rw-r--r--core/multimedia/opieplayer/libflash/flash.h129
-rw-r--r--core/multimedia/opieplayer/libflash/font.cc105
-rw-r--r--core/multimedia/opieplayer/libflash/font.h56
-rw-r--r--core/multimedia/opieplayer/libflash/graphic.cc632
-rw-r--r--core/multimedia/opieplayer/libflash/graphic.h174
-rw-r--r--core/multimedia/opieplayer/libflash/graphic16.cc658
-rw-r--r--core/multimedia/opieplayer/libflash/graphic16.h39
-rw-r--r--core/multimedia/opieplayer/libflash/graphic24.cc648
-rw-r--r--core/multimedia/opieplayer/libflash/graphic24.h39
-rw-r--r--core/multimedia/opieplayer/libflash/graphic32.cc657
-rw-r--r--core/multimedia/opieplayer/libflash/graphic32.h39
-rw-r--r--core/multimedia/opieplayer/libflash/jconfig.h45
-rw-r--r--core/multimedia/opieplayer/libflash/jerror.h291
-rw-r--r--core/multimedia/opieplayer/libflash/jmorecfg.h363
-rw-r--r--core/multimedia/opieplayer/libflash/jpeglib.h1096
-rw-r--r--core/multimedia/opieplayer/libflash/libflash.pro15
-rw-r--r--core/multimedia/opieplayer/libflash/libflashplugin.cpp223
-rw-r--r--core/multimedia/opieplayer/libflash/libflashplugin.h96
-rw-r--r--core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp70
-rw-r--r--core/multimedia/opieplayer/libflash/libflashpluginimpl.h53
-rw-r--r--core/multimedia/opieplayer/libflash/matrix.cc68
-rw-r--r--core/multimedia/opieplayer/libflash/matrix.h49
-rw-r--r--core/multimedia/opieplayer/libflash/movie.cc171
-rw-r--r--core/multimedia/opieplayer/libflash/movie.h68
-rw-r--r--core/multimedia/opieplayer/libflash/program.cc921
-rw-r--r--core/multimedia/opieplayer/libflash/program.h185
-rw-r--r--core/multimedia/opieplayer/libflash/rect.h55
-rw-r--r--core/multimedia/opieplayer/libflash/script.cc1988
-rw-r--r--core/multimedia/opieplayer/libflash/script.h144
-rw-r--r--core/multimedia/opieplayer/libflash/shape.cc1205
-rw-r--r--core/multimedia/opieplayer/libflash/shape.h181
-rw-r--r--core/multimedia/opieplayer/libflash/sound.cc439
-rw-r--r--core/multimedia/opieplayer/libflash/sound.h83
-rw-r--r--core/multimedia/opieplayer/libflash/sprite.cc91
-rw-r--r--core/multimedia/opieplayer/libflash/sprite.h38
-rw-r--r--core/multimedia/opieplayer/libflash/sqrt.cc4099
-rw-r--r--core/multimedia/opieplayer/libflash/swf.h229
-rw-r--r--core/multimedia/opieplayer/libflash/text.cc246
-rw-r--r--core/multimedia/opieplayer/libflash/text.h77
54 files changed, 19476 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/libflash/Makefile.in b/core/multimedia/opieplayer/libflash/Makefile.in
new file mode 100644
index 0000000..52c8557
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/Makefile.in
@@ -0,0 +1,644 @@
1#############################################################################
2
3####### Compiler, tools and options
4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB)
7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB)
9 INCPATH =-I$(QPEDIR)/include
10 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
11 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP)
12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC)
14
15####### Target
16
17DESTDIR = ../../plugins/codecs/
18VER_MAJ = 1
19VER_MIN = 0
20VER_PATCH = 0
21 TARGET= flashplugin
22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23
24####### Files
25
26 HEADERS =libflashplugin.h \
27 libflashpluginimpl.h
28 SOURCES =libflashplugin.cpp \
29 libflashpluginimpl.cpp \
30 adpcm.cc \
31 character.cc \
32 flash.cc \
33 graphic16.cc \
34 matrix.cc \
35 script.cc \
36 sprite.cc \
37 bitmap.cc \
38 cxform.cc \
39 font.cc \
40 graphic24.cc \
41 movie.cc \
42 shape.cc \
43 sqrt.cc \
44 button.cc \
45 displaylist.cc \
46 graphic.cc \
47 graphic32.cc \
48 program.cc \
49 sound.cc \
50 text.cc
51 OBJECTS =libflashplugin.o \
52 libflashpluginimpl.o \
53 adpcm.o \
54 character.o \
55 flash.o \
56 graphic16.o \
57 matrix.o \
58 script.o \
59 sprite.o \
60 bitmap.o \
61 cxform.o \
62 font.o \
63 graphic24.o \
64 movie.o \
65 shape.o \
66 sqrt.o \
67 button.o \
68 displaylist.o \
69 graphic.o \
70 graphic32.o \
71 program.o \
72 sound.o \
73 text.o
74INTERFACES =
75UICDECLS =
76UICIMPLS =
77 SRCMOC =
78 OBJMOC =
79
80
81####### Implicit rules
82
83.SUFFIXES: .cpp .cxx .cc .C .c
84
85.cpp.o:
86 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
87
88.cxx.o:
89 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
90
91.cc.o:
92 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
93
94.C.o:
95 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
96
97.c.o:
98 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
99
100####### Build rules
101
102
103all: $(DESTDIR)$(SYSCONF_LINK_TARGET)
104
105$(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
106 $(SYSCONF_LINK_LIB)
107
108moc: $(SRCMOC)
109
110tmake: Makefile.in
111
112Makefile.in: libflash.pro
113 tmake libflash.pro -o Makefile.in
114
115clean:
116 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
117 -rm -f *~ core
118 -rm -f allmoc.cpp
119
120####### Extension Modules
121
122listpromodules:
123 @echo
124
125listallmodules:
126 @echo
127
128listaddonpromodules:
129 @echo
130
131listaddonentmodules:
132 @echo
133
134
135REQUIRES=
136
137####### Sub-libraries
138
139
140###### Combined headers
141
142
143
144####### Compile
145
146libflashplugin.o: libflashplugin.cpp \
147 libflashplugin.h \
148 flash.h \
149 ../mediaplayerplugininterface.h
150
151libflashpluginimpl.o: libflashpluginimpl.cpp \
152 libflashplugin.h \
153 flash.h \
154 ../mediaplayerplugininterface.h \
155 libflashpluginimpl.h \
156 ../mediaplayerplugininterface.h
157
158adpcm.o: adpcm.cc \
159 swf.h \
160 flash.h \
161 matrix.h \
162 cxform.h \
163 rect.h \
164 jpeglib.h \
165 jconfig.h \
166 jmorecfg.h \
167 jerror.h \
168 graphic.h \
169 character.h \
170 bitmap.h \
171 shape.h \
172 displaylist.h \
173 sound.h \
174 button.h \
175 font.h \
176 text.h \
177 adpcm.h \
178 program.h \
179 sprite.h \
180 script.h \
181 movie.h
182
183character.o: character.cc \
184 swf.h \
185 flash.h \
186 matrix.h \
187 cxform.h \
188 rect.h \
189 jpeglib.h \
190 jconfig.h \
191 jmorecfg.h \
192 jerror.h \
193 graphic.h \
194 character.h \
195 bitmap.h \
196 shape.h \
197 displaylist.h \
198 sound.h \
199 button.h \
200 font.h \
201 text.h \
202 adpcm.h \
203 program.h \
204 sprite.h \
205 script.h \
206 movie.h
207
208flash.o: flash.cc \
209 swf.h \
210 flash.h \
211 matrix.h \
212 cxform.h \
213 rect.h \
214 jpeglib.h \
215 jconfig.h \
216 jmorecfg.h \
217 jerror.h \
218 graphic.h \
219 character.h \
220 bitmap.h \
221 shape.h \
222 displaylist.h \
223 sound.h \
224 button.h \
225 font.h \
226 text.h \
227 adpcm.h \
228 program.h \
229 sprite.h \
230 script.h \
231 movie.h \
232 graphic16.h \
233 graphic24.h \
234 graphic32.h
235
236graphic16.o: graphic16.cc \
237 swf.h \
238 flash.h \
239 matrix.h \
240 cxform.h \
241 rect.h \
242 jpeglib.h \
243 jconfig.h \
244 jmorecfg.h \
245 jerror.h \
246 graphic.h \
247 character.h \
248 bitmap.h \
249 shape.h \
250 displaylist.h \
251 sound.h \
252 button.h \
253 font.h \
254 text.h \
255 adpcm.h \
256 program.h \
257 sprite.h \
258 script.h \
259 movie.h \
260 graphic16.h
261
262matrix.o: matrix.cc \
263 matrix.h
264
265script.o: script.cc \
266 swf.h \
267 flash.h \
268 matrix.h \
269 cxform.h \
270 rect.h \
271 jpeglib.h \
272 jconfig.h \
273 jmorecfg.h \
274 jerror.h \
275 graphic.h \
276 character.h \
277 bitmap.h \
278 shape.h \
279 displaylist.h \
280 sound.h \
281 button.h \
282 font.h \
283 text.h \
284 adpcm.h \
285 program.h \
286 sprite.h \
287 script.h \
288 movie.h
289
290sprite.o: sprite.cc \
291 swf.h \
292 flash.h \
293 matrix.h \
294 cxform.h \
295 rect.h \
296 jpeglib.h \
297 jconfig.h \
298 jmorecfg.h \
299 jerror.h \
300 graphic.h \
301 character.h \
302 bitmap.h \
303 shape.h \
304 displaylist.h \
305 sound.h \
306 button.h \
307 font.h \
308 text.h \
309 adpcm.h \
310 program.h \
311 sprite.h \
312 script.h \
313 movie.h
314
315bitmap.o: bitmap.cc \
316 swf.h \
317 flash.h \
318 matrix.h \
319 cxform.h \
320 rect.h \
321 jpeglib.h \
322 jconfig.h \
323 jmorecfg.h \
324 jerror.h \
325 graphic.h \
326 character.h \
327 bitmap.h \
328 shape.h \
329 displaylist.h \
330 sound.h \
331 button.h \
332 font.h \
333 text.h \
334 adpcm.h \
335 program.h \
336 sprite.h \
337 script.h \
338 movie.h
339
340cxform.o: cxform.cc \
341 swf.h \
342 flash.h \
343 matrix.h \
344 cxform.h \
345 rect.h \
346 jpeglib.h \
347 jconfig.h \
348 jmorecfg.h \
349 jerror.h \
350 graphic.h \
351 character.h \
352 bitmap.h \
353 shape.h \
354 displaylist.h \
355 sound.h \
356 button.h \
357 font.h \
358 text.h \
359 adpcm.h \
360 program.h \
361 sprite.h \
362 script.h \
363 movie.h
364
365font.o: font.cc \
366 swf.h \
367 flash.h \
368 matrix.h \
369 cxform.h \
370 rect.h \
371 jpeglib.h \
372 jconfig.h \
373 jmorecfg.h \
374 jerror.h \
375 graphic.h \
376 character.h \
377 bitmap.h \
378 shape.h \
379 displaylist.h \
380 sound.h \
381 button.h \
382 font.h \
383 text.h \
384 adpcm.h \
385 program.h \
386 sprite.h \
387 script.h \
388 movie.h
389
390graphic24.o: graphic24.cc \
391 swf.h \
392 flash.h \
393 matrix.h \
394 cxform.h \
395 rect.h \
396 jpeglib.h \
397 jconfig.h \
398 jmorecfg.h \
399 jerror.h \
400 graphic.h \
401 character.h \
402 bitmap.h \
403 shape.h \
404 displaylist.h \
405 sound.h \
406 button.h \
407 font.h \
408 text.h \
409 adpcm.h \
410 program.h \
411 sprite.h \
412 script.h \
413 movie.h \
414 graphic24.h
415
416movie.o: movie.cc \
417 movie.h \
418 swf.h \
419 flash.h \
420 matrix.h \
421 cxform.h \
422 rect.h \
423 jpeglib.h \
424 jconfig.h \
425 jmorecfg.h \
426 jerror.h \
427 graphic.h \
428 character.h \
429 bitmap.h \
430 shape.h \
431 displaylist.h \
432 sound.h \
433 button.h \
434 font.h \
435 text.h \
436 adpcm.h \
437 program.h \
438 sprite.h \
439 script.h
440
441shape.o: shape.cc \
442 swf.h \
443 flash.h \
444 matrix.h \
445 cxform.h \
446 rect.h \
447 jpeglib.h \
448 jconfig.h \
449 jmorecfg.h \
450 jerror.h \
451 graphic.h \
452 character.h \
453 bitmap.h \
454 shape.h \
455 displaylist.h \
456 sound.h \
457 button.h \
458 font.h \
459 text.h \
460 adpcm.h \
461 program.h \
462 sprite.h \
463 script.h \
464 movie.h
465
466sqrt.o: sqrt.cc
467
468button.o: button.cc \
469 swf.h \
470 flash.h \
471 matrix.h \
472 cxform.h \
473 rect.h \
474 jpeglib.h \
475 jconfig.h \
476 jmorecfg.h \
477 jerror.h \
478 graphic.h \
479 character.h \
480 bitmap.h \
481 shape.h \
482 displaylist.h \
483 sound.h \
484 button.h \
485 font.h \
486 text.h \
487 adpcm.h \
488 program.h \
489 sprite.h \
490 script.h \
491 movie.h
492
493displaylist.o: displaylist.cc \
494 swf.h \
495 flash.h \
496 matrix.h \
497 cxform.h \
498 rect.h \
499 jpeglib.h \
500 jconfig.h \
501 jmorecfg.h \
502 jerror.h \
503 graphic.h \
504 character.h \
505 bitmap.h \
506 shape.h \
507 displaylist.h \
508 sound.h \
509 button.h \
510 font.h \
511 text.h \
512 adpcm.h \
513 program.h \
514 sprite.h \
515 script.h \
516 movie.h
517
518graphic.o: graphic.cc \
519 swf.h \
520 flash.h \
521 matrix.h \
522 cxform.h \
523 rect.h \
524 jpeglib.h \
525 jconfig.h \
526 jmorecfg.h \
527 jerror.h \
528 graphic.h \
529 character.h \
530 bitmap.h \
531 shape.h \
532 displaylist.h \
533 sound.h \
534 button.h \
535 font.h \
536 text.h \
537 adpcm.h \
538 program.h \
539 sprite.h \
540 script.h \
541 movie.h
542
543graphic32.o: graphic32.cc \
544 swf.h \
545 flash.h \
546 matrix.h \
547 cxform.h \
548 rect.h \
549 jpeglib.h \
550 jconfig.h \
551 jmorecfg.h \
552 jerror.h \
553 graphic.h \
554 character.h \
555 bitmap.h \
556 shape.h \
557 displaylist.h \
558 sound.h \
559 button.h \
560 font.h \
561 text.h \
562 adpcm.h \
563 program.h \
564 sprite.h \
565 script.h \
566 movie.h \
567 graphic32.h
568
569program.o: program.cc \
570 swf.h \
571 flash.h \
572 matrix.h \
573 cxform.h \
574 rect.h \
575 jpeglib.h \
576 jconfig.h \
577 jmorecfg.h \
578 jerror.h \
579 graphic.h \
580 character.h \
581 bitmap.h \
582 shape.h \
583 displaylist.h \
584 sound.h \
585 button.h \
586 font.h \
587 text.h \
588 adpcm.h \
589 program.h \
590 sprite.h \
591 script.h \
592 movie.h
593
594sound.o: sound.cc \
595 swf.h \
596 flash.h \
597 matrix.h \
598 cxform.h \
599 rect.h \
600 jpeglib.h \
601 jconfig.h \
602 jmorecfg.h \
603 jerror.h \
604 graphic.h \
605 character.h \
606 bitmap.h \
607 shape.h \
608 displaylist.h \
609 sound.h \
610 button.h \
611 font.h \
612 text.h \
613 adpcm.h \
614 program.h \
615 sprite.h \
616 script.h \
617 movie.h
618
619text.o: text.cc \
620 swf.h \
621 flash.h \
622 matrix.h \
623 cxform.h \
624 rect.h \
625 jpeglib.h \
626 jconfig.h \
627 jmorecfg.h \
628 jerror.h \
629 graphic.h \
630 character.h \
631 bitmap.h \
632 shape.h \
633 displaylist.h \
634 sound.h \
635 button.h \
636 font.h \
637 text.h \
638 adpcm.h \
639 program.h \
640 sprite.h \
641 script.h \
642 movie.h
643
644
diff --git a/core/multimedia/opieplayer/libflash/README b/core/multimedia/opieplayer/libflash/README
new file mode 100644
index 0000000..9914a00
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/README
@@ -0,0 +1,191 @@
1
2MODIFICATIONS BY TROLLTECH
3--------------------------
4
5Oct. 2001
6
7Just the Lib directory of the flash library source archive
8has been copied in to the QPE CVS tree. For the full source code
9to create a KDE screensaver or stand alone player etc, download
10the orginal source tar ball from http://www.swift-tools.com/Flash
11The files libflashplugin* have been added to wrapper the library
12to produce a Qtopia Media Player plugin out of the code.
13
14John R.
15
16
17INTRODUCTION
18------------
19
20Jun. 12th 2000
21
22This the Version 0.4.10 of the Flash Library for Linux.
23
24Flash Plugin is under GPL, see COPYING file.
25
26Provides:
27- Lib contains the FlashLib sources.
28- Plugin contains plugin sources.
29- Player contains the standalone player sources.
30- Kflash a Flash KDE screen saver.
31
32New features:
33- Bug fixes.
34- 24 and 32 modes supported.
35- Flash Library as screen saver (for xcreensaver and KDE).
36
37To get some information on this library check out the following link :
38http://www.swift-tools.com/Flash
39
40 Authors:Olivier Debon <odebon@club-internet.fr>
41 Fabrice Bellard <fabrice.bellard@netgem.com>
42
43FEATURES
44--------
45
46Limitations :
47 - The plugin and the player use XShm extensions, so remote display is not possible.
48 - No Flash 4 features (but no crash on Flash 4 files).
49
50Not functional :
51 - No Morphing.
52 - No vertical anti-aliasing.
53
54SOUND SUPPORT
55-------------
56
57Limitations :
58 - No streamed sound supported (interleaved data).
59 - No sound envelop. So no fading or balancing effect.
60
61But the main feature is here and sound can be enjoyed.
62
63I recommend OSS drivers, but it is not required at all
64(http://www.opensound.com)
65
66If you have troubles with sound put the -DNOSOUND option
67for compilation. Also do this for non-Linux Unix.
68
69THE PLAYER
70----------
71
72The standalone player can simply control movie by
73pressing Q to quit, P to pause, C to continue and
74R to replay.
75There is also the possibility to zoom in or out
76and scroll using Keypad +/- and cursor keys, but
77it is buggy on frozen images.
78
79THE SCREEN SAVERS
80-----------------
81
82The standalone player can be run though xscreensaver. Modify
83your .xscreensaver file to add swfplayer:
84programs: swfplayer -root /home/olivier/Flash/Test/test.swf
85(See xscreensaver doc for more details on Xscreensaver).
86
87For KDE, just install the kflash.kss file from the Kflash
88directory in /usr/bin (or where your KDE installation expects
89kss file to be).
90In your KDE start menu, select Settings->Desktop->Screensaver
91Choose 'Flash Movies' and click on SetUp button. You'll have
92to select a Flash file (take the test.swf file provided with
93this distribution). The fullscreen option will scale the movie
94to the entire screen (it can be very CPU intensive). The
95enable sound option will allow to play sounds, but as a screen
96saver mode this is not a good idea :)
97
98BUG REPORT
99----------
100
101If Netscape crashes when it started to play a Flash file, please
102report the complete url where you have found the file.
103Do not send the actual file !
104
105If you have rendering problem also report the url.
106
107If the plugin does not seem to show anything or does not do what it
108is supposed to do, please consider that the plugin does not support
109all Flash 2/4 features. Anyway it tries to play it but may fail then.
110
111COMPILATION
112-----------
113
114If you use Linux just type 'make'.
115
116Warning : the plugin compilation should not fail, but you may
117have problem with Netscape at startup. See INSTALLATION section
118for workarounds.
119
120For other Unices like FreeBSD or Solaris you may have to change
121some flags. See Plugin/Makefile for hints.
122
123INSTALLATION
124------------
125
126Once you have successfully compiled the plugin, put the file
127npflash.so (located in the Plugin directory) into your
128~/.netscape/plugins directory or into the system-wide
129/opt/netscape/plugins directory (depends on where you have installed
130Netscape).
131
132If Netscape already runs type 'javascript:navigator.plugins.refresh'
133in the Location field.
134
135 PROBLEMS
136 --------
137
138If you have problem to successfully install the plugin, please
139read the following hints. Otherwise, report the problem with full
140description of your configuration :
141- Distribution.
142- Compiler.
143- Libs (the output of ldconfig -p is useful).
144- The netscape version and the output of 'ldd netscape'.
145
146If some symbols like _rtti or _throw are unresolved, it seems
147that you have egcs. Just uncomment the proper line in the main
148Makefile.
149You may then still have some unresolved symbols like __sigsetjmp.
150This time, add -DC6R5 in the Plugin/Makefile at the PLUGIN_DEFINES
151line.
152
153 CHECKING
154 --------
155
156To verify that the plugin is installed properly, type "about:plugins"
157in Netscape's "Location:" or "Netsite:" field. The plugin should show
158up there, something like
159
160___________________________________________________________________________
161
162 Shockwave Flash
163
164 File name: /opt/netscape/plugins/npflash.so
165
166 Flash file player Version 0.4.10
167
168 Shockwave is a trademark of Macromedia®
169
170 Author: Olivier Debon
171
172 ---------------------------------------------------------------------------------
173| Mime Type | Description | Suffixes | Enabled |
174|--------------------------------+-------------------+-------------+--------------|
175| application/futuresplash | Flash Plugin | spl | Yes |
176| application/x-shockwave-flash | | swf | Yes |
177 ---------------------------------------------------------------------------------
178
179___________________________________________________________________________
180
181
182If it shows up, but the "Enabled" column says "No", you need to
183configure the Flash plugin as a helper application. Go to
184Edit/Preferences/Navigator/Applications, and add it as follows:
185
186Description: Flash Plugin
187MIME Type: application/x-shockwave-flash
188Suffixes: swf
189Handled By: Plug In (select "Shockwave Flash")
190
191------
diff --git a/core/multimedia/opieplayer/libflash/adpcm.cc b/core/multimedia/opieplayer/libflash/adpcm.cc
new file mode 100644
index 0000000..a4bc435
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/adpcm.cc
@@ -0,0 +1,235 @@
1
2#include "swf.h"
3
4#ifdef RCSID
5static char *rcsid = "$Id$";
6#endif
7
8// This file has been rearranged from the code posted
9// on news:forums.macromedia.com by Jonathan Gay.
10// Courtesy of Macromedia
11
12//
13// ADPCM tables
14//
15
16static const int indexTable2[2] = {
17 -1, 2,
18};
19
20// Is this ok?
21static const int indexTable3[4] = {
22 -1, -1, 2, 4,
23};
24
25static const int indexTable4[8] = {
26 -1, -1, -1, -1, 2, 4, 6, 8,
27};
28
29static const int indexTable5[16] = {
30 -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16,
31};
32
33static const int* indexTables[] = {
34 indexTable2,
35 indexTable3,
36 indexTable4,
37 indexTable5
38};
39
40static const int stepsizeTable[89] = {
41 7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
42 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
43 50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
44 130, 143, 157, 173, 190, 209, 230, 253, 279, 307,
45 337, 371, 408, 449, 494, 544, 598, 658, 724, 796,
46 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066,
47 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358,
48 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
49 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
50};
51
52long
53Adpcm::GetBits(int n)
54{
55 if ( bitPos < n ) FillBuffer();
56
57 assert(bitPos >= n);
58
59 long v = ((unsigned long)bitBuf << (32-bitPos)) >> (32-n);
60 bitPos -= n;
61
62 return v;
63}
64
65long
66Adpcm::GetSBits(int n)
67{
68 if ( bitPos < n ) FillBuffer();
69
70 assert(bitPos >= n);
71
72 long v = ((long)bitBuf << (32-bitPos)) >> (32-n);
73 bitPos -= n;
74
75 return v;
76}
77
78//
79// The Decompressor
80//
81
82// Constructor
83Adpcm::Adpcm(unsigned char *buffer, long isStereo)
84{
85 stereo = isStereo;
86 src = buffer;
87
88 nBits = 0; // flag that it is not inited
89 nSamples = 0;
90
91 bitPos = 0;
92 bitBuf = 0;
93}
94
95void
96Adpcm::FillBuffer()
97{
98 while ( bitPos <= 24 /*&& srcSize > 0*/ ) {
99 bitBuf = (bitBuf<<8) | *src++;
100 bitPos += 8;
101 }
102}
103
104void
105Adpcm::Decompress(short *dst, long n)
106{
107 if ( nBits == 0 ) {
108 // Get the compression header
109 nBits = (int)GetBits(2)+2;
110 }
111
112 const int* indexTable = indexTables[nBits-2];
113 int k0 = 1 << (nBits-2);
114 int signmask = 1 << (nBits-1);
115
116 if ( !stereo ) {
117 // Optimize for mono
118 long vp = valpred[0]; // maybe these can get into registers...
119 int ind = index[0];
120 long ns = nSamples;
121
122 while ( n-- > 0 ) {
123 ns++;
124
125 if ( (ns & 0xFFF) == 1 ) {
126 // Get a new block header
127 *dst++ = (short)(vp = GetSBits(16));
128
129 ind = (int)GetBits(6); // The first sample in a block does not have a delta
130 } else {
131 // Process a delta value
132 int delta = (int)GetBits(nBits);
133
134 // Compute difference and new predicted value
135 // Computes 'vpdiff = (delta+0.5)*step/4'
136 int step = stepsizeTable[ind];
137 long vpdiff = 0;
138 int k = k0;
139
140 do {
141 if ( delta & k )
142 vpdiff += step;
143 step >>= 1;
144 k >>= 1;
145 } while ( k );
146
147 vpdiff += step; // add 0.5
148
149 if ( delta & signmask ) // the sign bit
150 vp -= vpdiff;
151 else
152 vp += vpdiff;
153
154 // Find new index value
155 ind += indexTable[delta&(~signmask)];
156
157 if ( ind < 0 )
158 ind = 0;
159 else if ( ind > 88 )
160 ind = 88;
161
162 // clamp output value
163 if ( vp != (short)vp )
164 vp = vp < 0 ? -32768 : 32767;
165
166 /* Step 7 - Output value */
167 *dst++ = (short)vp;
168 }
169 }
170
171 valpred[0] = vp;
172 index[0] = ind;
173 nSamples = ns;
174
175 } else {
176 int sn = stereo ? 2 : 1;
177
178 // Stereo
179 while ( n-- > 0 ) {
180
181 nSamples++;
182
183 if ( (nSamples & 0xFFF) == 1 ) {
184 // Get a new block header
185 for ( int i = 0; i < sn; i++ ) {
186
187 *dst++ = (short)(valpred[i] = GetSBits(16));
188
189 // The first sample in a block does not have a delta
190 index[i] = (int)GetBits(6);
191 }
192 } else {
193 // Process a delta value
194 for ( int i = 0; i < sn; i++ ) {
195 int delta = (int)GetBits(nBits);
196
197 // Compute difference and new predicted value
198 // Computes 'vpdiff = (delta+0.5)*step/4'
199
200 int step = stepsizeTable[index[i]];
201 long vpdiff = 0;
202 int k = k0;
203
204 do {
205 if ( delta & k ) vpdiff += step;
206 step >>= 1;
207 k >>= 1;
208 } while ( k );
209 vpdiff += step; // add 0.5
210
211
212 if ( delta & signmask ) // the sign bit
213 valpred[i] -= vpdiff;
214 else
215 valpred[i] += vpdiff;
216
217 // Find new index value
218 index[i] += indexTable[delta&(~signmask)];
219
220 if ( index[i] < 0 )
221 index[i] = 0;
222 else if ( index[i] > 88 )
223 index[i] = 88;
224
225 // clamp output value
226 if ( valpred[i] != (short)valpred[i] )
227 valpred[i] = valpred[i] < 0 ? -32768 : 32767;
228
229 /* Step 7 - Output value */
230 *dst++ = (short)valpred[i];
231 }
232 }
233 }
234 }
235}
diff --git a/core/multimedia/opieplayer/libflash/adpcm.h b/core/multimedia/opieplayer/libflash/adpcm.h
new file mode 100644
index 0000000..5714c0c
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/adpcm.h
@@ -0,0 +1,36 @@
1#ifndef _ADPCM_H_
2#define _ADPCM_H_
3
4class Adpcm {
5
6 // Destination format - note we always decompress to 16 bit
7 long stereo;
8 int nBits; // number of bits in each sample
9
10 long valpred[2]; // Current state
11 int index[2];
12
13 long nSamples; // number of samples decompressed so far
14
15 // Parsing Info
16 unsigned char *src;
17 long bitBuf; // this should always contain at least 24 bits of data
18 int bitPos;
19
20 void FillBuffer();
21
22 long GetBits(int n);
23
24 long GetSBits(int n);
25
26public:
27 Adpcm(unsigned char *buffer, long isStereo);
28
29 void Decompress(short * dst, long n); // return number of good samples
30#ifdef DUMP
31 void dump(BitStream *bs);
32 void Compress(short *pcm, long n, int bits);
33#endif
34};
35
36#endif /* _ADPCM_H_ */
diff --git a/core/multimedia/opieplayer/libflash/bitmap.cc b/core/multimedia/opieplayer/libflash/bitmap.cc
new file mode 100644
index 0000000..03b4588
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/bitmap.cc
@@ -0,0 +1,606 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29static unsigned char *inputData;
30
31// Class variables
32
33int Bitmap::haveTables = 0;
34
35struct jpeg_decompress_struct Bitmap::jpegObject;
36
37struct jpeg_source_mgr Bitmap::jpegSourceManager;
38
39MyErrorHandler Bitmap::jpegErrorMgr;
40
41Bitmap::Bitmap(long id, int level) : Character(BitmapType, id )
42{
43 pixels = NULL;
44 alpha_buf = NULL;
45 colormap = NULL;
46 nbColors = 0;
47 defLevel = level;
48}
49
50Bitmap::~Bitmap()
51{
52 if (pixels) {
53 delete[] pixels;
54 }
55 if (alpha_buf) {
56 delete[] alpha_buf;
57 }
58 if (colormap)
59 {
60 delete colormap;
61 }
62 if (haveTables) {
63 jpeg_destroy_decompress(&jpegObject);
64 haveTables = 0;
65 }
66}
67
68static void errorExit(j_common_ptr info)
69{
70 (*info->err->output_message) (info);
71 longjmp(((MyErrorHandler *)info->err)->setjmp_buffer, 1);
72}
73
74// Methods for Source data manager
75static void initSource(struct jpeg_decompress_struct *cInfo)
76{
77 cInfo->src->bytes_in_buffer = 0;
78}
79
80static boolean fillInputBuffer(struct jpeg_decompress_struct *cInfo)
81{
82 cInfo->src->next_input_byte = inputData;
83 cInfo->src->bytes_in_buffer = 1;
84 inputData++;
85
86 return 1;
87}
88
89static void skipInputData(struct jpeg_decompress_struct *cInfo, long count)
90{
91 cInfo->src->bytes_in_buffer = 0;
92 inputData += count;
93}
94
95static boolean resyncToRestart(struct jpeg_decompress_struct *cInfo, int desired)
96{
97 return jpeg_resync_to_restart(cInfo, desired);
98}
99
100static void termSource(struct jpeg_decompress_struct *cInfo)
101{
102}
103
104long Bitmap::getWidth()
105{
106 return width;
107}
108
109long Bitmap::getHeight()
110{
111 return height;
112}
113
114Color *
115Bitmap::getColormap(long *n) {
116 if (n) *n = nbColors;
117 return colormap;
118}
119
120unsigned char *
121Bitmap::getPixels()
122{
123 return pixels;
124}
125
126// Read Tables and Compressed data to produce an image
127
128static int
129buildJpegAlpha(Bitmap *b, unsigned char *buffer)
130{
131 z_streamstream;
132 int status;
133 unsigned char *data;
134
135 data = new unsigned char[b->width*b->height];
136 if (data == NULL)
137 return -1;
138
139 stream.next_in = buffer;
140 stream.avail_in = 1;
141 stream.next_out = data;
142 stream.avail_out = b->width*b->height;
143 stream.zalloc = Z_NULL;
144 stream.zfree = Z_NULL;
145
146 status = inflateInit(&stream);
147
148 while (1) {
149 status = inflate(&stream, Z_SYNC_FLUSH) ;
150 if (status == Z_STREAM_END) {
151 break;
152 }
153 if (status != Z_OK) {
154 printf("Zlib data error : %s\n", stream.msg);
155 delete data;
156 return -1;
157 }
158 stream.avail_in = 1;
159 }
160
161 inflateEnd(&stream);
162
163 b->alpha_buf = data;
164
165 return 0;
166}
167
168int
169Bitmap::buildFromJpegInterchangeData(unsigned char *stream, int read_alpha, long offset)
170{
171 struct jpeg_decompress_struct cInfo;
172 struct jpeg_source_mgr mySrcMgr;
173 MyErrorHandler errorMgr;
174 JSAMPROW buffer[1];
175 unsigned char *ptrPix;
176 int stride;
177 long n;
178
179#if PRINT&1
180 printf("flash: loading jpeg (interchange)\n");
181#endif
182
183 // Kludge to correct some corrupted files
184 if (stream[1] == 0xd9 && stream[3] == 0xd8) {
185 stream[3] = 0xd9;
186 stream[1] = 0xd8;
187 }
188
189 // Setup error handler
190 cInfo.err = jpeg_std_error(&errorMgr.pub);
191 errorMgr.pub.error_exit = errorExit;
192
193 if (setjmp(errorMgr.setjmp_buffer)) {
194 // JPEG data Error
195 jpeg_destroy_decompress(&cInfo);
196 if (pixels) {
197 delete[] pixels;
198 pixels = NULL;
199 }
200 return -1;
201 }
202
203 // Set current stream pointer to stream
204 inputData = stream;
205
206 // Here it's Ok
207
208 jpeg_create_decompress(&cInfo);
209
210 // Setup source manager structure
211 mySrcMgr.init_source = initSource;
212 mySrcMgr.fill_input_buffer = fillInputBuffer;
213 mySrcMgr.skip_input_data = skipInputData;
214 mySrcMgr.resync_to_restart = resyncToRestart;
215 mySrcMgr.term_source = termSource;
216
217 // Set default source manager
218 cInfo.src = &mySrcMgr;
219
220 jpeg_read_header(&cInfo, FALSE);
221
222 jpeg_read_header(&cInfo, TRUE);
223 cInfo.quantize_colors = TRUE;// Create colormapped image
224 jpeg_start_decompress(&cInfo);
225
226 // Set objet dimensions
227 height = cInfo.output_height;
228 width = cInfo.output_width;
229 bpl = width;
230 pixels = new unsigned char [height*width];
231 if (pixels == NULL) {
232 jpeg_finish_decompress(&cInfo);
233 jpeg_destroy_decompress(&cInfo);
234 return -1;
235 }
236 ptrPix = pixels;
237
238 stride = cInfo.output_width * cInfo.output_components;
239
240 buffer[0] = (JSAMPROW)malloc(stride);
241
242 while (cInfo.output_scanline < cInfo.output_height) {
243
244 jpeg_read_scanlines(&cInfo, buffer, 1);
245
246 memcpy(ptrPix,buffer[0],stride);
247
248 ptrPix+= stride;
249 }
250
251 free(buffer[0]);
252
253 colormap = new Color[cInfo.actual_number_of_colors];
254 if (colormap == NULL) {
255 delete pixels;
256 jpeg_finish_decompress(&cInfo);
257 jpeg_destroy_decompress(&cInfo);
258 return -1;
259 }
260 nbColors = cInfo.actual_number_of_colors;
261
262 for(n=0; n < nbColors; n++)
263 {
264 colormap[n].red = cInfo.colormap[0][n];
265 colormap[n].green = cInfo.colormap[1][n];
266 colormap[n].blue = cInfo.colormap[2][n];
267 }
268
269 jpeg_finish_decompress(&cInfo);
270 jpeg_destroy_decompress(&cInfo);
271
272 if (read_alpha) {
273 if (buildJpegAlpha(this, stream + offset) < 0) {
274 return -1;
275 }
276 }
277 return 0;
278}
279
280// Read JPEG image using pre-loaded Tables
281
282int
283Bitmap::buildFromJpegAbbreviatedData(unsigned char *stream)
284{
285 JSAMPROW buffer[1];
286 unsigned char *ptrPix;
287 int stride;
288 long n;
289 int status;
290
291#if PRINT&1
292 printf("flash: loading jpeg (abbreviated)\n");
293#endif
294
295 // Set current stream pointer to stream
296 inputData = stream;
297
298 // Error handler
299 if (setjmp(jpegErrorMgr.setjmp_buffer)) {
300 // JPEG data Error
301 //jpeg_destroy_decompress(&jpegObject);
302 if (pixels) {
303 delete[] pixels;
304 pixels = NULL;
305 }
306 return -1;
307 }
308
309 // Here it's ok
310
311 jpeg_read_header(&jpegObject, TRUE);
312 jpegObject.quantize_colors = TRUE;// Create colormapped image
313 jpeg_start_decompress(&jpegObject);
314
315 // Set objet dimensions
316 height = jpegObject.output_height;
317 width = jpegObject.output_width;
318 bpl = width;
319 pixels = new unsigned char [height*width];
320 if (pixels == NULL) {
321 jpeg_finish_decompress(&jpegObject);
322 return -1;
323 }
324 ptrPix = pixels;
325
326 stride = jpegObject.output_width * jpegObject.output_components;
327
328 buffer[0] = (JSAMPROW)malloc(stride);
329
330 while (jpegObject.output_scanline < jpegObject.output_height) {
331
332 status = jpeg_read_scanlines(&jpegObject, buffer, 1);
333
334 memcpy(ptrPix,buffer[0],stride);
335
336 ptrPix+= stride;
337 }
338
339 free(buffer[0]);
340
341 colormap = new Color[jpegObject.actual_number_of_colors];
342 if (colormap == NULL) {
343 jpeg_finish_decompress(&jpegObject);
344 delete pixels;
345 return -1;
346 }
347 nbColors = jpegObject.actual_number_of_colors;
348
349 for(n=0; n < nbColors; n++)
350 {
351 colormap[n].red = jpegObject.colormap[0][n];
352 colormap[n].green = jpegObject.colormap[1][n];
353 colormap[n].blue = jpegObject.colormap[2][n];
354 }
355
356 status = jpeg_finish_decompress(&jpegObject);
357
358 return 0;
359}
360
361// Just init JPEG object and read JPEG Tables
362
363int
364Bitmap::readJpegTables(unsigned char *stream)
365{
366 if (haveTables) {
367 //Error, it has already been initialized
368 return -1;
369 }
370
371 // Setup error handler
372 jpegObject.err = jpeg_std_error(&jpegErrorMgr.pub);
373 jpegErrorMgr.pub.error_exit = errorExit;
374
375 if (setjmp(jpegErrorMgr.setjmp_buffer)) {
376 // JPEG data Error
377 jpeg_destroy_decompress(&jpegObject);
378 return -1;
379 }
380
381 // Set current stream pointer to stream
382 inputData = stream;
383
384 // Here it's Ok
385
386 jpeg_create_decompress(&jpegObject);
387
388 // Setup source manager structure
389 jpegSourceManager.init_source = initSource;
390 jpegSourceManager.fill_input_buffer = fillInputBuffer;
391 jpegSourceManager.skip_input_data = skipInputData;
392 jpegSourceManager.resync_to_restart = resyncToRestart;
393 jpegSourceManager.term_source = termSource;
394
395 // Set default source manager
396 jpegObject.src = &jpegSourceManager;
397
398 jpeg_read_header(&jpegObject, FALSE);
399
400 haveTables = 1;
401
402 return 0;
403}
404
405int
406Bitmap::buildFromZlibData(unsigned char *buffer, int width, int height, int format, int tableSize, int tableHasAlpha)
407{
408 z_streamstream;
409 int status;
410 unsigned char *data;
411 int elementSize;
412
413#if PRINT&1
414 printf("flash: loading with zlib\n");
415#endif
416
417 this->width = width;
418 this->height = height;
419 this->bpl = width;
420
421 if (tableHasAlpha) {
422 elementSize = 4;// Cmap is RGBA
423 } else {
424 elementSize = 3;// Cmap is RGB
425 }
426
427 stream.next_in = buffer;
428 stream.avail_in = 1;
429 stream.zalloc = Z_NULL;
430 stream.zfree = Z_NULL;
431
432 tableSize++;
433
434 // Uncompress Color Table
435 if (format == 3) {
436 unsigned char *colorTable;
437 long n;
438
439 // Ajust width for 32 bit padding
440 width = (width+3)/4*4;
441 this->width = width;
442 this->bpl = width;
443
444 depth = 1;
445 colorTable = new unsigned char[tableSize*elementSize];
446 if (colorTable == NULL) {
447 return -1;
448 }
449
450 stream.next_out = colorTable;
451 stream.avail_out = tableSize*elementSize;
452
453 inflateInit(&stream);
454
455 while (1) {
456 status = inflate(&stream, Z_SYNC_FLUSH);
457 if (status == Z_STREAM_END) {
458 break;
459 }
460 if (status != Z_OK) {
461 printf("Zlib cmap error : %s\n", stream.msg);
462 return -1;
463 }
464 stream.avail_in = 1;
465 // Colormap if full
466 if (stream.avail_out == 0) {
467 break;
468 }
469 }
470
471 nbColors = tableSize;
472
473 colormap = new Color[nbColors];
474 if (colormap == NULL) {
475 delete colorTable;
476 return -1;
477 }
478
479 for(n=0; n < nbColors; n++) {
480 colormap[n].red = colorTable[n*elementSize+0];
481 colormap[n].green = colorTable[n*elementSize+1];
482 colormap[n].blue = colorTable[n*elementSize+2];
483 if (tableHasAlpha) {
484 colormap[n].alpha = colorTable[n*elementSize+3];
485 }
486 }
487
488 delete colorTable;
489
490 } else if (format == 4) {
491 depth = 2;
492 width = (width+1)/2*2;
493 this->bpl = width;
494 } else if (format == 5) {
495 depth = 4;
496 }
497
498 data = new unsigned char[depth*width*height];
499 if (data == NULL) {
500 if (colormap) delete colormap;
501 return -1;
502 }
503
504 stream.next_out = data;
505 stream.avail_out = depth*width*height;
506
507 if (format != 3) {
508 status = inflateInit(&stream);
509 }
510
511 while (1) {
512 status = inflate(&stream, Z_SYNC_FLUSH) ;
513 if (status == Z_STREAM_END) {
514 break;
515 }
516 if (status != Z_OK) {
517 printf("Zlib data error : %s\n", stream.msg);
518 delete data;
519 return -1;
520 }
521 stream.avail_in = 1;
522 }
523
524 inflateEnd(&stream);
525
526 pixels = new unsigned char [height*width];
527 if (pixels == NULL) {
528 if (colormap) delete colormap;
529 delete data;
530 return -1;
531 }
532
533 if (format != 3) {
534 int n,c;
535 unsigned char r,g,b,a;
536 unsigned char *ptr;
537
538 r = g = b = a = 0; /* to supress warnings */
539
540 nbColors = 0;
541 colormap = new Color[256];
542 if (colormap == NULL) {
543 delete data;
544 delete pixels;
545 return -1;
546 }
547 memset(colormap, 0, 256 * sizeof(Color));
548 ptr = pixels;
549
550 for(n=0; n < width*height*depth; n+=depth,ptr++) {
551
552 switch (format) {
553 case 4:
554 a = 1;
555 r = (data[n] & 0x78)<<1;
556 g = ((data[n] & 0x03)<<6) | (data[n+1] & 0xc0)>>2;
557 b = (data[n+1] & 0x1e)<<3;
558 break;
559 case 5:
560 a = data[n];
561 // Reduce color dynamic range
562 r = data[n+1]&0xe0;
563 g = data[n+2]&0xe0;
564 b = data[n+3]&0xe0;
565 break;
566 }
567 for(c=0; c < nbColors; c++) {
568 if (r == colormap[c].red
569 && g == colormap[c].green
570 && b == colormap[c].blue) {
571 *ptr = c;
572 break;
573 }
574 }
575 if (c == nbColors) {
576 if (nbColors == 256) continue;
577 nbColors++;
578 if (nbColors == 256) {
579 //printf("Colormap entries exhausted. After %d scanned pixels\n", n/4);
580 }
581 colormap[c].alpha = a;
582 colormap[c].red = r;
583 colormap[c].green = g;
584 colormap[c].blue = b;
585 *ptr = c;
586 }
587 }
588 } else {
589 memcpy(pixels, data, width*height);
590 if (tableHasAlpha) {
591 int n;
592 unsigned char *ptr, *alpha;
593
594 alpha_buf = (unsigned char *)malloc(width*height);
595 ptr = data;
596 alpha = alpha_buf;
597 for(n=0; n < width*height; n++, ptr++, alpha++) {
598 *alpha = colormap[*ptr].alpha;
599 }
600 }
601 }
602
603 delete data;
604 return 0;
605}
606
diff --git a/core/multimedia/opieplayer/libflash/bitmap.h b/core/multimedia/opieplayer/libflash/bitmap.h
new file mode 100644
index 0000000..7925309
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/bitmap.h
@@ -0,0 +1,72 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _BITMAP_H_
21#define _BITMAP_H_
22
23struct MyErrorHandler {
24 struct jpeg_error_mgr pub;
25 jmp_buf setjmp_buffer;
26};
27
28class Bitmap : public Character {
29 public:
30 long width;
31 long height;
32 long bpl;
33 long depth;
34
35 unsigned char *pixels; // Array of Pixels
36 Color *colormap; // Array of color definitions
37 long nbColors;
38
39 unsigned char *alpha_buf;// Array of alpha values (no alpha if NULL)
40
41 int defLevel;
42
43// Class Variables
44
45 static int haveTables;
46 static struct jpeg_decompress_struct jpegObject;
47 static struct jpeg_source_mgr jpegSourceManager;
48 static MyErrorHandler jpegErrorMgr;
49
50public:
51 Bitmap(long id, int level = 1);
52 ~Bitmap();
53
54 // JPEG handling methods
55 int buildFromJpegInterchangeData(unsigned char *stream, int alpha, long offset);// Complete
56 int buildFromJpegAbbreviatedData(unsigned char *stream);// Abbreviated
57
58 // Class Method
59 static int readJpegTables(unsigned char *stream);// Tables Only
60
61 // ZLIB handling methods
62 int buildFromZlibData(unsigned char *buffer,
63 int width, int height,
64 int format, int tableSize, int tableHasAlpha);
65
66 long getWidth();
67 long getHeight();
68 Color *getColormap(long *n);
69 unsigned char *getPixels();
70};
71
72#endif /* _BITMAP_H_ */
diff --git a/core/multimedia/opieplayer/libflash/button.cc b/core/multimedia/opieplayer/libflash/button.cc
new file mode 100644
index 0000000..7d8369d
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/button.cc
@@ -0,0 +1,328 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29#define PRINT 0
30
31// Contructor
32
33Button::Button(long id, int level) : Character(ButtonType, id)
34{
35 defLevel = level;
36 actionRecords = 0;
37 buttonRecords = 0;
38 conditionList = 0;
39 reset();
40 isMenu = 0;
41 sound[0] = sound[1] = sound[2] = sound[3] = 0;
42}
43
44// Destructor
45
46Button::~Button()
47{
48 if (actionRecords) {
49 ActionRecord *ar,*del;
50 for(ar = actionRecords; ar;) {
51 del = ar;
52 ar = ar->next;
53 delete del;
54 }
55 }
56 if (buttonRecords) {
57 ButtonRecord *br,*del;
58 for(br = buttonRecords; br;) {
59 del = br;
60 br = br->next;
61 if (del->cxform)
62 delete del->cxform;
63 delete del;
64 }
65 }
66 if (conditionList) {
67 Condition *cond,*del;
68 for(cond = conditionList; cond;) {
69 ActionRecord *ar,*d;
70
71 for(ar = cond->actions; ar;) {
72 d = ar;
73 ar = ar->next;
74 delete d;
75 }
76
77 del = cond;
78 cond = cond->next;
79 delete del;
80 }
81 }
82}
83
84ButtonRecord *
85Button::getButtonRecords()
86{
87 return buttonRecords;
88}
89
90ActionRecord *
91Button::getActionRecords()
92{
93 return actionRecords;
94}
95
96Sound **
97Button::getSounds()
98{
99 return sound;
100}
101
102Condition *
103Button::getConditionList()
104{
105 return conditionList;
106}
107
108void
109Button::setButtonSound(Sound *s, int state)
110{
111 if (state >=0 && state < 4) {
112 sound[state] = s;
113 }
114}
115
116void
117Button::setButtonMenu(int menu)
118{
119 isMenu = menu;
120}
121
122void
123Button::addButtonRecord( ButtonRecord *br )
124{
125#if 0
126 /* SURTOUT PAS !!! */
127 ButtonRecord **l;
128
129 /* sort by layer */
130 l=&buttonRecords;
131 while (*l != NULL && (*l)->layer < br->layer) l = &(*l)->next;
132 br->next = *l;
133 *l = br;
134#else
135 br->next = 0;
136
137 if (buttonRecords == 0) {
138 buttonRecords = br;
139 } else {
140 ButtonRecord *current;
141
142 for(current = buttonRecords; current->next; current = current->next);
143
144 current->next = br;
145 }
146#endif
147}
148
149void
150Button::addCondition( long transition )
151{
152 Condition *condition;
153
154 condition = new Condition;
155 if (condition == NULL) return;
156
157 condition->transition = transition;
158 condition->next = conditionList;
159
160 // Move current actionRecords to this condition
161 condition->actions = actionRecords;
162 actionRecords = 0;
163
164 conditionList = condition;
165}
166
167void
168Button::addActionRecord( ActionRecord *ar )
169{
170 ar->next = 0;
171
172 if (actionRecords == 0) {
173 actionRecords = ar;
174 } else {
175 ActionRecord *current;
176
177 for(current = actionRecords; current->next; current = current->next);
178
179 current->next = ar;
180 }
181}
182
183void
184Button::getRegion(GraphicDevice *gd, Matrix *matrix, void *id, ScanLineFunc scan_line_func)
185{
186 ButtonRecord *br;
187
188 for (br = buttonRecords; br; br = br->next)
189 {
190 if ((br->state & stateHitTest) && br->character /* Temporaire */) {
191 Matrix mat;
192
193 mat = (*matrix) * br->buttonMatrix;
194 br->character->getRegion(gd, &mat, id, scan_line_func);
195 }
196 }
197}
198
199int
200Button::execute(GraphicDevice *gd, Matrix *matrix, Cxform *cxform, ButtonState renderState)
201{
202 ButtonRecord *br;
203 int sprite = 0;
204 Cxform *cxf = 0;
205
206#if PRINT==2
207 printf("Rendering Button %d for State(s) ", getTagId());
208#endif
209 for (br = buttonRecords; br; br = br->next)
210 {
211 if ((br->state & renderState) && br->character != NULL) {
212 Matrix mat;
213
214#if PRINT==2
215 printf("%d ", br->state);
216#endif
217 mat = (*matrix) * br->buttonMatrix;
218
219 if (cxform) {
220 cxf = cxform;
221 } else if (br->cxform) {
222 cxf = br->cxform;
223 }
224
225 if (br->character->execute(gd, &mat, cxf)) {
226 sprite = 1;
227 }
228 }
229 }
230#if PRINT==2
231 printf("\n");
232#endif
233 return sprite;
234}
235
236ActionRecord *
237Button::getActionFromTransition(ButtonState cur, ButtonState old)
238{
239 Condition *cond;
240 long mask;
241
242 if (old == cur) return NULL;
243
244 /* transitions */
245 mask = 0;
246 if (old == stateUp && cur == stateOver)
247 mask |= 0x001;
248 else if (old == stateOver && cur == stateUp)
249 mask |= 0x002;
250 else if (old == stateOver && cur == stateDown)
251 mask |= 0x004;
252 else if (old == stateDown && cur == stateOver)
253 mask |= 0x008;
254
255 if (!isMenu) {
256 /* push button transitions (XXX: not quite correct) */
257 if (old == stateDown && cur == stateUp)
258 mask = 0x010;
259 else if (old == stateUp && cur == stateDown)
260 mask = 0x020;
261 /* XXX: what is transition 0x040 ?? */
262 } else {
263 /* menu button transitions (XXX: not quite correct) */
264 if (old == stateUp && cur == stateDown)
265 mask = 0x080;
266 else if (old == stateDown && cur == stateUp)
267 mask = 0x100;
268 }
269
270 for (cond = conditionList; cond; cond = cond->next) {
271 if (cond->transition & mask) {
272 return cond->actions;
273 }
274 }
275 return 0;
276}
277
278void
279Button::getBoundingBox(Rect *bbox, DisplayListEntry *e)
280{
281 ButtonRecord *br;
282
283 bbox->reset();
284 for (br = buttonRecords; br; br = br->next)
285 {
286 if (br->state & e->renderState) {
287 if (br->character) {
288 Rect bb;
289
290 bb.reset();
291 br->character->getBoundingBox(&bb,e);
292 transformBoundingBox(bbox, &br->buttonMatrix, &bb, 0);
293 }
294 }
295 }
296}
297
298/* Get current render character, actually it should be a list of characters
299 so a DisplayList after all */
300Character *
301Button::getRenderCharacter(ButtonState state)
302{
303 ButtonRecord *br;
304
305 for (br = buttonRecords; br; br = br->next)
306 {
307 if (br->state & state) {
308 return br->character;
309 }
310 }
311 return 0;
312}
313
314void
315Button::updateButtonState(DisplayListEntry *e)
316{
317 ButtonRecord *br;
318
319 e->buttonCharacter = 0;
320 for (br = buttonRecords; br; br = br->next)
321 {
322 if (br->state & e->renderState) {
323 e->buttonCharacter = br->character;
324 e->buttonMatrix = br->buttonMatrix;
325 return;
326 }
327 }
328}
diff --git a/core/multimedia/opieplayer/libflash/button.h b/core/multimedia/opieplayer/libflash/button.h
new file mode 100644
index 0000000..75781b2
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/button.h
@@ -0,0 +1,88 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _BUTTON_H_
21#define _BUTTON_H_
22
23struct ButtonRecord {
24 ButtonState state;
25 Character *character;
26 long layer;
27 Matrix buttonMatrix;
28 Cxform *cxform;
29
30 struct ButtonRecord*next;
31};
32
33struct Condition {
34 long transition;
35 ActionRecord *actions;
36
37 Condition *next;
38};
39
40class Button : public Character {
41public:
42 long defLevel;
43
44 ButtonRecord *buttonRecords;
45 ActionRecord *actionRecords;
46 Condition *conditionList;
47
48 long isMenu;
49
50 Sound *sound[4];
51
52 Button(long id, int level = 1);
53 ~Button();
54 void addActionRecord( ActionRecord *ar );
55 void addButtonRecord( ButtonRecord *br );
56 void addCondition( long transition );
57 int execute(GraphicDevice *gd, Matrix *matrix,
58 Cxform *cxform, ButtonState renderState);
59 ActionRecord*getActionFromTransition(ButtonState currentState,
60 ButtonState old);
61 void getRegion(GraphicDevice *gd, Matrix *matrix,
62 void *id, ScanLineFunc scan_line_func);
63 ButtonRecord*getButtonRecords();
64 void setButtonSound(Sound *, int);
65 void setButtonMenu(int);
66
67 ActionRecord*getActionRecords();
68 Condition*getConditionList();
69 Sound **getSounds();
70
71 void getBoundingBox(Rect *bb, DisplayListEntry *);
72
73 void updateButtonState(DisplayListEntry *);
74 Character*getRenderCharacter(ButtonState state);
75
76 // Builtin
77 int isButton() {
78 return 1;
79 };
80
81#ifdef DUMP
82 void dump(BitStream *);
83 void dumpButtonRecords(BitStream *, int putCxform = 0);
84 void dumpButtonConditions(BitStream *);
85#endif
86};
87
88#endif /* _BUTTON_H_ */
diff --git a/core/multimedia/opieplayer/libflash/character.cc b/core/multimedia/opieplayer/libflash/character.cc
new file mode 100644
index 0000000..4b5ce36
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/character.cc
@@ -0,0 +1,233 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29///// Character member definitions
30
31Character::Character(ObjectType objectType, long tagid)
32{
33 type = objectType;
34 tagId = tagid;
35 name = NULL;
36}
37
38Character::~Character()
39{
40 delete name;
41}
42
43int
44Character::execute(GraphicDevice *gd, Matrix *matrix, Cxform *cxform)
45{
46 printf("Cannot be executed\n");
47 return 0;
48}
49
50ActionRecord *
51Character::eventHandler(GraphicDevice *gd, FlashEvent *ev)
52{
53 fprintf(stderr,"Unable to handle event !!!\n");
54 return 0;
55}
56
57int
58Character::isButton()
59{
60 return 0;
61}
62
63int
64Character::isSprite(void)
65{
66 return 0;
67}
68
69char *
70Character::getName()
71{
72 return name;
73}
74
75void
76Character::getBoundingBox(Rect *bb, DisplayListEntry *e)
77{
78 //fprintf(stderr,"Unable to handle getBoundingBox !!!\n");
79 bb->xmin = LONG_MAX;
80 bb->ymin = LONG_MAX;
81 bb->ymax = LONG_MIN;
82 bb->ymax = LONG_MIN;
83 return;
84}
85
86void
87Character::getRegion(GraphicDevice *gd, Matrix *matrix,
88 void *id, ScanLineFunc scan_line_func)
89{
90 fprintf(stderr,"Unable to handle getRegion !!!\n");
91 return;
92}
93
94long
95Character::getTagId()
96{
97 return tagId;
98}
99
100void
101Character::reset()
102{
103}
104
105ObjectType
106Character::getType()
107{
108 return type;
109}
110
111char *
112Character::getTypeString()
113{
114 switch (type) {
115 case BitmapType:
116 return "Bitmap";
117 case FontType:
118 return "Font";
119 case ButtonType:
120 return "Button";
121 case SpriteType:
122 return "Sprite";
123 case ShapeType:
124 return "Shape";
125 case SoundType:
126 return "Sound";
127 case TextType:
128 return "Text";
129 default:
130 return "Unknown";
131 }
132}
133
134void
135Character::setName(char* string)
136{
137 name = strdup(string);
138}
139
140///// Dict methods definitions
141
142Dict::Dict()
143{
144 head = 0;
145}
146
147Dict::~Dict()
148{
149 struct sCharCell *cell,*del;
150
151 for(cell = head; cell;)
152 {
153 del = cell;
154 cell = cell->next;
155 delete del->elt;
156 delete del;
157 }
158}
159
160void
161Dict::addCharacter(Character *character)
162{
163 struct sCharCell *cell;
164
165 cell = new sCharCell;
166 if (cell == NULL) {
167 delete character;
168 return;
169 }
170 cell->elt = character;
171 cell->next = head;
172
173 head = cell;
174}
175
176Character *
177Dict::getCharacter(long id)
178{
179 struct sCharCell *cell;
180
181 for(cell = head; cell; cell = cell->next)
182 {
183 if (id == cell->elt->getTagId()) return cell->elt;
184 }
185 return 0;
186}
187
188void
189Dict::dictRewind()
190{
191 currentCell = head;
192}
193
194Character *
195Dict::dictNextCharacter()
196{
197 if (currentCell) {
198 struct sCharCell *cell;
199
200 cell = currentCell;
201 currentCell = currentCell->next;
202 return cell->elt;
203 } else {
204 return 0;
205 }
206}
207
208void
209Dict::nameCharacter(long id, char *string)
210{
211 struct sCharCell *cell;
212
213 for(cell = head; cell; cell = cell->next)
214 {
215 if (cell->elt->getTagId() == id) {
216 cell->elt->setName(string);
217 break;
218 }
219 }
220}
221
222#ifdef DUMP
223void
224Dict::dictSetUnsaved()
225{
226 struct sCharCell *cell;
227
228 for(cell = head; cell; cell = cell->next)
229 {
230 cell->elt->saved = 0;
231 }
232}
233#endif
diff --git a/core/multimedia/opieplayer/libflash/character.h b/core/multimedia/opieplayer/libflash/character.h
new file mode 100644
index 0000000..583cb17
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/character.h
@@ -0,0 +1,90 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _CHARACTER_H_
21#define _CHARACTER_H_
22
23enum ObjectType {
24 ShapeType,
25 TextType,
26 FontType,
27 SoundType,
28 BitmapType,
29 SpriteType,
30 ButtonType
31};
32
33class DisplayListEntry;
34
35// Character definition
36
37class Character {
38 long tagId;
39 ObjectType type;
40 char *name;
41
42public:
43 Character(ObjectType type, long tagId);
44 virtual ~Character();
45
46 virtual int execute(GraphicDevice *, Matrix *, Cxform *);// Display, play or whatever
47 virtual int isButton(void);// True if Character is a button
48 virtual int isSprite(void);
49 virtual ActionRecord*eventHandler(GraphicDevice *, FlashEvent *);
50 virtual void getRegion(GraphicDevice *gd, Matrix *matrix, void *id, ScanLineFunc scan_line_func);
51 virtual void reset();// Reset internal state of object
52 virtual void getBoundingBox(Rect *bb, DisplayListEntry *de);
53#ifdef DUMP
54 virtual void dump(BitStream *main);
55
56 int saved;
57#endif
58
59 long getTagId();// Return tagId
60 ObjectType getType();
61 char *getTypeString();
62 char *getName();
63 void setName(char *);
64};
65
66struct sCharCell {
67 Character *elt;
68 struct sCharCell *next;
69};
70
71class Dict {
72 struct sCharCell *head;
73 struct sCharCell *currentCell;// Iteration variable for dictNextCharacter
74
75public:
76 Dict();
77 ~Dict();
78
79 void addCharacter(Character *character);
80 void nameCharacter(long id, char *string);
81 Character*getCharacter(long id);
82 void dictRewind();
83 Character*dictNextCharacter();
84
85#ifdef DUMP
86 void dictSetUnsaved();
87#endif
88};
89
90#endif /* _CHARACTER_H_ */
diff --git a/core/multimedia/opieplayer/libflash/cxform.cc b/core/multimedia/opieplayer/libflash/cxform.cc
new file mode 100644
index 0000000..b448f5d
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/cxform.cc
@@ -0,0 +1,79 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id";
27#endif
28
29long
30Cxform::getRed(long v) {
31 long val;
32
33 val = (long)(ra*v+rb);
34 if (val > 255) val = 255;
35 else if (val < 0) val = 0;
36 return val;
37}
38
39long
40Cxform::getGreen(long v) {
41 long val;
42
43 val = (long)(ga*v+gb);
44 if (val > 255) val = 255;
45 else if (val < 0) val = 0;
46 return val;
47}
48
49long
50Cxform::getBlue(long v) {
51 long val;
52
53 val = (long)(ba*v+bb);
54 if (val > 255) val = 255;
55 else if (val < 0) val = 0;
56 return val;
57}
58
59long
60Cxform::getAlpha(long v) {
61 long val;
62
63 val = (long)(aa*v+ab);
64 if (val > 255) val = 255;
65 else if (val < 0) val = 0;
66 return val;
67}
68
69Color
70Cxform::getColor(Color color) {
71 Color newColor;
72
73 newColor.red = getRed(color.red);
74 newColor.green = getGreen(color.green);
75 newColor.blue = getBlue(color.blue);
76 newColor.alpha = getAlpha(color.alpha);
77
78 return newColor;
79}
diff --git a/core/multimedia/opieplayer/libflash/cxform.h b/core/multimedia/opieplayer/libflash/cxform.h
new file mode 100644
index 0000000..14f7189
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/cxform.h
@@ -0,0 +1,46 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _CXFORM_H_
21#define _CXFORM_H_
22
23struct Color {
24 unsigned char red,green,blue,alpha;
25 long pixel;
26};
27
28struct Cxform
29{
30 float aa; long ab;// a is multiply factor, b is addition factor
31 float ra; long rb;
32 float ga; long gb;
33 float ba; long bb;
34
35 longgetRed(long v);
36 longgetGreen(long v);
37 longgetBlue(long v);
38 longgetAlpha(long v);
39 ColorgetColor(Color color);
40
41#ifdef DUMP
42 void dump(BitStream *bs, int alpha = 0);
43#endif
44};
45
46#endif /* _CXFORM_H_ */
diff --git a/core/multimedia/opieplayer/libflash/displaylist.cc b/core/multimedia/opieplayer/libflash/displaylist.cc
new file mode 100644
index 0000000..d71cfb7
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/displaylist.cc
@@ -0,0 +1,708 @@
1////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29#define PRINT 0
30
31void deleteButton(FlashMovie *movie, DisplayListEntry *e)
32{
33 /* save the focus */
34 if (movie->mouse_active == 0 && e->renderState == stateOver) {
35 movie->lost_over = (Button *)e->character;
36 movie->cur_focus = NULL;
37 }
38
39 if (e == movie->cur_focus) {
40 movie->cur_focus = NULL;
41 }
42}
43
44void addButton(FlashMovie *movie, DisplayListEntry *e)
45{
46 if (movie->mouse_active == 0 &&
47 movie->cur_focus == NULL &&
48 movie->lost_over == (Button *)e->character) {
49 /* restore the lost focus */
50 e->renderState = stateOver;
51 e->oldState = stateOver;
52 ((Button *)e->character)->updateButtonState(e);
53 movie->lost_over = NULL;
54 movie->cur_focus = e;
55 }
56}
57
58DisplayList::DisplayList(FlashMovie *movie)
59{
60 list = NULL;
61 this->movie = movie;
62 bbox.reset();
63 isSprite = 0;
64}
65
66DisplayList::~DisplayList()
67{
68 clearList();
69}
70
71void
72DisplayList::clearList()
73{
74 DisplayListEntry *del, *e;
75
76 for(e = list; e;)
77 {
78 updateBoundingBox(e);
79 if (e->character->isButton()) {
80 deleteButton(movie,e);
81 }
82 del = e;
83 e = e->next;
84 delete del;
85 }
86 list = 0;
87}
88
89DisplayListEntry *
90DisplayList::getList()
91{
92 return list;
93}
94
95static void bbox(Rect *rect, Matrix *m, long x1, long y1)
96{
97 long x,y;
98
99 x = m->getX(x1,y1);
100 y = m->getY(x1,y1);
101 if (x < rect->xmin) rect->xmin = x;
102 if (x > rect->xmax) rect->xmax = x;
103 if (y < rect->ymin) rect->ymin = y;
104 if (y > rect->ymax) rect->ymax = y;
105}
106
107// Update bb to include boundary, optional reset of bb
108void transformBoundingBox(Rect *bb, Matrix *matrix, Rect *boundary, int reset)
109{
110 if (reset) {
111 bb->reset();
112 }
113
114 if (boundary->xmin != LONG_MAX) {
115 bbox(bb, matrix, boundary->xmin, boundary->ymin);
116 bbox(bb, matrix, boundary->xmax, boundary->ymin);
117 bbox(bb, matrix, boundary->xmin, boundary->ymax);
118 bbox(bb, matrix, boundary->xmax, boundary->ymax);
119 }
120}
121
122void
123DisplayList::placeObject(GraphicDevice *gd,Character *character, long depth, Matrix *matrix, Cxform *cxform, char *name)
124{
125 DisplayListEntry *n,*e,*prev;
126
127 n = new DisplayListEntry;
128 if (n == NULL) return;
129
130 n->depth = depth;
131 n->matrix = matrix;
132 n->cxform = cxform;
133 n->character = character;
134 n->instanceName = name;
135 n->owner = this;
136
137#if 0
138 printf("Dl %lx: placeObject: depth=%d character=%d cxform=%p\n",
139 this, n->depth,n->character ? n->character->getTagId() : 0, cxform);
140#endif
141
142 if (character == 0 || matrix == 0 || cxform == 0) {
143 for (e = list; e; prev = e, e = e->next) {
144 if (e->depth == n->depth) {
145 if (character == 0) {
146 n->character = e->character;
147 }
148 if (matrix == 0) {
149 n->matrix = e->matrix;
150 }
151 if (cxform == 0) {
152 n->cxform = e->cxform;
153 }
154 break;
155 }
156 }
157 }
158
159 if (n->character == 0) {
160 // Not found !!! Should not happen
161 // printf("PlaceObject cannot find character at depth %ld\n", n->depth);
162 delete n;
163 return;
164 }
165
166 prev = 0;
167 for (e = list; e; prev = e, e = e->next)
168 {
169 if (e->depth == n->depth) {
170 if (e->character->isButton()) {
171 deleteButton(movie, e);
172 }
173
174 // Do update, object has moved or been resized
175 updateBoundingBox(e);
176
177 // Replace object
178 e->depth = n->depth;
179 e->matrix = n->matrix;
180 e->cxform = n->cxform;
181 e->character = n->character;
182 /* if it is a button, we must update its state */
183 if (e->character->isButton()) {
184 movie->buttons_updated = 1;
185 addButton(movie, e);
186 }
187
188 updateBoundingBox(e);
189
190 delete n;
191 return;
192 }
193 if (e->depth > n->depth) break;
194 }
195 /* new object */
196
197 /* button instantiation */
198 if (n->character->isButton()) {
199 n->renderState = stateUp;
200 n->oldState = stateUp;
201 ((Button *)n->character)->updateButtonState(n);
202 addButton(movie,n);
203 }
204
205 updateBoundingBox(n);
206
207 if (prev == 0) {
208 // Object comes at first place
209 n->next = list;
210 list = n;
211 } else {
212 // Insert object
213 n->next = prev->next;
214 prev->next = n;
215 }
216}
217
218
219Character *
220DisplayList::removeObject(GraphicDevice *gd,Character *character, long depth)
221{
222 DisplayListEntry *e,*prev;
223
224 // List should not be empty
225 if (list == 0) return 0;
226
227#if 0
228 printf("removeObject: depth=%d character=%d\n",
229 depth,character ? character->getTagId() : 0);
230#endif
231
232 prev = 0;
233 for (e = list; e; prev = e, e = e->next) {
234 if (e->depth == depth) {
235 if (prev) {
236 prev->next = e->next;
237 } else {
238 list = e->next;
239 }
240 if (character == 0) {
241 character = e->character;
242 }
243 if (e->character->isButton()) {
244 deleteButton(movie, e);
245 }
246 if (e->character->isSprite()) {
247 ((Sprite*)e->character)->reset();
248 }
249
250 updateBoundingBox(e);
251
252 delete e;
253 return character;
254 }
255 }
256 return 0;// Should not happen
257}
258
259void
260DisplayList::updateBoundingBox(DisplayListEntry *e)
261{
262 Rect rect;
263
264 //rect.reset();
265 e->character->getBoundingBox(&rect,e);
266 transformBoundingBox(&this->bbox, e->matrix, &rect, 0);
267}
268
269int
270DisplayList::updateSprites()
271{
272 Sprite *sprite;
273 DisplayListEntry *e;
274 int refresh = 0;
275
276 for (e = this->list; e != NULL; e = e->next) {
277 if (e->character->isButton() && e->buttonCharacter) {
278 if (e->buttonCharacter->isSprite()) {
279 Matrix mat;
280
281 sprite = (Sprite *)e->buttonCharacter;
282 refresh |= sprite->program->dl->updateSprites();
283 refresh |= sprite->program->nestedMovie(this->movie->gd,this->movie->sm, e->matrix, e->cxform);
284 mat = (*e->matrix) * e->buttonMatrix;
285 transformBoundingBox(&this->bbox, &mat,
286 &(sprite->program->dl->bbox),
287 0);
288 }
289 }
290 if (e->character->isSprite()) {
291 sprite = (Sprite *)e->character;
292 refresh |= sprite->program->dl->updateSprites();
293 refresh |= sprite->program->nestedMovie(this->movie->gd,this->movie->sm, e->matrix, e->cxform);
294 transformBoundingBox(&this->bbox, e->matrix,
295 &(sprite->program->dl->bbox),
296 0);
297 }
298 }
299 return refresh;
300}
301
302/* Function can return either 0,1 or 2
303 0: Nothing match, continue
304 1: Something matches, but continue searching
305 2: Something matches, but stop searching
306*/
307
308static int exploreButtons1(Program *prg, void *opaque,
309 ExploreButtonFunc func)
310{
311 DisplayListEntry *e;
312 int ret, ret2 = 0;
313
314 for(e=prg->dl->list; e != NULL; e = e->next) {
315 if (e->character == NULL) continue;
316 if (e->character->isButton()) {
317 ret = func(opaque,prg,e);
318 if (ret == 2) return ret;// Func asks to return at once !!!
319 if (ret) ret2 = 1;
320 }
321 if (e->character->isSprite()) {
322 ret = exploreButtons1(((Sprite *)e->character)->program,
323 opaque,func);
324 if (ret == 2) return ret;// Func asks to return at once !!!
325 if (ret) ret2 = 1;
326 }
327 }
328 return ret2;
329}
330
331int exploreButtons(FlashMovie *movie, void *opaque, ExploreButtonFunc func)
332{
333 CInputScript *script;
334 int ret;
335
336 script = movie->main;
337 while (script != NULL) {
338 if (script->program) {
339 ret = exploreButtons1(script->program, opaque, func);
340 if (ret) return ret;
341 }
342 script = script->next;
343 }
344 return 0;
345}
346
347typedef struct {
348 long x,y;
349 int hit;
350 DisplayListEntry *bhit;
351} HitTable;
352
353static void button_hit_func(void *id, long y, long start, long end)
354{
355 HitTable *h = (HitTable *) id;
356 if ( y == h->y && (h->x >= start && h->x < end) )
357 h->hit = 1;
358}
359
360typedef struct {
361 FlashMovie *movie;
362 DisplayListEntry *bhit;
363} ButtonHit;
364
365static int button_hit(void *opaque, Program *prg, DisplayListEntry *e)
366{
367 ButtonHit *h = (ButtonHit *) opaque;
368 HitTable hit_table;
369 FlashMovie *movie = h->movie;
370 Rect bb,boundary;
371 Matrix mat;
372 ButtonState save;
373
374 hit_table.x = movie->mouse_x;
375 hit_table.y = movie->mouse_y / FRAC;
376 hit_table.hit = 0;
377
378 // Compute the bounding box in screen coordinates
379 save = e->renderState;
380 e->renderState = stateHitTest;
381 e->character->getBoundingBox(&boundary,e);
382 e->renderState = save;
383 mat = (*movie->gd->adjust) * e->renderMatrix;
384 transformBoundingBox(&bb, &mat, &boundary, 1);
385 // Check if mouse is within bb
386 if (movie->mouse_x < bb.xmin) return 0;
387 if (movie->mouse_x > bb.xmax) return 0;
388 if (movie->mouse_y < bb.ymin) return 0;
389 if (movie->mouse_y > bb.ymax) return 0;
390
391 e->character->getRegion(movie->gd, &e->renderMatrix,
392 &hit_table, button_hit_func);
393
394 if (hit_table.hit) {
395 h->bhit = e;
396 return 1;
397 } else {
398 return 0;
399 }
400}
401
402static int button_reset(void *opaque, Program *prg, DisplayListEntry *e)
403{
404 if (e->renderState != stateUp) {
405 e->owner->updateBoundingBox(e);
406 e->oldState = e->renderState;
407 e->renderState = stateUp;
408 ((Button *)e->character)->updateButtonState(e);
409 e->owner->updateBoundingBox(e);
410 }
411 return 0;
412}
413
414/* update the button states according to the current mouse state & return the list of actions */
415void
416DisplayList::updateButtons(FlashMovie *movie)
417{
418 DisplayListEntry *bhit;
419 ButtonHit h;
420
421 if (movie->mouse_active) {
422
423 h.bhit = NULL;
424 h.movie = movie;
425
426 exploreButtons(movie, &h, button_hit);
427
428 bhit = h.bhit;
429
430 /* set every button to not hit */
431 exploreButtons(movie, NULL, button_reset);
432
433 if (bhit) {
434 ButtonState state;
435
436 if (movie->button_pressed) {
437 state = stateDown;
438 } else {
439 state = stateOver;
440 }
441 if (state != bhit->renderState) {
442 bhit->owner->updateBoundingBox(bhit);
443 bhit->renderState = state;
444 ((Button *)bhit->character)->updateButtonState(bhit);
445 bhit->owner->updateBoundingBox(bhit);
446 movie->cur_focus = bhit;
447 if (movie->cursorOnOff)
448 movie->cursorOnOff(1,movie->cursorOnOffClientData);
449 }
450 } else {
451 if (movie->cursorOnOff)
452 movie->cursorOnOff(0,movie->cursorOnOffClientData);
453 }
454 }
455}
456
457typedef struct {
458 ActionRecord *action;// Action to do
459 Program *prg; // Context program
460} ButtonAction;
461
462static int button_action(void *opaque, Program *prg, DisplayListEntry *e)
463{
464 ButtonAction *h = (ButtonAction *)opaque;
465 static ActionRecord actionRefresh;
466 static ActionRecord soundFx;
467 Button *b;
468 ActionRecord **paction;
469 int n;
470
471 actionRefresh.action = ActionRefresh;
472 actionRefresh.next = 0;
473
474 soundFx.action = ActionPlaySound;
475 soundFx.next = &actionRefresh;
476
477 b = (Button *)e->character;
478
479 if (e->oldState != e->renderState) {
480
481 paction = &actionRefresh.next;
482
483 if (b->conditionList) {
484 *paction = b->getActionFromTransition(e->renderState, e->oldState);
485 } else if (e->renderState == stateDown) {
486 /* if the button is pressed and
487 no condition list is defined*/
488 *paction = b->actionRecords;
489 }
490
491 switch(e->renderState) {
492 case stateUp:
493 n = 0;
494 break;
495 case stateOver:
496 n = 1;
497 break;
498 default:
499 /* case stateDown: */
500 n = 2;
501 break;
502 }
503
504 if (b->sound[n]) {
505 soundFx.sound = b->sound[n];
506 h->action = &soundFx;
507 } else {
508 h->action = &actionRefresh;
509 }
510
511 e->oldState = e->renderState;
512
513 h->prg = prg;
514 return 2;
515 }
516 h->action = 0;// Nothing to do about this
517 return 0;
518}
519
520int computeActions(FlashMovie *movie, Program **prg, ActionRecord **ar)
521{
522 ButtonAction h;
523
524 h.action = NULL;
525 exploreButtons(movie, &h, button_action);
526 if (h.action) {
527 *prg = h.prg;
528 *ar = h.action;
529 return 1;
530 }
531 return 0;
532}
533
534#define FOCUS_ZOOM 1.5
535/* in pixels */
536#define FOCUS_SIZE_MIN 50
537#define FOCUS_TRANSLATE 15
538
539int
540DisplayList::render(GraphicDevice *gd, Matrix *render_matrix, Cxform *cxform)
541{
542 DisplayListEntry *e,*cur_focus;
543 int sprite = 0;
544 long n = 0;
545 Cxform cxf,*cxf1;
546 Rect bb,boundary;
547
548 cur_focus = NULL;
549
550 /*
551 if (isSprite == 0) {
552 if (this->bbox.xmin == LONG_MAX) return 0;
553 gd->updateClippingRegion(&this->bbox, render_matrix);
554 gd->clearCanvas();
555 }
556 */
557
558 for (e = list; e; e = e->next)
559 {
560#if PRINT
561 printf("Character %3d @ %3d\n", e->character ? e->character->getTagId() : 0, e->depth);
562#endif
563 if (e->character) {
564 Matrix mat;
565
566 if (render_matrix) {
567 mat = *render_matrix;
568 }
569
570 if (e->matrix) {
571 mat = mat * (*e->matrix);
572 }
573
574 /* fast clipping */
575 // If object boundaries are outside current clip region give up with rendering
576 e->character->getBoundingBox(&boundary,e);
577 if (boundary.xmin != LONG_MAX) {
578 Matrix tmat;
579
580 tmat = (*gd->adjust) * mat;
581 transformBoundingBox(&bb, &tmat, &boundary, 1);
582
583 bb.xmin = bb.xmin >> FRAC_BITS;
584 bb.ymin = bb.ymin >> FRAC_BITS;
585 bb.xmax = (bb.xmax + FRAC - 1) >> FRAC_BITS;
586 bb.ymax = (bb.ymax + FRAC - 1) >> FRAC_BITS;
587
588 if (bb.xmin >= gd->clip_rect.xmax ||
589 bb.xmax <= gd->clip_rect.xmin ||
590 bb.ymin >= gd->clip_rect.ymax ||
591 bb.ymax <= gd->clip_rect.ymin) {
592 continue;
593 }
594 }
595
596 if (cxform == NULL) {
597 cxf1 = e->cxform;
598 }
599 else if (e->cxform == NULL) {
600 cxf1 = cxform;
601 }
602 else {
603 cxf1 = &cxf;
604 cxf.ra = cxform->ra * e->cxform->ra;
605 cxf.ga = cxform->ga * e->cxform->ga;
606 cxf.ba = cxform->ba * e->cxform->ba;
607 cxf.aa = cxform->aa * e->cxform->aa;
608
609 cxf.rb = (long)(cxform->ra * e->cxform->rb + cxform->rb);
610 cxf.gb = (long)(cxform->ga * e->cxform->gb + cxform->gb);
611 cxf.bb = (long)(cxform->ba * e->cxform->bb + cxform->bb);
612 cxf.ab = (long)(cxform->aa * e->cxform->ab + cxform->ab);
613 }
614
615 if (e->character->isButton()) {
616 Button *b = (Button *) e->character;
617
618 e->renderMatrix = mat;
619
620 if (e->renderState != stateUp && movie->mouse_active == 0) {
621 cur_focus = e;
622 ((Button *)e->character)->updateButtonState(e);
623 }
624
625 if (b->execute(gd, &mat, cxf1, e->renderState)) {
626 sprite = 1;
627 }
628 } else {
629 if (e->character->execute(gd, &mat, cxf1)) {
630 sprite = 1;
631 }
632 }
633
634 n++;
635 }
636 }
637
638#if 0
639 {
640 /* display the bounding box (debug) */
641 Matrix tmat;
642 long x1,x2,y1,y2;
643 Color white;
644
645 white.red = 255;
646 white.green = white.blue = 0;
647 gd->setForegroundColor(white);
648
649 if (render_matrix) {
650 tmat = (*gd->adjust) * (*render_matrix);
651 } else {
652 tmat = *gd->adjust;
653 }
654 x1 = bbox.xmin;
655 y1 = bbox.ymin;
656 x2 = bbox.xmax;
657 y2 = bbox.ymax;
658 gd->drawLine(tmat.getX(x1,y1),tmat.getY(x1,y1),tmat.getX(x2,y1),tmat.getY(x2,y1),10*FRAC);
659 gd->drawLine(tmat.getX(x2,y1),tmat.getY(x2,y1),tmat.getX(x2,y2),tmat.getY(x2,y2),10*FRAC);
660 gd->drawLine(tmat.getX(x2,y2),tmat.getY(x2,y2),tmat.getX(x1,y2),tmat.getY(x1,y2),10*FRAC);
661 gd->drawLine(tmat.getX(x1,y2),tmat.getY(x1,y2),tmat.getX(x1,y1),tmat.getY(x1,y1),10*FRAC);
662 bbox.print();
663 }
664#endif
665
666 // Reset clipping zone
667 bbox.reset();
668
669 return sprite;
670}
671
672void
673DisplayList::getBoundary(Rect *bb)
674{
675 DisplayListEntry *e;
676 Rect boundary;
677
678 bb->reset();
679 for (e = list; e; e = e->next)
680 {
681 if (e->character) {
682 e->character->getBoundingBox(&boundary,e);
683 transformBoundingBox(bb, e->matrix, &boundary, 0);
684 }
685 }
686}
687
688extern "C" {
689
690void dump_buttons(FlashHandle flashHandle)
691{
692#if 0
693 Rect rect;
694 DisplayListEntry *e;
695 FlashMovie *movie;
696
697 movie = (FlashMovie *)flashHandle;
698
699 for (e = movie->first_button; e; e = e->next_button) {
700 computeBBox(movie,&rect,e);
701 printf("button: id=%d pos=%d %d %d %d\n",
702 e->character->getTagId(),
703 rect.xmin, rect.ymin, rect.xmax, rect.ymax);
704 }
705#endif
706}
707
708}
diff --git a/core/multimedia/opieplayer/libflash/displaylist.h b/core/multimedia/opieplayer/libflash/displaylist.h
new file mode 100644
index 0000000..536f628
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/displaylist.h
@@ -0,0 +1,80 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _DISPLAYLIST_H_
21#define _DISPLAYLIST_H_
22
23class Character;
24class Program;
25
26struct DisplayList;
27
28// Display List management
29struct DisplayListEntry {
30 Character *character;
31 long depth;
32 Matrix *matrix;
33 Cxform *cxform;
34 char *instanceName;
35
36 /* button state */
37 ButtonState renderState;
38 ButtonState oldState;
39 Character *buttonCharacter;
40 Matrix buttonMatrix;
41 Matrix renderMatrix; /* last render matrix */
42
43 DisplayListEntry*next;
44
45 DisplayList *owner;// Parent
46};
47
48struct DisplayList {
49 DisplayListEntry*list;
50 FlashMovie *movie;
51 Rect bbox; // Delta clipping region
52 int isSprite;
53public:
54 DisplayList(FlashMovie *movie);
55 ~DisplayList();
56 DisplayListEntry*getList();
57 void clearList();
58 void placeObject(GraphicDevice *gd,Character *character, long depth, Matrix *matrix = 0, Cxform *cxform = 0, char *name = 0);
59 Character *removeObject(GraphicDevice *gd, Character *character, long depth);
60
61 int render(GraphicDevice *gd, Matrix *m = 0, Cxform *cxform = 0);
62 void updateBoundingBox(DisplayListEntry *);
63 void updateButtons (FlashMovie *);
64 void getBoundary(Rect *bb);// Returns boundary of current displayed objects
65 int updateSprites();// Update sprites in the display list
66};
67
68typedef void (*DisplayListFunc)(DisplayListEntry *e, void *opaque);
69
70 void updateButtons(FlashMovie *m);
71 int computeActions(FlashMovie *m, Program **prog, ActionRecord **ar);
72 void renderFocus(FlashMovie *movie);
73
74typedef int (*ExploreButtonFunc)(void *opaque, Program *prg, DisplayListEntry *e);
75 int exploreButtons(FlashMovie *movie, void *opaque, ExploreButtonFunc func);
76 void updateBoundingBox(DisplayListEntry *e);
77 void transformBoundingBox(Rect *bb, Matrix *matrix, Rect *boundary, int reset);
78 void updateButtonState(DisplayListEntry *e, ButtonState state);
79
80#endif /* _DISPLAYLIST_H_ */
diff --git a/core/multimedia/opieplayer/libflash/flash.cc b/core/multimedia/opieplayer/libflash/flash.cc
new file mode 100644
index 0000000..75d351c
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/flash.cc
@@ -0,0 +1,275 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24#include "graphic16.h"
25#include "graphic24.h"
26#include "graphic32.h"
27
28#ifdef RCSID
29static char *rcsid = "$Id$";
30#endif
31
32// Interface with standard C
33extern "C" {
34
35FlashHandle
36FlashNew()
37{
38 FlashMovie *fh;
39
40 fh = new FlashMovie;
41
42 fh->main = new CInputScript;
43
44 return (FlashHandle)fh;
45}
46
47int
48FlashParse(FlashHandle flashHandle, int level, char *data, long size)
49{
50 FlashMovie *fh;
51 CInputScript *script;
52 int status = FLASH_PARSE_ERROR;
53
54 fh = (FlashMovie *)flashHandle;
55
56 for(script = fh->main; script != NULL; script = script->next) {
57 if (script->level == level) {
58 status = script->ParseData(fh, data, size);
59
60 if (status & FLASH_PARSE_START) {
61 fh->msPerFrame = 1000/fh->main->frameRate;
62 script->program->rewindMovie();
63 }
64 break;
65 }
66 }
67
68 return status;
69}
70
71void
72FlashGetInfo(FlashHandle flashHandle, struct FlashInfo *fi)
73{
74 FlashMovie *fh;
75
76 fh = (FlashMovie *)flashHandle;
77
78 fi->version = fh->main->m_fileVersion;
79 fi->frameRate = fh->main->frameRate;
80 fi->frameCount = fh->main->frameCount;
81 fi->frameWidth = fh->main->frameRect.xmax - fh->main->frameRect.xmin;
82 fi->frameHeight = fh->main->frameRect.ymax - fh->main->frameRect.ymin;
83}
84
85long FlashGraphicInit(FlashHandle flashHandle, FlashDisplay *fd)
86{
87 FlashMovie *fh;
88
89 fh = (FlashMovie *)flashHandle;
90
91 switch (fd->bpp) {
92 case 4:
93 fh->gd = new GraphicDevice32(fd);
94 break;
95 case 3:
96 fh->gd = new GraphicDevice24(fd);
97 break;
98 case 2:
99 fh->gd = new GraphicDevice16(fd);
100 break;
101 default:
102 fprintf(stderr, "Unsupported depth\n");
103 }
104
105 fh->gd->setMovieDimension(fh->main->frameRect.xmax - fh->main->frameRect.xmin,
106 fh->main->frameRect.ymax - fh->main->frameRect.ymin);
107
108 return 1;// Ok
109}
110
111void
112FlashSoundInit(FlashHandle flashHandle, char *device)
113{
114 FlashMovie *fh;
115
116 fh = (FlashMovie *)flashHandle;
117
118 fh->sm = new SoundMixer(device);
119}
120
121void
122FlashZoom(FlashHandle flashHandle, int zoom)
123{
124 FlashMovie *fh;
125
126 fh = (FlashMovie *)flashHandle;
127
128 fh->gd->setMovieZoom(zoom);
129}
130
131void
132FlashOffset(FlashHandle flashHandle, int x, int y)
133{
134 FlashMovie *fh;
135
136 fh = (FlashMovie *)flashHandle;
137
138 fh->gd->setMovieOffset(x,y);
139}
140
141long
142FlashExec(FlashHandle flashHandle, long flag,
143 FlashEvent *fe, struct timeval *wakeDate)
144{
145 FlashMovie *fh;
146 long wakeUp = 0;
147
148 fh = (FlashMovie *)flashHandle;
149
150 if (fh->main == NULL) return 0; // Not ready
151 if (fh->main->program == NULL) return 0; // Not ready
152 if (fh->main->program->nbFrames == 0) return 0; // Still not ready
153 if (fh->gd == 0) return 0;
154
155 switch (flag & FLASH_CMD_MASK) {
156 case FLASH_STOP:
157 fh->main->program->pauseMovie();
158 wakeUp = 0;
159 break;
160 case FLASH_CONT:
161 fh->main->program->continueMovie();
162 wakeUp = FLASH_STATUS_WAKEUP;
163 break;
164 case FLASH_REWIND:
165 fh->main->program->rewindMovie();
166 wakeUp = 0;
167 break;
168 case FLASH_STEP:
169 fh->main->program->nextStepMovie();
170 wakeUp = 0;
171 break;
172 }
173
174 if (flag & FLASH_WAKEUP) {
175 // Compute next wakeup time
176 gettimeofday(wakeDate,0);
177 wakeDate->tv_usec += fh->msPerFrame*1000;
178 if (wakeDate->tv_usec > 1000000) {
179 wakeDate->tv_usec -= 1000000;
180 wakeDate->tv_sec++;
181 }
182
183 // Play frame
184 wakeUp = fh->processMovie(fh->gd, fh->sm);
185 }
186
187 if (checkFlashTimer(&fh->scheduledTime)) {
188 if (fh->handleEvent(fh->gd, fh->sm, &fh->scheduledEvent)) {
189 wakeUp = 1;
190 }
191
192 setFlashTimer(&fh->scheduledTime, -1);
193 }
194
195 if (flag & FLASH_EVENT) {
196 wakeUp = fh->handleEvent(fh->gd, fh->sm, fe);
197 if (wakeUp) {
198 /* Wake up at once, except for mouse move (40 ms after) */
199 gettimeofday(wakeDate,0);
200 if (fe->type == FeMouseMove) {
201 wakeDate->tv_usec += 40*1000;
202 if (wakeDate->tv_usec > 1000000) {
203 wakeDate->tv_usec -= 1000000;
204 wakeDate->tv_sec++;
205 }
206 }
207 }
208 }
209
210 return wakeUp || (fh->scheduledTime.tv_sec != -1);
211}
212
213void FlashSetGetSwfMethod(FlashHandle flashHandle, void (*getSwf)(char *url, int level, void *clientData), void *clientData)
214{
215 FlashMovie *fh;
216
217 fh = (FlashMovie *)flashHandle;
218
219 fh->getSwf = getSwf;
220 fh->getSwfClientData = clientData;
221}
222
223
224void
225FlashSetCursorOnOffMethod(FlashHandle flashHandle, void (*cursorOnOff)(int , void *), void *clientData)
226{
227 FlashMovie *fh;
228
229 fh = (FlashMovie *)flashHandle;
230
231 fh->cursorOnOff = cursorOnOff;
232 fh->cursorOnOffClientData = clientData;
233}
234
235void
236FlashSetGetUrlMethod(FlashHandle flashHandle, void (*getUrl)(char *, char *, void *), void *clientData)
237{
238 FlashMovie *fh;
239
240 fh = (FlashMovie *)flashHandle;
241
242 fh->getUrl = getUrl;
243 fh->getUrlClientData = clientData;
244}
245
246void
247FlashClose(FlashHandle flashHandle)
248{
249 FlashMovie *fh;
250
251 fh = (FlashMovie *)flashHandle;
252
253 delete fh;
254}
255
256void
257FlashSettings(FlashHandle flashHandle, long settings)
258{
259 FlashMovie *fh;
260
261 fh = (FlashMovie *)flashHandle;
262
263 fh->main->program->modifySettings( settings );
264}
265
266int shape_size,shape_nb,shaperecord_size,shaperecord_nb,style_size,style_nb;
267
268void flash_dump(void)
269{
270 printf("flash: shape_size=%d (nb=%d)\n",shape_size,shape_nb);
271 printf("flash: shaperecord_size=%d (nb=%d)\n",shaperecord_size,shaperecord_nb);
272 printf("flash: style_size=%d (nb=%d)\n",style_size,style_nb);
273}
274
275}; /* end of extern C */
diff --git a/core/multimedia/opieplayer/libflash/flash.h b/core/multimedia/opieplayer/libflash/flash.h
new file mode 100644
index 0000000..9330713
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/flash.h
@@ -0,0 +1,129 @@
1/*///////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////// */
20#ifndef _FLASH_H_
21#define _FLASH_H_
22
23#define PLUGIN_NAME "Shockwave Flash"
24#define FLASH_VERSION_STRING "Version 0.4.10"
25
26/* Flags to pass to FlashExec */
27#define FLASH_WAKEUP 0x01
28#define FLASH_EVENT 0x02
29#define FLASH_CMD 0x04
30
31/* Mask to extract commands */
32#define FLASH_CMD_MASK 0xf0
33/* Commands */
34 #define FLASH_STOP 0x10/* Pause the movie */
35 #define FLASH_CONT 0x20/* Continue the movie after pause */
36 #define FLASH_REWIND 0x30/* Rewind the movie and pause */
37 #define FLASH_STEP 0x40/* Frame by frame operation */
38
39/* return codes of FlashExec */
40#define FLASH_STATUS_WAKEUP 0x01 /* FlashExec must be called again after a given time */
41
42struct FlashInfo {
43 long frameRate;
44 long frameCount;
45 long frameWidth;
46 long frameHeight;
47 long version;
48};
49
50/* Player settings */
51 #define PLAYER_LOOP(1<<0)
52 #define PLAYER_QUALITY(1<<1)
53 #define PLAYER_MENU(1<<2)
54
55/* Parser status */
56#define FLASH_PARSE_ERROR 0
57#define FLASH_PARSE_START 1
58#define FLASH_PARSE_NEED_DATA 2
59#define FLASH_PARSE_EOM 4
60#define FLASH_PARSE_WAKEUP 8
61#define FLASH_PARSE_OOM 16 /* Out Of Memory */
62
63typedef void *FlashHandle;
64
65#if defined(__cplusplus) || defined(c_plusplus)
66extern "C" {
67#endif
68
69enum FlashEventType {
70 FeNone,
71 FeMouseMove,
72 FeButtonPress,
73 FeButtonRelease,
74 FeRefresh,
75 FeKeyPress,
76 /* internal events */
77 FeKeyRelease,
78};
79
80enum FlashKey {
81 FeKeyUp = 1,
82 FeKeyDown,
83 FeKeyLeft,
84 FeKeyRight,
85 FeKeyEnter,
86 FeKeyNext
87};
88
89
90
91typedef struct FlashEvent {
92 enum FlashEventType type;
93 int x,y; /* Mouse coordinates,
94 relative to upper-left window corner */
95 enum FlashKey key;
96} FlashEvent;
97
98typedef struct FlashDisplay {
99 void *pixels;
100 int bpl; /* bytes per line */
101 int width;
102 int height;
103 int depth;
104 int bpp;
105 int flash_refresh;
106 /* Clipping region */
107 int clip_x, clip_y;
108 int clip_width, clip_height;
109} FlashDisplay;
110
111extern FlashHandle FlashNew();
112extern void FlashGetInfo(FlashHandle fh, struct FlashInfo *fi);
113extern long FlashGraphicInit(FlashHandle fh, FlashDisplay *fd);
114extern void FlashSoundInit(FlashHandle fh, char *device);
115extern int FlashParse(FlashHandle fh, int level, char *data, long size);
116extern long FlashExec(FlashHandle fh, long flag, FlashEvent *fe, struct timeval *wakeDate);
117extern void FlashClose(FlashHandle fh);
118extern void FlashSetGetUrlMethod(FlashHandle flashHandle, void (*getUrl)(char *, char *, void *), void *);
119extern void FlashSetGetSwfMethod(FlashHandle flashHandle, void (*getSwf)(char *url, int level, void *clientData), void *clientData);
120extern void FlashSetCursorOnOffMethod(FlashHandle flashHandle, void (*cursorOnOff)(int , void *), void *clientData);
121extern void FlashZoom(FlashHandle fh, int zoom);
122extern void FlashOffset(FlashHandle fh, int x, int y);
123extern void FlashSettings(FlashHandle fh, long settings);
124
125#if defined(__cplusplus) || defined(c_plusplus)
126};
127#endif
128
129#endif /* _FLASH_H_ */
diff --git a/core/multimedia/opieplayer/libflash/font.cc b/core/multimedia/opieplayer/libflash/font.cc
new file mode 100644
index 0000000..d937276
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/font.cc
@@ -0,0 +1,105 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29SwfFont::SwfFont(long id) : Character(FontType, id)
30{
31 glyphs = 0;
32 nbGlyphs = 0;
33 name = NULL;
34 setFontName("Unknown");
35 flags = (FontFlags)0;
36 lookUpTable = 0;
37}
38
39SwfFont::~SwfFont()
40{
41 if (lookUpTable) {
42 delete lookUpTable;
43 }
44 delete name;
45 delete [] glyphs;
46}
47
48void
49SwfFont::setFontFlags(FontFlags f)
50{
51 flags = f;
52}
53
54char *
55SwfFont::getName()
56{
57 return name;
58}
59
60FontFlags
61SwfFont::getFlags()
62{
63 return flags;
64}
65
66long
67SwfFont::getNbGlyphs()
68{
69 return nbGlyphs;
70}
71
72Shape *
73SwfFont::getGlyph(long index)
74{
75 if (index >= nbGlyphs) return 0;
76 return &glyphs[index];
77}
78
79long
80SwfFont::getGlyphCode(long index)
81{
82 if (lookUpTable == 0 || index >= nbGlyphs) return 0;
83 return lookUpTable[index];
84}
85
86void
87SwfFont::setFontName(char *str)
88{
89 delete name;
90 name = new char[strlen(str)+1];
91 strcpy(name,str);
92}
93
94void
95SwfFont::setFontLookUpTable(long *lut)
96{
97 lookUpTable = lut;
98}
99
100void
101SwfFont::setFontShapeTable(Shape *shapes, long n)
102{
103 glyphs = shapes;
104 nbGlyphs = n;
105}
diff --git a/core/multimedia/opieplayer/libflash/font.h b/core/multimedia/opieplayer/libflash/font.h
new file mode 100644
index 0000000..bc151ca
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/font.h
@@ -0,0 +1,56 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _SWFFONT_H_
21#define _SWFFONT_H_
22
23class SwfFont : public Character {
24 Shape *glyphs;// Array
25 long nbGlyphs;
26 char *name;
27 FontFlags flags;
28 long *lookUpTable;// Array
29
30 // Font2
31 long ascent;
32 long descent;
33 long leading;
34
35public:
36 SwfFont(long id);
37 ~SwfFont();
38
39 void setFontShapeTable(Shape *shapes, long n);
40 void setFontName(char *str);
41 void setFontLookUpTable(long *lut);
42 void setFontFlags(FontFlags f);
43 long getGlyphCode(long index);
44 long getNbGlyphs();
45 Shape *getGlyph(long index);
46
47 char *getName();
48 FontFlags getFlags();
49
50#ifdef DUMP
51 void dump(BitStream *bs);
52 void dumpFontInfo(BitStream *bs);
53#endif
54};
55
56#endif /* _SWFFONT_H_ */
diff --git a/core/multimedia/opieplayer/libflash/graphic.cc b/core/multimedia/opieplayer/libflash/graphic.cc
new file mode 100644
index 0000000..f65011e
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/graphic.cc
@@ -0,0 +1,632 @@
1////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29#define PRINT 0
30
31// Public
32
33GraphicDevice::GraphicDevice(FlashDisplay *fd)
34{
35 flashDisplay = fd;
36
37 bgInitialized = 0;
38
39 // Reset flash refresh flag
40 flashDisplay->flash_refresh = 0;
41
42 /* 16 bits, RGB565 */
43 redMask = 0xF800;
44 greenMask = 0x07E0;
45 blueMask = 0x001F;
46
47 /* should be the actual window size */
48 targetWidth = fd->width;
49 targetHeight = fd->height;
50 bpl = fd->bpl;
51
52#if PRINT
53 printf("Target Width = %d\n", targetWidth);
54 printf("Target Height = %d\n", targetHeight);
55#endif
56
57 zoom = FRAC;
58 movieWidth = targetWidth;
59 movieHeight = targetHeight;
60
61 viewPort.xmin = 0;
62 viewPort.xmax = targetWidth-1;
63 viewPort.ymin = 0;
64 viewPort.ymax = targetHeight-1;
65
66 canvasBuffer = (unsigned char *) fd->pixels;
67
68 adjust = new Matrix;
69 foregroundColor.red = 0;
70 foregroundColor.green = 0;
71 foregroundColor.blue = 0;
72 foregroundColor.alpha = ALPHA_OPAQUE;
73
74 backgroundColor.red = 0;
75 backgroundColor.green = 0;
76 backgroundColor.blue = 0;
77 backgroundColor.alpha = ALPHA_OPAQUE;
78
79 showMore = 0;
80
81 setClipping(0);// Reset
82 setClipping(1);
83
84 /* polygon rasterizer : handle memory errors ! */
85
86 height = targetHeight;
87 segs = (Segment **)malloc(height * sizeof(Segment *));
88 memset(segs, 0, height * sizeof(Segment *));
89 ymin = height;
90 ymax = -1;
91
92 seg_pool = (Segment *)malloc(NB_SEGMENT_MAX * sizeof(Segment));
93 seg_pool_cur = seg_pool;
94}
95
96GraphicDevice::~GraphicDevice()
97{
98 free(segs);
99 free(seg_pool);
100
101 if (adjust) {
102 delete adjust;
103 }
104}
105
106Color *
107GraphicDevice::getColormap(Color *old, long n, Cxform *cxform)
108{
109 Color *newCmp;
110
111 newCmp = new Color[n];
112 if (newCmp == NULL) return NULL;
113
114 if (cxform) {
115 for(long i = 0; i < n; i++)
116 {
117 newCmp[i] = cxform->getColor(old[i]);
118 newCmp[i].pixel = allocColor(newCmp[i]);
119 }
120 } else {
121 for(long i = 0; i < n; i++)
122 {
123 newCmp[i] = old[i];
124 newCmp[i].pixel = allocColor(old[i]);
125 }
126 }
127
128 return newCmp;
129}
130
131long
132GraphicDevice::getHeight()
133{
134 return targetHeight;
135}
136
137long
138GraphicDevice::getWidth()
139{
140 return targetWidth;
141}
142
143Color
144GraphicDevice::getForegroundColor()
145{
146 return foregroundColor;
147}
148
149void
150GraphicDevice::setForegroundColor(Color color)
151{
152 foregroundColor = color;
153}
154
155Color
156GraphicDevice::getBackgroundColor()
157{
158 return backgroundColor;
159}
160
161int
162GraphicDevice::setBackgroundColor(Color color)
163{
164 if (bgInitialized == 0) {
165 backgroundColor = color;
166 clearCanvas();
167 bgInitialized = 1;
168 return 1;
169 }
170 return 0;
171}
172
173void
174GraphicDevice::setMovieDimension(long width, long height)
175{
176 float xAdjust, yAdjust;
177
178 movieWidth = width;
179 movieHeight = height;
180
181 xAdjust = (float)targetWidth*zoom/(float)width;
182 yAdjust = (float)targetHeight*zoom/(float)height;
183
184 if (xAdjust < yAdjust) {
185 adjust->a = xAdjust;
186 adjust->d = xAdjust;
187 adjust->ty = ((targetHeight*zoom) - (long)(height * xAdjust))/2;
188 viewPort.ymin = adjust->ty/zoom;
189 viewPort.ymax = targetHeight-viewPort.ymin-1;
190 } else {
191 adjust->a = yAdjust;
192 adjust->d = yAdjust;
193 adjust->tx = ((targetWidth*zoom) - (long)(width * yAdjust))/2;
194 viewPort.xmin = adjust->tx/zoom;
195 viewPort.xmax = targetWidth-viewPort.xmin-1;
196 }
197
198 if (viewPort.xmin < 0) viewPort.xmin = 0;
199 if (viewPort.ymin < 0) viewPort.ymin = 0;
200 if (viewPort.xmax >= targetWidth) viewPort.xmax = targetWidth-1;
201 if (viewPort.ymax >= targetHeight) viewPort.ymax = targetHeight-1;
202}
203
204void
205GraphicDevice::setMovieZoom(int z)
206{
207 z *= FRAC;
208 if (z <= 0 || z > 100) return;
209 zoom = z;
210 setMovieDimension(movieWidth,movieHeight);
211}
212
213void
214GraphicDevice::setMovieOffset(long x, long y)
215{
216 adjust->tx = -zoom*x;
217 adjust->ty = -zoom*y;
218}
219
220long
221GraphicDevice::clip(long &y, long &start, long &end)
222{
223 long xmin,xend;
224
225 if (y < clip_rect.ymin ||
226 y >= clip_rect.ymax) return 1;
227 if (end <= start)
228 return 1;
229 xmin = clip_rect.xmin * FRAC;
230 xend = clip_rect.xmax * FRAC;
231
232 if (end <= xmin || start >= xend) return 1;
233
234 if (start < xmin) start = xmin;
235 if (end > xend) end = xend;
236
237 return 0;
238}
239
240void
241GraphicDevice::drawBox(long x1, long y1, long x2, long y2)
242{
243 int i;
244
245 for(i=0;i<FRAC*2;i++) {
246 drawLine(x1+i, y1+i, x2-i, y1+i, 0);
247 drawLine(x1+i, y2-i, x2-i, y2-i, 0);
248
249 drawLine(x1+i, y1+i+1, x1+i, y2-i-1, 0);
250 drawLine(x2-i, y1+i+1, x2-i, y2-i-1, 0);
251 }
252}
253
254/* polygon rasteriser */
255
256inline Segment *
257GraphicDevice::allocSeg()
258{
259 Segment *seg;
260
261 if ( (seg_pool_cur - seg_pool) >= NB_SEGMENT_MAX )
262 return NULL;
263 seg = seg_pool_cur++;
264
265 return seg;
266}
267
268/* add a segment to the current path */
269void
270GraphicDevice::addSegment(long x1, long y1, long x2, long y2,
271 FillStyleDef *f0,
272 FillStyleDef *f1,
273 int aa)
274{
275 Segment *seg,**segs;
276 long dX, X, Y, ymin, ymax, tmp;
277 FillStyleDef *ff;
278
279 if ( y1 == y2 ) {
280 return;
281 }
282
283 if (y1 < y2) {
284 ymin = y1;
285 ymax = y2;
286 ff = f0;
287 f0 = f1;
288 f1 = ff;
289 } else {
290 ymin = y2;
291 ymax = y1;
292 tmp = x1;
293 x1 = x2;
294 x2 = tmp;
295 }
296
297 if (ymax>>FRAC_BITS < clip_rect.ymin) {
298 return;
299 }
300 if (ymin>>FRAC_BITS > clip_rect.ymax) {
301 return;
302 }
303
304 X = x1 << SEGFRAC;
305 dX = ((x2 - x1)<<SEGFRAC)/(ymax-ymin);
306
307 if (ymin < 0) {
308 X += dX * (-ymin);
309 ymin = 0;
310 }
311
312 Y = (ymin + (FRAC-1)) & ~(FRAC-1);
313 if (Y > ymax) {
314 //printf("Elimine @ y = %d ymin = %d, ymax = %d\n", Y, ymin, seg->ymax);
315 return;
316 }
317 X += dX * (Y-ymin);
318
319 Y >>= FRAC_BITS;
320 if (Y >= clip_rect.ymax) {
321 return;
322 }
323
324 seg = allocSeg();
325 if (seg == NULL) {
326 return;
327 }
328
329 seg->next = 0;
330 seg->nextValid = 0;
331 seg->aa = aa;
332 seg->ymax = ymax;
333 seg->x1 = x1;
334 seg->x2 = x2;
335 seg->X = X;
336 seg->dX = dX;
337 seg->fs[0] = f0;
338 seg->fs[1] = f1;
339
340 if (Y < this->ymin) this->ymin = Y;
341 ymax = (seg->ymax + FRAC - 1) >> FRAC_BITS;
342 if (ymax >= this->height) ymax = this->height-1;
343 if (ymax > this->ymax) this->ymax = ymax;
344
345 segs = this->segs;
346
347 if (segs[Y] == 0) {
348 segs[Y] = seg;
349 } else {
350 Segment *s,*prev;
351
352 prev = 0;
353 for(s = segs[Y]; s; prev = s, s = s->next) {
354 if (s->X > seg->X) {
355 if (prev) {
356 prev->next = seg;
357 seg->next = s;
358 } else {
359 seg->next = segs[Y];
360 segs[Y] = seg;
361 }
362 break;
363 }
364 }
365 if (s == 0) {
366 prev->next = seg;
367 seg->next = s;
368 }
369 }
370}
371
372inline Segment *
373GraphicDevice::progressSegments(Segment * curSegs, long y)
374{
375 Segment *seg,*prev;
376
377 // Update current segments
378 seg = curSegs;
379 prev = 0;
380 while(seg)
381 {
382 if ((y*FRAC) > seg->ymax) {
383 // Remove this segment, no more valid
384 if (prev) {
385 prev->nextValid = seg->nextValid;
386 } else {
387 curSegs = seg->nextValid;
388 }
389 seg = seg->nextValid;
390 } else {
391 seg->X += seg->dX * FRAC;
392 prev = seg;
393 seg = seg->nextValid;
394 }
395 }
396 return curSegs;
397}
398
399inline Segment *
400GraphicDevice::newSegments(Segment *curSegs, Segment *newSegs)
401{
402 Segment *s,*seg,*prev;
403
404 s = curSegs;
405 prev = 0;
406
407 // Check for new segments
408 for (seg = newSegs; seg; seg=seg->next)
409 {
410 // Place it at the correct position according to X
411 if (curSegs == 0) {
412 curSegs = seg;
413 seg->nextValid = 0;
414 } else {
415 for(; s; prev = s, s = s->nextValid)
416 {
417 if ( s->X > seg->X ||
418 ( (s->X == seg->X) &&
419 ( (seg->x1 == s->x1 && seg->dX < s->dX) ||
420 (seg->x2 == s->x2 && seg->dX > s->dX)
421 ))) {
422 // Insert before s
423 if (prev) {
424 seg->nextValid = s;
425 prev->nextValid = seg;
426 } else {
427 seg->nextValid = curSegs;
428 curSegs = seg;
429 }
430 break;
431 }
432 }
433 // Append at the end
434 if (s == 0) {
435 prev->nextValid = seg;
436 seg->nextValid = 0;
437 }
438 }
439
440 s = seg;
441 }
442
443 return curSegs;
444}
445
446#if 0
447static void
448printSeg(Segment *seg)
449{
450 /*
451 printf("Seg %08x : X = %5d, Ft = %d, Cl = %2x/%2x/%2x, Cr = %2x/%2x/%2x, x1=%5d, x2=%5d, ymin=%5d, ymax=%5d\n", seg,
452 seg->X>>SEGFRAC,
453 seg->right ? seg->right->type: -1,
454 seg->left ? seg->left->color.red : -1,
455 seg->left ? seg->left->color.green : -1,
456 seg->left ? seg->left->color.blue : -1,
457 seg->right ? seg->right->color.red : -1,
458 seg->right ? seg->right->color.green : -1,
459 seg->right ? seg->right->color.blue : -1,
460 seg->x1, seg->x2, seg->ymin, seg->ymax);
461 */
462}
463#endif
464
465inline void
466GraphicDevice::renderScanLine(long y, Segment *curSegs)
467{
468 Segment *seg;
469 long width;
470 int fi = 1;
471 FillStyleDef *f;
472
473 width = targetWidth * FRAC;
474
475 if (curSegs && curSegs->fs[0] && curSegs->fs[1] == 0) {
476 fi = 0;
477 }
478 for(seg = curSegs; seg && seg->nextValid; seg = seg->nextValid)
479 {
480 if (seg->nextValid->X <0) continue;
481 if ((seg->X>>SEGFRAC) > width) break;
482 f = seg->fs[fi];
483 if (f) {
484 switch (f->type) {
485 case f_Solid:
486 if (seg->aa) {
487 fillLineAA(f, y, seg->X>>SEGFRAC, seg->nextValid->X>>SEGFRAC);
488 } else {
489 fillLine(f, y, seg->X>>SEGFRAC, seg->nextValid->X>>SEGFRAC);
490 }
491 break;
492 case f_TiledBitmap:
493 case f_clippedBitmap:
494 fillLineBitmap(f, y, seg->X>>SEGFRAC, seg->nextValid->X>>SEGFRAC);
495 break;
496 case f_LinearGradient:
497 fillLineLG(&f->gradient, y, seg->X>>SEGFRAC, seg->nextValid->X>>SEGFRAC);
498 break;
499 case f_RadialGradient:
500 fillLineRG(&f->gradient, y, seg->X>>SEGFRAC, seg->nextValid->X>>SEGFRAC);
501 break;
502 case f_None:
503 break;
504 }
505 }
506 }
507}
508
509/* draw the current path */
510void
511GraphicDevice::drawPolygon(void)
512{
513 long y;
514 Segment *curSegs,*seg;
515
516 // no segments ?
517 if (this->ymax == -1)
518 return;
519
520 // Foreach scanline
521 curSegs = 0;
522 for(y=this->ymin; y <= this->ymax; y++) {
523
524 // Make X values progess and remove unuseful segments
525 curSegs = progressSegments(curSegs, y);
526
527 // Add the new segment starting at the y position.
528 curSegs = newSegments(curSegs, this->segs[y]);
529
530 // Render the scanline
531 if (this->scan_line_func == NULL) {
532 renderScanLine(y, curSegs);
533 } else {
534 for(seg = curSegs; seg && seg->nextValid; seg = seg->nextValid) {
535 if (seg->nextValid->X >= seg->X) {
536 scan_line_func(this->scan_line_func_id, y, seg->X>>SEGFRAC, seg->nextValid->X>>SEGFRAC);
537 }
538 }
539 }
540 }
541
542 /* free the segments */
543 memset(this->segs + this->ymin, 0,
544 (this->ymax - this->ymin + 1) * sizeof(Segment *));
545
546 this->ymax = -1;
547 this->ymin = this->height;
548
549 this->seg_pool_cur = this->seg_pool;
550}
551
552void
553GraphicDevice::updateClippingRegion(Rect *rect)
554{
555 if (!clipping) return;
556
557 transformBoundingBox(&clip_rect, adjust, rect, 1);
558 clip_rect.xmin >>= FRAC_BITS;
559 clip_rect.xmax >>= FRAC_BITS;
560 clip_rect.ymin >>= FRAC_BITS;
561 clip_rect.ymax >>= FRAC_BITS;
562
563 clip_rect.xmin-=2;
564 clip_rect.ymin-=2;
565 clip_rect.xmax+=2;
566 clip_rect.ymax+=2;
567
568 if (clip_rect.xmin < viewPort.xmin) clip_rect.xmin = viewPort.xmin;
569 if (clip_rect.xmax < viewPort.xmin) clip_rect.xmax = viewPort.xmin;
570 if (clip_rect.ymin < viewPort.ymin) clip_rect.ymin = viewPort.ymin;
571 if (clip_rect.ymax < viewPort.ymin) clip_rect.ymax = viewPort.ymin;
572
573 if (clip_rect.xmax > viewPort.xmax) clip_rect.xmax = viewPort.xmax;
574 if (clip_rect.ymax > viewPort.ymax) clip_rect.ymax = viewPort.ymax;
575 if (clip_rect.xmin > viewPort.xmax) clip_rect.xmin = viewPort.xmax;
576 if (clip_rect.ymin > viewPort.ymax) clip_rect.ymin = viewPort.ymax;
577}
578
579void
580GraphicDevice::setClipping(int value)
581{
582 clipping = value;
583 if (clipping == 0) {
584 // Reset region
585 clip_rect.xmin = viewPort.xmin;
586 clip_rect.xmax = viewPort.xmax;
587 clip_rect.ymin = viewPort.ymin;
588 clip_rect.ymax = viewPort.ymax;
589 }
590}
591
592// Virtual
593void
594GraphicDevice::clearCanvas()
595{
596}
597
598long
599GraphicDevice::allocColor(Color color)
600{
601 return 0;
602}
603
604void
605GraphicDevice::fillLineBitmap(FillStyleDef *f, long y, long start, long end)
606{
607}
608
609void
610GraphicDevice::fillLineLG(Gradient *grad, long y, long start, long end)
611{
612}
613
614void
615GraphicDevice::fillLineRG(Gradient *grad, long y, long start, long end)
616{
617}
618
619void
620GraphicDevice::fillLine(FillStyleDef *f, long y, long start, long end)
621{
622}
623
624void
625GraphicDevice::fillLineAA(FillStyleDef *f, long y, long start, long end)
626{
627}
628
629void
630GraphicDevice::drawLine(long x1, long y1, long x2, long y2, long width)
631{
632}
diff --git a/core/multimedia/opieplayer/libflash/graphic.h b/core/multimedia/opieplayer/libflash/graphic.h
new file mode 100644
index 0000000..63ebd99
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/graphic.h
@@ -0,0 +1,174 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _GRAPHIC_H_
21#define _GRAPHIC_H_
22
23#define ALPHA_OPAQUE 255
24
25enum FillType {
26 f_Solid = 0x00,
27 f_LinearGradient = 0x10,
28 f_RadialGradient = 0x12,
29 f_TiledBitmap = 0x40,
30 f_clippedBitmap = 0x41,
31 f_None = 0x80
32};
33
34struct Gradient {
35 int nbGradients;
36 unsigned char ratio[8];
37 Color color[8];
38 // For rendering
39 Color *ramp;
40 Matrix imat;
41 int has_alpha;
42};
43
44
45struct FillStyleDef {
46 FillType type;// See enum FillType
47
48 // Solid
49 Color color;
50
51 // Gradient
52 Gradient gradient;
53
54 // Bitmap
55 Bitmap *bitmap;
56 Matrix bitmap_matrix;
57 Color *cmap;
58 unsigned char *alpha_table;
59
60 // Gradient or Bitmap
61 Matrix matrix;
62
63 FillStyleDef() {
64 style_size += sizeof(FillStyleDef);
65 style_nb++;
66 }
67};
68
69struct Segment {
70 long x1,x2;
71 long ymax;
72 FillStyleDef *fs[2];// 0 is left 1 is right
73 int aa;
74 long dX;
75 long X;
76
77 struct Segment *next;
78 struct Segment *nextValid;
79};
80
81/* fractional bits (we don't use twips here... too expensive) */
82#define FRAC_BITS 5
83#define FRAC (1 << FRAC_BITS)
84#define NB_SEGMENT_MAX (2048*4)
85 #define SEGFRAC 8
86
87class GraphicDevice {
88 int targetWidth;
89 int targetHeight;
90 Rect viewPort;
91 int movieWidth;
92 int movieHeight;
93 int zoom;
94 unsigned long redMask;
95 unsigned long greenMask;
96 unsigned long blueMask;
97 int clipping;
98
99public:
100 FlashDisplay *flashDisplay;
101 int bgInitialized;
102 Color backgroundColor;
103 Color foregroundColor;
104
105public:
106 void *scan_line_func_id;
107 ScanLineFunc scan_line_func;
108 Rect clip_rect;
109
110private:
111 Segment **segs;
112 int ymin,ymax;
113 int height;
114 Segment *seg_pool;
115 Segment *seg_pool_cur;
116
117 Segment * allocSeg();
118 Segment * progressSegments(Segment * curSegs, long y);
119 Segment * newSegments(Segment *curSegs, Segment *newSegs);
120 void renderScanLine(long y, Segment *curSegs);
121
122protected:
123 long clip(long &y, long &start, long &end);
124
125public:
126 Matrix *adjust;// Matrix to fit window (shrink or expand)
127
128 long showMore;// Used for debugging
129
130 // For Direct Graphics
131 unsigned char *canvasBuffer;// A pointer to canvas'memory
132 long bpl;// Bytes per line
133 long bpp;// Bytes per pixel
134 long pad;// Scanline pad in byte
135
136 GraphicDevice(FlashDisplay *fd);
137 virtual ~GraphicDevice();
138
139 int setBackgroundColor(Color);
140 void setForegroundColor(Color);
141 Color getBackgroundColor();
142 Color getForegroundColor();
143 void setMovieDimension(long width, long height);
144 void setMovieZoom(int zoom);
145 void setMovieOffset(long x, long y);
146 long getWidth();
147 long getHeight();
148 Color *getColormap(Color *old, long n, Cxform *cxform);
149
150 void drawBox(long x1, long y1, long x2, long y2);
151
152 void addSegment(long x1, long y1, long x2, long y2,
153 FillStyleDef *f0,
154 FillStyleDef *f1,
155 int aa);
156
157 void drawPolygon(void);
158
159 void updateClippingRegion(Rect *);
160 void setClipping(int);
161
162 // Virtual functions
163 virtual void clearCanvas();
164 virtual long allocColor(Color color);
165 virtual void fillLineBitmap(FillStyleDef *f, long y, long start, long end);
166 virtual void fillLineLG(Gradient *grad, long y, long start, long end);
167 virtual void fillLineRG(Gradient *grad, long y, long start, long end);
168 virtual void fillLine(FillStyleDef *f, long y, long start, long end);
169 virtual void fillLineAA(FillStyleDef *f, long y, long start, long end);
170 virtual void drawLine(long x1, long y1, long x2, long y2, long width);
171
172};
173
174#endif /* _GRAPHIC_H_ */
diff --git a/core/multimedia/opieplayer/libflash/graphic16.cc b/core/multimedia/opieplayer/libflash/graphic16.cc
new file mode 100644
index 0000000..24d0c20
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/graphic16.cc
@@ -0,0 +1,658 @@
1////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#include "graphic16.h"
26
27extern unsigned char SQRT[];
28
29#define FULL_AA
30
31#define PRINT 0
32
33typedef unsigned short TYPE;
34
35GraphicDevice16::GraphicDevice16(FlashDisplay *fd) : GraphicDevice(fd)
36{
37}
38
39long
40GraphicDevice16::allocColor(Color color)
41{
42 return (color.red >> 3)<<11 | (color.green>>2)<<5 | (color.blue>>3);
43}
44
45void
46GraphicDevice16::clearCanvas()
47{
48 TYPE pixel;
49 TYPE *point,*p;
50 long h, w,n;
51
52 if (!bgInitialized) return;
53
54 pixel = allocColor(backgroundColor);
55
56 point = (TYPE *)(canvasBuffer + clip_rect.ymin * bpl) + clip_rect.xmin;
57 w = clip_rect.xmax - clip_rect.xmin;
58 h = clip_rect.ymax - clip_rect.ymin;
59
60 while (h--) {
61 p = point;
62 n = w;
63 while (n--) {
64 *p++ = pixel;
65 }
66
67 point = (TYPE *)((char *)point + bpl);
68 }
69
70 flashDisplay->flash_refresh = 1;
71 flashDisplay->clip_x = clip_rect.xmin;
72 flashDisplay->clip_y = clip_rect.ymin;
73 flashDisplay->clip_width = clip_rect.xmax-clip_rect.xmin;
74 flashDisplay->clip_height = clip_rect.ymax-clip_rect.ymin;
75}
76
77#define RED_MASK 0xF800
78#define GREEN_MASK 0x07E0
79#define BLUE_MASK 0x001F
80
81/* alpha = 0 : select c1, alpha = 255 select c2 */
82static inline unsigned long
83mix_alpha(unsigned long c1,
84 unsigned long c2, int alpha)
85{
86 long r1,r2,r;
87 long g1,g2,g;
88 long b1,b2,b;
89
90 r1 = c1 & RED_MASK;
91 r2 = c2 & RED_MASK;
92 r = (((r2-r1)*alpha + r1 * 256) >> 8) & RED_MASK;
93
94 g1 = c1 & GREEN_MASK;
95 g2 = c2 & GREEN_MASK;
96 g = (((g2-g1)*alpha + g1 * 256) >> 8) & GREEN_MASK;
97
98 b1 = c1 & BLUE_MASK;
99 b2 = c2 & BLUE_MASK;
100 b = (((b2-b1)*alpha + b1 * 256) >> 8) & BLUE_MASK;
101
102 return (r|g|b);
103}
104
105void
106GraphicDevice16::fillLineAA(FillStyleDef *f, long y, long start, long end)
107{
108 register long n;
109 TYPE *line;
110 TYPE *point,pixel;
111 unsigned int alpha, start_alpha,end_alpha;
112
113 if (clip(y,start,end)) return;
114
115 line = (TYPE *)(canvasBuffer + bpl*y);
116
117 alpha = f->color.alpha;
118 pixel = f->color.pixel;
119
120 if (alpha == ALPHA_OPAQUE) {
121
122 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
123 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
124
125 start >>= FRAC_BITS;
126 end >>= FRAC_BITS;
127
128 point = &line[start];
129
130 if (start == end) {
131 *point = mix_alpha(*point, pixel, start_alpha + end_alpha - 255);
132 } else {
133 n = end-start;
134 if (start_alpha < 255) {
135 *point = mix_alpha(*point, pixel, start_alpha);
136 point++;
137 n--;
138 }
139 while (n > 0) {
140 *point = pixel;
141 point++;
142 n--;
143 }
144 if (end_alpha > 0) {
145 *point = mix_alpha(*point, pixel, end_alpha);
146 }
147 }
148 } else {
149
150 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
151 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
152
153 start >>= FRAC_BITS;
154 end >>= FRAC_BITS;
155
156 point = &line[start];
157
158 if (start == end) {
159 *point = mix_alpha(*point, pixel,
160 ((start_alpha + end_alpha - 255) * alpha) >> 8);
161 } else {
162 n = end-start;
163 if (start_alpha < 255) {
164 *point = mix_alpha(*point, pixel, (start_alpha * alpha) >> 8);
165 point++;
166 n--;
167 }
168 while (n > 0) {
169 *point = mix_alpha(*point, pixel, alpha);
170 point++;
171 n--;
172 }
173 if (end_alpha > 0) {
174 *point = mix_alpha(*point, pixel, (end_alpha * alpha) >> 8);
175 }
176 }
177 }
178}
179
180void
181GraphicDevice16::fillLine(FillStyleDef *f, long y, long start, long end)
182{
183 register long n;
184 TYPE *line,*point;
185 TYPE pixel;
186 unsigned int alpha;
187
188 if (clip(y,start,end)) return;
189
190 start >>= FRAC_BITS;
191 end >>= FRAC_BITS;
192
193 line = (TYPE *)(canvasBuffer + bpl*y);
194 point = &line[start];
195 n = end-start;
196 pixel = f->color.pixel;
197 alpha = f->color.alpha;
198 if (alpha == ALPHA_OPAQUE) {
199 while (n--) {
200 *point = pixel;
201 point++;
202 }
203 } else {
204 while (n--) {
205 *point = mix_alpha(*point, pixel, alpha);
206 point++;
207 }
208 }
209}
210
211void
212GraphicDevice16::fillLineBitmap(FillStyleDef *f, long y, long start, long end)
213{
214 int n;
215 long x1,y1,dx,dy;
216 Matrix *m = &f->bitmap_matrix;
217 Bitmap *b = f->bitmap;
218 unsigned char *pixels;
219 TYPE *p;
220 Color *cmap;
221 long pixbpl;
222 TYPE pixel;
223 int offset;
224 unsigned char *alpha_table;
225
226 /* safety test) */
227 if (!b) return;
228
229 if (clip(y,start,end)) return;
230
231 start /= FRAC;
232 end /= FRAC;
233 n = end - start;
234 p = (TYPE *) (this->canvasBuffer + this->bpl*y + start * 2);
235
236 /* the coordinates in the image are normalized to 16 bits */
237 x1 = (long) (m->a * start + m->b * y + m->tx);
238 y1 = (long) (m->c * start + m->d * y + m->ty);
239 dx = (long) (m->a);
240 dy = (long) (m->c);
241
242 pixels = b->pixels;
243 pixbpl = b->bpl;
244 cmap = f->cmap;
245
246 if (b->alpha_buf == NULL) {
247 while (n) {
248 if (x1 >= 0 && y1 >= 0 &&
249 (x1 >> 16) < b->width && (y1 >> 16) < b->height) {
250
251 pixel = cmap[pixels[(y1 >> 16) * pixbpl + (x1 >> 16)]].pixel;
252 *p = pixel;
253 }
254 x1 += dx;
255 y1 += dy;
256 p++;
257 n--;
258 }
259 } else if (f->alpha_table) {
260 alpha_table = f->alpha_table;
261 while (n) {
262 if (x1 >= 0 && y1 >= 0 &&
263 (x1 >> 16) < b->width && (y1 >> 16) < b->height) {
264
265 offset = (y1 >> 16) * pixbpl + (x1 >> 16);
266 pixel = cmap[pixels[offset]].pixel;
267 *p = mix_alpha(*p, pixel, alpha_table[b->alpha_buf[offset]]);
268 }
269 x1 += dx;
270 y1 += dy;
271 p++;
272 n--;
273 }
274 } else {
275 while (n) {
276 if (x1 >= 0 && y1 >= 0 &&
277 (x1 >> 16) < b->width && (y1 >> 16) < b->height) {
278
279 offset = (y1 >> 16) * pixbpl + (x1 >> 16);
280 pixel = cmap[pixels[offset]].pixel;
281 *p = mix_alpha(*p, pixel, b->alpha_buf[offset]);
282 }
283 x1 += dx;
284 y1 += dy;
285 p++;
286 n--;
287 }
288 }
289}
290
291void
292GraphicDevice16::fillLineLG(Gradient *grad, long y, long start, long end)
293{
294 long dr,r,v,r2;
295 register long n;
296 TYPE *line;
297 TYPE *point;
298 Color *cp,*ramp;
299 Matrix *m = &grad->imat;
300 unsigned int start_alpha,end_alpha;
301
302 if (clip(y,start,end)) return;
303
304 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
305 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
306
307 start /= FRAC;
308 end /= FRAC;
309
310 n = end-start;
311
312 r = (long) (m->a * start + m->b * y + m->tx);
313 dr = (long) (m->a);
314
315 ramp = grad->ramp;
316
317 line = (TYPE *)(canvasBuffer + bpl*y);
318 point = &line[start];
319
320 r2 = r + n * dr;
321 if ( ((r | r2) & ~255) == 0 ) {
322 if (!grad->has_alpha) {
323#ifdef FULL_AA
324 if (start_alpha < 255) {
325 v = r>>16;
326 *point = mix_alpha(*point, (TYPE)ramp[v].pixel, start_alpha);
327 point++;
328 r += dr;
329 n--;
330 }
331#endif /* FULL_AA */
332 while (n>0) {
333 v = r>>16;
334 *point = (TYPE)ramp[v].pixel;
335 point++;
336 r += dr;
337 n--;
338 }
339#ifdef FULL_AA
340 if (end_alpha > 0) {
341 v = r>>16;
342 *point = mix_alpha(*point, (TYPE)ramp[v].pixel, end_alpha);
343 }
344#endif /* FULL_AA */
345 } else {
346 while (n--) {
347 v = r>>16;
348 cp = &ramp[v];
349 *point = mix_alpha(*point, cp->pixel, cp->alpha);
350 point++;
351 r += dr;
352 }
353 }
354 } else {
355 if (!grad->has_alpha) {
356#ifdef FULL_AA
357 if (start_alpha < 255) {
358 v = r>>16;
359 if (v < 0) v = 0;
360 else if (v > 255) v = 255;
361 *point = mix_alpha(*point, (TYPE)ramp[v].pixel, start_alpha);
362 point++;
363 r += dr;
364 n--;
365 }
366#endif /* FULL_AA */
367 while (n>0) {
368 v = r>>16;
369 if (v < 0) v = 0;
370 else if (v > 255) v = 255;
371 *point = (TYPE)ramp[v].pixel;
372 point++;
373 r += dr;
374 n--;
375 }
376#ifdef FULL_AA
377 if (end_alpha > 0) {
378 v = r>>16;
379 if (v < 0) v = 0;
380 else if (v > 255) v = 255;
381 *point = mix_alpha(*point, (TYPE)ramp[v].pixel, end_alpha);
382 }
383#endif /* FULL_AA */
384 } else {
385 while (n--) {
386 v = r>>16;
387 if (v < 0) v = 0;
388 else if (v > 255) v = 255;
389 cp = &ramp[v];
390 *point = mix_alpha(*point, cp->pixel, cp->alpha);
391 point++;
392 r += dr;
393 }
394 }
395 }
396}
397
398void
399GraphicDevice16::fillLineRG(Gradient *grad, long y, long start, long end)
400{
401 long X,dx,r,Y,dy;
402 long dist2;
403 register long n;
404 Color *cp,*ramp;
405 TYPE *line;
406 TYPE *point;
407 Matrix *m = &grad->imat;
408 unsigned int start_alpha,end_alpha;
409
410 if (clip(y,start,end)) return;
411
412 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
413 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
414
415 start /= FRAC;
416 end /= FRAC;
417
418 n = end-start;
419
420 X = (long) (m->a * start + m->b * y + m->tx);
421 Y = (long) (m->c * start + m->d * y + m->ty);
422 dx = (long) (m->a);
423 dy = (long) (m->c);
424
425 ramp = grad->ramp;
426
427 line = (TYPE *)(canvasBuffer + bpl*y);
428 point = &line[start];
429
430 if (!grad->has_alpha) {
431#ifdef FULL_AA
432 if (start == end) {
433 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
434 if ((unsigned long)dist2 >= 65536) {
435 r = 255;
436 } else {
437 r = SQRT[dist2];
438 }
439 *point = mix_alpha(*point, (TYPE)ramp[r].pixel, start_alpha + end_alpha - 255);
440 } else {
441 if (start_alpha < 255) {
442 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
443 if ((unsigned long)dist2 >= 65536) {
444 r = 255;
445 } else {
446 r = SQRT[dist2];
447 }
448 *point = mix_alpha(*point, (TYPE)ramp[r].pixel, start_alpha);
449 point++;
450 X += dx;
451 Y += dy;
452 n--;
453 }
454#endif /* FULL_AA */
455 while (n>0) {
456 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
457 if ((unsigned long)dist2 >= 65536) {
458 r = 255;
459 } else {
460 r= SQRT[dist2];
461 }
462 *point = (TYPE)ramp[r].pixel;
463 point++;
464 X += dx;
465 Y += dy;
466 n--;
467 }
468#ifdef FULL_AA
469 if (end_alpha > 0) {
470 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
471 if ((unsigned long)dist2 >= 65536) {
472 r = 255;
473 } else {
474 r= SQRT[dist2];
475 }
476 *point = mix_alpha(*point, (TYPE)ramp[r].pixel, end_alpha);
477 }
478 }
479#endif /* FULL_AA */
480
481 } else {
482 while (n--) {
483 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
484 if ((unsigned long)dist2 >= 65536) {
485 r = 255;
486 } else {
487 r= SQRT[dist2];
488 }
489 cp = &ramp[r];
490 *point = mix_alpha(*point, cp->pixel, cp->alpha);
491 point++;
492 X += dx;
493 Y += dy;
494 }
495 }
496}
497
498void
499GraphicDevice16::drawLine(long x1, long y1, long x2, long y2, long width)
500{
501 int n,adr,dx,dy,sx,color;
502 register int a;
503 register TYPE *pp;
504 int alpha;
505
506 x1 = (x1) >> FRAC_BITS;
507 y1 = (y1) >> FRAC_BITS;
508 x2 = (x2) >> FRAC_BITS;
509 y2 = (y2) >> FRAC_BITS;
510
511 if (y1 > y2 || (y1 == y2 && x1 > x2)) {
512 long tmp;
513
514 tmp=x1;
515 x1=x2;
516 x2=tmp;
517
518 tmp=y1;
519 y1=y2;
520 y2=tmp;
521 }
522
523 if (y1 == y2 && (y1 < clip_rect.ymin || y1 > clip_rect.ymax)) return;
524 if (x1 == x2 && (x1 < clip_rect.xmin || x1 > clip_rect.xmax)) return;
525 if (x1 == x2 && y1 == y2) return;// Bad !!!
526
527 if (y1 < clip_rect.ymin && y1 != y2) {
528 x1 += (x2-x1)*(clip_rect.ymin-y1)/(y2-y1);
529 y1 = clip_rect.ymin;
530 }
531
532 if (y2 > clip_rect.ymax && y1 != y2) {
533 x2 -= (x2-x1)*(y2-clip_rect.ymax)/(y2-y1);
534 y2 = clip_rect.ymax;
535 }
536
537 if (x1 < x2) {
538 if (x1 < clip_rect.xmin && x1 != x2) {
539 y1 += (y2-y1)*(clip_rect.xmin-x1)/(x2-x1);
540 x1 = clip_rect.xmin;
541 }
542
543 if (x2 > clip_rect.xmax && x1 != x2) {
544 y2 -= (y2-y1)*(x2-clip_rect.xmax)/(x2-x1);
545 x2 = clip_rect.xmax;
546 }
547 }
548
549 if (x1 > x2) {
550 if (x2 < clip_rect.xmin && x2 != x1) {
551 y2 -= (y2-y1)*(clip_rect.xmin-x2)/(x1-x2);
552 x2 = clip_rect.xmin;
553 }
554
555 if (x1 > clip_rect.xmax && x2 != x1) {
556 y1 += (y2-y1)*(x1-clip_rect.xmax)/(x1-x2);
557 x1 = clip_rect.xmax;
558 }
559 }
560
561 // Check again
562 if (x1 == x2 && y1 == y2) return;
563 if (x1 < clip_rect.xmin || x2 < clip_rect.xmin) return;
564 if (y1 < clip_rect.ymin || y2 < clip_rect.ymin) return;
565 if (x1 > clip_rect.xmax || x2 > clip_rect.xmax) return;
566 if (y1 > clip_rect.ymax || y2 > clip_rect.ymax) return;
567
568 sx=bpl >> 1;
569 adr=(y1 * sx + x1);
570 pp = (TYPE *)canvasBuffer + adr;
571
572 dx = x2 - x1;
573 dy = y2 - y1;
574
575 color = allocColor(foregroundColor);
576 alpha = foregroundColor.alpha;
577
578 if (alpha == ALPHA_OPAQUE) {
579
580 #define PUTPIXEL() \
581 { \
582 *pp=color; \
583 }
584
585#define DRAWLINE(dx,dy,inc_1,inc_2) \
586 n=dx;\
587 a=2*dy-dx;\
588 dy=2*dy;\
589 dx=2*dx-dy;\
590 do {\
591 PUTPIXEL();\
592 if (a>0) { pp+=(inc_1); a-=dx; }\
593 else { pp+=(inc_2); a+=dy; }\
594 } while (--n >= 0);
595
596/* fin macro */
597
598 if (dx == 0 && dy == 0) {
599 PUTPIXEL();
600 } else if (dx > 0) {
601 if (dx >= dy) {
602 DRAWLINE(dx, dy, sx + 1, 1);
603 } else {
604 DRAWLINE(dy, dx, sx + 1, sx);
605 }
606 } else {
607 dx = -dx;
608 if (dx >= dy) {
609 DRAWLINE(dx, dy, sx - 1, -1);
610 } else {
611 DRAWLINE(dy, dx, sx - 1, sx);
612 }
613 }
614
615
616#undef DRAWLINE
617#undef PUTPIXEL
618 } else {
619 #define PUTPIXEL() \
620 { \
621 *pp=mix_alpha(*pp,color,alpha); \
622 }
623
624#define DRAWLINE(dx,dy,inc_1,inc_2) \
625 n=dx;\
626 a=2*dy-dx;\
627 dy=2*dy;\
628 dx=2*dx-dy;\
629 do {\
630 PUTPIXEL();\
631 if (a>0) { pp+=(inc_1); a-=dx; }\
632 else { pp+=(inc_2); a+=dy; }\
633 } while (--n >= 0);
634
635/* fin macro */
636
637 if (dx == 0 && dy == 0) {
638 PUTPIXEL();
639 } else if (dx > 0) {
640 if (dx >= dy) {
641 DRAWLINE(dx, dy, sx + 1, 1);
642 } else {
643 DRAWLINE(dy, dx, sx + 1, sx);
644 }
645 } else {
646 dx = -dx;
647 if (dx >= dy) {
648 DRAWLINE(dx, dy, sx - 1, -1);
649 } else {
650 DRAWLINE(dy, dx, sx - 1, sx);
651 }
652 }
653
654
655#undef DRAWLINE
656#undef PUTPIXEL
657 }
658}
diff --git a/core/multimedia/opieplayer/libflash/graphic16.h b/core/multimedia/opieplayer/libflash/graphic16.h
new file mode 100644
index 0000000..938d856
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/graphic16.h
@@ -0,0 +1,39 @@
1////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25class GraphicDevice16: public GraphicDevice {
26private:
27 long GraphicDevice16::allocColor(Color color);
28
29public:
30 GraphicDevice16(FlashDisplay *fd);
31
32 void clearCanvas();
33 void fillLineAA(FillStyleDef *f, long y, long start, long end);
34 void fillLine(FillStyleDef *f, long y, long start, long end);
35 void fillLineBitmap(FillStyleDef *f, long y, long start, long end);
36 void fillLineLG(Gradient *grad, long y, long start, long end);
37 void fillLineRG(Gradient *grad, long y, long start, long end);
38 void drawLine(long x1, long y1, long x2, long y2, long width);
39};
diff --git a/core/multimedia/opieplayer/libflash/graphic24.cc b/core/multimedia/opieplayer/libflash/graphic24.cc
new file mode 100644
index 0000000..6d15019
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/graphic24.cc
@@ -0,0 +1,648 @@
1////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#include "graphic24.h"
26
27extern unsigned char SQRT[];
28
29#define FULL_AA
30
31#define PRINT 0
32
33typedef unsigned char TYPE;
34#define BPP 3
35
36GraphicDevice24::GraphicDevice24(FlashDisplay *fd) : GraphicDevice(fd)
37{
38}
39
40long
41GraphicDevice24::allocColor(Color color)
42{
43 return 0;
44}
45
46void
47GraphicDevice24::clearCanvas()
48{
49 TYPE *point,*p;
50 long h, w,n;
51
52 if (!bgInitialized) return;
53
54 point = (TYPE *)(canvasBuffer + clip_rect.ymin * bpl) + clip_rect.xmin*BPP;
55 w = clip_rect.xmax - clip_rect.xmin;
56 h = clip_rect.ymax - clip_rect.ymin;
57
58 while (h--) {
59 p = point;
60 n = w;
61 while (n--) {
62 *p++ = backgroundColor.blue;
63 *p++ = backgroundColor.green;
64 *p++ = backgroundColor.red;
65 }
66
67 point = (TYPE *)((char *)point + bpl);
68 }
69
70 flashDisplay->flash_refresh = 1;
71 flashDisplay->clip_x = clip_rect.xmin;
72 flashDisplay->clip_y = clip_rect.ymin;
73 flashDisplay->clip_width = clip_rect.xmax-clip_rect.xmin;
74 flashDisplay->clip_height = clip_rect.ymax-clip_rect.ymin;
75}
76
77/* alpha = 0 : select c1, alpha = 255 select c2 */
78static inline void mix_alpha(TYPE *c1, Color c2, int alpha)
79{
80 *c1 = (((c2.blue- (*c1))*alpha + (*c1) * 256) >> 8);
81 c1++;
82 *c1 = (((c2.green- (*c1))*alpha + (*c1) * 256) >> 8);
83 c1++;
84 *c1 = (((c2.red- (*c1))*alpha + (*c1) * 256) >> 8);
85}
86
87void
88GraphicDevice24::fillLineAA(FillStyleDef *f, long y, long start, long end)
89{
90 register long n;
91 TYPE *line;
92 TYPE *point;
93 Color pixel;
94 unsigned int alpha, start_alpha,end_alpha;
95
96 if (clip(y,start,end)) return;
97
98 line = (TYPE *)(canvasBuffer + bpl*y);
99
100 alpha = f->color.alpha;
101 pixel = f->color;
102
103 if (alpha == ALPHA_OPAQUE) {
104
105 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
106 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
107
108 start >>= FRAC_BITS;
109 end >>= FRAC_BITS;
110
111 point = &line[start*BPP];
112
113 if (start == end) {
114 mix_alpha(point, pixel, start_alpha + end_alpha - 255);
115 } else {
116 n = end-start;
117 if (start_alpha < 255) {
118 mix_alpha(point, pixel, start_alpha);
119 point += BPP;
120 n--;
121 }
122 while (n > 0) {
123 *point++ = pixel.blue;
124 *point++ = pixel.green;
125 *point++ = pixel.red;
126 n--;
127 }
128 if (end_alpha > 0) {
129 mix_alpha(point, pixel, end_alpha);
130 }
131 }
132 } else {
133
134 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
135 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
136
137 start >>= FRAC_BITS;
138 end >>= FRAC_BITS;
139
140 point = &line[start*BPP];
141
142 if (start == end) {
143 mix_alpha(point, pixel, ((start_alpha + end_alpha - 255) * alpha) >> 8);
144 } else {
145 n = end-start;
146 if (start_alpha < 255) {
147 mix_alpha(point, pixel, (start_alpha * alpha) >> 8);
148 point+=BPP;
149 n--;
150 }
151 while (n > 0) {
152 mix_alpha(point, pixel, alpha);
153 point+=BPP;
154 n--;
155 }
156 if (end_alpha > 0) {
157 mix_alpha(point, pixel, (end_alpha * alpha) >> 8);
158 }
159 }
160 }
161}
162
163void
164GraphicDevice24::fillLine(FillStyleDef *f, long y, long start, long end)
165{
166 register long n;
167 TYPE *line,*point;
168 Color pixel;
169 unsigned int alpha;
170
171 if (clip(y,start,end)) return;
172
173 start >>= FRAC_BITS;
174 end >>= FRAC_BITS;
175
176 line = (TYPE *)(canvasBuffer + bpl*y);
177 point = &line[start*BPP];
178 n = end-start;
179 alpha = f->color.alpha;
180 pixel = f->color;
181 if (alpha == ALPHA_OPAQUE) {
182 while (n--) {
183 *point++ = pixel.blue;
184 *point++ = pixel.green;
185 *point++ = pixel.red;
186 }
187 } else {
188 while (n--) {
189 mix_alpha(point, pixel, alpha);
190 point+=BPP;
191 }
192 }
193}
194
195void
196GraphicDevice24::fillLineBitmap(FillStyleDef *f, long y, long start, long end)
197{
198 int n;
199 long x1,y1,dx,dy;
200 Matrix *m = &f->bitmap_matrix;
201 Bitmap *b = f->bitmap;
202 unsigned char *pixels;
203 TYPE *p;
204 Color *cmap;
205 long pixbpl;
206 Color pixel;
207 int offset;
208 unsigned char *alpha_table;
209
210 /* safety test) */
211 if (!b) return;
212
213 if (clip(y,start,end)) return;
214
215 start /= FRAC;
216 end /= FRAC;
217 n = end - start;
218 p = (TYPE *) (canvasBuffer + bpl*y + start*BPP);
219
220 x1 = (long) (m->a * start + m->b * y + m->tx);
221 y1 = (long) (m->c * start + m->d * y + m->ty);
222 dx = (long) (m->a);
223 dy = (long) (m->c);
224
225 pixels = b->pixels;
226 pixbpl = b->bpl;
227 cmap = f->cmap;
228
229 if (b->alpha_buf == NULL) {
230 while (n) {
231 if (x1 >= 0 && y1 >= 0 &&
232 (x1 >> 16) < b->width && (y1 >> 16) < b->height) {
233
234 pixel = cmap[pixels[(y1 >> 16) * pixbpl + (x1 >> 16)]];
235 *p++ = pixel.blue;
236 *p++ = pixel.green;
237 *p++ = pixel.red;
238 } else {
239 p+=BPP;
240 }
241 x1 += dx;
242 y1 += dy;
243 n--;
244 }
245 } else if (f->alpha_table) {
246 alpha_table = f->alpha_table;
247 while (n) {
248 if (x1 >= 0 && y1 >= 0 &&
249 (x1 >> 16) < b->width && (y1 >> 16) < b->height) {
250
251 offset = (y1 >> 16) * pixbpl + (x1 >> 16);
252 mix_alpha(p, cmap[pixels[offset]], alpha_table[b->alpha_buf[offset]]);
253 }
254 p+=BPP;
255 x1 += dx;
256 y1 += dy;
257 n--;
258 }
259 } else {
260 while (n) {
261 if (x1 >= 0 && y1 >= 0 &&
262 (x1 >> 16) < b->width && (y1 >> 16) < b->height) {
263
264 offset = (y1 >> 16) * pixbpl + (x1 >> 16);
265 mix_alpha(p, cmap[pixels[offset]], b->alpha_buf[offset]);
266 }
267 p+=BPP;
268 x1 += dx;
269 y1 += dy;
270 n--;
271 }
272 }
273}
274
275void
276GraphicDevice24::fillLineLG(Gradient *grad, long y, long start, long end)
277{
278 long dr,r,v,r2;
279 register long n;
280 TYPE *line;
281 TYPE *point;
282 Color *cp,*ramp;
283 Matrix *m = &grad->imat;
284 unsigned int start_alpha,end_alpha;
285
286 if (clip(y,start,end)) return;
287
288 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
289 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
290
291 start /= FRAC;
292 end /= FRAC;
293
294 n = end-start;
295
296 r = (long) (m->a * start + m->b * y + m->tx);
297 dr = (long) (m->a);
298
299 ramp = grad->ramp;
300
301 line = (TYPE *)(canvasBuffer + bpl*y);
302 point = &line[start*BPP];
303
304 r2 = r + n * dr;
305 if ( ((r | r2) & ~255) == 0 ) {
306 if (!grad->has_alpha) {
307#ifdef FULL_AA
308 if (start_alpha < 255) {
309 v = r>>16;
310 mix_alpha(point, ramp[v], start_alpha);
311 point+=BPP;
312 r += dr;
313 n--;
314 }
315#endif /* FULL_AA */
316 while (n>0) {
317 v = r>>16;
318 *point++ = ramp[v].blue;
319 *point++ = ramp[v].green;
320 *point++ = ramp[v].red;
321 r += dr;
322 n--;
323 }
324#ifdef FULL_AA
325 if (end_alpha > 0) {
326 v = r>>16;
327 mix_alpha(point, ramp[v], end_alpha);
328 }
329#endif /* FULL_AA */
330 } else {
331 while (n--) {
332 v = r>>16;
333 cp = &ramp[v];
334 mix_alpha(point, *cp, cp->alpha);
335 point+=BPP;
336 r += dr;
337 }
338 }
339 } else {
340 if (!grad->has_alpha) {
341#ifdef FULL_AA
342 if (start_alpha < 255) {
343 v = r>>16;
344 if (v < 0) v = 0;
345 else if (v > 255) v = 255;
346 mix_alpha(point, ramp[v], start_alpha);
347 point+=BPP;
348 r += dr;
349 n--;
350 }
351#endif /* FULL_AA */
352 while (n>0) {
353 v = r>>16;
354 if (v < 0) v = 0;
355 else if (v > 255) v = 255;
356 *point++ = ramp[v].blue;
357 *point++ = ramp[v].green;
358 *point++ = ramp[v].red;
359 r += dr;
360 n--;
361 }
362#ifdef FULL_AA
363 if (end_alpha > 0) {
364 v = r>>16;
365 if (v < 0) v = 0;
366 else if (v > 255) v = 255;
367 mix_alpha(point, ramp[v], end_alpha);
368 }
369#endif /* FULL_AA */
370 } else {
371 while (n--) {
372 v = r>>16;
373 if (v < 0) v = 0;
374 else if (v > 255) v = 255;
375 cp = &ramp[v];
376 mix_alpha(point, *cp, cp->alpha);
377 point+=BPP;
378 r += dr;
379 }
380 }
381 }
382}
383
384void
385GraphicDevice24::fillLineRG(Gradient *grad, long y, long start, long end)
386{
387 long X,dx,r,Y,dy;
388 long dist2;
389 register long n;
390 Color *cp,*ramp;
391 TYPE *line;
392 TYPE *point;
393 Matrix *m = &grad->imat;
394 unsigned int start_alpha,end_alpha;
395
396 if (clip(y,start,end)) return;
397
398 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
399 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
400
401 start /= FRAC;
402 end /= FRAC;
403
404 n = end-start;
405
406 X = (long) (m->a * start + m->b * y + m->tx);
407 Y = (long) (m->c * start + m->d * y + m->ty);
408 dx = (long) (m->a);
409 dy = (long) (m->c);
410
411 ramp = grad->ramp;
412
413 line = (TYPE *)(canvasBuffer + bpl*y);
414 point = &line[start*BPP];
415
416 if (!grad->has_alpha) {
417#ifdef FULL_AA
418 if (start == end) {
419 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
420 if ((unsigned long)dist2 >= 65536) {
421 r = 255;
422 } else {
423 r= SQRT[dist2];
424 }
425 mix_alpha(point, ramp[r], start_alpha + end_alpha - 255);
426 } else {
427 if (start_alpha < 255) {
428 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
429 if ((unsigned long)dist2 >= 65536) {
430 r = 255;
431 } else {
432 r= SQRT[dist2];
433 }
434 mix_alpha(point, ramp[r], start_alpha);
435 point+=BPP;
436 X += dx;
437 Y += dy;
438 n--;
439 }
440#endif /* FULL_AA */
441 while (n>0) {
442 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
443 if ((unsigned long)dist2 >= 65536) {
444 r = 255;
445 } else {
446 r= SQRT[dist2];
447 }
448 *point++ = ramp[r].blue;
449 *point++ = ramp[r].green;
450 *point++ = ramp[r].red;
451 X += dx;
452 Y += dy;
453 n--;
454 }
455#ifdef FULL_AA
456 if (end_alpha > 0) {
457 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
458 if ((unsigned long)dist2 >= 65536) {
459 r = 255;
460 } else {
461 r= SQRT[dist2];
462 }
463 mix_alpha(point, ramp[r], end_alpha);
464 }
465 }
466#endif /* FULL_AA */
467
468 } else {
469 while (n--) {
470 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
471 if ((unsigned long)dist2 >= 65536) {
472 r = 255;
473 } else {
474 r= SQRT[dist2];
475 }
476 cp = &ramp[r];
477 mix_alpha(point, *cp, cp->alpha);
478 point+=BPP;
479 X += dx;
480 Y += dy;
481 }
482 }
483}
484
485void
486GraphicDevice24::drawLine(long x1, long y1, long x2, long y2, long width)
487{
488 int n,adr,dx,dy,sx;
489 Color color;
490 register int a;
491 register TYPE *pp;
492 int alpha;
493
494 x1 = (x1) >> FRAC_BITS;
495 y1 = (y1) >> FRAC_BITS;
496 x2 = (x2) >> FRAC_BITS;
497 y2 = (y2) >> FRAC_BITS;
498
499 if (y1 > y2 || (y1 == y2 && x1 > x2)) {
500 long tmp;
501
502 tmp=x1;
503 x1=x2;
504 x2=tmp;
505
506 tmp=y1;
507 y1=y2;
508 y2=tmp;
509 }
510
511 if (y1 == y2 && (y1 < clip_rect.ymin || y1 > clip_rect.ymax)) return;
512 if (x1 == x2 && (x1 < clip_rect.xmin || x1 > clip_rect.xmax)) return;
513 if (x1 == x2 && y1 == y2) return;// Bad !!!
514
515 if (y1 < clip_rect.ymin && y1 != y2) {
516 x1 += (x2-x1)*(clip_rect.ymin-y1)/(y2-y1);
517 y1 = clip_rect.ymin;
518 }
519
520 if (y2 > clip_rect.ymax && y1 != y2) {
521 x2 -= (x2-x1)*(y2-clip_rect.ymax)/(y2-y1);
522 y2 = clip_rect.ymax;
523 }
524
525 if (x1 < x2) {
526 if (x1 < clip_rect.xmin && x1 != x2) {
527 y1 += (y2-y1)*(clip_rect.xmin-x1)/(x2-x1);
528 x1 = clip_rect.xmin;
529 }
530
531 if (x2 > clip_rect.xmax && x1 != x2) {
532 y2 -= (y2-y1)*(x2-clip_rect.xmax)/(x2-x1);
533 x2 = clip_rect.xmax;
534 }
535 }
536
537 if (x1 > x2) {
538 if (x2 < clip_rect.xmin && x2 != x1) {
539 y2 -= (y2-y1)*(clip_rect.xmin-x2)/(x1-x2);
540 x2 = clip_rect.xmin;
541 }
542
543 if (x1 > clip_rect.xmax && x2 != x1) {
544 y1 += (y2-y1)*(x1-clip_rect.xmax)/(x1-x2);
545 x1 = clip_rect.xmax;
546 }
547 }
548
549 // Check again
550 if (x1 == x2 && y1 == y2) return;
551 if (x1 < clip_rect.xmin || x2 < clip_rect.xmin) return;
552 if (y1 < clip_rect.ymin || y2 < clip_rect.ymin) return;
553 if (x1 > clip_rect.xmax || x2 > clip_rect.xmax) return;
554 if (y1 > clip_rect.ymax || y2 > clip_rect.ymax) return;
555
556 sx=bpl >> 1;
557 adr=(y1 * sx + x1);
558 pp = (TYPE *)canvasBuffer + adr;
559
560 dx = x2 - x1;
561 dy = y2 - y1;
562
563 color = foregroundColor;
564 alpha = foregroundColor.alpha;
565
566 if (alpha == ALPHA_OPAQUE) {
567
568 #define PUTPIXEL() \
569 { \
570 *pp++=color.red; \
571 *pp++=color.green; \
572 *pp++=color.blue; \
573 }
574
575#define DRAWLINE(dx,dy,inc_1,inc_2) \
576 n=dx;\
577 a=2*dy-dx;\
578 dy=2*dy;\
579 dx=2*dx-dy;\
580 do {\
581 PUTPIXEL();\
582 if (a>0) { pp+=(inc_1); a-=dx; }\
583 else { pp+=(inc_2); a+=dy; }\
584 } while (--n >= 0);
585
586/* fin macro */
587
588 if (dx == 0 && dy == 0) {
589 PUTPIXEL();
590 } else if (dx > 0) {
591 if (dx >= dy) {
592 DRAWLINE(dx, dy, sx + 1, 1);
593 } else {
594 DRAWLINE(dy, dx, sx + 1, sx);
595 }
596 } else {
597 dx = -dx;
598 if (dx >= dy) {
599 DRAWLINE(dx, dy, sx - 1, -1);
600 } else {
601 DRAWLINE(dy, dx, sx - 1, sx);
602 }
603 }
604
605
606#undef DRAWLINE
607#undef PUTPIXEL
608 } else {
609 #define PUTPIXEL() \
610 { \
611 mix_alpha(pp,color,alpha); \
612 }
613
614#define DRAWLINE(dx,dy,inc_1,inc_2) \
615 n=dx;\
616 a=2*dy-dx;\
617 dy=2*dy;\
618 dx=2*dx-dy;\
619 do {\
620 PUTPIXEL();\
621 if (a>0) { pp+=(inc_1*BPP); a-=dx; }\
622 else { pp+=(inc_2*BPP); a+=dy; }\
623 } while (--n >= 0);
624
625/* fin macro */
626
627 if (dx == 0 && dy == 0) {
628 PUTPIXEL();
629 } else if (dx > 0) {
630 if (dx >= dy) {
631 DRAWLINE(dx, dy, sx + 1, 1);
632 } else {
633 DRAWLINE(dy, dx, sx + 1, sx);
634 }
635 } else {
636 dx = -dx;
637 if (dx >= dy) {
638 DRAWLINE(dx, dy, sx - 1, -1);
639 } else {
640 DRAWLINE(dy, dx, sx - 1, sx);
641 }
642 }
643
644
645#undef DRAWLINE
646#undef PUTPIXEL
647 }
648}
diff --git a/core/multimedia/opieplayer/libflash/graphic24.h b/core/multimedia/opieplayer/libflash/graphic24.h
new file mode 100644
index 0000000..4c10e49
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/graphic24.h
@@ -0,0 +1,39 @@
1////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25class GraphicDevice24: public GraphicDevice {
26private:
27 long GraphicDevice24::allocColor(Color color);
28
29public:
30 GraphicDevice24(FlashDisplay *fd);
31
32 void clearCanvas();
33 void fillLineAA(FillStyleDef *f, long y, long start, long end);
34 void fillLine(FillStyleDef *f, long y, long start, long end);
35 void fillLineBitmap(FillStyleDef *f, long y, long start, long end);
36 void fillLineLG(Gradient *grad, long y, long start, long end);
37 void fillLineRG(Gradient *grad, long y, long start, long end);
38 void drawLine(long x1, long y1, long x2, long y2, long width);
39};
diff --git a/core/multimedia/opieplayer/libflash/graphic32.cc b/core/multimedia/opieplayer/libflash/graphic32.cc
new file mode 100644
index 0000000..b9c2008
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/graphic32.cc
@@ -0,0 +1,657 @@
1////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#include "graphic32.h"
26
27extern unsigned char SQRT[];
28
29#define FULL_AA
30
31#define PRINT 0
32
33typedef unsigned long TYPE;
34
35GraphicDevice32::GraphicDevice32(FlashDisplay *fd) : GraphicDevice(fd)
36{
37}
38
39long
40GraphicDevice32::allocColor(Color color)
41{
42 return (color.red)<<16 | (color.green)<<8 | (color.blue);
43}
44
45void
46GraphicDevice32::clearCanvas()
47{
48 TYPE pixel;
49 TYPE *point,*p;
50 long h, w,n;
51
52 if (!bgInitialized) return;
53
54 pixel = allocColor(backgroundColor);
55
56 point = (TYPE *)(canvasBuffer + clip_rect.ymin * bpl) + clip_rect.xmin;
57 w = clip_rect.xmax - clip_rect.xmin;
58 h = clip_rect.ymax - clip_rect.ymin;
59
60 while (h--) {
61 p = point;
62 n = w;
63 while (n--) {
64 *p++ = pixel;
65 }
66
67 point = (TYPE *)((char *)point + bpl);
68 }
69
70 flashDisplay->flash_refresh = 1;
71 flashDisplay->clip_x = clip_rect.xmin;
72 flashDisplay->clip_y = clip_rect.ymin;
73 flashDisplay->clip_width = clip_rect.xmax-clip_rect.xmin;
74 flashDisplay->clip_height = clip_rect.ymax-clip_rect.ymin;
75}
76
77#define RED_MASK 0xFF0000
78#define GREEN_MASK 0x00FF00
79#define BLUE_MASK 0x0000FF
80
81/* alpha = 0 : select c1, alpha = 255 select c2 */
82static inline unsigned long
83mix_alpha(unsigned long c1, unsigned long c2, int alpha)
84{
85 long r1,r2,r;
86 long g1,g2,g;
87 long b1,b2,b;
88
89 r1 = c1 & RED_MASK;
90 r2 = c2 & RED_MASK;
91 r = (((r2-r1)*alpha + r1 * 256) >> 8) & RED_MASK;
92
93 g1 = c1 & GREEN_MASK;
94 g2 = c2 & GREEN_MASK;
95 g = (((g2-g1)*alpha + g1 * 256) >> 8) & GREEN_MASK;
96
97 b1 = c1 & BLUE_MASK;
98 b2 = c2 & BLUE_MASK;
99 b = (((b2-b1)*alpha + b1 * 256) >> 8) & BLUE_MASK;
100
101 return (r|g|b);
102}
103
104void
105GraphicDevice32::fillLineAA(FillStyleDef *f, long y, long start, long end)
106{
107 register long n;
108 TYPE *line;
109 TYPE *point,pixel;
110 unsigned int alpha, start_alpha,end_alpha;
111
112 if (clip(y,start,end)) return;
113
114 line = (TYPE *)(canvasBuffer + bpl*y);
115
116 alpha = f->color.alpha;
117 pixel = f->color.pixel;
118
119 if (alpha == ALPHA_OPAQUE) {
120
121 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
122 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
123
124 start >>= FRAC_BITS;
125 end >>= FRAC_BITS;
126
127 point = &line[start];
128
129 if (start == end) {
130 *point = mix_alpha(*point, pixel, start_alpha + end_alpha - 255);
131 } else {
132 n = end-start;
133 if (start_alpha < 255) {
134 *point = mix_alpha(*point, pixel, start_alpha);
135 point++;
136 n--;
137 }
138 while (n > 0) {
139 *point = pixel;
140 point++;
141 n--;
142 }
143 if (end_alpha > 0) {
144 *point = mix_alpha(*point, pixel, end_alpha);
145 }
146 }
147 } else {
148
149 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
150 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
151
152 start >>= FRAC_BITS;
153 end >>= FRAC_BITS;
154
155 point = &line[start];
156
157 if (start == end) {
158 *point = mix_alpha(*point, pixel,
159 ((start_alpha + end_alpha - 255) * alpha) >> 8);
160 } else {
161 n = end-start;
162 if (start_alpha < 255) {
163 *point = mix_alpha(*point, pixel, (start_alpha * alpha) >> 8);
164 point++;
165 n--;
166 }
167 while (n > 0) {
168 *point = mix_alpha(*point, pixel, alpha);
169 point++;
170 n--;
171 }
172 if (end_alpha > 0) {
173 *point = mix_alpha(*point, pixel, (end_alpha * alpha) >> 8);
174 }
175 }
176 }
177}
178
179void
180GraphicDevice32::fillLine(FillStyleDef *f, long y, long start, long end)
181{
182 register long n;
183 TYPE *line,*point;
184 TYPE pixel;
185 unsigned int alpha;
186
187 if (clip(y,start,end)) return;
188
189 start >>= FRAC_BITS;
190 end >>= FRAC_BITS;
191
192 line = (TYPE *)(canvasBuffer + bpl*y);
193 point = &line[start];
194 n = end-start;
195 pixel = f->color.pixel;
196 alpha = f->color.alpha;
197 if (alpha == ALPHA_OPAQUE) {
198 while (n--) {
199 *point = pixel;
200 point++;
201 }
202 } else {
203 while (n--) {
204 *point = mix_alpha(*point, pixel, alpha);
205 point++;
206 }
207 }
208}
209
210void
211GraphicDevice32::fillLineBitmap(FillStyleDef *f, long y, long start, long end)
212{
213 int n;
214 long x1,y1,dx,dy;
215 Matrix *m = &f->bitmap_matrix;
216 Bitmap *b = f->bitmap;
217 unsigned char *pixels;
218 TYPE *p;
219 Color *cmap;
220 long pixbpl;
221 TYPE pixel;
222 int offset;
223 unsigned char *alpha_table;
224
225 /* safety test) */
226 if (!b) return;
227
228 if (clip(y,start,end)) return;
229
230 start /= FRAC;
231 end /= FRAC;
232 n = end - start;
233 p = (TYPE *) (this->canvasBuffer + this->bpl*y + start * sizeof(TYPE));
234
235 /* the coordinates in the image are normalized to 16 bits */
236 x1 = (long) (m->a * start + m->b * y + m->tx);
237 y1 = (long) (m->c * start + m->d * y + m->ty);
238 dx = (long) (m->a);
239 dy = (long) (m->c);
240
241 pixels = b->pixels;
242 pixbpl = b->bpl;
243 cmap = f->cmap;
244
245 if (b->alpha_buf == NULL) {
246 while (n) {
247 if (x1 >= 0 && y1 >= 0 &&
248 (x1 >> 16) < b->width && (y1 >> 16) < b->height) {
249
250 pixel = cmap[pixels[(y1 >> 16) * pixbpl + (x1 >> 16)]].pixel;
251 *p = pixel;
252 }
253 x1 += dx;
254 y1 += dy;
255 p++;
256 n--;
257 }
258 } else if (f->alpha_table) {
259 alpha_table = f->alpha_table;
260 while (n) {
261 if (x1 >= 0 && y1 >= 0 &&
262 (x1 >> 16) < b->width && (y1 >> 16) < b->height) {
263
264 offset = (y1 >> 16) * pixbpl + (x1 >> 16);
265 pixel = cmap[pixels[offset]].pixel;
266 *p = mix_alpha(*p, pixel, alpha_table[b->alpha_buf[offset]]);
267 }
268 x1 += dx;
269 y1 += dy;
270 p++;
271 n--;
272 }
273 } else {
274 while (n) {
275 if (x1 >= 0 && y1 >= 0 &&
276 (x1 >> 16) < b->width && (y1 >> 16) < b->height) {
277
278 offset = (y1 >> 16) * pixbpl + (x1 >> 16);
279 pixel = cmap[pixels[offset]].pixel;
280 *p = mix_alpha(*p, pixel, b->alpha_buf[offset]);
281 }
282 x1 += dx;
283 y1 += dy;
284 p++;
285 n--;
286 }
287 }
288}
289
290void
291GraphicDevice32::fillLineLG(Gradient *grad, long y, long start, long end)
292{
293 long dr,r,v,r2;
294 register long n;
295 TYPE *line;
296 TYPE *point;
297 Color *cp,*ramp;
298 Matrix *m = &grad->imat;
299 unsigned int start_alpha,end_alpha;
300
301 if (clip(y,start,end)) return;
302
303 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
304 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
305
306 start /= FRAC;
307 end /= FRAC;
308
309 n = end-start;
310
311 r = (long) (m->a * start + m->b * y + m->tx);
312 dr = (long) (m->a);
313
314 ramp = grad->ramp;
315
316 line = (TYPE *)(canvasBuffer + bpl*y);
317 point = &line[start];
318
319 r2 = r + n * dr;
320 if ( ((r | r2) & ~255) == 0 ) {
321 if (!grad->has_alpha) {
322#ifdef FULL_AA
323 if (start_alpha < 255) {
324 v = r>>16;
325 *point = mix_alpha(*point, (TYPE)ramp[v].pixel, start_alpha);
326 point++;
327 r += dr;
328 n--;
329 }
330#endif /* FULL_AA */
331 while (n>0) {
332 v = r>>16;
333 *point = (TYPE)ramp[v].pixel;
334 point++;
335 r += dr;
336 n--;
337 }
338#ifdef FULL_AA
339 if (end_alpha > 0) {
340 v = r>>16;
341 *point = mix_alpha(*point, (TYPE)ramp[v].pixel, end_alpha);
342 }
343#endif /* FULL_AA */
344 } else {
345 while (n--) {
346 v = r>>16;
347 cp = &ramp[v];
348 *point = mix_alpha(*point, cp->pixel, cp->alpha);
349 point++;
350 r += dr;
351 }
352 }
353 } else {
354 if (!grad->has_alpha) {
355#ifdef FULL_AA
356 if (start_alpha < 255) {
357 v = r>>16;
358 if (v < 0) v = 0;
359 else if (v > 255) v = 255;
360 *point = mix_alpha(*point, (TYPE)ramp[v].pixel, start_alpha);
361 point++;
362 r += dr;
363 n--;
364 }
365#endif /* FULL_AA */
366 while (n>0) {
367 v = r>>16;
368 if (v < 0) v = 0;
369 else if (v > 255) v = 255;
370 *point = (TYPE)ramp[v].pixel;
371 point++;
372 r += dr;
373 n--;
374 }
375#ifdef FULL_AA
376 if (end_alpha > 0) {
377 v = r>>16;
378 if (v < 0) v = 0;
379 else if (v > 255) v = 255;
380 *point = mix_alpha(*point, (TYPE)ramp[v].pixel, end_alpha);
381 }
382#endif /* FULL_AA */
383 } else {
384 while (n--) {
385 v = r>>16;
386 if (v < 0) v = 0;
387 else if (v > 255) v = 255;
388 cp = &ramp[v];
389 *point = mix_alpha(*point, cp->pixel, cp->alpha);
390 point++;
391 r += dr;
392 }
393 }
394 }
395}
396
397void
398GraphicDevice32::fillLineRG(Gradient *grad, long y, long start, long end)
399{
400 long X,dx,r,Y,dy;
401 long dist2;
402 register long n;
403 Color *cp,*ramp;
404 TYPE *line;
405 TYPE *point;
406 Matrix *m = &grad->imat;
407 unsigned int start_alpha,end_alpha;
408
409 if (clip(y,start,end)) return;
410
411 start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));
412 end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);
413
414 start /= FRAC;
415 end /= FRAC;
416
417 n = end-start;
418
419 X = (long) (m->a * start + m->b * y + m->tx);
420 Y = (long) (m->c * start + m->d * y + m->ty);
421 dx = (long) (m->a);
422 dy = (long) (m->c);
423
424 ramp = grad->ramp;
425
426 line = (TYPE *)(canvasBuffer + bpl*y);
427 point = &line[start];
428
429 if (!grad->has_alpha) {
430#ifdef FULL_AA
431 if (start == end) {
432 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
433 if ((unsigned long)dist2 >= 65536) {
434 r = 255;
435 } else {
436 r = SQRT[dist2];
437 }
438 *point = mix_alpha(*point, (TYPE)ramp[r].pixel, start_alpha + end_alpha - 255);
439 } else {
440 if (start_alpha < 255) {
441 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
442 if ((unsigned long)dist2 >= 65536) {
443 r = 255;
444 } else {
445 r = SQRT[dist2];
446 }
447 *point = mix_alpha(*point, (TYPE)ramp[r].pixel, start_alpha);
448 point++;
449 X += dx;
450 Y += dy;
451 n--;
452 }
453#endif /* FULL_AA */
454 while (n>0) {
455 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
456 if ((unsigned long)dist2 >= 65536) {
457 r = 255;
458 } else {
459 r= SQRT[dist2];
460 }
461 *point = (TYPE)ramp[r].pixel;
462 point++;
463 X += dx;
464 Y += dy;
465 n--;
466 }
467#ifdef FULL_AA
468 if (end_alpha > 0) {
469 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
470 if ((unsigned long)dist2 >= 65536) {
471 r = 255;
472 } else {
473 r= SQRT[dist2];
474 }
475 *point = mix_alpha(*point, (TYPE)ramp[r].pixel, end_alpha);
476 }
477 }
478#endif /* FULL_AA */
479
480 } else {
481 while (n--) {
482 dist2 = ((X>>16)*(X>>16))+((Y>>16)*(Y>>16));
483 if ((unsigned long)dist2 >= 65536) {
484 r = 255;
485 } else {
486 r= SQRT[dist2];
487 }
488 cp = &ramp[r];
489 *point = mix_alpha(*point, cp->pixel, cp->alpha);
490 point++;
491 X += dx;
492 Y += dy;
493 }
494 }
495}
496
497void
498GraphicDevice32::drawLine(long x1, long y1, long x2, long y2, long width)
499{
500 int n,adr,dx,dy,sx,color;
501 register int a;
502 register TYPE *pp;
503 int alpha;
504
505 x1 = (x1) >> FRAC_BITS;
506 y1 = (y1) >> FRAC_BITS;
507 x2 = (x2) >> FRAC_BITS;
508 y2 = (y2) >> FRAC_BITS;
509
510 if (y1 > y2 || (y1 == y2 && x1 > x2)) {
511 long tmp;
512
513 tmp=x1;
514 x1=x2;
515 x2=tmp;
516
517 tmp=y1;
518 y1=y2;
519 y2=tmp;
520 }
521
522 if (y1 == y2 && (y1 < clip_rect.ymin || y1 > clip_rect.ymax)) return;
523 if (x1 == x2 && (x1 < clip_rect.xmin || x1 > clip_rect.xmax)) return;
524 if (x1 == x2 && y1 == y2) return;// Bad !!!
525
526 if (y1 < clip_rect.ymin && y1 != y2) {
527 x1 += (x2-x1)*(clip_rect.ymin-y1)/(y2-y1);
528 y1 = clip_rect.ymin;
529 }
530
531 if (y2 > clip_rect.ymax && y1 != y2) {
532 x2 -= (x2-x1)*(y2-clip_rect.ymax)/(y2-y1);
533 y2 = clip_rect.ymax;
534 }
535
536 if (x1 < x2) {
537 if (x1 < clip_rect.xmin && x1 != x2) {
538 y1 += (y2-y1)*(clip_rect.xmin-x1)/(x2-x1);
539 x1 = clip_rect.xmin;
540 }
541
542 if (x2 > clip_rect.xmax && x1 != x2) {
543 y2 -= (y2-y1)*(x2-clip_rect.xmax)/(x2-x1);
544 x2 = clip_rect.xmax;
545 }
546 }
547
548 if (x1 > x2) {
549 if (x2 < clip_rect.xmin && x2 != x1) {
550 y2 -= (y2-y1)*(clip_rect.xmin-x2)/(x1-x2);
551 x2 = clip_rect.xmin;
552 }
553
554 if (x1 > clip_rect.xmax && x2 != x1) {
555 y1 += (y2-y1)*(x1-clip_rect.xmax)/(x1-x2);
556 x1 = clip_rect.xmax;
557 }
558 }
559
560 // Check again
561 if (x1 == x2 && y1 == y2) return;
562 if (x1 < clip_rect.xmin || x2 < clip_rect.xmin) return;
563 if (y1 < clip_rect.ymin || y2 < clip_rect.ymin) return;
564 if (x1 > clip_rect.xmax || x2 > clip_rect.xmax) return;
565 if (y1 > clip_rect.ymax || y2 > clip_rect.ymax) return;
566
567 sx=bpl >> 1;
568 adr=(y1 * sx + x1);
569 pp = (TYPE *)canvasBuffer + adr;
570
571 dx = x2 - x1;
572 dy = y2 - y1;
573
574 color = allocColor(foregroundColor);
575 alpha = foregroundColor.alpha;
576
577 if (alpha == ALPHA_OPAQUE) {
578
579 #define PUTPIXEL() \
580 { \
581 *pp=color; \
582 }
583
584#define DRAWLINE(dx,dy,inc_1,inc_2) \
585 n=dx;\
586 a=2*dy-dx;\
587 dy=2*dy;\
588 dx=2*dx-dy;\
589 do {\
590 PUTPIXEL();\
591 if (a>0) { pp+=(inc_1); a-=dx; }\
592 else { pp+=(inc_2); a+=dy; }\
593 } while (--n >= 0);
594
595/* fin macro */
596
597 if (dx == 0 && dy == 0) {
598 PUTPIXEL();
599 } else if (dx > 0) {
600 if (dx >= dy) {
601 DRAWLINE(dx, dy, sx + 1, 1);
602 } else {
603 DRAWLINE(dy, dx, sx + 1, sx);
604 }
605 } else {
606 dx = -dx;
607 if (dx >= dy) {
608 DRAWLINE(dx, dy, sx - 1, -1);
609 } else {
610 DRAWLINE(dy, dx, sx - 1, sx);
611 }
612 }
613
614
615#undef DRAWLINE
616#undef PUTPIXEL
617 } else {
618 #define PUTPIXEL() \
619 { \
620 *pp=mix_alpha(*pp,color,alpha); \
621 }
622
623#define DRAWLINE(dx,dy,inc_1,inc_2) \
624 n=dx;\
625 a=2*dy-dx;\
626 dy=2*dy;\
627 dx=2*dx-dy;\
628 do {\
629 PUTPIXEL();\
630 if (a>0) { pp+=(inc_1); a-=dx; }\
631 else { pp+=(inc_2); a+=dy; }\
632 } while (--n >= 0);
633
634/* fin macro */
635
636 if (dx == 0 && dy == 0) {
637 PUTPIXEL();
638 } else if (dx > 0) {
639 if (dx >= dy) {
640 DRAWLINE(dx, dy, sx + 1, 1);
641 } else {
642 DRAWLINE(dy, dx, sx + 1, sx);
643 }
644 } else {
645 dx = -dx;
646 if (dx >= dy) {
647 DRAWLINE(dx, dy, sx - 1, -1);
648 } else {
649 DRAWLINE(dy, dx, sx - 1, sx);
650 }
651 }
652
653
654#undef DRAWLINE
655#undef PUTPIXEL
656 }
657}
diff --git a/core/multimedia/opieplayer/libflash/graphic32.h b/core/multimedia/opieplayer/libflash/graphic32.h
new file mode 100644
index 0000000..3d75a4d
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/graphic32.h
@@ -0,0 +1,39 @@
1////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25class GraphicDevice32: public GraphicDevice {
26private:
27 long GraphicDevice32::allocColor(Color color);
28
29public:
30 GraphicDevice32(FlashDisplay *fd);
31
32 void clearCanvas();
33 void fillLineAA(FillStyleDef *f, long y, long start, long end);
34 void fillLine(FillStyleDef *f, long y, long start, long end);
35 void fillLineBitmap(FillStyleDef *f, long y, long start, long end);
36 void fillLineLG(Gradient *grad, long y, long start, long end);
37 void fillLineRG(Gradient *grad, long y, long start, long end);
38 void drawLine(long x1, long y1, long x2, long y2, long width);
39};
diff --git a/core/multimedia/opieplayer/libflash/jconfig.h b/core/multimedia/opieplayer/libflash/jconfig.h
new file mode 100644
index 0000000..9594ec5
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/jconfig.h
@@ -0,0 +1,45 @@
1/* jconfig.h. Generated automatically by configure. */
2/* jconfig.cfg --- source file edited by configure script */
3/* see jconfig.doc for explanations */
4
5#define HAVE_PROTOTYPES
6#define HAVE_UNSIGNED_CHAR
7#define HAVE_UNSIGNED_SHORT
8#undef void
9#undef const
10#undef CHAR_IS_UNSIGNED
11#define HAVE_STDDEF_H
12#define HAVE_STDLIB_H
13#undef NEED_BSD_STRINGS
14#undef NEED_SYS_TYPES_H
15#undef NEED_FAR_POINTERS
16#undef NEED_SHORT_EXTERNAL_NAMES
17/* Define this if you get warnings about undefined structures. */
18#undef INCOMPLETE_TYPES_BROKEN
19
20#ifdef JPEG_INTERNALS
21
22#undef RIGHT_SHIFT_IS_UNSIGNED
23#define INLINE __inline__
24/* These are for configuring the JPEG memory manager. */
25#undef DEFAULT_MAX_MEM
26#undef NO_MKTEMP
27
28#endif /* JPEG_INTERNALS */
29
30#ifdef JPEG_CJPEG_DJPEG
31
32 #define BMP_SUPPORTED /* BMP image file format */
33 #define GIF_SUPPORTED /* GIF image file format */
34 #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
35 #undef RLE_SUPPORTED /* Utah RLE image file format */
36 #define TARGA_SUPPORTED /* Targa image file format */
37
38#undef TWO_FILE_COMMANDLINE
39#undef NEED_SIGNAL_CATCHER
40#undef DONT_USE_B_MODE
41
42/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
43#undef PROGRESS_REPORT
44
45#endif /* JPEG_CJPEG_DJPEG */
diff --git a/core/multimedia/opieplayer/libflash/jerror.h b/core/multimedia/opieplayer/libflash/jerror.h
new file mode 100644
index 0000000..fc2fffe
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/jerror.h
@@ -0,0 +1,291 @@
1/*
2 * jerror.h
3 *
4 * Copyright (C) 1994-1997, Thomas G. Lane.
5 * This file is part of the Independent JPEG Group's software.
6 * For conditions of distribution and use, see the accompanying README file.
7 *
8 * This file defines the error and message codes for the JPEG library.
9 * Edit this file to add new codes, or to translate the message strings to
10 * some other language.
11 * A set of error-reporting macros are defined too. Some applications using
12 * the JPEG library may wish to include this file to get the error codes
13 * and/or the macros.
14 */
15
16/*
17 * To define the enum list of message codes, include this file without
18 * defining macro JMESSAGE. To create a message string table, include it
19 * again with a suitable JMESSAGE definition (see jerror.c for an example).
20 */
21#ifndef JMESSAGE
22#ifndef JERROR_H
23/* First time through, define the enum list */
24#define JMAKE_ENUM_LIST
25#else
26/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
27#define JMESSAGE(code,string)
28#endif /* JERROR_H */
29#endif /* JMESSAGE */
30
31#ifdef JMAKE_ENUM_LIST
32
33typedef enum {
34
35 #define JMESSAGE(code,string)code ,
36
37#endif /* JMAKE_ENUM_LIST */
38
39JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
40
41/* For maintenance convenience, list is alphabetical by message code name */
42JMESSAGE(JERR_ARITH_NOTIMPL,
43 "Sorry, there are legal restrictions on arithmetic coding")
44JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
45JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
46JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
47JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
48JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
49JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
50JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
51JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
52JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
53JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length")
54JMESSAGE(JERR_BAD_LIB_VERSION,
55 "Wrong JPEG library version: library is %d, caller expects %d")
56JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan")
57JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d")
58JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d")
59JMESSAGE(JERR_BAD_PROGRESSION,
60 "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d")
61JMESSAGE(JERR_BAD_PROG_SCRIPT,
62 "Invalid progressive parameters at scan script entry %d")
63JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors")
64JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d")
65JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d")
66JMESSAGE(JERR_BAD_STRUCT_SIZE,
67 "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u")
68JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access")
69JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small")
70JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here")
71JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")
72JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d")
73JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request")
74JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d")
75JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x")
76JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d")
77JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d")
78JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)")
79JMESSAGE(JERR_EMS_READ, "Read from EMS failed")
80JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed")
81JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")
82JMESSAGE(JERR_FILE_READ, "Input file read error")
83JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")
84JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet")
85JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")
86JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")
87JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels")
88JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")
89JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")
90JMESSAGE(JERR_MISMATCHED_QUANT_TABLE,
91 "Cannot transcode due to multiple use of quantization table %d")
92JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
93JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
94JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
95JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
96JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
97JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
98JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
99JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined")
100JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x")
101JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)")
102JMESSAGE(JERR_QUANT_COMPONENTS,
103 "Cannot quantize more than %d color components")
104JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
105JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
106JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")
107JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")
108JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
109JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")
110JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")
111JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
112JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
113JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
114JMESSAGE(JERR_TFILE_WRITE,
115 "Write failed on temporary file --- out of disk space?")
116JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines")
117JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x")
118JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up")
119JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation")
120JMESSAGE(JERR_XMS_READ, "Read from XMS failed")
121JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed")
122JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT)
123JMESSAGE(JMSG_VERSION, JVERSION)
124JMESSAGE(JTRC_16BIT_TABLES,
125 "Caution: quantization tables are too coarse for baseline JPEG")
126JMESSAGE(JTRC_ADOBE,
127 "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")
128JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")
129JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")
130JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")
131JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")
132JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d")
133JMESSAGE(JTRC_DRI, "Define Restart Interval %u")
134JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u")
135JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u")
136JMESSAGE(JTRC_EOI, "End Of Image")
137JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
138JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
139JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
140 "Warning: thumbnail image size does not match data length %u")
141JMESSAGE(JTRC_JFIF_EXTENSION,
142 "JFIF extension marker: type 0x%02x, length %u")
143JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
144JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
145JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
146JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u")
147JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors")
148JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors")
149JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization")
150JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d")
151JMESSAGE(JTRC_RST, "RST%d")
152JMESSAGE(JTRC_SMOOTH_NOTIMPL,
153 "Smoothing not supported with nonstandard sampling ratios")
154JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d")
155JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d")
156JMESSAGE(JTRC_SOI, "Start of Image")
157JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")
158JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d")
159JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d")
160JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s")
161JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s")
162JMESSAGE(JTRC_THUMB_JPEG,
163 "JFIF extension marker: JPEG-compressed thumbnail image, length %u")
164JMESSAGE(JTRC_THUMB_PALETTE,
165 "JFIF extension marker: palette thumbnail image, length %u")
166JMESSAGE(JTRC_THUMB_RGB,
167 "JFIF extension marker: RGB thumbnail image, length %u")
168JMESSAGE(JTRC_UNKNOWN_IDS,
169 "Unrecognized component IDs %d %d %d, assuming YCbCr")
170JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
171JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
172JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
173JMESSAGE(JWRN_BOGUS_PROGRESSION,
174 "Inconsistent progression sequence for component %d coefficient %d")
175JMESSAGE(JWRN_EXTRANEOUS_DATA,
176 "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x")
177JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment")
178JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code")
179JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d")
180JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")
181JMESSAGE(JWRN_MUST_RESYNC,
182 "Corrupt JPEG data: found marker 0x%02x instead of RST%d")
183JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")
184JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")
185
186#ifdef JMAKE_ENUM_LIST
187
188 JMSG_LASTMSGCODE
189} J_MESSAGE_CODE;
190
191#undef JMAKE_ENUM_LIST
192#endif /* JMAKE_ENUM_LIST */
193
194/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
195#undef JMESSAGE
196
197
198#ifndef JERROR_H
199#define JERROR_H
200
201/* Macros to simplify using the error and trace message stuff */
202/* The first parameter is either type of cinfo pointer */
203
204/* Fatal errors (print message and exit) */
205#define ERREXIT(cinfo,code) \
206 ((cinfo)->err->msg_code = (code), \
207 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
208#define ERREXIT1(cinfo,code,p1) \
209 ((cinfo)->err->msg_code = (code), \
210 (cinfo)->err->msg_parm.i[0] = (p1), \
211 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
212#define ERREXIT2(cinfo,code,p1,p2) \
213 ((cinfo)->err->msg_code = (code), \
214 (cinfo)->err->msg_parm.i[0] = (p1), \
215 (cinfo)->err->msg_parm.i[1] = (p2), \
216 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
217#define ERREXIT3(cinfo,code,p1,p2,p3) \
218 ((cinfo)->err->msg_code = (code), \
219 (cinfo)->err->msg_parm.i[0] = (p1), \
220 (cinfo)->err->msg_parm.i[1] = (p2), \
221 (cinfo)->err->msg_parm.i[2] = (p3), \
222 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
223#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \
224 ((cinfo)->err->msg_code = (code), \
225 (cinfo)->err->msg_parm.i[0] = (p1), \
226 (cinfo)->err->msg_parm.i[1] = (p2), \
227 (cinfo)->err->msg_parm.i[2] = (p3), \
228 (cinfo)->err->msg_parm.i[3] = (p4), \
229 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
230#define ERREXITS(cinfo,code,str) \
231 ((cinfo)->err->msg_code = (code), \
232 strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
233 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
234
235 #define MAKESTMT(stuff) do { stuff } while (0)
236
237/* Nonfatal errors (we can keep going, but the data is probably corrupt) */
238#define WARNMS(cinfo,code) \
239 ((cinfo)->err->msg_code = (code), \
240 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
241#define WARNMS1(cinfo,code,p1) \
242 ((cinfo)->err->msg_code = (code), \
243 (cinfo)->err->msg_parm.i[0] = (p1), \
244 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
245#define WARNMS2(cinfo,code,p1,p2) \
246 ((cinfo)->err->msg_code = (code), \
247 (cinfo)->err->msg_parm.i[0] = (p1), \
248 (cinfo)->err->msg_parm.i[1] = (p2), \
249 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
250
251/* Informational/debugging messages */
252#define TRACEMS(cinfo,lvl,code) \
253 ((cinfo)->err->msg_code = (code), \
254 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
255#define TRACEMS1(cinfo,lvl,code,p1) \
256 ((cinfo)->err->msg_code = (code), \
257 (cinfo)->err->msg_parm.i[0] = (p1), \
258 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
259#define TRACEMS2(cinfo,lvl,code,p1,p2) \
260 ((cinfo)->err->msg_code = (code), \
261 (cinfo)->err->msg_parm.i[0] = (p1), \
262 (cinfo)->err->msg_parm.i[1] = (p2), \
263 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
264#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \
265 MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
266 _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
267 (cinfo)->err->msg_code = (code); \
268 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
269#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \
270 MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
271 _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
272 (cinfo)->err->msg_code = (code); \
273 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
274#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \
275 MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
276 _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
277 _mp[4] = (p5); \
278 (cinfo)->err->msg_code = (code); \
279 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
280#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \
281 MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
282 _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
283 _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
284 (cinfo)->err->msg_code = (code); \
285 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
286#define TRACEMSS(cinfo,lvl,code,str) \
287 ((cinfo)->err->msg_code = (code), \
288 strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
289 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
290
291#endif /* JERROR_H */
diff --git a/core/multimedia/opieplayer/libflash/jmorecfg.h b/core/multimedia/opieplayer/libflash/jmorecfg.h
new file mode 100644
index 0000000..54a7d1c
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/jmorecfg.h
@@ -0,0 +1,363 @@
1/*
2 * jmorecfg.h
3 *
4 * Copyright (C) 1991-1997, Thomas G. Lane.
5 * This file is part of the Independent JPEG Group's software.
6 * For conditions of distribution and use, see the accompanying README file.
7 *
8 * This file contains additional configuration options that customize the
9 * JPEG software for special applications or support machine-dependent
10 * optimizations. Most users will not need to touch this file.
11 */
12
13
14/*
15 * Define BITS_IN_JSAMPLE as either
16 * 8 for 8-bit sample values (the usual setting)
17 * 12 for 12-bit sample values
18 * Only 8 and 12 are legal data precisions for lossy JPEG according to the
19 * JPEG standard, and the IJG code does not support anything else!
20 * We do not support run-time selection of data precision, sorry.
21 */
22
23 #define BITS_IN_JSAMPLE 8/* use 8 or 12 */
24
25
26/*
27 * Maximum number of components (color channels) allowed in JPEG image.
28 * To meet the letter of the JPEG spec, set this to 255. However, darn
29 * few applications need more than 4 channels (maybe 5 for CMYK + alpha
30 * mask). We recommend 10 as a reasonable compromise; use 4 if you are
31 * really short on memory. (Each allowed component costs a hundred or so
32 * bytes of storage, whether actually used in an image or not.)
33 */
34
35 #define MAX_COMPONENTS 10/* maximum number of image components */
36
37
38/*
39 * Basic data types.
40 * You may need to change these if you have a machine with unusual data
41 * type sizes; for example, "char" not 8 bits, "short" not 16 bits,
42 * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
43 * but it had better be at least 16.
44 */
45
46/* Representation of a single sample (pixel element value).
47 * We frequently allocate large arrays of these, so it's important to keep
48 * them small. But if you have memory to burn and access to char or short
49 * arrays is very slow on your hardware, you might want to change these.
50 */
51
52#if BITS_IN_JSAMPLE == 8
53/* JSAMPLE should be the smallest type that will hold the values 0..255.
54 * You can use a signed char by having GETJSAMPLE mask it with 0xFF.
55 */
56
57#ifdef HAVE_UNSIGNED_CHAR
58
59typedef unsigned char JSAMPLE;
60#define GETJSAMPLE(value) ((int) (value))
61
62#else /* not HAVE_UNSIGNED_CHAR */
63
64typedef char JSAMPLE;
65#ifdef CHAR_IS_UNSIGNED
66#define GETJSAMPLE(value) ((int) (value))
67#else
68#define GETJSAMPLE(value) ((int) (value) & 0xFF)
69#endif /* CHAR_IS_UNSIGNED */
70
71#endif /* HAVE_UNSIGNED_CHAR */
72
73 #define MAXJSAMPLE255
74 #define CENTERJSAMPLE128
75
76#endif /* BITS_IN_JSAMPLE == 8 */
77
78
79#if BITS_IN_JSAMPLE == 12
80/* JSAMPLE should be the smallest type that will hold the values 0..4095.
81 * On nearly all machines "short" will do nicely.
82 */
83
84typedef short JSAMPLE;
85#define GETJSAMPLE(value) ((int) (value))
86
87 #define MAXJSAMPLE4095
88 #define CENTERJSAMPLE2048
89
90#endif /* BITS_IN_JSAMPLE == 12 */
91
92
93/* Representation of a DCT frequency coefficient.
94 * This should be a signed value of at least 16 bits; "short" is usually OK.
95 * Again, we allocate large arrays of these, but you can change to int
96 * if you have memory to burn and "short" is really slow.
97 */
98
99typedef short JCOEF;
100
101
102/* Compressed datastreams are represented as arrays of JOCTET.
103 * These must be EXACTLY 8 bits wide, at least once they are written to
104 * external storage. Note that when using the stdio data source/destination
105 * managers, this is also the data type passed to fread/fwrite.
106 */
107
108#ifdef HAVE_UNSIGNED_CHAR
109
110typedef unsigned char JOCTET;
111#define GETJOCTET(value) (value)
112
113#else /* not HAVE_UNSIGNED_CHAR */
114
115typedef char JOCTET;
116#ifdef CHAR_IS_UNSIGNED
117#define GETJOCTET(value) (value)
118#else
119#define GETJOCTET(value) ((value) & 0xFF)
120#endif /* CHAR_IS_UNSIGNED */
121
122#endif /* HAVE_UNSIGNED_CHAR */
123
124
125/* These typedefs are used for various table entries and so forth.
126 * They must be at least as wide as specified; but making them too big
127 * won't cost a huge amount of memory, so we don't provide special
128 * extraction code like we did for JSAMPLE. (In other words, these
129 * typedefs live at a different point on the speed/space tradeoff curve.)
130 */
131
132/* UINT8 must hold at least the values 0..255. */
133
134#ifdef HAVE_UNSIGNED_CHAR
135typedef unsigned char UINT8;
136#else /* not HAVE_UNSIGNED_CHAR */
137#ifdef CHAR_IS_UNSIGNED
138typedef char UINT8;
139#else /* not CHAR_IS_UNSIGNED */
140typedef short UINT8;
141#endif /* CHAR_IS_UNSIGNED */
142#endif /* HAVE_UNSIGNED_CHAR */
143
144/* UINT16 must hold at least the values 0..65535. */
145
146#ifdef HAVE_UNSIGNED_SHORT
147typedef unsigned short UINT16;
148#else /* not HAVE_UNSIGNED_SHORT */
149typedef unsigned int UINT16;
150#endif /* HAVE_UNSIGNED_SHORT */
151
152/* INT16 must hold at least the values -32768..32767. */
153
154 #ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
155typedef short INT16;
156#endif
157
158/* INT32 must hold at least signed 32-bit values. */
159
160 #ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
161typedef long INT32;
162#endif
163
164/* Datatype used for image dimensions. The JPEG standard only supports
165 * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
166 * "unsigned int" is sufficient on all machines. However, if you need to
167 * handle larger images and you don't mind deviating from the spec, you
168 * can change this datatype.
169 */
170
171typedef unsigned int JDIMENSION;
172
173#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
174
175
176/* These macros are used in all function definitions and extern declarations.
177 * You could modify them if you need to change function linkage conventions;
178 * in particular, you'll need to do that to make the library a Windows DLL.
179 * Another application is to make all functions global for use with debuggers
180 * or code profilers that require it.
181 */
182
183/* a function called through method pointers: */
184 #define METHODDEF(type) static type
185/* a function used only in its module: */
186 #define LOCAL(type) static type
187/* a function referenced thru EXTERNs: */
188 #define GLOBAL(type) type
189/* a reference to a GLOBAL function: */
190 #define EXTERN(type) extern type
191
192
193/* This macro is used to declare a "method", that is, a function pointer.
194 * We want to supply prototype parameters if the compiler can cope.
195 * Note that the arglist parameter must be parenthesized!
196 * Again, you can customize this if you need special linkage keywords.
197 */
198
199#ifdef HAVE_PROTOTYPES
200#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
201#else
202#define JMETHOD(type,methodname,arglist) type (*methodname) ()
203#endif
204
205
206/* Here is the pseudo-keyword for declaring pointers that must be "far"
207 * on 80x86 machines. Most of the specialized coding for 80x86 is handled
208 * by just saying "FAR *" where such a pointer is needed. In a few places
209 * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
210 */
211
212#ifdef NEED_FAR_POINTERS
213#define FAR far
214#else
215#define FAR
216#endif
217
218
219/*
220 * On a few systems, type boolean and/or its values FALSE, TRUE may appear
221 * in standard header files. Or you may have conflicts with application-
222 * specific header files that you want to include together with these files.
223 * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
224 */
225
226#ifndef HAVE_BOOLEAN
227typedef int boolean;
228#endif
229 #ifndef FALSE /* in case these macros already exist */
230 #define FALSE 0 /* values of boolean */
231#endif
232#ifndef TRUE
233 #define TRUE1
234#endif
235
236
237/*
238 * The remaining options affect code selection within the JPEG library,
239 * but they don't need to be visible to most applications using the library.
240 * To minimize application namespace pollution, the symbols won't be
241 * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
242 */
243
244#ifdef JPEG_INTERNALS
245#define JPEG_INTERNAL_OPTIONS
246#endif
247
248#ifdef JPEG_INTERNAL_OPTIONS
249
250
251/*
252 * These defines indicate whether to include various optional functions.
253 * Undefining some of these symbols will produce a smaller but less capable
254 * library. Note that you can leave certain source files out of the
255 * compilation/linking process if you've #undef'd the corresponding symbols.
256 * (You may HAVE to do that if your compiler doesn't like null source files.)
257 */
258
259/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
260
261/* Capability options common to encoder and decoder: */
262
263 #define DCT_ISLOW_SUPPORTED/* slow but accurate integer algorithm */
264 #define DCT_IFAST_SUPPORTED/* faster, less accurate integer method */
265 #define DCT_FLOAT_SUPPORTED/* floating-point: accurate, fast on fast HW */
266
267/* Encoder capability options: */
268
269#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
270#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
271 #define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
272 #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
273/* Note: if you selected 12-bit data precision, it is dangerous to turn off
274 * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
275 * precision, so jchuff.c normally uses entropy optimization to compute
276 * usable tables for higher precision. If you don't want to do optimization,
277 * you'll have to supply different default Huffman tables.
278 * The exact same statements apply for progressive JPEG: the default tables
279 * don't work for progressive mode. (This may get fixed, however.)
280 */
281#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
282
283/* Decoder capability options: */
284
285#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
286#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
287 #define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
288 #define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
289#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
290 #define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
291#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
292#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
293 #define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
294 #define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
295
296/* more capability options later, no doubt */
297
298
299/*
300 * Ordering of RGB data in scanlines passed to or from the application.
301 * If your application wants to deal with data in the order B,G,R, just
302 * change these macros. You can also deal with formats such as R,G,B,X
303 * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
304 * the offsets will also change the order in which colormap data is organized.
305 * RESTRICTIONS:
306 * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
307 * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
308 * useful if you are using JPEG color spaces other than YCbCr or grayscale.
309 * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
310 * is not 3 (they don't understand about dummy color components!). So you
311 * can't use color quantization if you change that value.
312 */
313
314 #define RGB_RED 0/* Offset of Red in an RGB scanline element */
315 #define RGB_GREEN 1/* Offset of Green */
316 #define RGB_BLUE 2/* Offset of Blue */
317 #define RGB_PIXELSIZE 3/* JSAMPLEs per RGB scanline element */
318
319
320/* Definitions for speed-related optimizations. */
321
322
323/* If your compiler supports inline functions, define INLINE
324 * as the inline keyword; otherwise define it as empty.
325 */
326
327#ifndef INLINE
328 #ifdef __GNUC__ /* for instance, GNU C knows about inline */
329#define INLINE __inline__
330#endif
331#ifndef INLINE
332 #define INLINE /* default is to define it as empty */
333#endif
334#endif
335
336
337/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
338 * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
339 * as short on such a machine. MULTIPLIER must be at least 16 bits wide.
340 */
341
342#ifndef MULTIPLIER
343 #define MULTIPLIER int /* type for fastest integer multiply */
344#endif
345
346
347/* FAST_FLOAT should be either float or double, whichever is done faster
348 * by your compiler. (Note that this type is only used in the floating point
349 * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
350 * Typically, float is faster in ANSI C compilers, while double is faster in
351 * pre-ANSI compilers (because they insist on converting to double anyway).
352 * The code below therefore chooses float if we have ANSI-style prototypes.
353 */
354
355#ifndef FAST_FLOAT
356#ifdef HAVE_PROTOTYPES
357#define FAST_FLOAT float
358#else
359#define FAST_FLOAT double
360#endif
361#endif
362
363#endif /* JPEG_INTERNAL_OPTIONS */
diff --git a/core/multimedia/opieplayer/libflash/jpeglib.h b/core/multimedia/opieplayer/libflash/jpeglib.h
new file mode 100644
index 0000000..d1be8dd
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/jpeglib.h
@@ -0,0 +1,1096 @@
1/*
2 * jpeglib.h
3 *
4 * Copyright (C) 1991-1998, Thomas G. Lane.
5 * This file is part of the Independent JPEG Group's software.
6 * For conditions of distribution and use, see the accompanying README file.
7 *
8 * This file defines the application interface for the JPEG library.
9 * Most applications using the library need only include this file,
10 * and perhaps jerror.h if they want to know the exact error codes.
11 */
12
13#ifndef JPEGLIB_H
14#define JPEGLIB_H
15
16/*
17 * First we include the configuration files that record how this
18 * installation of the JPEG library is set up. jconfig.h can be
19 * generated automatically for many systems. jmorecfg.h contains
20 * manual configuration options that most people need not worry about.
21 */
22
23 #ifndef JCONFIG_INCLUDED/* in case jinclude.h already did */
24 #include "jconfig.h" /* widely used configuration options */
25#endif
26 #include "jmorecfg.h" /* seldom changed options */
27
28
29/* Version ID for the JPEG library.
30 * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
31 */
32
33 #define JPEG_LIB_VERSION 62/* Version 6b */
34
35
36/* Various constants determining the sizes of things.
37 * All of these are specified by the JPEG standard, so don't change them
38 * if you want to be compatible.
39 */
40
41 #define DCTSIZE 8/* The basic DCT block is 8x8 samples */
42 #define DCTSIZE2 64/* DCTSIZE squared; # of elements in a block */
43 #define NUM_QUANT_TBLS 4/* Quantization tables are numbered 0..3 */
44 #define NUM_HUFF_TBLS 4/* Huffman tables are numbered 0..3 */
45 #define NUM_ARITH_TBLS 16/* Arith-coding tables are numbered 0..15 */
46 #define MAX_COMPS_IN_SCAN 4/* JPEG limit on # of components in one scan */
47 #define MAX_SAMP_FACTOR 4/* JPEG limit on sampling factors */
48/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;
49 * the PostScript DCT filter can emit files with many more than 10 blocks/MCU.
50 * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
51 * to handle it. We even let you do this from the jconfig.h file. However,
52 * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
53 * sometimes emits noncompliant files doesn't mean you should too.
54 */
55#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */
56#ifndef D_MAX_BLOCKS_IN_MCU
57#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */
58#endif
59
60
61/* Data structures for images (arrays of samples and of DCT coefficients).
62 * On 80x86 machines, the image arrays are too big for near pointers,
63 * but the pointer arrays can fit in near memory.
64 */
65
66 typedef JSAMPLE FAR *JSAMPROW;/* ptr to one image row of pixel samples. */
67 typedef JSAMPROW *JSAMPARRAY;/* ptr to some rows (a 2-D sample array) */
68 typedef JSAMPARRAY *JSAMPIMAGE;/* a 3-D sample array: top index is color */
69
70 typedef JCOEF JBLOCK[DCTSIZE2];/* one block of coefficients */
71 typedef JBLOCK FAR *JBLOCKROW;/* pointer to one row of coefficient blocks */
72 typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */
73 typedef JBLOCKARRAY *JBLOCKIMAGE;/* a 3-D array of coefficient blocks */
74
75 typedef JCOEF FAR *JCOEFPTR;/* useful in a couple of places */
76
77
78/* Types for JPEG compression parameters and working tables. */
79
80
81/* DCT coefficient quantization tables. */
82
83typedef struct {
84 /* This array gives the coefficient quantizers in natural array order
85 * (not the zigzag order in which they are stored in a JPEG DQT marker).
86 * CAUTION: IJG versions prior to v6a kept this array in zigzag order.
87 */
88 UINT16 quantval[DCTSIZE2];/* quantization step for each coefficient */
89 /* This field is used only during compression. It's initialized FALSE when
90 * the table is created, and set TRUE when it's been output to the file.
91 * You could suppress output of a table by setting this to TRUE.
92 * (See jpeg_suppress_tables for an example.)
93 */
94 boolean sent_table; /* TRUE when table has been output */
95} JQUANT_TBL;
96
97
98/* Huffman coding tables. */
99
100typedef struct {
101 /* These two fields directly represent the contents of a JPEG DHT marker */
102 UINT8 bits[17]; /* bits[k] = # of symbols with codes of */
103 /* length k bits; bits[0] is unused */
104 UINT8 huffval[256]; /* The symbols, in order of incr code length */
105 /* This field is used only during compression. It's initialized FALSE when
106 * the table is created, and set TRUE when it's been output to the file.
107 * You could suppress output of a table by setting this to TRUE.
108 * (See jpeg_suppress_tables for an example.)
109 */
110 boolean sent_table; /* TRUE when table has been output */
111} JHUFF_TBL;
112
113
114/* Basic info about one component (color channel). */
115
116typedef struct {
117 /* These values are fixed over the whole image. */
118 /* For compression, they must be supplied by parameter setup; */
119 /* for decompression, they are read from the SOF marker. */
120 int component_id; /* identifier for this component (0..255) */
121 int component_index; /* its index in SOF or cinfo->comp_info[] */
122 int h_samp_factor; /* horizontal sampling factor (1..4) */
123 int v_samp_factor; /* vertical sampling factor (1..4) */
124 int quant_tbl_no; /* quantization table selector (0..3) */
125 /* These values may vary between scans. */
126 /* For compression, they must be supplied by parameter setup; */
127 /* for decompression, they are read from the SOS marker. */
128 /* The decompressor output side may not use these variables. */
129 int dc_tbl_no; /* DC entropy table selector (0..3) */
130 int ac_tbl_no; /* AC entropy table selector (0..3) */
131
132 /* Remaining fields should be treated as private by applications. */
133
134 /* These values are computed during compression or decompression startup: */
135 /* Component's size in DCT blocks.
136 * Any dummy blocks added to complete an MCU are not counted; therefore
137 * these values do not depend on whether a scan is interleaved or not.
138 */
139 JDIMENSION width_in_blocks;
140 JDIMENSION height_in_blocks;
141 /* Size of a DCT block in samples. Always DCTSIZE for compression.
142 * For decompression this is the size of the output from one DCT block,
143 * reflecting any scaling we choose to apply during the IDCT step.
144 * Values of 1,2,4,8 are likely to be supported. Note that different
145 * components may receive different IDCT scalings.
146 */
147 int DCT_scaled_size;
148 /* The downsampled dimensions are the component's actual, unpadded number
149 * of samples at the main buffer (preprocessing/compression interface), thus
150 * downsampled_width = ceil(image_width * Hi/Hmax)
151 * and similarly for height. For decompression, IDCT scaling is included, so
152 * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)
153 */
154 JDIMENSION downsampled_width; /* actual width in samples */
155 JDIMENSION downsampled_height; /* actual height in samples */
156 /* This flag is used only for decompression. In cases where some of the
157 * components will be ignored (eg grayscale output from YCbCr image),
158 * we can skip most computations for the unused components.
159 */
160 boolean component_needed;/* do we need the value of this component? */
161
162 /* These values are computed before starting a scan of the component. */
163 /* The decompressor output side may not use these variables. */
164 int MCU_width; /* number of blocks per MCU, horizontally */
165 int MCU_height; /* number of blocks per MCU, vertically */
166 int MCU_blocks; /* MCU_width * MCU_height */
167 int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */
168 int last_col_width; /* # of non-dummy blocks across in last MCU */
169 int last_row_height; /* # of non-dummy blocks down in last MCU */
170
171 /* Saved quantization table for component; NULL if none yet saved.
172 * See jdinput.c comments about the need for this information.
173 * This field is currently used only for decompression.
174 */
175 JQUANT_TBL * quant_table;
176
177 /* Private per-component storage for DCT or IDCT subsystem. */
178 void * dct_table;
179} jpeg_component_info;
180
181
182/* The script for encoding a multiple-scan file is an array of these: */
183
184typedef struct {
185 int comps_in_scan; /* number of components encoded in this scan */
186 int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
187 int Ss, Se; /* progressive JPEG spectral selection parms */
188 int Ah, Al; /* progressive JPEG successive approx. parms */
189} jpeg_scan_info;
190
191/* The decompressor can save APPn and COM markers in a list of these: */
192
193typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr;
194
195struct jpeg_marker_struct {
196 jpeg_saved_marker_ptr next;/* next in list, or NULL */
197 UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
198 unsigned int original_length;/* # bytes of data in the file */
199 unsigned int data_length;/* # bytes of data saved at data[] */
200 JOCTET FAR * data; /* the data contained in the marker */
201 /* the marker length word is not counted in data_length or original_length */
202};
203
204/* Known color spaces. */
205
206typedef enum {
207 JCS_UNKNOWN, /* error/unspecified */
208 JCS_GRAYSCALE, /* monochrome */
209 JCS_RGB, /* red/green/blue */
210 JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
211 JCS_CMYK, /* C/M/Y/K */
212 JCS_YCCK /* Y/Cb/Cr/K */
213} J_COLOR_SPACE;
214
215/* DCT/IDCT algorithm options. */
216
217typedef enum {
218 JDCT_ISLOW, /* slow but accurate integer algorithm */
219 JDCT_IFAST, /* faster, less accurate integer method */
220 JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
221} J_DCT_METHOD;
222
223 #ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */
224#define JDCT_DEFAULT JDCT_ISLOW
225#endif
226 #ifndef JDCT_FASTEST /* may be overridden in jconfig.h */
227#define JDCT_FASTEST JDCT_IFAST
228#endif
229
230/* Dithering options for decompression. */
231
232typedef enum {
233 JDITHER_NONE, /* no dithering */
234 JDITHER_ORDERED,/* simple ordered dither */
235 JDITHER_FS /* Floyd-Steinberg error diffusion dither */
236} J_DITHER_MODE;
237
238
239/* Common fields between JPEG compression and decompression master structs. */
240
241#define jpeg_common_fields \
242 struct jpeg_error_mgr * err;/* Error handler module */\
243 struct jpeg_memory_mgr * mem;/* Memory manager module */\
244 struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\
245 void * client_data; /* Available for use by application */\
246 boolean is_decompressor;/* So common code can tell which is which */\
247 int global_state /* For checking call sequence validity */
248
249/* Routines that are to be used by both halves of the library are declared
250 * to receive a pointer to this structure. There are no actual instances of
251 * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
252 */
253struct jpeg_common_struct {
254 jpeg_common_fields; /* Fields common to both master struct types */
255 /* Additional fields follow in an actual jpeg_compress_struct or
256 * jpeg_decompress_struct. All three structs must agree on these
257 * initial fields! (This would be a lot cleaner in C++.)
258 */
259};
260
261typedef struct jpeg_common_struct * j_common_ptr;
262typedef struct jpeg_compress_struct * j_compress_ptr;
263typedef struct jpeg_decompress_struct * j_decompress_ptr;
264
265
266/* Master record for a compression instance */
267
268struct jpeg_compress_struct {
269 jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */
270
271 /* Destination for compressed data */
272 struct jpeg_destination_mgr * dest;
273
274 /* Description of source image --- these fields must be filled in by
275 * outer application before starting compression. in_color_space must
276 * be correct before you can even call jpeg_set_defaults().
277 */
278
279 JDIMENSION image_width;/* input image width */
280 JDIMENSION image_height;/* input image height */
281 int input_components; /* # of color components in input image */
282 J_COLOR_SPACE in_color_space;/* colorspace of input image */
283
284 double input_gamma; /* image gamma of input image */
285
286 /* Compression parameters --- these fields must be set before calling
287 * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
288 * initialize everything to reasonable defaults, then changing anything
289 * the application specifically wants to change. That way you won't get
290 * burnt when new parameters are added. Also note that there are several
291 * helper routines to simplify changing parameters.
292 */
293
294 int data_precision; /* bits of precision in image data */
295
296 int num_components; /* # of color components in JPEG image */
297 J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
298
299 jpeg_component_info * comp_info;
300 /* comp_info[i] describes component that appears i'th in SOF */
301
302 JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
303 /* ptrs to coefficient quantization tables, or NULL if not defined */
304
305 JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
306 JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
307 /* ptrs to Huffman coding tables, or NULL if not defined */
308
309 UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
310 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
311 UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
312
313 int num_scans; /* # of entries in scan_info array */
314 const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */
315 /* The default value of scan_info is NULL, which causes a single-scan
316 * sequential JPEG file to be emitted. To create a multi-scan file,
317 * set num_scans and scan_info to point to an array of scan definitions.
318 */
319
320 boolean raw_data_in; /* TRUE=caller supplies downsampled data */
321 boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
322 boolean optimize_coding;/* TRUE=optimize entropy encoding parms */
323 boolean CCIR601_sampling;/* TRUE=first samples are cosited */
324 int smoothing_factor; /* 1..100, or 0 for no input smoothing */
325 J_DCT_METHOD dct_method;/* DCT algorithm selector */
326
327 /* The restart interval can be specified in absolute MCUs by setting
328 * restart_interval, or in MCU rows by setting restart_in_rows
329 * (in which case the correct restart_interval will be figured
330 * for each scan).
331 */
332 unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
333 int restart_in_rows; /* if > 0, MCU rows per restart interval */
334
335 /* Parameters controlling emission of special markers. */
336
337 boolean write_JFIF_header;/* should a JFIF marker be written? */
338 UINT8 JFIF_major_version;/* What to write for the JFIF version number */
339 UINT8 JFIF_minor_version;
340 /* These three values are not used by the JPEG code, merely copied */
341 /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
342 /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
343 /* ratio is defined by X_density/Y_density even when density_unit=0. */
344 UINT8 density_unit; /* JFIF code for pixel size units */
345 UINT16 X_density; /* Horizontal pixel density */
346 UINT16 Y_density; /* Vertical pixel density */
347 boolean write_Adobe_marker;/* should an Adobe marker be written? */
348
349 /* State variable: index of next scanline to be written to
350 * jpeg_write_scanlines(). Application may use this to control its
351 * processing loop, e.g., "while (next_scanline < image_height)".
352 */
353
354 JDIMENSION next_scanline;/* 0 .. image_height-1 */
355
356 /* Remaining fields are known throughout compressor, but generally
357 * should not be touched by a surrounding application.
358 */
359
360 /*
361 * These fields are computed during compression startup
362 */
363 boolean progressive_mode;/* TRUE if scan script uses progressive mode */
364 int max_h_samp_factor;/* largest h_samp_factor */
365 int max_v_samp_factor;/* largest v_samp_factor */
366
367 JDIMENSION total_iMCU_rows;/* # of iMCU rows to be input to coef ctlr */
368 /* The coefficient controller receives data in units of MCU rows as defined
369 * for fully interleaved scans (whether the JPEG file is interleaved or not).
370 * There are v_samp_factor * DCTSIZE sample rows of each component in an
371 * "iMCU" (interleaved MCU) row.
372 */
373
374 /*
375 * These fields are valid during any one scan.
376 * They describe the components and MCUs actually appearing in the scan.
377 */
378 int comps_in_scan; /* # of JPEG components in this scan */
379 jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
380 /* *cur_comp_info[i] describes component that appears i'th in SOS */
381
382 JDIMENSION MCUs_per_row;/* # of MCUs across the image */
383 JDIMENSION MCU_rows_in_scan;/* # of MCU rows in the image */
384
385 int blocks_in_MCU; /* # of DCT blocks per MCU */
386 int MCU_membership[C_MAX_BLOCKS_IN_MCU];
387 /* MCU_membership[i] is index in cur_comp_info of component owning */
388 /* i'th block in an MCU */
389
390 int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
391
392 /*
393 * Links to compression subobjects (methods and private variables of modules)
394 */
395 struct jpeg_comp_master * master;
396 struct jpeg_c_main_controller * main;
397 struct jpeg_c_prep_controller * prep;
398 struct jpeg_c_coef_controller * coef;
399 struct jpeg_marker_writer * marker;
400 struct jpeg_color_converter * cconvert;
401 struct jpeg_downsampler * downsample;
402 struct jpeg_forward_dct * fdct;
403 struct jpeg_entropy_encoder * entropy;
404 jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */
405 int script_space_size;
406};
407
408
409/* Master record for a decompression instance */
410
411struct jpeg_decompress_struct {
412 jpeg_common_fields; /* Fields shared with jpeg_compress_struct */
413
414 /* Source of compressed data */
415 struct jpeg_source_mgr * src;
416
417 /* Basic description of image --- filled in by jpeg_read_header(). */
418 /* Application may inspect these values to decide how to process image. */
419
420 JDIMENSION image_width;/* nominal image width (from SOF marker) */
421 JDIMENSION image_height;/* nominal image height */
422 int num_components; /* # of color components in JPEG image */
423 J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
424
425 /* Decompression processing parameters --- these fields must be set before
426 * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes
427 * them to default values.
428 */
429
430 J_COLOR_SPACE out_color_space; /* colorspace for output */
431
432 unsigned int scale_num, scale_denom; /* fraction by which to scale image */
433
434 double output_gamma; /* image gamma wanted in output */
435
436 boolean buffered_image;/* TRUE=multiple output passes */
437 boolean raw_data_out; /* TRUE=downsampled data wanted */
438
439 J_DCT_METHOD dct_method;/* IDCT algorithm selector */
440 boolean do_fancy_upsampling;/* TRUE=apply fancy upsampling */
441 boolean do_block_smoothing;/* TRUE=apply interblock smoothing */
442
443 boolean quantize_colors;/* TRUE=colormapped output wanted */
444 /* the following are ignored if not quantize_colors: */
445 J_DITHER_MODE dither_mode;/* type of color dithering to use */
446 boolean two_pass_quantize;/* TRUE=use two-pass color quantization */
447 int desired_number_of_colors;/* max # colors to use in created colormap */
448 /* these are significant only in buffered-image mode: */
449 boolean enable_1pass_quant;/* enable future use of 1-pass quantizer */
450 boolean enable_external_quant;/* enable future use of external colormap */
451 boolean enable_2pass_quant;/* enable future use of 2-pass quantizer */
452
453 /* Description of actual output image that will be returned to application.
454 * These fields are computed by jpeg_start_decompress().
455 * You can also use jpeg_calc_output_dimensions() to determine these values
456 * in advance of calling jpeg_start_decompress().
457 */
458
459 JDIMENSION output_width;/* scaled image width */
460 JDIMENSION output_height;/* scaled image height */
461 int out_color_components;/* # of color components in out_color_space */
462 int output_components;/* # of color components returned */
463 /* output_components is 1 (a colormap index) when quantizing colors;
464 * otherwise it equals out_color_components.
465 */
466 int rec_outbuf_height;/* min recommended height of scanline buffer */
467 /* If the buffer passed to jpeg_read_scanlines() is less than this many rows
468 * high, space and time will be wasted due to unnecessary data copying.
469 * Usually rec_outbuf_height will be 1 or 2, at most 4.
470 */
471
472 /* When quantizing colors, the output colormap is described by these fields.
473 * The application can supply a colormap by setting colormap non-NULL before
474 * calling jpeg_start_decompress; otherwise a colormap is created during
475 * jpeg_start_decompress or jpeg_start_output.
476 * The map has out_color_components rows and actual_number_of_colors columns.
477 */
478 int actual_number_of_colors;/* number of entries in use */
479 JSAMPARRAY colormap; /* The color map as a 2-D pixel array */
480
481 /* State variables: these variables indicate the progress of decompression.
482 * The application may examine these but must not modify them.
483 */
484
485 /* Row index of next scanline to be read from jpeg_read_scanlines().
486 * Application may use this to control its processing loop, e.g.,
487 * "while (output_scanline < output_height)".
488 */
489 JDIMENSION output_scanline;/* 0 .. output_height-1 */
490
491 /* Current input scan number and number of iMCU rows completed in scan.
492 * These indicate the progress of the decompressor input side.
493 */
494 int input_scan_number;/* Number of SOS markers seen so far */
495 JDIMENSION input_iMCU_row;/* Number of iMCU rows completed */
496
497 /* The "output scan number" is the notional scan being displayed by the
498 * output side. The decompressor will not allow output scan/row number
499 * to get ahead of input scan/row, but it can fall arbitrarily far behind.
500 */
501 int output_scan_number;/* Nominal scan number being displayed */
502 JDIMENSION output_iMCU_row;/* Number of iMCU rows read */
503
504 /* Current progression status. coef_bits[c][i] indicates the precision
505 * with which component c's DCT coefficient i (in zigzag order) is known.
506 * It is -1 when no data has yet been received, otherwise it is the point
507 * transform (shift) value for the most recent scan of the coefficient
508 * (thus, 0 at completion of the progression).
509 * This pointer is NULL when reading a non-progressive file.
510 */
511 int (*coef_bits)[DCTSIZE2];/* -1 or current Al value for each coef */
512
513 /* Internal JPEG parameters --- the application usually need not look at
514 * these fields. Note that the decompressor output side may not use
515 * any parameters that can change between scans.
516 */
517
518 /* Quantization and Huffman tables are carried forward across input
519 * datastreams when processing abbreviated JPEG datastreams.
520 */
521
522 JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
523 /* ptrs to coefficient quantization tables, or NULL if not defined */
524
525 JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
526 JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
527 /* ptrs to Huffman coding tables, or NULL if not defined */
528
529 /* These parameters are never carried across datastreams, since they
530 * are given in SOF/SOS markers or defined to be reset by SOI.
531 */
532
533 int data_precision; /* bits of precision in image data */
534
535 jpeg_component_info * comp_info;
536 /* comp_info[i] describes component that appears i'th in SOF */
537
538 boolean progressive_mode;/* TRUE if SOFn specifies progressive mode */
539 boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
540
541 UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
542 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
543 UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
544
545 unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */
546
547 /* These fields record data obtained from optional markers recognized by
548 * the JPEG library.
549 */
550 boolean saw_JFIF_marker;/* TRUE iff a JFIF APP0 marker was found */
551 /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
552 UINT8 JFIF_major_version;/* JFIF version number */
553 UINT8 JFIF_minor_version;
554 UINT8 density_unit; /* JFIF code for pixel size units */
555 UINT16 X_density; /* Horizontal pixel density */
556 UINT16 Y_density; /* Vertical pixel density */
557 boolean saw_Adobe_marker;/* TRUE iff an Adobe APP14 marker was found */
558 UINT8 Adobe_transform;/* Color transform code from Adobe marker */
559
560 boolean CCIR601_sampling;/* TRUE=first samples are cosited */
561
562 /* Aside from the specific data retained from APPn markers known to the
563 * library, the uninterpreted contents of any or all APPn and COM markers
564 * can be saved in a list for examination by the application.
565 */
566 jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
567
568 /* Remaining fields are known throughout decompressor, but generally
569 * should not be touched by a surrounding application.
570 */
571
572 /*
573 * These fields are computed during decompression startup
574 */
575 int max_h_samp_factor;/* largest h_samp_factor */
576 int max_v_samp_factor;/* largest v_samp_factor */
577
578 int min_DCT_scaled_size;/* smallest DCT_scaled_size of any component */
579
580 JDIMENSION total_iMCU_rows;/* # of iMCU rows in image */
581 /* The coefficient controller's input and output progress is measured in
582 * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows
583 * in fully interleaved JPEG scans, but are used whether the scan is
584 * interleaved or not. We define an iMCU row as v_samp_factor DCT block
585 * rows of each component. Therefore, the IDCT output contains
586 * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
587 */
588
589 JSAMPLE * sample_range_limit; /* table for fast range-limiting */
590
591 /*
592 * These fields are valid during any one scan.
593 * They describe the components and MCUs actually appearing in the scan.
594 * Note that the decompressor output side must not use these fields.
595 */
596 int comps_in_scan; /* # of JPEG components in this scan */
597 jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
598 /* *cur_comp_info[i] describes component that appears i'th in SOS */
599
600 JDIMENSION MCUs_per_row;/* # of MCUs across the image */
601 JDIMENSION MCU_rows_in_scan;/* # of MCU rows in the image */
602
603 int blocks_in_MCU; /* # of DCT blocks per MCU */
604 int MCU_membership[D_MAX_BLOCKS_IN_MCU];
605 /* MCU_membership[i] is index in cur_comp_info of component owning */
606 /* i'th block in an MCU */
607
608 int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
609
610 /* This field is shared between entropy decoder and marker parser.
611 * It is either zero or the code of a JPEG marker that has been
612 * read from the data source, but has not yet been processed.
613 */
614 int unread_marker;
615
616 /*
617 * Links to decompression subobjects (methods, private variables of modules)
618 */
619 struct jpeg_decomp_master * master;
620 struct jpeg_d_main_controller * main;
621 struct jpeg_d_coef_controller * coef;
622 struct jpeg_d_post_controller * post;
623 struct jpeg_input_controller * inputctl;
624 struct jpeg_marker_reader * marker;
625 struct jpeg_entropy_decoder * entropy;
626 struct jpeg_inverse_dct * idct;
627 struct jpeg_upsampler * upsample;
628 struct jpeg_color_deconverter * cconvert;
629 struct jpeg_color_quantizer * cquantize;
630};
631
632
633/* "Object" declarations for JPEG modules that may be supplied or called
634 * directly by the surrounding application.
635 * As with all objects in the JPEG library, these structs only define the
636 * publicly visible methods and state variables of a module. Additional
637 * private fields may exist after the public ones.
638 */
639
640
641/* Error handler object */
642
643struct jpeg_error_mgr {
644 /* Error exit handler: does not return to caller */
645 JMETHOD(void, error_exit, (j_common_ptr cinfo));
646 /* Conditionally emit a trace or warning message */
647 JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));
648 /* Routine that actually outputs a trace or error message */
649 JMETHOD(void, output_message, (j_common_ptr cinfo));
650 /* Format a message string for the most recent JPEG error or message */
651 JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer));
652 #define JMSG_LENGTH_MAX 200/* recommended size of format_message buffer */
653 /* Reset error state variables at start of a new image */
654 JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
655
656 /* The message ID code and any parameters are saved here.
657 * A message can have one string parameter or up to 8 int parameters.
658 */
659 int msg_code;
660#define JMSG_STR_PARM_MAX 80
661 union {
662 int i[8];
663 char s[JMSG_STR_PARM_MAX];
664 } msg_parm;
665
666 /* Standard state variables for error facility */
667
668 int trace_level; /* max msg_level that will be displayed */
669
670 /* For recoverable corrupt-data errors, we emit a warning message,
671 * but keep going unless emit_message chooses to abort. emit_message
672 * should count warnings in num_warnings. The surrounding application
673 * can check for bad data by seeing if num_warnings is nonzero at the
674 * end of processing.
675 */
676 long num_warnings; /* number of corrupt-data warnings */
677
678 /* These fields point to the table(s) of error message strings.
679 * An application can change the table pointer to switch to a different
680 * message list (typically, to change the language in which errors are
681 * reported). Some applications may wish to add additional error codes
682 * that will be handled by the JPEG library error mechanism; the second
683 * table pointer is used for this purpose.
684 *
685 * First table includes all errors generated by JPEG library itself.
686 * Error code 0 is reserved for a "no such error string" message.
687 */
688 const char * const * jpeg_message_table; /* Library errors */
689 int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
690 /* Second table can be added by application (see cjpeg/djpeg for example).
691 * It contains strings numbered first_addon_message..last_addon_message.
692 */
693 const char * const * addon_message_table; /* Non-library errors */
694 int first_addon_message;/* code for first string in addon table */
695 int last_addon_message;/* code for last string in addon table */
696};
697
698
699/* Progress monitor object */
700
701struct jpeg_progress_mgr {
702 JMETHOD(void, progress_monitor, (j_common_ptr cinfo));
703
704 long pass_counter; /* work units completed in this pass */
705 long pass_limit; /* total number of work units in this pass */
706 int completed_passes; /* passes completed so far */
707 int total_passes; /* total number of passes expected */
708};
709
710
711/* Data destination object for compression */
712
713struct jpeg_destination_mgr {
714 JOCTET * next_output_byte;/* => next byte to write in buffer */
715 size_t free_in_buffer;/* # of byte spaces remaining in buffer */
716
717 JMETHOD(void, init_destination, (j_compress_ptr cinfo));
718 JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo));
719 JMETHOD(void, term_destination, (j_compress_ptr cinfo));
720};
721
722
723/* Data source object for decompression */
724
725struct jpeg_source_mgr {
726 const JOCTET * next_input_byte; /* => next byte to read from buffer */
727 size_t bytes_in_buffer;/* # of bytes remaining in buffer */
728
729 JMETHOD(void, init_source, (j_decompress_ptr cinfo));
730 JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo));
731 JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes));
732 JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired));
733 JMETHOD(void, term_source, (j_decompress_ptr cinfo));
734};
735
736
737/* Memory manager object.
738 * Allocates "small" objects (a few K total), "large" objects (tens of K),
739 * and "really big" objects (virtual arrays with backing store if needed).
740 * The memory manager does not allow individual objects to be freed; rather,
741 * each created object is assigned to a pool, and whole pools can be freed
742 * at once. This is faster and more convenient than remembering exactly what
743 * to free, especially where malloc()/free() are not too speedy.
744 * NB: alloc routines never return NULL. They exit to error_exit if not
745 * successful.
746 */
747
748 #define JPOOL_PERMANENT 0/* lasts until master record is destroyed */
749 #define JPOOL_IMAGE 1/* lasts until done with image/datastream */
750 #define JPOOL_NUMPOOLS2
751
752typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
753typedef struct jvirt_barray_control * jvirt_barray_ptr;
754
755
756struct jpeg_memory_mgr {
757 /* Method pointers */
758 JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,
759 size_t sizeofobject));
760 JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,
761 size_t sizeofobject));
762 JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,
763 JDIMENSION samplesperrow,
764 JDIMENSION numrows));
765 JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,
766 JDIMENSION blocksperrow,
767 JDIMENSION numrows));
768 JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
769 int pool_id,
770 boolean pre_zero,
771 JDIMENSION samplesperrow,
772 JDIMENSION numrows,
773 JDIMENSION maxaccess));
774 JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,
775 int pool_id,
776 boolean pre_zero,
777 JDIMENSION blocksperrow,
778 JDIMENSION numrows,
779 JDIMENSION maxaccess));
780 JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo));
781 JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo,
782 jvirt_sarray_ptr ptr,
783 JDIMENSION start_row,
784 JDIMENSION num_rows,
785 boolean writable));
786 JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo,
787 jvirt_barray_ptr ptr,
788 JDIMENSION start_row,
789 JDIMENSION num_rows,
790 boolean writable));
791 JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id));
792 JMETHOD(void, self_destruct, (j_common_ptr cinfo));
793
794 /* Limit on memory allocation for this JPEG object. (Note that this is
795 * merely advisory, not a guaranteed maximum; it only affects the space
796 * used for virtual-array buffers.) May be changed by outer application
797 * after creating the JPEG object.
798 */
799 long max_memory_to_use;
800
801 /* Maximum allocation request accepted by alloc_large. */
802 long max_alloc_chunk;
803};
804
805
806/* Routine signature for application-supplied marker processing methods.
807 * Need not pass marker code since it is stored in cinfo->unread_marker.
808 */
809typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
810
811
812/* Declarations for routines called by application.
813 * The JPP macro hides prototype parameters from compilers that can't cope.
814 * Note JPP requires double parentheses.
815 */
816
817#ifdef HAVE_PROTOTYPES
818 #define JPP(arglist)arglist
819#else
820 #define JPP(arglist)()
821#endif
822
823
824/* Short forms of external names for systems with brain-damaged linkers.
825 * We shorten external names to be unique in the first six letters, which
826 * is good enough for all known systems.
827 * (If your compiler itself needs names to be unique in less than 15
828 * characters, you are out of luck. Get a better compiler.)
829 */
830
831#ifdef NEED_SHORT_EXTERNAL_NAMES
832 #define jpeg_std_error jStdError
833 #define jpeg_CreateCompressjCreaCompress
834 #define jpeg_CreateDecompressjCreaDecompress
835 #define jpeg_destroy_compressjDestCompress
836 #define jpeg_destroy_decompressjDestDecompress
837 #define jpeg_stdio_dest jStdDest
838 #define jpeg_stdio_src jStdSrc
839 #define jpeg_set_defaultsjSetDefaults
840 #define jpeg_set_colorspacejSetColorspace
841 #define jpeg_default_colorspacejDefColorspace
842 #define jpeg_set_qualityjSetQuality
843 #define jpeg_set_linear_qualityjSetLQuality
844 #define jpeg_add_quant_tablejAddQuantTable
845 #define jpeg_quality_scalingjQualityScaling
846 #define jpeg_simple_progressionjSimProgress
847 #define jpeg_suppress_tablesjSuppressTables
848 #define jpeg_alloc_quant_tablejAlcQTable
849 #define jpeg_alloc_huff_tablejAlcHTable
850 #define jpeg_start_compressjStrtCompress
851 #define jpeg_write_scanlinesjWrtScanlines
852 #define jpeg_finish_compressjFinCompress
853 #define jpeg_write_raw_datajWrtRawData
854 #define jpeg_write_markerjWrtMarker
855 #define jpeg_write_m_headerjWrtMHeader
856 #define jpeg_write_m_bytejWrtMByte
857 #define jpeg_write_tablesjWrtTables
858 #define jpeg_read_headerjReadHeader
859 #define jpeg_start_decompressjStrtDecompress
860 #define jpeg_read_scanlinesjReadScanlines
861 #define jpeg_finish_decompressjFinDecompress
862 #define jpeg_read_raw_datajReadRawData
863 #define jpeg_has_multiple_scansjHasMultScn
864 #define jpeg_start_outputjStrtOutput
865 #define jpeg_finish_outputjFinOutput
866 #define jpeg_input_completejInComplete
867 #define jpeg_new_colormapjNewCMap
868 #define jpeg_consume_inputjConsumeInput
869 #define jpeg_calc_output_dimensionsjCalcDimensions
870 #define jpeg_save_markersjSaveMarkers
871 #define jpeg_set_marker_processorjSetMarker
872 #define jpeg_read_coefficientsjReadCoefs
873 #define jpeg_write_coefficientsjWrtCoefs
874 #define jpeg_copy_critical_parametersjCopyCrit
875 #define jpeg_abort_compressjAbrtCompress
876 #define jpeg_abort_decompressjAbrtDecompress
877 #define jpeg_abort jAbort
878 #define jpeg_destroy jDestroy
879 #define jpeg_resync_to_restartjResyncRestart
880#endif /* NEED_SHORT_EXTERNAL_NAMES */
881
882
883/* Default error-management setup */
884EXTERN(struct jpeg_error_mgr *) jpeg_std_error
885 JPP((struct jpeg_error_mgr * err));
886
887/* Initialization of JPEG compression objects.
888 * jpeg_create_compress() and jpeg_create_decompress() are the exported
889 * names that applications should call. These expand to calls on
890 * jpeg_CreateCompress and jpeg_CreateDecompress with additional information
891 * passed for version mismatch checking.
892 * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.
893 */
894#define jpeg_create_compress(cinfo) \
895 jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
896 (size_t) sizeof(struct jpeg_compress_struct))
897#define jpeg_create_decompress(cinfo) \
898 jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
899 (size_t) sizeof(struct jpeg_decompress_struct))
900EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo,
901 int version, size_t structsize));
902EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo,
903 int version, size_t structsize));
904/* Destruction of JPEG compression objects */
905EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo));
906EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
907
908/* Standard data source and destination managers: stdio streams. */
909/* Caller is responsible for opening the file before and closing after. */
910EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
911EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
912
913/* Default parameter setup for compression */
914EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
915/* Compression parameter setup aids */
916EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo,
917 J_COLOR_SPACE colorspace));
918EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo));
919EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
920 boolean force_baseline));
921EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
922 int scale_factor,
923 boolean force_baseline));
924EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
925 const unsigned int *basic_table,
926 int scale_factor,
927 boolean force_baseline));
928EXTERN(int) jpeg_quality_scaling JPP((int quality));
929EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo));
930EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo,
931 boolean suppress));
932EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo));
933EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo));
934
935/* Main entry points for compression */
936EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo,
937 boolean write_all_tables));
938EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo,
939 JSAMPARRAY scanlines,
940 JDIMENSION num_lines));
941EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo));
942
943/* Replaces jpeg_write_scanlines when writing raw downsampled data. */
944EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo,
945 JSAMPIMAGE data,
946 JDIMENSION num_lines));
947
948/* Write a special marker. See libjpeg.doc concerning safe usage. */
949EXTERN(void) jpeg_write_marker
950 JPP((j_compress_ptr cinfo, int marker,
951 const JOCTET * dataptr, unsigned int datalen));
952/* Same, but piecemeal. */
953EXTERN(void) jpeg_write_m_header
954 JPP((j_compress_ptr cinfo, int marker, unsigned int datalen));
955EXTERN(void) jpeg_write_m_byte
956 JPP((j_compress_ptr cinfo, int val));
957
958/* Alternate compression function: just write an abbreviated table file */
959EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo));
960
961/* Decompression startup: read start of JPEG datastream to see what's there */
962EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
963 boolean require_image));
964/* Return value is one of: */
965 #define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */
966 #define JPEG_HEADER_OK 1 /* Found valid image datastream */
967 #define JPEG_HEADER_TABLES_ONLY2 /* Found valid table-specs-only datastream */
968/* If you pass require_image = TRUE (normal case), you need not check for
969 * a TABLES_ONLY return code; an abbreviated file will cause an error exit.
970 * JPEG_SUSPENDED is only possible if you use a data source module that can
971 * give a suspension return (the stdio source module doesn't).
972 */
973
974/* Main entry points for decompression */
975EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo));
976EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo,
977 JSAMPARRAY scanlines,
978 JDIMENSION max_lines));
979EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo));
980
981/* Replaces jpeg_read_scanlines when reading raw downsampled data. */
982EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo,
983 JSAMPIMAGE data,
984 JDIMENSION max_lines));
985
986/* Additional entry points for buffered-image mode. */
987EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo));
988EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo,
989 int scan_number));
990EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo));
991EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo));
992EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo));
993EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo));
994/* Return value is one of: */
995 /* #define JPEG_SUSPENDED0 Suspended due to lack of input data */
996 #define JPEG_REACHED_SOS1 /* Reached start of new scan */
997 #define JPEG_REACHED_EOI2 /* Reached end of image */
998 #define JPEG_ROW_COMPLETED3 /* Completed one iMCU row */
999 #define JPEG_SCAN_COMPLETED4 /* Completed last iMCU row of a scan */
1000
1001/* Precalculate output dimensions for current decompression parameters. */
1002EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
1003
1004/* Control saving of COM and APPn markers into marker_list. */
1005EXTERN(void) jpeg_save_markers
1006 JPP((j_decompress_ptr cinfo, int marker_code,
1007 unsigned int length_limit));
1008
1009/* Install a special processing method for COM or APPn markers. */
1010EXTERN(void) jpeg_set_marker_processor
1011 JPP((j_decompress_ptr cinfo, int marker_code,
1012 jpeg_marker_parser_method routine));
1013
1014/* Read or write raw DCT coefficients --- useful for lossless transcoding. */
1015EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo));
1016EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo,
1017 jvirt_barray_ptr * coef_arrays));
1018EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,
1019 j_compress_ptr dstinfo));
1020
1021/* If you choose to abort compression or decompression before completing
1022 * jpeg_finish_(de)compress, then you need to clean up to release memory,
1023 * temporary files, etc. You can just call jpeg_destroy_(de)compress
1024 * if you're done with the JPEG object, but if you want to clean it up and
1025 * reuse it, call this:
1026 */
1027EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo));
1028EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo));
1029
1030/* Generic versions of jpeg_abort and jpeg_destroy that work on either
1031 * flavor of JPEG object. These may be more convenient in some places.
1032 */
1033EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo));
1034EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo));
1035
1036/* Default restart-marker-resync procedure for use by data source modules */
1037EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo,
1038 int desired));
1039
1040
1041/* These marker codes are exported since applications and data source modules
1042 * are likely to want to use them.
1043 */
1044
1045 #define JPEG_RST0 0xD0/* RST0 marker code */
1046 #define JPEG_EOI 0xD9/* EOI marker code */
1047 #define JPEG_APP0 0xE0/* APP0 marker code */
1048 #define JPEG_COM 0xFE/* COM marker code */
1049
1050
1051/* If we have a brain-damaged compiler that emits warnings (or worse, errors)
1052 * for structure definitions that are never filled in, keep it quiet by
1053 * supplying dummy definitions for the various substructures.
1054 */
1055
1056#ifdef INCOMPLETE_TYPES_BROKEN
1057 #ifndef JPEG_INTERNALS /* will be defined in jpegint.h */
1058struct jvirt_sarray_control { long dummy; };
1059struct jvirt_barray_control { long dummy; };
1060struct jpeg_comp_master { long dummy; };
1061struct jpeg_c_main_controller { long dummy; };
1062struct jpeg_c_prep_controller { long dummy; };
1063struct jpeg_c_coef_controller { long dummy; };
1064struct jpeg_marker_writer { long dummy; };
1065struct jpeg_color_converter { long dummy; };
1066struct jpeg_downsampler { long dummy; };
1067struct jpeg_forward_dct { long dummy; };
1068struct jpeg_entropy_encoder { long dummy; };
1069struct jpeg_decomp_master { long dummy; };
1070struct jpeg_d_main_controller { long dummy; };
1071struct jpeg_d_coef_controller { long dummy; };
1072struct jpeg_d_post_controller { long dummy; };
1073struct jpeg_input_controller { long dummy; };
1074struct jpeg_marker_reader { long dummy; };
1075struct jpeg_entropy_decoder { long dummy; };
1076struct jpeg_inverse_dct { long dummy; };
1077struct jpeg_upsampler { long dummy; };
1078struct jpeg_color_deconverter { long dummy; };
1079struct jpeg_color_quantizer { long dummy; };
1080#endif /* JPEG_INTERNALS */
1081#endif /* INCOMPLETE_TYPES_BROKEN */
1082
1083
1084/*
1085 * The JPEG library modules define JPEG_INTERNALS before including this file.
1086 * The internal structure declarations are read only when that is true.
1087 * Applications using the library should not include jpegint.h, but may wish
1088 * to include jerror.h.
1089 */
1090
1091#ifdef JPEG_INTERNALS
1092 #include "jpegint.h" /* fetch private declarations */
1093 #include "jerror.h" /* fetch error codes too */
1094#endif
1095
1096#endif /* JPEGLIB_H */
diff --git a/core/multimedia/opieplayer/libflash/libflash.pro b/core/multimedia/opieplayer/libflash/libflash.pro
new file mode 100644
index 0000000..d144f0b
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/libflash.pro
@@ -0,0 +1,15 @@
1 TEMPLATE= lib
2 CONFIG += qt warn_on release
3 HEADERS = libflashplugin.h libflashpluginimpl.h
4 SOURCES = libflashplugin.cpp libflashpluginimpl.cpp \
5 adpcm.cc character.cc flash.cc graphic16.cc matrix.cc script.cc \
6 sprite.cc bitmap.cc cxform.cc font.cc graphic24.cc movie.cc \
7 shape.cc sqrt.cc button.cc displaylist.cc graphic.cc graphic32.cc \
8 program.cc sound.cc text.cc
9 TARGET = flashplugin
10 DESTDIR = ../../plugins/codecs
11INCLUDEPATH += $(QPEDIR)/include ..
12DEPENDPATH += ../$(QPEDIR)/include ..
13LIBS += -lqpe
14 VERSION = 1.0.0
15
diff --git a/core/multimedia/opieplayer/libflash/libflashplugin.cpp b/core/multimedia/opieplayer/libflash/libflashplugin.cpp
new file mode 100644
index 0000000..538c695
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/libflashplugin.cpp
@@ -0,0 +1,223 @@
1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "libflashplugin.h"
21
22#if 0
23
24bool LibFlashPlugin::audioReadSamples( short *output, int channel, long samples, int stream ) {
25}
26
27
28bool LibFlashPlugin::audioReReadSamples( short *output, int channel, long samples, int stream ) {
29}
30
31
32bool LibFlashPlugin::audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ) {
33 samplesRead = samples;
34}
35
36
37bool LibFlashPlugin::audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ) {
38}
39
40
41bool LibFlashPlugin::videoReadFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, ColorFormat color_model, int stream ) {
42}
43
44
45bool LibFlashPlugin::videoReadScaledFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, int out_w, int out_h, ColorFormat color_model, int stream ) {
46/*
47 int format = MPEG3_RGB565;
48 switch ( color_model ) {
49 case RGB565:format = MPEG3_RGB565; break;
50 case RGBA8888:format = MPEG3_RGBA8888; break;
51 case BGRA8888:format = MPEG3_BGRA8888; break;
52 }
53*/
54}
55
56
57bool LibFlashPlugin::videoReadYUVFrame( char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h, int stream ) {
58}
59
60
61FlashHandle file;
62FlashDisplay *fd;
63
64#endif
65
66
67LibFlashPlugin::LibFlashPlugin() {
68 file = NULL;
69 fd = 0;
70}
71#include <stdio.h>
72#include <stdlib.h>
73static int readFile(const char *filename, char **buffer, long *size)
74{
75 FILE *in;
76 char *buf;
77 long length;
78
79 printf("read files\n");
80
81 in = fopen(filename,"r");
82 if (in == 0) {
83 perror(filename);
84 return -1;
85 }
86 fseek(in,0,SEEK_END);
87 length = ftell(in);
88 rewind(in);
89 buf = (char *)malloc(length);
90 fread(buf,length,1,in);
91 fclose(in);
92
93 *size = length;
94 *buffer = buf;
95
96 return length;
97}
98
99static void showUrl(char *url, char * /*target*/, void * /*client_data*/) {
100 printf("get url\n");
101 printf("GetURL : %s\n", url);
102}
103
104static void getSwf(char *url, int level, void *client_data) {
105 FlashHandle flashHandle = (FlashHandle) client_data;
106 char *buffer;
107 long size;
108
109 printf("get swf\n");
110
111 printf("LoadMovie: %s @ %d\n", url, level);
112 if (readFile(url, &buffer, &size) > 0) {
113 FlashParse(flashHandle, level, buffer, size);
114 }
115}
116
117bool LibFlashPlugin::open( const QString& fileName ) {
118
119 printf("opening file\n");
120
121 delete fd;
122 fd = new FlashDisplay;
123 fd->pixels = new int[320*240*4];
124 fd->width = 200;
125 fd->bpl = 320*2;
126 fd->height = 300;
127 fd->depth = 16;
128 fd->bpp = 2;
129 fd->flash_refresh = 25;
130 fd->clip_x = 0;
131 fd->clip_y = 0;
132 fd->clip_width = 0;
133 fd->clip_height = 0;
134
135 char *buffer;
136 long size;
137 int status;
138 struct FlashInfo fi;
139
140 if (readFile(fileName.latin1(), &buffer, &size) < 0)
141 exit(2);
142
143 if (!(file = FlashNew()))
144 exit(1);
145
146 do
147 status = FlashParse(file, 0, buffer, size);
148 while (status & FLASH_PARSE_NEED_DATA);
149
150 free(buffer);
151 FlashGetInfo(file, &fi);
152 //FlashSettings(flashHandle, PLAYER_LOOP);
153 FlashGraphicInit(file, fd);
154 FlashSoundInit(file, "/dev/dsp");
155 FlashSetGetUrlMethod(file, showUrl, 0);
156 FlashSetGetSwfMethod(file, getSwf, (void*)file);
157
158 printf("opened file\n");
159}
160
161// If decoder doesn't support audio then return 0 here
162bool LibFlashPlugin::audioSetSample( long sample, int stream ) { return TRUE; }
163long LibFlashPlugin::audioGetSample( int stream ) { return 0; }
164//bool LibFlashPlugin::audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ) { return TRUE; }
165//bool LibFlashPlugin::audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ) { return FALSE; }
166bool LibFlashPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ) { return FALSE; }
167//bool LibFlashPlugin::audioReadSamples( short *output, int channel, long samples, int stream ) { return TRUE; }
168//bool LibFlashPlugin::audioReReadSamples( short *output, int channel, long samples, int stream ) { return TRUE; }
169
170// If decoder doesn't support video then return 0 here
171int LibFlashPlugin::videoStreams() { return 1; }
172int LibFlashPlugin::videoWidth( int stream ) { return 300; }
173int LibFlashPlugin::videoHeight( int stream ) { return 200; }
174double LibFlashPlugin::videoFrameRate( int stream ) { return 25.0; }
175int LibFlashPlugin::videoFrames( int stream ) { return 1000000; }
176bool LibFlashPlugin::videoSetFrame( long frame, int stream ) { return TRUE; }
177long LibFlashPlugin::videoGetFrame( int stream ) { return 0; }
178bool LibFlashPlugin::videoReadFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, ColorFormat color_model, int stream ) { return TRUE; }
179#include <time.h>
180bool LibFlashPlugin::videoReadScaledFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, int out_w, int out_h, ColorFormat color_model, int stream ) {
181 struct timeval wd;
182 FlashEvent fe;
183
184/*
185 delete fd;
186 fd = new FlashDisplay;
187 fd->pixels = output_rows[0];
188 fd->width = 300; // out_w;
189 fd->bpl = 640; // out_w*2;
190 fd->height = 200;//out_h;
191 fd->depth = 16;
192 fd->bpp = 2;
193 fd->flash_refresh = 50;
194 fd->clip_x = 0;//in_x;
195 fd->clip_y = 0;//in_y;
196 fd->clip_width = 300;//in_w;
197 fd->clip_height = 200;//in_h;
198 FlashGraphicInit(file, fd);
199*/
200
201 long cmd = FLASH_WAKEUP;
202 FlashExec(file, cmd, 0, &wd);
203
204 fe.type = FeRefresh;
205 cmd = FLASH_EVENT;
206 FlashExec(file, cmd, &fe, &wd);
207/*
208 for (int i = 0; i < out_h; i++)
209 memcpy( output_rows[i], (char*)fd->pixels + i*fd->bpl, QMIN( fd->width * fd->bpp, out_w * fd->bpp ) );
210 */
211 memcpy( output_rows[0], (char*)fd->pixels, out_w * out_h * 2 );
212}
213
214bool LibFlashPlugin::videoReadYUVFrame( char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h, int stream ) { return TRUE; }
215
216// Profiling
217double LibFlashPlugin::getTime() { return 0.0; }
218
219// Ignore if these aren't supported
220bool LibFlashPlugin::setSMP( int cpus ) { return TRUE; }
221bool LibFlashPlugin::setMMX( bool useMMX ) { return TRUE; }
222
223
diff --git a/core/multimedia/opieplayer/libflash/libflashplugin.h b/core/multimedia/opieplayer/libflash/libflashplugin.h
new file mode 100644
index 0000000..532bca2
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/libflashplugin.h
@@ -0,0 +1,96 @@
1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef LIBFLASH_PLUGIN_H
21#define LIBFLASH_PLUGIN_H
22
23
24#include <qstring.h>
25#include <qapplication.h>
26#include "flash.h"
27#include "mediaplayerplugininterface.h"
28
29
30class LibFlashPlugin : public MediaPlayerDecoder {
31
32public:
33 LibFlashPlugin();
34 ~LibFlashPlugin() { close(); }
35
36 const char *pluginName() { return "LibFlashPlugin: " PLUGIN_NAME " " FLASH_VERSION_STRING; }
37 const char *pluginComment() { return "This is the libflash library: " PLUGIN_NAME " " FLASH_VERSION_STRING; }
38 double pluginVersion() { return 1.0; }
39
40 bool isFileSupported( const QString& fileName ) { return fileName.right(4) == ".swf"; }
41 bool open( const QString& fileName );
42 bool close() { FlashClose( file ); file = NULL; return TRUE; }
43 bool isOpen() { return file != NULL; }
44 const QString &fileInfo() { return strInfo = qApp->translate( "MediaPlayer", "No Information Available", "media plugin text" ); }
45
46 // If decoder doesn't support audio then return 0 here
47 int audioStreams() { return 1; }
48 int audioChannels( int /*stream*/ ) { return 2; }
49 int audioFrequency( int /*stream*/ ) { return 44100; }
50 int audioSamples( int /*stream*/ ) { return 1000000; }
51 bool audioSetSample( long sample, int stream );
52 long audioGetSample( int stream );
53 //bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream );
54 //bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream );
55 bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream );
56 //bool audioReadSamples( short *output, int channel, long samples, int stream );
57 //bool audioReReadSamples( short *output, int channel, long samples, int stream );
58
59 // If decoder doesn't support video then return 0 here
60 int videoStreams();
61 int videoWidth( int stream );
62 int videoHeight( int stream );
63 double videoFrameRate( int stream );
64 int videoFrames( int stream );
65 bool videoSetFrame( long frame, int stream );
66 long videoGetFrame( int stream );
67 bool videoReadFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, ColorFormat color_model, int stream );
68 bool videoReadScaledFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, int out_w, int out_h, ColorFormat color_model, int stream );
69 bool videoReadYUVFrame( char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h, int stream );
70
71 // Profiling
72 double getTime();
73
74 // Ignore if these aren't supported
75 bool setSMP( int cpus );
76 bool setMMX( bool useMMX );
77
78 // Capabilities
79 bool supportsAudio() { return TRUE; }
80 bool supportsVideo() { return TRUE; }
81 bool supportsYUV() { return TRUE; }
82 bool supportsMMX() { return TRUE; }
83 bool supportsSMP() { return TRUE; }
84 bool supportsStereo() { return TRUE; }
85 bool supportsScaling() { return TRUE; }
86
87private:
88 FlashHandle file;
89 FlashDisplay *fd;
90 QString strInfo;
91
92};
93
94
95#endif
96
diff --git a/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp b/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp
new file mode 100644
index 0000000..af2c07e
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp
@@ -0,0 +1,70 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "libflashplugin.h"
21#include "libflashpluginimpl.h"
22
23
24LibFlashPluginImpl::LibFlashPluginImpl()
25 : libflashplugin(0), ref(0)
26{
27}
28
29
30LibFlashPluginImpl::~LibFlashPluginImpl()
31{
32 if ( libflashplugin )
33 delete libflashplugin;
34}
35
36
37MediaPlayerDecoder *LibFlashPluginImpl::decoder()
38{
39 if ( !libflashplugin )
40 libflashplugin = new LibFlashPlugin;
41 return libflashplugin;
42}
43
44
45MediaPlayerEncoder *LibFlashPluginImpl::encoder()
46{
47 return NULL;
48}
49
50
51#ifndef QT_NO_COMPONENT
52
53
54QRESULT LibFlashPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
55{
56 *iface = 0;
57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
58 *iface = this, (*iface)->addRef();
59 return QS_OK;
60}
61
62
63Q_EXPORT_INTERFACE()
64{
65 Q_CREATE_INSTANCE( LibFlashPluginImpl )
66}
67
68
69#endif
70
diff --git a/core/multimedia/opieplayer/libflash/libflashpluginimpl.h b/core/multimedia/opieplayer/libflash/libflashpluginimpl.h
new file mode 100644
index 0000000..b5cc869
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/libflashpluginimpl.h
@@ -0,0 +1,53 @@
1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef LIBFLASH_PLUGIN_IMPL_H
21#define LIBFLASH_PLUGIN_IMPL_H
22
23
24#include "../mediaplayerplugininterface.h"
25
26
27class LibFlashPlugin;
28
29
30class LibFlashPluginImpl : public MediaPlayerPluginInterface
31{
32public:
33 LibFlashPluginImpl();
34 virtual ~LibFlashPluginImpl();
35
36#ifndef QT_NO_COMPONENT
37
38 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
39 Q_REFCOUNT
40
41#endif
42
43 virtual MediaPlayerDecoder *decoder();
44 virtual MediaPlayerEncoder *encoder();
45
46private:
47 LibFlashPlugin *libflashplugin;
48 ulong ref;
49};
50
51
52#endif
53
diff --git a/core/multimedia/opieplayer/libflash/matrix.cc b/core/multimedia/opieplayer/libflash/matrix.cc
new file mode 100644
index 0000000..0d8c82c
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/matrix.cc
@@ -0,0 +1,68 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "matrix.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29Matrix::Matrix()
30{
31 a = 1.0;
32 d = 1.0;
33 b = c = 0.0;
34 tx = ty = 0;
35}
36
37Matrix Matrix::operator*(Matrix m)
38{
39 Matrix mat;
40
41 mat.a = this->a * m.a + this->b * m.c;
42 mat.b = this->a * m.b + this->b * m.d;
43 mat.c = this->c * m.a + this->d * m.c;
44 mat.d = this->c * m.b + this->d * m.d;
45
46 mat.tx = this->getX(m.tx,m.ty);
47 mat.ty = this->getY(m.tx,m.ty);
48
49 return mat;
50}
51
52Matrix Matrix::invert()
53{
54 Matrix mat;
55 float det;
56
57 det = a*d-b*c;
58
59 mat.a = d/det;
60 mat.b = -b/det;
61 mat.c = -c/det;
62 mat.d = a/det;
63
64 mat.tx = - (long)(mat.a * tx + mat.b * ty);
65 mat.ty = - (long)(mat.c * tx + mat.d * ty);
66
67 return mat;
68}
diff --git a/core/multimedia/opieplayer/libflash/matrix.h b/core/multimedia/opieplayer/libflash/matrix.h
new file mode 100644
index 0000000..83b54c2
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/matrix.h
@@ -0,0 +1,49 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _MATRIX_H_
21#define _MATRIX_H_
22
23struct Matrix {
24 float a,b,c,d;
25 long tx,ty;
26public:
27 Matrix operator*(Matrix);
28 Matrix invert();
29 Matrix();
30
31#ifdef DUMP
32 void dump(BitStream *bs);
33#endif
34
35 inline
36 long Matrix::getX(long x, long y)
37 {
38 return (long) (x*a+y*b+tx);
39 };
40
41 inline
42 long Matrix::getY(long x, long y)
43 {
44 return (long) (x*c+y*d+ty);
45 };
46
47};
48
49#endif /* _MATRIX_H_ */
diff --git a/core/multimedia/opieplayer/libflash/movie.cc b/core/multimedia/opieplayer/libflash/movie.cc
new file mode 100644
index 0000000..349e43b
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/movie.cc
@@ -0,0 +1,171 @@
1////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22#include "movie.h"
23
24FlashMovie::FlashMovie()
25{
26 gd = NULL;
27 sm = NULL;
28 getSwf = NULL;
29 getUrl = NULL;
30 cursorOnOff = NULL;
31 buttons_updated = 0;
32 scheduledTime.tv_sec = -1;
33 cur_focus = NULL;
34 lost_over = NULL;
35 msPerFrame = 0;
36
37 /* mouse handling */
38 mouse_active = 0;
39 mouse_x = -1;
40 mouse_y = -1;
41 button_pressed = 0;
42 refresh = 1;
43}
44
45FlashMovie::~FlashMovie()
46{
47 CInputScript *n;
48
49 while (main != NULL) {
50 n = main->next;
51 delete main;
52 main = n;
53 }
54
55 if (gd) delete gd;
56 if (sm) delete sm;
57}
58
59int
60FlashMovie::processMovie(GraphicDevice *gd, SoundMixer *sm)
61{
62 CInputScript *script;
63 int wakeUp = 0;
64
65 if (sm && sm->playSounds()) {
66 wakeUp = 1;
67 }
68 for (script = this->main; script != NULL; script = script->next) {
69 if (script->program == NULL) continue;
70 if (script->program->nbFrames == 0) continue;
71 if (script->program->processMovie(gd,sm)) {
72 wakeUp = 1;
73 }
74 }
75 renderMovie();
76 return wakeUp;
77}
78
79int
80FlashMovie::handleEvent(GraphicDevice *gd, SoundMixer *sm, FlashEvent *event)
81{
82 int wakeUp = 0;
83
84 if (sm && sm->playSounds()) {
85 wakeUp = 1;
86 }
87 if (this->main == 0) return 0;
88 if (this->main->program == 0) return 0;
89 if (this->main->program->handleEvent(gd, sm, event)) {
90 wakeUp = 1;
91 }
92 renderMovie();
93 return wakeUp;
94}
95
96/* current focus bigger and translated if needed */
97void
98FlashMovie::renderFocus()
99{
100 Rect rect,boundary;
101 Matrix mat;
102
103 if (mouse_active || !cur_focus) return;
104
105 /* rect is the bbox in screen coordinates */
106
107 // Compute the bounding box in screen coordinates
108 cur_focus->character->getBoundingBox(&boundary,cur_focus);
109 mat = (*gd->adjust) * cur_focus->renderMatrix;
110 transformBoundingBox(&rect, &mat, &boundary, 1);
111
112 gd->drawBox(rect.xmin, rect.ymin, rect.xmax, rect.ymax);
113}
114
115void
116FlashMovie::renderMovie()
117{
118 CInputScript *script,*prev,*next;
119 Rect clipping;
120 Matrix identity;
121
122 clipping.reset();
123
124 // First pass to update the clipping region
125 for (script = this->main; script != NULL; script = script->next) {
126 if (script->level == -1) {
127 clipping.xmin = -32768;
128 clipping.ymin = -32768;
129 clipping.xmax = 32767;
130 clipping.ymax = 32767;
131 continue;
132 }
133 if (script->program == NULL) continue;
134 if (script->program->dl->bbox.xmin == LONG_MAX) continue;
135 transformBoundingBox(&clipping, &identity, &script->program->dl->bbox, 0);
136 script->program->render = 0;
137 }
138
139 if (clipping.xmin == LONG_MAX) return;
140
141 // Update the clipping region
142 gd->updateClippingRegion(&clipping);
143 gd->clearCanvas();
144
145 // Second pass to render the movie
146 for (script = this->main; script != NULL; script = script->next) {
147 if (script->level == -1) continue;
148 if (script->program == NULL) continue;
149 script->program->dl->render(gd);
150 }
151 renderFocus();
152
153 // Final pass to delete some movies
154 script = this->main;
155 prev = 0;
156 while (script != NULL) {
157 if (script->level == -1) {
158 next = script->next;
159 if (prev == 0) {
160 this->main = next;
161 } else {
162 prev->next = next;
163 }
164 delete script;
165 script = next;
166 } else {
167 prev = script;
168 script = script->next;
169 }
170 }
171}
diff --git a/core/multimedia/opieplayer/libflash/movie.h b/core/multimedia/opieplayer/libflash/movie.h
new file mode 100644
index 0000000..d83ce79
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/movie.h
@@ -0,0 +1,68 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _MOVIE_H_
21#define _MOVIE_H_
22
23#include "swf.h"
24
25struct FlashMovie {
26 /* true if a button has been moved */
27 int buttons_updated;
28
29 /* current keyboard focus */
30 DisplayListEntry *cur_focus;
31
32 /* mouse state */
33 long mouse_active;
34 long mouse_x;
35 long mouse_y;
36 int button_pressed;
37
38 Button *lost_over;
39
40 /* a button can return to a given state after some time */
41 FlashEvent scheduledEvent;
42 struct timeval scheduledTime;
43
44 int refresh;
45
46 CInputScript *main;
47 long msPerFrame;
48 GraphicDevice*gd;
49 SoundMixer *sm;
50
51 void (*getUrl)(char *,char *, void *);
52 void *getUrlClientData;
53
54 void (*getSwf)(char *url, int level, void *clientData);
55 void *getSwfClientData;
56
57 void (*cursorOnOff)(int , void *);
58 void *cursorOnOffClientData;
59
60 FlashMovie();
61 ~FlashMovie();
62 int processMovie(GraphicDevice *gd, SoundMixer *sm);
63 int handleEvent(GraphicDevice *gd, SoundMixer *sm, FlashEvent *event);
64 void renderMovie();
65 void renderFocus();
66};
67
68#endif /* _MOVIE_H_ */
diff --git a/core/multimedia/opieplayer/libflash/program.cc b/core/multimedia/opieplayer/libflash/program.cc
new file mode 100644
index 0000000..c6e8c0f
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/program.cc
@@ -0,0 +1,921 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#define NOTHING 0x0
26#define WAKEUP 0x1
27#define GOTO 0x2
28#define REFRESH 0x4
29
30#ifdef RCSID
31static char *rcsid = "$Id$";
32#endif
33
34#define PRINT 0
35
36int debug = 0;
37
38Program::Program(FlashMovie *movie, long n)
39{
40 long f;
41
42 this->movie = movie;
43
44 totalFrames = 0;
45
46 dl = new DisplayList(movie);
47 if (dl == NULL) return;
48 frames = new Frame[n];
49 if (frames == NULL) {
50 delete dl;
51 return;
52 }
53
54 nbFrames = 0;
55 totalFrames = n;
56 currentFrame = 0;
57 loadingFrame = 0;
58 movieWait = 1;
59 nextFrame = currentFrame;
60 for(f = 0; f < n; f++)
61 {
62 frames[f].controls = 0;
63 frames[f].label = NULL;
64 }
65
66 movieStatus = MoviePlay;
67 settings = 0;
68}
69
70Program::~Program()
71{
72 int i;
73 Control *ctrl, *ctrl1;
74
75 delete dl;
76
77 if (frames != NULL) {
78 for(i=0;i<nbFrames;i++) {
79 ctrl = frames[i].controls;
80 if (frames[i].label) free(frames[i].label);
81 while (ctrl != NULL) {
82 ctrl1 = ctrl->next;
83 ctrl->next = NULL;
84 delete ctrl;
85 ctrl = ctrl1;
86 }
87 }
88
89 delete[] frames;
90 }
91}
92
93void
94Program::validateLoadingFrame()
95{
96 nbFrames = loadingFrame;
97 loadingFrame++;
98 movieWait = 0;
99}
100
101 Frame*
102Program::getFrames()
103{
104 return frames;
105}
106
107long
108Program::getNbFrames()
109{
110 return nbFrames;
111}
112
113DisplayList *
114Program::getDisplayList()
115{
116 return dl;
117}
118
119long
120Program::getCurrentFrame()
121{
122 return currentFrame;
123}
124
125void
126Program::setCurrentFrame(long n)
127{
128 currentFrame = n;
129 nextFrame = n;
130 //refresh = 1;
131}
132
133void
134Program::gotoFrame(GraphicDevice *gd, long frame)
135{
136 long f;
137
138 //printf("GotoFrame %d (Current = %d)\n", frame, currentFrame);
139 dl->clearList();
140
141 for(f=0; f <= frame; f++) {
142 runFrame(gd, 0, f, 0);
143 }
144}
145
146long
147Program::runFrame(GraphicDevice *gd, SoundMixer *sm, long f, long action)
148{
149 Control *ctrl;
150 Character*character;
151 Matrix *matrix;
152 Cxform *cxform;
153 long status = NOTHING;
154 long update = 0;
155 char *name;
156
157#if PRINT&1
158 if (action) printf("Prog %x (dl=%x): Frame N° %d/%d\n", this, this->dl, f, nbFrames-1);
159#endif
160 movie->buttons_updated = 0;
161
162 for(ctrl = frames[f].controls; ctrl; ctrl = ctrl->next)
163 {
164 switch (ctrl->type)
165 {
166 case ctrlPlaceObject:
167 case ctrlPlaceObject2:
168 character = 0;
169 matrix = 0;
170 cxform = 0;
171 name = "";
172 if (ctrl->flags & placeHasCharacter) {
173 character = ctrl->character;
174 }
175 if (ctrl->flags & placeHasMatrix) {
176 matrix = &ctrl->matrix;
177 }
178 if (ctrl->flags & placeHasColorXform) {
179 cxform = &ctrl->cxform;
180 }
181 if (ctrl->flags & placeHasName) {
182 name = ctrl->name;
183 }
184 if (!ctrl->clipDepth) {// Ignore
185 dl->placeObject(gd,character, ctrl->depth, matrix, cxform, name);
186 update = 1;
187 }
188 break;
189 case ctrlRemoveObject:
190 character = ctrl->character;
191
192 if (!character) break;// Should not happen
193
194 dl->removeObject(gd, character, ctrl->depth);
195 if (action) {
196 character->reset();
197 update = 1;
198 }
199 break;
200 case ctrlRemoveObject2:
201 character = dl->removeObject(gd,NULL, ctrl->depth);
202 if (character && action) {
203 character->reset();
204 update = 1;
205 }
206 break;
207 // Actions
208 case ctrlDoAction:
209 if (action) {
210 status = doAction(gd, ctrl->actionRecords, sm);
211 }
212 break;
213 case ctrlStartSound:
214 if (action && sm) {
215 sm->startSound( (Sound *)ctrl->character );
216 }
217 break;
218 case ctrlStopSound:
219 if (action && sm) {
220 sm->stopSounds();
221 }
222 break;
223 case ctrlBackgroundColor:
224 if (action) {
225 if (gd->setBackgroundColor(ctrl->color)) {
226 dl->bbox.xmin = -32768;
227 dl->bbox.ymin = -32768;
228 dl->bbox.xmax = 32768;
229 dl->bbox.ymax = 32768;
230 }
231 }
232 break;
233 }
234 }
235 if (movie->buttons_updated) {
236 dl->updateButtons(movie);
237 }
238
239 if (status & GOTO) {
240 if (nextFrame < nbFrames) {
241 gotoFrame(gd,nextFrame);
242 if (nextFrame != f)
243 if (movieStatus == MoviePaused) runFrame(gd,sm,nextFrame);
244 update = 1;
245 }
246 }
247
248#if PRINT&1
249 if (action) printf("Frame N° %d ready\n", f);
250#endif
251 return update;
252}
253
254long
255Program::nestedMovie(GraphicDevice *gd, SoundMixer *sm, Matrix *mat, Cxform *cxform)
256{
257 if (movieStatus == MoviePlay) {
258 // Movie Beeing Played
259 advanceFrame();
260 if (currentFrame == 0) {
261 dl->clearList();
262 }
263 runFrame(gd, sm, currentFrame);
264 if (nbFrames == 1) {
265 pauseMovie();
266 }
267 }
268
269 return (movieStatus == MoviePlay);
270}
271
272long
273Program::processMovie(GraphicDevice *gd, SoundMixer *sm)
274{
275 int wakeUp = 0;
276
277#if PRINT&1
278 printf("Prog %x (dl=%x): Current = %d Next = %d Wait = %d Status = %d\n", this, this->dl, currentFrame, nextFrame, movieWait, movieStatus);
279#endif
280
281 if (movieStatus == MoviePlay && movieWait == 0) {
282 // Movie Beeing Played
283 advanceFrame();
284 if (currentFrame == 0) {
285 dl->clearList();
286 }
287 wakeUp |= runFrame(gd, sm, currentFrame);
288 wakeUp |= dl->updateSprites();
289 if (nextFrame == nbFrames) {
290 if (nbFrames != totalFrames) {
291 movieWait = 1;
292 } else if ((settings & PLAYER_LOOP) == 0) {
293 pauseMovie();
294 }
295 }
296 } else {
297 wakeUp |= dl->updateSprites();
298 }
299
300 if (wakeUp) {
301 render = 1;
302 }
303
304 return (wakeUp || movieStatus == MoviePlay);
305}
306
307/* timer (ms) -1 = delete timer */
308void setFlashTimer(struct timeval *tv, int time_ms)
309{
310 if (time_ms == -1) {
311 tv->tv_sec = -1;
312 } else {
313 gettimeofday(tv,0);
314
315 tv->tv_usec += time_ms*1000;
316 while (tv->tv_usec > 1000000) {
317 tv->tv_usec -= 1000000;
318 tv->tv_sec++;
319 }
320 }
321}
322
323int checkFlashTimer(struct timeval *tv)
324{
325 struct timeval now;
326
327 if (tv->tv_sec == -1) return 0;
328
329 gettimeofday(&now,0);
330 return (now.tv_sec > tv->tv_sec ||
331 (now.tv_sec == tv->tv_sec && now.tv_usec >= tv->tv_usec));
332}
333
334/* bbox */
335typedef struct {
336 long x1,y1,x2,y2;
337} ButtonBoundingBox;
338
339
340static void button_bbox_func(void *id, long y, long start, long end)
341{
342 ButtonBoundingBox *h = (ButtonBoundingBox *) id;
343
344 if (y < h->y1) h->y1 = y;
345 if (y > h->y2) h->y2 = y;
346 if (start < h->x1) h->x1 = start;
347 if (end > h->x2) h->x2 = end;
348}
349
350void computeBBox(FlashMovie *movie, Rect *rect, DisplayListEntry *e)
351{
352 ButtonBoundingBox bb;
353
354 bb.x1 = LONG_MAX;
355 bb.y1 = LONG_MAX;
356 bb.x2 = LONG_MIN;
357 bb.y2 = LONG_MIN;
358
359 e->character->getRegion(movie->gd,&e->renderMatrix,&bb,button_bbox_func);
360
361 rect->xmin = bb.x1 / FRAC;
362 rect->xmax = bb.x2 / FRAC;
363 rect->ymin = bb.y1;
364 rect->ymax = bb.y2;
365}
366
367void transform_coords(long *x_ptr,long *y_ptr, long cx, long cy, long dx, long dy)
368{
369 long x,y,x1,y1;
370 x = *x_ptr;
371 y = *y_ptr;
372
373 x -= cx;
374 y -= cy;
375
376 if (dx < 0) {
377 /* left */
378 x1 = - x;
379 y1 = y;
380 } else if (dy < 0) {
381 /* up */
382 y1 = x;
383 x1 = -y;
384 } else if (dy > 0) {
385 /* down */
386 y1 = x;
387 x1 = y;
388 } else {
389 /* right */
390 x1 = x;
391 y1 = y;
392 }
393
394 *x_ptr = x1;
395 *y_ptr = y1;
396}
397
398typedef struct {
399 FlashMovie *movie;
400 DisplayListEntry *emin,*cur_focus;
401 long dmin;
402 long w,cx,cy,dx,dy;
403} ButtonFocus;
404
405static int button_focus(void *opaque, Program *prg, DisplayListEntry *e)
406{
407 ButtonFocus *h=(ButtonFocus *)opaque;
408 Rect rect;
409 long d,x,y;
410
411 if (e != h->cur_focus) {
412 computeBBox(h->movie,&rect,e);
413 x = (rect.xmin + rect.xmax) / 2;
414 y = (rect.ymin + rect.ymax) / 2;
415
416 /* transform the coords so that the angular sector is directed to the right */
417 transform_coords(&x,&y,h->cx,h->cy,h->dx,h->dy);
418
419 /* inside it ? */
420 if ( x >= 0 &&
421 (y - x - h->w) <= 0 &&
422 (y + x + h->w) >= 0) {
423 d = x*x + y*y;
424
425 if (d < h->dmin) {
426 h->dmin = d;
427 h->emin = e;
428 }
429 }
430 }
431 return 0;
432}
433
434DisplayListEntry *moveFocus(FlashMovie *movie, long dx, long dy,
435 DisplayListEntry *cur_focus)
436{
437 Rect cur_rect;
438 ButtonFocus h;
439
440 h.movie = movie;
441 h.dx = dx;
442 h.dy = dy;
443
444 computeBBox(movie,&cur_rect,cur_focus);
445 /* center */
446 h.cx = (cur_rect.xmin + cur_rect.xmax) / 2;
447 h.cy = (cur_rect.ymin + cur_rect.ymax) / 2;
448
449 /* width/2 of the 45 degrees angular sector */
450 if (dy != 0) {
451 /* for vertical displacement, we have a larger width */
452 h.w = (cur_rect.xmax - cur_rect.xmin) / 2;
453 } else {
454 /* zero width for horizontal displacement */
455 h.w = 0;
456 }
457
458 /* now we select the nearest button in the angular sector */
459 h.dmin = LONG_MAX;
460 h.emin = NULL;
461 h.cur_focus = cur_focus;
462
463 exploreButtons(movie, &h, button_focus);
464
465 return h.emin;
466}
467
468static int button_newfocus(void *opaque, Program *prg, DisplayListEntry *e)
469{
470 * (DisplayListEntry **)opaque = e;
471 return 2;
472}
473
474static int button_nextfocus(void *opaque, Program *prg, DisplayListEntry *e)
475{
476 static int found = 0;
477 DisplayListEntry **focus;
478
479 focus = (DisplayListEntry **)opaque;
480 if (found) {
481 *focus = e;
482 found = 0;
483 return 2;
484 }
485 if (e == *focus) {
486 found = 1;
487 }
488 return 0;
489}
490
491
492/* XXX: should not be here (one level upper) */
493long
494Program::handleEvent(GraphicDevice *gd, SoundMixer *sm, FlashEvent *fe)
495{
496 ActionRecord*action;
497 Program *prog;
498 long status = 0;
499 DisplayListEntry *cur_focus, *new_focus;
500 long dx,dy;
501 int refresh;
502
503 refresh = 0;
504
505 switch(fe->type) {
506
507 case FeKeyRelease:
508 if (movie->mouse_active == 0) {
509
510 if (movie->cur_focus) {
511 movie->cur_focus->owner->updateBoundingBox(movie->cur_focus);
512 movie->cur_focus->renderState = stateOver;
513 movie->cur_focus->owner->updateBoundingBox(movie->cur_focus);
514 }
515 }
516 break;
517
518 case FeKeyPress:
519
520 movie->mouse_active = 0;
521
522 /* find the button which has the focus */
523 cur_focus = movie->cur_focus;
524
525 if (fe->key == FeKeyEnter) {
526 /* selection */
527 if (cur_focus) {
528 /* select the button */
529 cur_focus->owner->updateBoundingBox(cur_focus);
530 cur_focus->renderState = stateDown;
531 ((Button *)cur_focus->character)->updateButtonState(cur_focus);
532 cur_focus->owner->updateBoundingBox(cur_focus);
533
534 movie->scheduledEvent.type = FeKeyRelease;
535 movie->scheduledEvent.key = FeKeyEnter;
536
537 setFlashTimer(&movie->scheduledTime, 250); /* 250 ms down */
538 }
539 } else {
540 /* displacement */
541
542 if (cur_focus == NULL) {
543 /* no current focus : set one */
544 exploreButtons(movie, &cur_focus, button_newfocus);
545 if (cur_focus) {
546 cur_focus->renderState = stateOver;
547 ((Button *)cur_focus->character)->updateButtonState(cur_focus);
548 cur_focus->owner->updateBoundingBox(cur_focus);
549 }
550 movie->cur_focus = cur_focus;
551 } else {
552 /* move the focus (test) */
553 switch(fe->key) {
554 case FeKeyNext:
555 /* Next available */
556 cur_focus->owner->updateBoundingBox(cur_focus);
557 cur_focus->renderState = stateUp;
558 ((Button *)cur_focus->character)->updateButtonState(cur_focus);
559 cur_focus->owner->updateBoundingBox(cur_focus);
560 exploreButtons(movie, &cur_focus, button_nextfocus);
561 if (cur_focus) {
562 cur_focus->renderState = stateOver;
563 ((Button *)cur_focus->character)->updateButtonState(cur_focus);
564 cur_focus->owner->updateBoundingBox(cur_focus);
565 }
566 movie->cur_focus = cur_focus;
567 dx = 0;
568 dy = 0;
569 break;
570 case FeKeyUp:
571 dx = 0;
572 dy = -1;
573 break;
574 case FeKeyDown:
575 dx = 0;
576 dy = 1;
577 break;
578 case FeKeyLeft:
579 dx = -1;
580 dy = 0;
581 break;
582 case FeKeyRight:
583 dx = 1;
584 dy = 0;
585 break;
586 default:
587 /* should not happen */
588 dx = 0;
589 dy = 0;
590 break;
591 }
592
593 if (dx != 0 || dy != 0) {
594
595 new_focus = moveFocus(movie, dx, dy, cur_focus);
596 if (new_focus) {
597 cur_focus->owner->updateBoundingBox(cur_focus);
598 cur_focus->renderState = stateUp;
599 ((Button *)cur_focus->character)->updateButtonState(cur_focus);
600 cur_focus->owner->updateBoundingBox(cur_focus);
601
602 if (computeActions(movie, &prog, &action)) {
603 status |= prog->doAction(gd, action, sm);
604 }
605
606 new_focus->renderState = stateOver;
607 ((Button *)new_focus->character)->updateButtonState(new_focus);
608 movie->cur_focus = new_focus;
609 new_focus->owner->updateBoundingBox(new_focus);
610 } else {
611 return 0;
612 }
613 }
614 }
615 if (movie->cur_focus == NULL) return 0;
616 }
617 break;
618
619 case FeMouseMove:
620 movie->mouse_active = 1;
621 movie->mouse_x = fe->x * FRAC;
622 movie->mouse_y = fe->y * FRAC;
623 dl->updateButtons(movie);
624 break;
625
626 case FeButtonPress:
627 movie->mouse_active = 1;
628 movie->button_pressed = 1;
629 dl->updateButtons(movie);
630 break;
631
632 case FeButtonRelease:
633 movie->mouse_active = 1;
634 movie->button_pressed = 0;
635 dl->updateButtons(movie);
636 break;
637
638 default:
639 return 0;
640 }
641
642 if (computeActions(movie, &prog, &action)) {
643 status |= prog->doAction(gd, action, sm);
644 }
645
646 if (status & REFRESH) {
647 status |= WAKEUP;
648 refresh = 1;
649 }
650 if (status & GOTO) {
651 if (nextFrame < nbFrames) {
652 gotoFrame(gd, nextFrame);
653 if (movieStatus == MoviePaused) runFrame(gd,sm,nextFrame);
654 refresh = 1;
655 }
656 }
657
658 if (refresh) {
659 dl->updateSprites();
660 render = 1;
661 }
662 return (refresh || movieStatus == MoviePlay);
663}
664
665long
666Program::doAction(GraphicDevice *gd, ActionRecord *action, SoundMixer *sm)
667{
668 long status = NOTHING;
669 long f;
670 char *target = "";
671 long skip = 0;
672
673 while(action)
674 {
675 if (skip) skip--;
676 else
677 switch (action->action)
678 {
679 case ActionPlaySound:
680#if PRINT&2
681 printf("Prog %x : PlaySound\n", this);
682#endif
683 if (sm) {
684 sm->startSound(action->sound);
685 }
686 status |= WAKEUP;
687 break;
688 case ActionRefresh:
689#if PRINT&2
690 printf("Prog %x : Refresh\n", this);
691#endif
692 status |= REFRESH;
693 break;
694 case ActionGotoFrame:
695#if PRINT&2
696 printf("Prog %x : GotoFrame %d\n", this, action->frameIndex);
697#endif
698 if (target[0] == 0) {
699 if (action->frameIndex < nbFrames) {
700 currentFrame = action->frameIndex;
701 pauseMovie();
702 status |= WAKEUP|GOTO;
703 }
704 }
705 break;
706 case ActionGetURL:
707#if PRINT&2
708 printf("Prog %x : GetURL %s target = %s\n", this, action->url, action->target);
709#endif
710 {
711 int len,level;
712 len = strlen(action->target);
713
714 if (len > 6 && memcmp(action->target,"_level", 6) == 0) {
715 level = atoi(action->target + 6);
716 loadNewSwf(movie, action->url, level);
717 } else {
718 if (movie->getUrl) {
719 movie->getUrl(action->url, action->target, movie->getUrlClientData);
720 }
721 }
722 }
723 break;
724 case ActionNextFrame:
725 nextFrame = currentFrame+1;
726 movieStatus = MoviePlay;
727 status |= WAKEUP;
728 break;
729 case ActionPrevFrame:
730 nextFrame = currentFrame-1;
731 status |= WAKEUP|GOTO;
732 break;
733 case ActionPlay:
734#if PRINT&2
735 printf("Prog %x : Play\n", this);
736#endif
737 if (target[0] == 0) {
738 movieStatus = MoviePlay;
739 if ((status & GOTO) == 0) {
740 if (currentFrame == nextFrame) advanceFrame();
741 }
742 status |= WAKEUP;
743 }
744 break;
745 case ActionStop:
746#if PRINT&2
747 printf("Prog %x : Stop\n", this);
748#endif
749 if (target[0] == 0) {
750 movieStatus = MoviePaused;
751 nextFrame = currentFrame;
752 }
753 break;
754 case ActionToggleQuality:
755 break;
756 case ActionStopSounds:
757 if (sm) {
758 sm->stopSounds();
759 }
760 break;
761 case ActionWaitForFrame:
762 if (action->frameIndex >= nbFrames) {
763 skip = action->skipCount;
764 }
765 break;
766 case ActionSetTarget:
767#if PRINT&2
768 printf("Prog %x : SetTarget '%s'\n", this, action->target);
769#endif
770 target = action->target;
771 break;
772 case ActionGoToLabel:
773#if PRINT&2
774 printf("Prog %x : GotoFrame '%s'\n", this, action->frameLabel);
775#endif
776 f = searchFrame(gd, action->frameLabel, target);
777 if (f >= 0) {
778 currentFrame = f;
779 pauseMovie();
780 status |= WAKEUP|GOTO;
781 } else {
782 status |= REFRESH;
783 }
784 break;
785 }
786 action = action->next;
787 }
788 return status;
789}
790
791void
792Program::setCurrentFrameLabel(char *label)
793{
794 frames[loadingFrame].label = label;
795}
796
797void
798Program::rewindMovie()
799{
800 currentFrame = 0;
801 nextFrame = 0;
802}
803
804void
805Program::pauseMovie()
806{
807 movieStatus = MoviePaused;
808 nextFrame = currentFrame;
809}
810
811void
812Program::continueMovie()
813{
814 movieStatus = MoviePlay;
815}
816
817void
818Program::nextStepMovie()
819{
820 if (movieStatus == MoviePaused) {
821 advanceFrame();
822 }
823}
824
825void
826Program::advanceFrame()
827{
828 currentFrame = nextFrame;
829 nextFrame = currentFrame+1;
830 if (currentFrame == nbFrames) {
831 currentFrame = 0;
832 nextFrame = 0;
833 movieStatus = MoviePlay;
834 }
835}
836
837void
838Program::addControlInCurrentFrame(Control *ctrl)
839{
840 Control *c;
841
842 ctrl->next = 0;
843 if (frames[loadingFrame].controls == 0) {
844 frames[loadingFrame].controls = ctrl;
845 } else {
846 for(c = frames[loadingFrame].controls; c->next; c = c->next);
847 c->next = ctrl;
848 }
849}
850
851void
852Program::modifySettings(long flags)
853{
854 settings = flags;
855}
856
857long
858Program::searchFrame(GraphicDevice *gd, char *label, char *target)
859{
860 long f;
861 DisplayListEntry *e;
862 Program *prg;
863
864 // Current movie
865 if (target[0] == 0) {
866 for(f=0; f < nbFrames; f++)
867 {
868 if (frames[f].label && !strcmp(label,frames[f].label)) {
869 return f;
870 }
871 }
872 }
873
874 // Kludge !!!
875 for (e = dl->list; e; e = e->next) {
876 if (e->character->isSprite()) {
877 prg = ((Sprite *)e->character)->program;
878 f = prg->searchFrame(gd,label,"");
879 if (f >= 0 && f < prg->nbFrames) {
880 prg->dl->updateBoundingBox(e);
881 prg->gotoFrame(gd, f);
882 prg->nextFrame = f;
883 prg->dl->updateBoundingBox(e);
884 return -1;
885 }
886 }
887 }
888
889 return -1;
890}
891
892void loadNewSwf(FlashMovie *movie, char *url, int level)
893{
894 CInputScript *s,*prev,**l;
895
896 if (movie->getSwf == NULL) return;
897
898 for(s = movie->main, prev = 0; s != NULL; prev = s, s = s->next) {
899 if (s->level == level) {
900 // Mark movie to be deleted
901 s->level = -1;
902 break;
903 }
904 }
905
906 //printf("Unload movie @ %d\n", level);
907
908 if (*url == 0) return;// Just UnloadMovie
909
910 s = new CInputScript(level);
911 if (s == NULL) return;
912
913 /* insert it in the right order */
914 l = &movie->main;
915 while (*l != NULL && (*l)->level < level) l = &(*l)->next;
916 s->next = *l;
917 *l = s;
918
919 // Notify the external loader of a new movie to load
920 movie->getSwf(url, level, movie->getSwfClientData);
921}
diff --git a/core/multimedia/opieplayer/libflash/program.h b/core/multimedia/opieplayer/libflash/program.h
new file mode 100644
index 0000000..7672d88
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/program.h
@@ -0,0 +1,185 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _PROGRAM_H_
21#define _PROGRAM_H_
22
23enum ControlType {
24 ctrlPlaceObject,
25 ctrlPlaceObject2,
26 ctrlRemoveObject,
27 ctrlRemoveObject2,
28 ctrlDoAction,
29 ctrlStartSound,
30 ctrlStopSound,
31 ctrlBackgroundColor
32};
33
34enum PlaceFlags {
35 placeIsMove = 0x01,
36 placeHasCharacter= 0x02,
37 placeHasMatrix = 0x04,
38 placeHasColorXform= 0x08,
39 placeHasRatio = 0x10,
40 placeHasName = 0x20,
41 placeHasClip = 0x40
42};
43
44struct Control {
45 ControlTypetype;
46
47 // Place, Remove, Sound
48 Character*character;
49 long depth;
50
51 // Place 1&2
52 PlaceFlags flags;
53 Matrix matrix;
54 Cxform cxform;
55 long ratio;
56 long clipDepth;
57 char *name;
58
59 // BackgroundColor
60 Color color;
61
62 // DoAction
63 ActionRecord*actionRecords;
64
65 struct Control *next;
66
67
68 // Methods
69
70 void addActionRecord( ActionRecord *ar)
71 {
72 ar->next = 0;
73
74 if (actionRecords == 0) {
75 actionRecords = ar;
76 } else {
77 ActionRecord *current;
78
79 for(current = actionRecords; current->next; current = current->next);
80
81 current->next = ar;
82 }
83 };
84
85 Control()
86 {
87 actionRecords = 0;
88 cxform.aa = 1.0; cxform.ab = 0;
89 cxform.ra = 1.0; cxform.rb = 0;
90 cxform.ga = 1.0; cxform.gb = 0;
91 cxform.ba = 1.0; cxform.bb = 0;
92 ratio = 0;
93 clipDepth = 0;
94 name = 0;
95 };
96
97 ~Control()
98 {
99 ActionRecord*ar,*del;
100 for(ar = actionRecords; ar;)
101 {
102 del = ar;
103 ar = ar->next;
104 delete del;
105 }
106 if (name) {
107 free(name);
108 }
109 };
110};
111
112struct Frame {
113 char *label;
114 Control *controls;// Controls for this frame
115};
116
117enum MovieStatus {
118 MoviePaused,
119 MoviePlay
120};
121
122struct FlashMovie;
123
124struct Program {
125 DisplayList*dl;
126
127 Frame *frames;// Array
128 long nbFrames;// Number of valid frames
129 long currentFrame;
130 long loadingFrame;
131 long totalFrames;// Total expected number of frames
132 long nextFrame;
133 int movieWait;// If true freeze movie until next loaded frame
134 MovieStatus movieStatus;
135 Sound *currentSound;
136 long settings;
137 FlashMovie *movie;
138 long render;// True if needed to be rendered
139
140 Program(FlashMovie *movie,long n);
141 ~Program();
142
143 void rewindMovie();
144 void pauseMovie();
145 void continueMovie();
146 void nextStepMovie();
147 void gotoFrame(GraphicDevice *gd, long f);
148
149 long processMovie(GraphicDevice *, SoundMixer *);
150 long nestedMovie(GraphicDevice *, SoundMixer *, Matrix *, Cxform *);
151 long runFrame(GraphicDevice *, SoundMixer *, long f, long action=1);
152 long handleEvent(GraphicDevice *, SoundMixer *, FlashEvent *);
153 long doAction(GraphicDevice *gd, ActionRecord *action, SoundMixer *);
154 void setCurrentFrameLabel(char *label);
155 void advanceFrame();
156 void addControlInCurrentFrame(Control *ctrl);
157 void setGetUrlMethod( void (*)(char *, char *, void *), void *);
158 void modifySettings(long flags);
159 long searchFrame(GraphicDevice *gd, char *, char *);
160 void validateLoadingFrame();
161 long getCurrentFrame();
162 void setCurrentFrame(long);
163
164 Frame*getFrames();
165 long getNbFrames();
166
167 DisplayList *getDisplayList();
168
169#ifdef DUMP
170 void dump(BitStream *bs);
171 static void dumpActions(BitStream *bs, ActionRecord *actions);
172#endif
173};
174
175DisplayListEntry *findFocus(DisplayList *dl);
176void setFlashTimer(struct timeval *tv, int time_ms);
177int checkFlashTimer(struct timeval *tv);
178
179void loadNewSwf(FlashMovie *movie, char *url, int level);
180
181void computeBBox(FlashMovie *movie, Rect *rect, DisplayListEntry *e);
182
183long processMovie(FlashMovie *movie);
184
185#endif /* _PROGRAM_H_ */
diff --git a/core/multimedia/opieplayer/libflash/rect.h b/core/multimedia/opieplayer/libflash/rect.h
new file mode 100644
index 0000000..cb84eb3
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/rect.h
@@ -0,0 +1,55 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _RECT_H_
21#define _RECT_H_
22
23struct Rect
24{
25 long xmin;
26 long xmax;
27 long ymin;
28 long ymax;
29
30 long getWidth() {
31 return xmax-xmin;
32 };
33
34 long getHeight() {
35 return ymax-ymin;
36 };
37
38 void print() {
39 printf("Xmin = %d Xmax = %d Ymin = %d Ymax = %d\n",
40 (int)xmin,(int)xmax,(int)ymin,(int)ymax);
41 };
42
43 void reset() {
44 xmin = LONG_MAX;
45 ymin = LONG_MAX;
46 xmax = LONG_MIN;
47 ymax = LONG_MIN;
48 };
49
50#ifdef DUMP
51 void dump(BitStream *bs);
52#endif
53};
54
55#endif /* _RECT_H_ */
diff --git a/core/multimedia/opieplayer/libflash/script.cc b/core/multimedia/opieplayer/libflash/script.cc
new file mode 100644
index 0000000..db65819
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/script.cc
@@ -0,0 +1,1988 @@
1#include "swf.h"
2
3////////////////////////////////////////////////////////////
4// This file is derived from the 'buggy' SWF parser provided
5// by Macromedia.
6//
7// Modifications : Olivier Debon <odebon@club-internet.fr>
8//
9
10#ifdef RCSID
11static char *rcsid = "$Id$";
12#endif
13
14#define printf(fmt,args...)
15
16//////////////////////////////////////////////////////////////////////
17// Inline input script object methods.
18//////////////////////////////////////////////////////////////////////
19
20//
21// Inlines to parse a Flash file.
22//
23inline U8 CInputScript::GetByte(void)
24{
25 return m_fileBuf[m_filePos++];
26}
27
28inline U16 CInputScript::GetWord(void)
29{
30 U8 * s = m_fileBuf + m_filePos;
31 m_filePos += 2;
32 return (U16) s[0] | ((U16) s[1] << 8);
33}
34
35inline U32 CInputScript::GetDWord(void)
36{
37 U8 * s = m_fileBuf + m_filePos;
38 m_filePos += 4;
39 return (U32) s[0] | ((U32) s[1] << 8) | ((U32) s[2] << 16) | ((U32) s [3] << 24);
40}
41
42
43
44
45//////////////////////////////////////////////////////////////////////
46// Input script object methods.
47//////////////////////////////////////////////////////////////////////
48
49CInputScript::CInputScript(int level)
50// Class constructor.
51{
52 this->level = level;
53
54 // Initialize the input pointer.
55 m_fileBuf = NULL;
56
57 // Initialize the file information.
58 m_filePos = 0;
59 m_fileSize = 0;
60 m_fileVersion = 0;
61
62 // Initialize the bit position and buffer.
63 m_bitPos = 0;
64 m_bitBuf = 0;
65
66 // Initialize the output file.
67 m_outputFile = NULL;
68
69 // Set to true if we wish to dump all contents long form
70 m_dumpAll = false;
71
72 // if set to true will dump image guts (i.e. jpeg, zlib, etc. data)
73 m_dumpGuts = false;
74
75 needHeader = 1;
76 program = 0;
77
78 outOfMemory = 0;
79
80 next = NULL;
81
82 return;
83}
84
85
86CInputScript::~CInputScript(void)
87// Class destructor.
88{
89 // Free the buffer if it is there.
90 if (m_fileBuf)
91 {
92 delete program;
93 m_fileBuf = NULL;
94 m_fileSize = 0;
95 }
96}
97
98
99U16 CInputScript::GetTag(void)
100{
101 // Save the start of the tag.
102 m_tagStart = m_filePos;
103
104 if (m_actualSize-m_filePos < 2) return notEnoughData;
105
106 // Get the combined code and length of the tag.
107 U16 code = GetWord();
108
109 // The length is encoded in the tag.
110 U32 len = code & 0x3f;
111
112 // Remove the length from the code.
113 code = code >> 6;
114
115 // Determine if another long word must be read to get the length.
116 if (len == 0x3f) {
117 if (m_actualSize-m_filePos < 4) return notEnoughData;
118 len = (U32) GetDWord();
119 }
120
121 // Determine the end position of the tag.
122 m_tagEnd = m_filePos + (U32) len;
123 m_tagLen = (U32) len;
124
125 return code;
126}
127
128
129void CInputScript::GetRect (Rect * r)
130{
131 InitBits();
132 int nBits = (int) GetBits(5);
133 r->xmin = GetSBits(nBits);
134 r->xmax = GetSBits(nBits);
135 r->ymin = GetSBits(nBits);
136 r->ymax = GetSBits(nBits);
137}
138
139void CInputScript::GetMatrix(Matrix* mat)
140{
141 InitBits();
142
143 // Scale terms
144 if (GetBits(1))
145 {
146 int nBits = (int) GetBits(5);
147 mat->a = (float)(GetSBits(nBits))/(float)0x10000;
148 mat->d = (float)(GetSBits(nBits))/(float)0x10000;
149 }
150 else
151 {
152 mat->a = mat->d = 1.0;
153 }
154
155 // Rotate/skew terms
156 if (GetBits(1))
157 {
158 int nBits = (int)GetBits(5);
159 mat->c = (float)(GetSBits(nBits))/(float)0x10000;
160 mat->b = (float)(GetSBits(nBits))/(float)0x10000;
161 }
162 else
163 {
164 mat->b = mat->c = 0.0;
165 }
166
167 // Translate terms
168 int nBits = (int) GetBits(5);
169 mat->tx = GetSBits(nBits);
170 mat->ty = GetSBits(nBits);
171}
172
173
174void CInputScript::GetCxform(Cxform* cx, BOOL hasAlpha)
175{
176 int flags;
177 int nBits;
178 float aa; long ab;
179 float ra; long rb;
180 float ga; long gb;
181 float ba; long bb;
182
183 InitBits();
184
185 flags = (int) GetBits(2);
186 nBits = (int) GetBits(4);
187 aa = 1.0; ab = 0;
188 if (flags & 1)
189 {
190 ra = (float) GetSBits(nBits)/256.0;
191 ga = (float) GetSBits(nBits)/256.0;
192 ba = (float) GetSBits(nBits)/256.0;
193 if (hasAlpha) aa = (float) GetSBits(nBits)/256.0;
194 }
195 else
196 {
197 ra = ga = ba = 1.0;
198 }
199 if (flags & 2)
200 {
201 rb = (S32) GetSBits(nBits);
202 gb = (S32) GetSBits(nBits);
203 bb = (S32) GetSBits(nBits);
204 if (hasAlpha) ab = (S32) GetSBits(nBits);
205 }
206 else
207 {
208 rb = gb = bb = 0;
209 }
210 if (cx) {
211 cx->aa = aa;
212 cx->ab = ab;
213 cx->ra = ra;
214 cx->rb = rb;
215 cx->ga = ga;
216 cx->gb = gb;
217 cx->ba = ba;
218 cx->bb = bb;
219 }
220}
221
222
223/* XXX: should allocate string */
224char *CInputScript::GetString(void)
225{
226 // Point to the string.
227 char *str = (char *) &m_fileBuf[m_filePos];
228
229 // Skip over the string.
230 while (GetByte());
231
232 return str;
233}
234
235void CInputScript::InitBits(void)
236{
237 // Reset the bit position and buffer.
238 m_bitPos = 0;
239 m_bitBuf = 0;
240}
241
242
243S32 CInputScript::GetSBits (S32 n)
244// Get n bits from the string with sign extension.
245{
246 // Get the number as an unsigned value.
247 S32 v = (S32) GetBits(n);
248
249 // Is the number negative?
250 if (v & (1L << (n - 1)))
251 {
252 // Yes. Extend the sign.
253 v |= -1L << n;
254 }
255
256 return v;
257}
258
259
260U32 CInputScript::GetBits (S32 n)
261// Get n bits from the stream.
262{
263 U32 v = 0;
264
265 for (;;)
266 {
267 S32 s = n - m_bitPos;
268 if (s > 0)
269 {
270 // Consume the entire buffer
271 v |= m_bitBuf << s;
272 n -= m_bitPos;
273
274 // Get the next buffer
275 m_bitBuf = GetByte();
276 m_bitPos = 8;
277 }
278 else
279 {
280 // Consume a portion of the buffer
281 v |= m_bitBuf >> -s;
282 m_bitPos -= n;
283 m_bitBuf &= 0xff >> (8 - m_bitPos);// mask off the consumed bits
284 return v;
285 }
286 }
287}
288
289void CInputScript::ParseFreeCharacter()
290{
291 U32 tagid = (U32) GetWord();
292
293 tagid = tagid;
294
295 printf("tagFreeCharacter \ttagid %-5u\n", tagid);
296}
297
298
299void CInputScript::ParsePlaceObject()
300{
301 Control *ctrl;
302
303 ctrl = new Control;
304 if (ctrl == NULL) {
305 outOfMemory = 1;
306 return;
307 }
308 ctrl->type = ctrlPlaceObject;
309 ctrl->flags = (PlaceFlags)(placeHasMatrix | placeHasCharacter);
310
311 ctrl->character = getCharacter(GetWord());
312 ctrl->depth = GetWord();
313
314 GetMatrix(&(ctrl->matrix));
315
316 if ( m_filePos < m_tagEnd )
317 {
318 ctrl->flags = (PlaceFlags)(ctrl->flags | placeHasColorXform);
319
320 GetCxform(&ctrl->cxform, false);
321 }
322
323 program->addControlInCurrentFrame(ctrl);
324}
325
326
327void CInputScript::ParsePlaceObject2()
328{
329 Control *ctrl;
330
331 ctrl = new Control;
332 if (ctrl == NULL) {
333 outOfMemory = 1;
334 return;
335 }
336 ctrl->type = ctrlPlaceObject2;
337
338 ctrl->flags = (PlaceFlags)GetByte();
339 ctrl->depth = GetWord();
340
341 // Get the tag if specified.
342 if (ctrl->flags & placeHasCharacter)
343 {
344 ctrl->character = getCharacter(GetWord());
345 }
346
347 // Get the matrix if specified.
348 if (ctrl->flags & placeHasMatrix)
349 {
350 GetMatrix(&(ctrl->matrix));
351 }
352
353 // Get the color transform if specified.
354 if (ctrl->flags & placeHasColorXform)
355 {
356 GetCxform(&ctrl->cxform, true);
357 }
358
359 // Get the ratio if specified.
360 if (ctrl->flags & placeHasRatio)
361 {
362 ctrl->ratio = GetWord();
363 }
364
365 // Get the ratio if specified.
366 if (ctrl->flags & placeHasName)
367 {
368 ctrl->name = strdup(GetString());
369 }
370
371 // Get the clipdepth if specified.
372 if (ctrl->flags & placeHasClip)
373 {
374 ctrl->clipDepth = GetWord();
375 }
376
377 program->addControlInCurrentFrame(ctrl);
378}
379
380
381void CInputScript::ParseRemoveObject()
382{
383 Control *ctrl;
384
385 ctrl = new Control;
386 if (ctrl == NULL) {
387 outOfMemory = 1;
388 return;
389 }
390 ctrl->type = ctrlRemoveObject;
391 ctrl->character = getCharacter(GetWord());
392 ctrl->depth = GetWord();
393
394 program->addControlInCurrentFrame(ctrl);
395}
396
397
398void CInputScript::ParseRemoveObject2()
399{
400 Control *ctrl;
401
402 ctrl = new Control;
403 if (ctrl == NULL) {
404 outOfMemory = 1;
405 return;
406 }
407 ctrl->type = ctrlRemoveObject2;
408 ctrl->depth = GetWord();
409
410 program->addControlInCurrentFrame(ctrl);
411}
412
413
414void CInputScript::ParseSetBackgroundColor()
415{
416 Control *ctrl;
417
418 ctrl = new Control;
419 if (ctrl == NULL) {
420 outOfMemory = 1;
421 return;
422 }
423 ctrl->type = ctrlBackgroundColor;
424 ctrl->color.red = GetByte();
425 ctrl->color.green = GetByte();
426 ctrl->color.blue = GetByte();
427
428 program->addControlInCurrentFrame(ctrl);
429}
430
431
432void CInputScript::ParseDoAction()
433{
434 Control *ctrl;
435 ActionRecord *ar;
436
437 ctrl = new Control;
438 if (ctrl == NULL) {
439 outOfMemory = 1;
440 return;
441 }
442 ctrl->type = ctrlDoAction;
443
444 do {
445 ar = ParseActionRecord();
446 if (ar) {
447 ctrl->addActionRecord( ar );
448 }
449 if (outOfMemory) {
450 return;
451 }
452 } while (ar);
453
454 program->addControlInCurrentFrame(ctrl);
455
456}
457
458
459void CInputScript::ParseStartSound()
460{
461 Control *ctrl;
462
463 ctrl = new Control;
464 if (ctrl == NULL) {
465 outOfMemory = 1;
466 return;
467 }
468 ctrl->character = getCharacter(GetWord());
469 ctrl->type = ctrlStartSound;
470
471 program->addControlInCurrentFrame(ctrl);
472
473 if (!m_dumpAll)
474 return;
475
476 U32 code = GetByte();
477
478 printf("code %-3u", code);
479
480 if ( code & soundHasInPoint )
481 printf(" inpoint %u ", GetDWord());
482 if ( code & soundHasOutPoint )
483 printf(" oupoint %u", GetDWord());
484 if ( code & soundHasLoops )
485 printf(" loops %u", GetWord());
486
487 printf("\n");
488 if ( code & soundHasEnvelope )
489 {
490 int points = GetByte();
491
492 for ( int i = 0; i < points; i++ )
493 {
494 printf("\n");
495 printf("mark44 %u", GetDWord());
496 printf(" left chanel %u", GetWord());
497 printf(" right chanel %u", GetWord());
498 printf("\n");
499 }
500 }
501}
502
503
504void CInputScript::ParseStopSound()
505{
506 Control *ctrl;
507
508 ctrl = new Control;
509 if (ctrl == NULL) {
510 outOfMemory = 1;
511 return;
512 }
513 ctrl->type = ctrlStopSound;
514
515 program->addControlInCurrentFrame(ctrl);
516}
517
518
519void CInputScript::ParseShapeData(int getAlpha, int getStyles)
520{
521 int shapeRecord = 0;
522
523 if (getStyles) {
524 // ShapeWithStyle
525 ParseFillStyle(getAlpha);
526 ParseLineStyle(getAlpha);
527 }
528
529 InitBits();
530 m_nFillBits = (U16) GetBits(4);
531 m_nLineBits = (U16) GetBits(4);
532
533 do {
534 shapeRecord = ParseShapeRecord(getAlpha);
535 } while (shapeRecord);
536}
537
538int
539CInputScript::ParseShapeRecord(long getAlpha)
540{
541 // Determine if this is an edge.
542 BOOL isEdge = (BOOL) GetBits(1);
543
544 if (!isEdge)
545 {
546 // Handle a state change
547 U16 flags = (U16) GetBits(5);
548
549 // Are we at the end?
550 if (flags == 0)
551 {
552 // End of shape
553 return 0;
554 }
555
556 // Process a move to.
557 if (flags & flagsMoveTo)
558 {
559 U16 nBits = (U16) GetBits(5);
560 GetSBits(nBits);
561 GetSBits(nBits);
562 }
563
564 // Get new fill info.
565 if (flags & flagsFill0)
566 {
567 GetBits(m_nFillBits);
568 }
569 if (flags & flagsFill1)
570 {
571 GetBits(m_nFillBits);
572 }
573
574 // Get new line info
575 if (flags & flagsLine)
576 {
577 GetBits(m_nLineBits);
578 }
579
580 // Check to get a new set of styles for a new shape layer.
581 if (flags & flagsNewStyles)
582 {
583 // Parse the style.
584 ParseFillStyle(getAlpha);
585 ParseLineStyle(getAlpha);
586
587 InitBits();// Bug !
588
589 // Reset.
590 m_nFillBits = (U16) GetBits(4);
591 m_nLineBits = (U16) GetBits(4);
592 }
593
594 return flags & flagsEndShape ? 0 : 1;
595 }
596 else
597 {
598 if (GetBits(1))
599 {
600 // Handle a line
601 U16 nBits = (U16) GetBits(4) + 2;// nBits is biased by 2
602
603 // Save the deltas
604 if (GetBits(1))
605 {
606 // Handle a general line.
607 GetSBits(nBits);
608 GetSBits(nBits);
609 }
610 else
611 {
612 // Handle a vert or horiz line.
613 GetBits(1);
614 GetSBits(nBits);
615 }
616 }
617 else
618 {
619 // Handle a curve
620 U16 nBits = (U16) GetBits(4) + 2;// nBits is biased by 2
621
622 // Get the control
623 GetSBits(nBits);
624 GetSBits(nBits);
625
626 // Get the anchor
627 GetSBits(nBits);
628 GetSBits(nBits);
629 }
630
631 return 1;
632 }
633}
634
635
636void CInputScript::ParseFillStyle(long getAlpha)
637 //
638{
639 U16 i = 0;
640 FillType type;
641 Matrix matrix;
642
643 // Get the number of fills.
644 U16 nFills = GetByte();
645
646 // Do we have a larger number?
647 if (nFills == 255)
648 {
649 // Get the larger number.
650 nFills = GetWord();
651 }
652
653 // Get each of the fill style.
654 for (i = 0; i < nFills; i++)
655 {
656 U16 fillStyle = GetByte();
657
658 type = (FillType) fillStyle;
659
660 printf("fillstyle: type=%d\n",defs[i].type);
661 if (fillStyle & 0x10)
662 {
663 U16 nbGradients;
664
665 type = (FillType) (fillStyle & 0x12);
666
667 // Get the gradient matrix.
668 GetMatrix(&matrix);
669
670 // Get the number of colors.
671 nbGradients = GetByte();
672
673 // Get each of the colors.
674 for (U16 j = 0; j < nbGradients; j++)
675 {
676 GetByte();
677 GetByte();
678 GetByte();
679 GetByte();
680 if (getAlpha) {
681 GetByte();
682 }
683 }
684 }
685 else if (fillStyle & 0x40)
686 {
687 type = (FillType) (fillStyle & 0x41);
688
689 // Get the bitmapId
690 GetWord();
691
692 // Get the bitmap matrix.
693 GetMatrix(&matrix);
694 }
695 else
696 {
697 type = (FillType) 0;
698
699 // A solid color
700 GetByte();
701 GetByte();
702 GetByte();
703 if (getAlpha) {
704 GetByte();
705 }
706
707 printf("fillstyle: %x %x %x %x\n",
708 defs[i].color.red,
709 defs[i].color.green,
710 defs[i].color.blue,
711 defs[i].color.alpha);
712 }
713 }
714}
715
716void CInputScript::ParseLineStyle(long getAlpha)
717{
718 long i;
719
720 // Get the number of lines.
721 U16 nLines = GetByte();
722
723 // Do we have a larger number?
724 if (nLines == 255)
725 {
726 // Get the larger number.
727 nLines = GetWord();
728 }
729
730 // Get each of the line styles.
731 for (i = 0; i < nLines; i++)
732 {
733 GetWord();
734 GetByte();
735 GetByte();
736 GetByte();
737 if (getAlpha) {
738 GetByte();
739 }
740 }
741}
742
743
744void CInputScript::ParseDefineShape(int level)
745{
746 Shape *shape;
747 Rect rect;
748 U32 tagid;
749
750 tagid = (U32) GetWord();
751 shape = new Shape(tagid,level);
752 if (shape == NULL) {
753 outOfMemory = 1;
754 return;
755 }
756 shape->dict = this;
757
758 // Get the frame information.
759 GetRect(&rect);
760
761 shape->setBoundingBox(rect);
762
763 shape->file_ptr = (unsigned char*)malloc(m_tagEnd-m_filePos);
764 if (shape->file_ptr == NULL) {
765 outOfMemory = 1;
766 delete shape;
767 return;
768 }
769 memcpy((void*)shape->file_ptr,(void*)&m_fileBuf[m_filePos], m_tagEnd-m_filePos);
770
771 shape->getStyles = 1;
772 shape->getAlpha = (level == 3);
773
774 ParseShapeData(level == 3, 1);
775
776 addCharacter(shape);
777}
778
779void CInputScript::S_DumpImageGuts()
780{
781#if 0
782 U32 lfCount = 0;
783 printf("----- dumping image details -----");
784 while (m_filePos < m_tagEnd)
785 {
786 if ((lfCount % 16) == 0)
787 {
788 fprintf(stdout, "\n");
789 }
790 lfCount += 1;
791 fprintf(stdout, "%02x ", GetByte());
792 }
793 fprintf(stdout, "\n");
794#endif
795}
796
797void CInputScript::ParseDefineBits()
798{
799 Bitmap *bitmap;
800 U32 tagid = (U32) GetWord();
801 int status;
802
803 bitmap = new Bitmap(tagid,1);
804 if (bitmap == NULL) {
805 outOfMemory = 1;
806 return;
807 }
808
809 status = bitmap->buildFromJpegAbbreviatedData(&m_fileBuf[m_filePos]);
810
811 if (status < 0) {
812 fprintf(stderr,"Unable to read JPEG data\n");
813 delete bitmap;
814 return;
815 }
816
817 addCharacter(bitmap);
818}
819
820
821void CInputScript::ParseDefineBitsJPEG2()
822{
823 Bitmap *bitmap;
824 U32 tagid = (U32) GetWord();
825 int status;
826
827 bitmap = new Bitmap(tagid,2);
828 if (bitmap == NULL) {
829 outOfMemory = 1;
830 return;
831 }
832
833 status = bitmap->buildFromJpegInterchangeData(&m_fileBuf[m_filePos], 0, 0);
834
835 if (status < 0) {
836 fprintf(stderr,"Unable to read JPEG data\n");
837 delete bitmap;
838 return;
839 }
840
841 addCharacter(bitmap);
842}
843
844void CInputScript::ParseDefineBitsJPEG3()
845{
846 Bitmap *bitmap;
847 U32 tagid = (U32) GetWord();
848 int status;
849 long offset;
850
851 printf("tagDefineBitsJPEG3 \ttagid %-5u\n", tagid);
852
853 bitmap = new Bitmap(tagid,3);
854 if (bitmap == NULL) {
855 outOfMemory = 1;
856 return;
857 }
858
859 offset = GetDWord();// Not in the specs !!!!
860
861 status = bitmap->buildFromJpegInterchangeData(&m_fileBuf[m_filePos], 1, offset);
862 if (status < 0) {
863 fprintf(stderr,"Unable to read JPEG data\n");
864 delete bitmap;
865 return;
866 }
867
868 addCharacter(bitmap);
869}
870
871
872void CInputScript::ParseDefineBitsLossless(int level)
873{
874 Bitmap *bitmap;
875 U32 tagid = (U32) GetWord();
876 int status;
877 int tableSize;
878
879 bitmap = new Bitmap(tagid,0);
880 if (bitmap == NULL) {
881 outOfMemory = 1;
882 return;
883 }
884
885 int format = GetByte();
886 int width = GetWord();
887 int height = GetWord();
888
889 tableSize = 0;
890
891 if (format == 3) {
892 tableSize = GetByte();
893 }
894
895 status = bitmap->buildFromZlibData(&m_fileBuf[m_filePos], width, height, format, tableSize, level == 2);
896
897 if (status < 0) {
898 fprintf(stderr,"Unable to read ZLIB data\n");
899 delete bitmap;
900 return;
901 }
902
903 addCharacter(bitmap);
904}
905
906void CInputScript::ParseJPEGTables()
907{
908 Bitmap::readJpegTables(&m_fileBuf[m_filePos]);
909}
910
911
912ButtonRecord * CInputScript::ParseButtonRecord(long getCxform)
913{
914 U16 state;
915 ButtonRecord *br;
916 long tagid;
917 Matrix matrix;
918 long layer;
919 Cxform *cxform;
920
921 state = (U16) GetByte();
922
923 if (state == 0) return 0;
924
925 br = new ButtonRecord;
926 if (br == NULL) {
927 outOfMemory = 1;
928 return 0;
929 }
930
931 tagid = GetWord();
932 layer = GetWord();
933 GetMatrix(&matrix);
934
935 if (br) {
936 br->state = (ButtonState) state;
937 br->character = getCharacter(tagid);
938 br->layer = layer;
939 br->cxform = 0;
940 br->buttonMatrix = matrix;
941 }
942
943 if (getCxform) {
944 cxform = new Cxform;
945 GetCxform(cxform, true);
946 if (br) {
947 br->cxform = cxform;
948 if (cxform == NULL) {
949 outOfMemory = 1;
950 }
951 }
952 }
953
954 return br;
955}
956
957ActionRecord * CInputScript::ParseActionRecord()
958{
959 U8 action;
960 U16 length = 0;
961 char *url, *target, *label;
962 long frameIndex, skipCount;
963 ActionRecord *ar;
964
965 action = GetByte();
966 if (action == 0) return 0;
967
968 ar = new ActionRecord;
969 if (ar == NULL) {
970 outOfMemory = 1;
971 return 0;
972 }
973
974 ar->action = (Action)action;
975
976 if (action & 0x80) {
977 length = GetWord();
978 }
979
980 switch (action) {
981 case ActionGotoFrame:
982 frameIndex = GetWord();
983 if (ar) {
984 ar->frameIndex = frameIndex;
985 }
986 break;
987 case ActionGetURL:
988 url = GetString();
989 target = GetString();
990 if (ar) {
991 ar->url = strdup(url);
992 ar->target = strdup(target);
993 }
994 break;
995 case ActionWaitForFrame:
996 frameIndex = GetWord();
997 skipCount = GetByte();
998 if (ar) {
999 ar->frameIndex = frameIndex;
1000 ar->skipCount = skipCount;
1001 }
1002 break;
1003 case ActionSetTarget:
1004 target = strdup(GetString());
1005 if (ar) {
1006 ar->target = target;
1007 }
1008 break;
1009 case ActionGoToLabel:
1010 label = GetString();
1011 if (ar) {
1012 ar->frameLabel = strdup(label);
1013 }
1014 break;
1015 default:
1016 while (length--) {
1017 GetByte();
1018 }
1019 break;
1020 }
1021
1022 return ar;
1023}
1024
1025void CInputScript::ParseDefineButton()
1026{
1027 Button *button;
1028 ButtonRecord*buttonRecord;
1029 ActionRecord*actionRecord;
1030
1031 U32 tagid = (U32) GetWord();
1032
1033 button = new Button(tagid);
1034 if (button == NULL) {
1035 outOfMemory = 1;
1036 return;
1037 }
1038
1039 do {
1040 buttonRecord = ParseButtonRecord();
1041 if (buttonRecord) {
1042 button->addButtonRecord( buttonRecord );
1043 }
1044 if (outOfMemory) {
1045 return;
1046 }
1047 } while (buttonRecord);
1048
1049 do {
1050 actionRecord = ParseActionRecord();
1051 if (actionRecord) {
1052 button->addActionRecord( actionRecord );
1053 }
1054 if (outOfMemory) {
1055 return;
1056 }
1057 } while (actionRecord);
1058
1059 addCharacter(button);
1060}
1061
1062
1063void CInputScript::ParseDefineButton2()
1064{
1065 Button *button;
1066 ButtonRecord*buttonRecord;
1067 ActionRecord*actionRecord;
1068 U16 transition;
1069 U16 offset;
1070 U8 menu;
1071
1072 U32 tagid = (U32) GetWord();
1073
1074 button = new Button(tagid);
1075
1076 if (button == NULL) {
1077 outOfMemory = 1;
1078 return;
1079 }
1080
1081 menu = GetByte();
1082
1083 offset = GetWord();
1084
1085 do {
1086 buttonRecord = ParseButtonRecord(true);
1087 if (buttonRecord) {
1088 button->addButtonRecord( buttonRecord );
1089 }
1090 if (outOfMemory) {
1091 return;
1092 }
1093 } while (buttonRecord);
1094
1095 while (offset) {
1096 offset = GetWord();
1097
1098 transition = GetWord();
1099
1100 do {
1101 actionRecord = ParseActionRecord();
1102 if (actionRecord) {
1103 button->addActionRecord( actionRecord );
1104 }
1105 if (outOfMemory) {
1106 return;
1107 }
1108 } while (actionRecord);
1109
1110 button->addCondition( transition );
1111 }
1112
1113 addCharacter(button);
1114}
1115
1116
1117void CInputScript::ParseDefineFont()
1118{
1119 SwfFont*font = 0;
1120 U32 tagid = (U32) GetWord();
1121 long start;
1122 long nb,n;
1123 long offset;
1124 long*offsetTable = 0;
1125 Shape*shapes = 0;
1126
1127 font = new SwfFont(tagid);
1128 if (font == NULL) {
1129 outOfMemory = 1;
1130 return;
1131 }
1132 start = m_filePos;
1133
1134 offset = GetWord();
1135 nb = offset/2;
1136 offsetTable = new long[nb];
1137 if (offsetTable == NULL) {
1138 goto memory_error;
1139 }
1140 offsetTable[0] = offset;
1141
1142 for(n=1; n<nb; n++)
1143 {
1144 offsetTable[n] = GetWord();
1145 }
1146
1147 shapes = new Shape[nb];
1148 if (shapes == NULL) {
1149 goto memory_error;
1150 }
1151
1152 for(n=0; n<nb; n++)
1153 {
1154 long here;
1155
1156 m_filePos = offsetTable[n]+start;
1157
1158 here = m_filePos;
1159 ParseShapeData(0, 0);
1160
1161 // Keep data for later parsing
1162 shapes[n].file_ptr = (unsigned char*)malloc(m_filePos-here);
1163 if (shapes[n].file_ptr == NULL) {
1164 goto memory_error;
1165 }
1166 memcpy((void*)shapes[n].file_ptr,(void*)&m_fileBuf[here],m_filePos-here);
1167 }
1168
1169 font->setFontShapeTable(shapes,nb);
1170
1171 delete[] offsetTable;
1172
1173 addCharacter(font);
1174 return;
1175
1176memory_error:
1177 outOfMemory = 1;
1178 if (offsetTable) delete offsetTable;
1179 if (font) delete font;
1180 if (shapes) delete[] shapes;
1181}
1182
1183
1184void CInputScript::ParseDefineMorphShape()
1185{
1186 U32 tagid = (U32) GetWord();
1187
1188 tagid = tagid;
1189 printf("tagDefineMorphShape \ttagid %-5u\n", tagid);
1190}
1191
1192void CInputScript::ParseDefineFontInfo()
1193{
1194 SwfFont*font;
1195 U32 tagid = (U32) GetWord();
1196 long nameLen;
1197 char*name;
1198 long n,nb;
1199 FontFlags flags;
1200 long*lut;
1201
1202 font = (SwfFont *)getCharacter(tagid);
1203
1204 if (font == NULL) {
1205 outOfMemory = 1;
1206 return;
1207 }
1208
1209 nameLen = GetByte();
1210 name = new char[nameLen+1];
1211 if (name == NULL) {
1212 outOfMemory = 1;
1213 return;
1214 }
1215 for(n=0; n < nameLen; n++)
1216 {
1217 name[n] = GetByte();
1218 }
1219 name[n]=0;
1220
1221 font->setFontName(name);
1222
1223 delete name;
1224
1225 flags = (FontFlags)GetByte();
1226
1227 font->setFontFlags(flags);
1228
1229 nb = font->getNbGlyphs();
1230
1231 lut = new long[nb];
1232 if (lut == NULL) {
1233 outOfMemory = 1;
1234 delete font;
1235 return;
1236 }
1237
1238 for(n=0; n < nb; n++)
1239 {
1240 if (flags & fontWideCodes) {
1241 lut[n] = GetWord();
1242 } else {
1243 lut[n] = GetByte();
1244 }
1245 }
1246
1247 font->setFontLookUpTable(lut);
1248}
1249
1250
1251
1252
1253
1254void CInputScript::ParseDefineFont2()
1255{
1256 int n;
1257 U32 tagid = (U32) GetWord();
1258 FontFlags flags;
1259 char *name;
1260 long nameLen;
1261 long fontGlyphCount;
1262 long *offsetTable = NULL;
1263 Shape *shapes = NULL;
1264 long start;
1265 SwfFont *font;
1266 long *lut = NULL;
1267
1268 font = new SwfFont(tagid);
1269 if (font == NULL) {
1270 goto memory_error;
1271 }
1272
1273 flags = (FontFlags)GetWord();
1274
1275 font->setFontFlags(flags);
1276
1277 nameLen = GetByte();
1278 name = new char[nameLen+1];
1279 if (name == NULL) {
1280 goto memory_error;
1281 }
1282 for(n=0; n < nameLen; n++)
1283 {
1284 name[n] = GetByte();
1285 }
1286 name[n]=0;
1287
1288 font->setFontName(name);
1289
1290 delete name;
1291
1292 fontGlyphCount = GetWord();
1293
1294 start = m_filePos;
1295
1296 offsetTable = new long[fontGlyphCount];
1297 if (offsetTable == NULL) {
1298 goto memory_error;
1299 }
1300 for (n=0; n<fontGlyphCount; n++) {
1301 if (flags & 8) {
1302 offsetTable[n] = GetDWord();
1303 } else {
1304 offsetTable[n] = GetWord();
1305 }
1306 }
1307
1308 shapes = new Shape[fontGlyphCount];
1309 if (shapes == NULL) {
1310 goto memory_error;
1311 }
1312
1313 for (n=0; n<fontGlyphCount; n++) {
1314 long here;
1315
1316 m_filePos = offsetTable[n]+start;
1317
1318 here = m_filePos;
1319 ParseShapeData(0, 0);
1320
1321 // Keep data for later parsing
1322 shapes[n].file_ptr = (unsigned char*)malloc(m_filePos-here);
1323 if (shapes[n].file_ptr == NULL) {
1324 goto memory_error;
1325 }
1326 memcpy((void*)shapes[n].file_ptr,(void*)&m_fileBuf[here],m_filePos-here);
1327 }
1328
1329 font->setFontShapeTable(shapes,fontGlyphCount);
1330
1331 lut = new long[fontGlyphCount];
1332 if (lut == NULL) {
1333 goto memory_error;
1334 }
1335
1336 for(n=0; n < fontGlyphCount; n++)
1337 {
1338 if (flags & 4) {
1339 lut[n] = GetWord();
1340 } else {
1341 lut[n] = GetByte();
1342 }
1343 }
1344
1345 font->setFontLookUpTable(lut);
1346
1347 delete offsetTable;
1348
1349 addCharacter(font);
1350
1351 // This is an incomplete parsing
1352 return;
1353
1354memory_error:
1355 outOfMemory = 1;
1356 if (font) delete font;
1357 if (offsetTable) delete offsetTable;
1358 if (lut) delete lut;
1359 if (shapes) delete[] shapes;
1360}
1361
1362TextRecord * CInputScript::ParseTextRecord(int hasAlpha)
1363{
1364 TextRecord *tr;
1365 TextFlags flags;
1366
1367 flags = (TextFlags) GetByte();
1368 if (flags == 0) return 0;
1369
1370 tr = new TextRecord;
1371 if (tr == NULL) {
1372 outOfMemory = 1;
1373 return 0;
1374 }
1375
1376 tr->flags = flags;
1377
1378 if (flags & isTextControl) {
1379 if (flags & textHasFont) {
1380 long fontId;
1381
1382 fontId = GetWord();
1383 tr->font = (SwfFont *)getCharacter(fontId);
1384 }
1385 if (flags & textHasColor) {
1386 tr->color.red = GetByte();
1387 tr->color.green = GetByte();
1388 tr->color.blue = GetByte();
1389 if (hasAlpha) {
1390 tr->color.alpha = GetByte();
1391 } else {
1392 tr->color.alpha = ALPHA_OPAQUE;
1393 }
1394 }
1395 if (flags & textHasXOffset) {
1396 tr->xOffset = GetWord();
1397 }
1398 if (flags & textHasYOffset) {
1399 tr->yOffset = GetWord();
1400 }
1401 if (flags & textHasFont) {
1402 tr->fontHeight = GetWord();
1403 }
1404 tr->nbGlyphs = GetByte();
1405 } else {
1406 tr->flags = (TextFlags)0;
1407 tr->nbGlyphs = (long)flags;
1408 }
1409
1410 tr->glyphs = new Glyph[ tr->nbGlyphs ];
1411 if (tr->glyphs == NULL) {
1412 outOfMemory = 1;
1413 delete tr;
1414 return 0;
1415 }
1416
1417 InitBits();
1418 for (int g = 0; g < tr->nbGlyphs; g++)
1419 {
1420 tr->glyphs[g].index = GetBits(m_nGlyphBits);
1421 tr->glyphs[g].xAdvance = GetBits(m_nAdvanceBits);
1422 }
1423
1424 return tr;
1425}
1426
1427void CInputScript::ParseDefineText(int hasAlpha)
1428{
1429 Text *text;
1430 TextRecord*textRecord;
1431 Matrix m;
1432 Rect rect;
1433 U32 tagid = (U32) GetWord();
1434
1435 text = new Text(tagid);
1436 if (text == NULL) {
1437 outOfMemory = 1;
1438 return;
1439 }
1440
1441 GetRect(&rect);
1442 text->setTextBoundary(rect);
1443
1444 GetMatrix(&m);
1445 text->setTextMatrix(m);
1446
1447 m_nGlyphBits = GetByte();
1448 m_nAdvanceBits = GetByte();
1449
1450 do {
1451 textRecord = ParseTextRecord(hasAlpha);
1452 if (textRecord) {
1453 text->addTextRecord( textRecord );
1454 }
1455 if (outOfMemory) {
1456 delete text;
1457 return;
1458 }
1459 if (m_filePos >= m_tagEnd) break;
1460 } while (textRecord);
1461
1462 addCharacter(text);
1463}
1464
1465
1466void CInputScript::ParseDefineSound()
1467{
1468 Sound *sound;
1469 U32 tagid = (U32) GetWord();
1470 long nbSamples;
1471 long flags;
1472 char *buffer;
1473
1474 sound = new Sound(tagid);
1475
1476 flags = GetByte();
1477 sound->setSoundFlags(flags);
1478
1479 nbSamples = GetDWord();
1480 buffer = sound->setNbSamples(nbSamples);
1481 if (buffer == NULL) {
1482 outOfMemory = 1;
1483 delete sound;
1484 return;
1485 }
1486
1487 if (flags & soundIsADPCMCompressed) {
1488 Adpcm *adpcm;
1489
1490 adpcm = new Adpcm( &m_fileBuf[m_filePos] , flags & soundIsStereo );
1491
1492 adpcm->Decompress((short *)buffer, nbSamples);
1493
1494 delete adpcm;
1495 } else {
1496 memcpy(buffer, &m_fileBuf[m_filePos], m_tagLen-5);
1497 }
1498
1499 addCharacter(sound);
1500}
1501
1502
1503void CInputScript::ParseDefineButtonSound()
1504{
1505 U32 tagid = (U32) GetWord();
1506 Button*button;
1507
1508 tagid = tagid;
1509
1510 printf("tagDefineButtonSound \ttagid %-5u\n", tagid);
1511
1512 button = (Button *)getCharacter(tagid);
1513
1514 if (button == 0) {
1515 printf("Couldn't find Button id %d\n", tagid);
1516 return;
1517 }
1518
1519 // step through for button states
1520 for (int i = 0; i < 4; i++)
1521 {
1522 Sound*sound;
1523 U32 soundTag = GetWord();
1524
1525 sound = (Sound *)getCharacter(soundTag);
1526
1527 if (sound) {
1528 button->setButtonSound(sound,i);
1529 } else if (soundTag) {
1530 printf("Couldn't find Sound id %d\n", soundTag);
1531 }
1532
1533 switch (i)
1534 {
1535 case 0:
1536 printf("upState \ttagid %-5u\n", soundTag);
1537 break;
1538 case 1:
1539 printf("overState \ttagid %-5u\n", soundTag);
1540 break;
1541 case 2:
1542 printf("downState \ttagid %-5u\n", soundTag);
1543 break;
1544 }
1545
1546 if (soundTag)
1547 {
1548 U32 code = GetByte();
1549 printf("sound code %u", code);
1550
1551 if ( code & soundHasInPoint )
1552 printf(" inpoint %u", GetDWord());
1553 if ( code & soundHasOutPoint )
1554 printf(" outpoint %u", GetDWord());
1555 if ( code & soundHasLoops )
1556 printf(" loops %u", GetWord());
1557
1558 printf("\n");
1559 if ( code & soundHasEnvelope )
1560 {
1561 int points = GetByte();
1562
1563 for ( int p = 0; p < points; p++ )
1564 {
1565 printf("\n");
1566 printf("mark44 %u", GetDWord());
1567 printf(" left chanel %u", GetWord());
1568 printf(" right chanel %u", GetWord());
1569 printf("\n");
1570 }
1571 }
1572 }
1573 if (m_filePos == m_tagEnd) break;
1574 }
1575}
1576
1577void CInputScript::ParseSoundStreamHead()
1578{
1579 int mixFormat = GetByte();
1580
1581 // The stream settings
1582 int format = GetByte();
1583 int nSamples = GetWord();
1584
1585 mixFormat = mixFormat;
1586 format = format;
1587 nSamples = nSamples;
1588
1589 printf("tagSoundStreamHead \tmixFrmt %-3u frmt %-3u nSamples %-5u\n", mixFormat, format, nSamples);
1590}
1591
1592void CInputScript::ParseSoundStreamHead2()
1593{
1594 int mixFormat = GetByte();
1595
1596 // The stream settings
1597 int format = GetByte();
1598 int nSamples = GetWord();
1599
1600 mixFormat = mixFormat;
1601 format = format;
1602 nSamples = nSamples;
1603
1604 //printf("tagSoundStreamHead2 \tmixFormat %-3u format %-3u nSamples %-5u\n", mixFormat, format, nSamples);
1605}
1606
1607void CInputScript::ParseSoundStreamBlock()
1608{
1609 printf("tagSoundStreamBlock\n");
1610}
1611
1612void CInputScript::ParseDefineButtonCxform()
1613{
1614 ButtonRecord *br;
1615 Button*button;
1616 U32 tagid = (U32) GetWord();
1617
1618 button = (Button *)getCharacter(tagid);
1619
1620 for (br = button->getButtonRecords(); br; br = br->next)
1621 {
1622 br->cxform = new Cxform;
1623 GetCxform(br->cxform, false);
1624 }
1625}
1626
1627void CInputScript::ParseNameCharacter()
1628{
1629 U32 tagid = (U32) GetWord();
1630 char *label = strdup(GetString());
1631
1632 nameCharacter(tagid, label);
1633}
1634
1635
1636void CInputScript::ParseFrameLabel()
1637{
1638 char *label = strdup(GetString());
1639 program->setCurrentFrameLabel(label);
1640}
1641
1642
1643void CInputScript::ParseDefineMouseTarget()
1644{
1645 printf("tagDefineMouseTarget\n");
1646}
1647
1648
1649void CInputScript::ParseDefineSprite()
1650{
1651 Sprite *sprite;
1652 Program *prg;
1653 int status;
1654
1655 U32 tagid = (U32) GetWord();
1656 U32 frameCount = (U32) GetWord();
1657
1658 if (frameCount == 0) return;
1659
1660 printf("tagDefineSprite \ttagid %-5u \tframe count %-5u\n", tagid, frameCount);
1661
1662 sprite = new Sprite(program->movie, tagid, frameCount);
1663 if (sprite == NULL) {
1664 outOfMemory = 1;
1665 return;
1666 }
1667 if (sprite->getProgram() == NULL) {
1668 delete sprite;
1669 outOfMemory = 1;
1670 return;
1671 }
1672
1673 prg = sprite->getProgram();
1674
1675 // Set current program
1676 program = prg;
1677
1678 ParseTags(&status);
1679
1680 if (outOfMemory) {
1681 delete sprite;
1682 return;
1683 }
1684
1685 addCharacter(sprite);
1686}
1687
1688
1689void CInputScript::ParseUnknown(long code, long len)
1690{
1691 printf("Unknown Tag : %d - Length = %d\n", code, len);
1692}
1693
1694
1695void
1696CInputScript::ParseTags(int *status)
1697 // Parses the tags within the file.
1698{
1699
1700 // Initialize the end of frame flag.
1701 BOOL atEnd = false;
1702
1703 // Loop through each tag.
1704 while (!atEnd)
1705 {
1706 U32 here;
1707
1708 // Get the current tag.
1709 U16 code = GetTag();
1710
1711 if (code == notEnoughData) {
1712 m_filePos = m_tagStart;
1713 *status |= FLASH_PARSE_NEED_DATA;
1714 return;
1715 }
1716
1717 //printf("Code %d, tagLen %8u \n", code, m_tagLen);
1718
1719 here = m_filePos;
1720
1721 // Get the tag ending position.
1722 U32 tagEnd = m_tagEnd;
1723
1724 if (m_tagEnd > m_actualSize) {
1725 m_filePos = m_tagStart;
1726 *status |= FLASH_PARSE_NEED_DATA;
1727 return;
1728 }
1729
1730 switch (code)
1731 {
1732 case stagProtect:
1733 break;
1734
1735 case stagEnd:
1736
1737 // We reached the end of the file.
1738 atEnd = true;
1739
1740 printf("End of Movie\n");
1741
1742 break;
1743
1744 case stagShowFrame:
1745
1746 // Validate frame
1747 program->validateLoadingFrame();
1748 *status |= FLASH_PARSE_WAKEUP;
1749
1750 break;
1751
1752 case stagFreeCharacter:
1753 ParseFreeCharacter();
1754 break;
1755
1756 case stagPlaceObject:
1757 ParsePlaceObject();
1758 break;
1759
1760 case stagPlaceObject2:
1761 ParsePlaceObject2();
1762 break;
1763
1764 case stagRemoveObject:
1765 ParseRemoveObject();
1766 break;
1767
1768 case stagRemoveObject2:
1769 ParseRemoveObject2();
1770 break;
1771
1772 case stagSetBackgroundColor:
1773 ParseSetBackgroundColor();
1774 break;
1775
1776 case stagDoAction:
1777 ParseDoAction();
1778 break;
1779
1780 case stagStartSound:
1781 ParseStartSound();
1782 break;
1783
1784 case stagStopSound:
1785 ParseStopSound();
1786 break;
1787
1788 case stagDefineShape:
1789 ParseDefineShape(1);
1790 break;
1791
1792 case stagDefineShape2:
1793 ParseDefineShape(2);
1794 break;
1795
1796 case stagDefineShape3:
1797 ParseDefineShape(3);
1798 break;
1799
1800 case stagDefineBits:
1801 ParseDefineBits();
1802 break;
1803
1804 case stagDefineBitsJPEG2:
1805 ParseDefineBitsJPEG2();
1806 break;
1807
1808 case stagDefineBitsJPEG3:
1809 ParseDefineBitsJPEG3();
1810 break;
1811
1812 case stagDefineBitsLossless:
1813 ParseDefineBitsLossless(1);
1814 break;
1815
1816 case stagDefineBitsLossless2:
1817 ParseDefineBitsLossless(2);
1818 break;
1819
1820 case stagJPEGTables:
1821 ParseJPEGTables();
1822 break;
1823
1824 case stagDefineButton:
1825 ParseDefineButton();
1826 break;
1827
1828 case stagDefineButton2:
1829 ParseDefineButton2();
1830 break;
1831
1832 case stagDefineFont:
1833 ParseDefineFont();
1834 break;
1835
1836 case stagDefineMorphShape:
1837 ParseDefineMorphShape();
1838 break;
1839
1840 case stagDefineFontInfo:
1841 ParseDefineFontInfo();
1842 break;
1843
1844 case stagDefineText:
1845 ParseDefineText(0);
1846 break;
1847
1848 case stagDefineText2:
1849 ParseDefineText(1);
1850 break;
1851
1852 case stagDefineSound:
1853 ParseDefineSound();
1854 break;
1855
1856 case stagDefineButtonSound:
1857 ParseDefineButtonSound();
1858 break;
1859
1860 case stagSoundStreamHead:
1861 ParseSoundStreamHead();
1862 break;
1863
1864 case stagSoundStreamHead2:
1865 ParseSoundStreamHead2();
1866 break;
1867
1868 case stagSoundStreamBlock:
1869 ParseSoundStreamBlock();
1870 break;
1871
1872 case stagDefineButtonCxform:
1873 ParseDefineButtonCxform();
1874 break;
1875
1876 case stagDefineSprite:
1877 Program *save;
1878
1879 save = program;
1880 ParseDefineSprite();
1881 program->rewindMovie();
1882 program = save;
1883 break;
1884
1885 case stagNameCharacter:
1886 ParseNameCharacter();
1887 break;
1888
1889 case stagFrameLabel:
1890 ParseFrameLabel();
1891 break;
1892
1893 case stagDefineFont2:
1894 ParseDefineFont2();
1895 break;
1896
1897 default:
1898 ParseUnknown(code, m_tagLen);
1899 break;
1900 }
1901
1902 //printf("Bytes read = %d\n", m_filePos-here);
1903
1904 // Increment the past the tag.
1905 m_filePos = tagEnd;
1906
1907 if (outOfMemory) {
1908 fprintf(stderr,"Flash: Out of memory\n");
1909 *status |= FLASH_PARSE_OOM;
1910 return;
1911 }
1912 }
1913
1914 program->validateLoadingFrame();
1915 *status |= FLASH_PARSE_EOM;
1916}
1917
1918int
1919CInputScript::ParseData(FlashMovie *movie, char * data, long size)
1920{
1921 int status = FLASH_PARSE_ERROR;
1922
1923 m_fileBuf = (unsigned char *)data;
1924 m_actualSize = size;
1925
1926 if (needHeader) {
1927
1928 // Do we have sufficient data to read the header ?
1929 if (size < 21) {
1930 return FLASH_PARSE_NEED_DATA;// No, need more data
1931 }
1932
1933 needHeader = 0;// Yes
1934
1935 U8 fileHdr[8];
1936
1937 memcpy(fileHdr,data,8);
1938
1939 // Verify the header and get the file size.
1940 if (fileHdr[0] != 'F' || fileHdr[1] != 'W' || fileHdr[2] != 'S' )
1941 {
1942 //fprintf(stderr, "Not a Flash File.\n");
1943 return FLASH_PARSE_ERROR;// Error
1944 }
1945 else
1946 {
1947 // Get the file version.
1948 m_fileVersion = (U16) fileHdr[3];
1949 }
1950
1951 // Get the file size.
1952 m_fileSize = (U32) fileHdr[4]
1953 | ((U32) fileHdr[5] << 8)
1954 | ((U32) fileHdr[6] << 16)
1955 | ((U32) fileHdr[7] << 24);
1956
1957 // Verify the minimum length of a Flash file.
1958 if (m_fileSize < 21)
1959 {
1960 //printf("ERROR: File size is too short\n");
1961 return FLASH_PARSE_ERROR;// Error
1962 }
1963
1964 // Set the file position past the header and size information.
1965 m_filePos = 8;
1966
1967 // Get the frame information.
1968 GetRect(&frameRect);
1969
1970 frameRate = GetWord() >> 8;
1971
1972 frameCount = GetWord();
1973
1974 program = new Program(movie, frameCount);
1975
1976 if (program == NULL || program->totalFrames == 0) {
1977 return FLASH_PARSE_ERROR;
1978 }
1979
1980 status |= FLASH_PARSE_START;
1981 }
1982
1983 ParseTags(&status);
1984
1985 return status;
1986}
1987
1988
diff --git a/core/multimedia/opieplayer/libflash/script.h b/core/multimedia/opieplayer/libflash/script.h
new file mode 100644
index 0000000..a41c47e
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/script.h
@@ -0,0 +1,144 @@
1#ifndef _SCRIPT_H_
2#define _SCRIPT_H_
3
4// SWF file parser.
5//
6//////////////////////////////////////////////////////////////////////
7
8//////////////////////////////////////////////////////////////////////
9// Input script object definition.
10//////////////////////////////////////////////////////////////////////
11
12// An input script object. This object represents a script created from
13// an external file that is meant to be inserted into an output script.
14struct CInputScript : public Dict
15{
16 int level;
17 struct CInputScript *next;
18
19 Program *program;// Current parsed program
20
21 // Memory fences
22 int outOfMemory;
23
24 //Flash info
25 long frameRate;
26 long frameCount;
27 Rect frameRect;
28
29 // Pointer to file contents buffer.
30 U8 *m_fileBuf;
31
32 // File state information.
33 U32 m_filePos;
34 U32 m_fileSize;
35 U32 m_actualSize;
36 U32 m_fileStart;
37 U16 m_fileVersion;
38
39 int needHeader;
40
41 // Bit Handling
42 S32 m_bitPos;
43 U32 m_bitBuf;
44
45 // Tag parsing information.
46 U32 m_tagStart;
47 U32 m_tagEnd;
48 U32 m_tagLen;
49
50 // Parsing information.
51 S32 m_nFillBits;
52 S32 m_nLineBits;
53 S32 m_nGlyphBits;
54 S32 m_nAdvanceBits;
55
56 // Set to true if we wish to dump all contents long form
57 U32 m_dumpAll;
58
59 // if set to true will dump image guts (i.e. jpeg, zlib, etc. data)
60 U32 m_dumpGuts;
61
62 // Handle to output file.
63 FILE *m_outputFile;
64
65 // Constructor/destructor.
66 CInputScript(int level = 0);
67 ~CInputScript();
68
69 // Tag scanning methods.
70 U16 GetTag(void);
71 U8 GetByte(void);
72 U16 GetWord(void);
73 U32 GetDWord(void);
74 void GetRect(Rect *r);
75 void GetMatrix(Matrix *matrix);
76
77 void GetCxform(Cxform *cxform, BOOL hasAlpha);
78 char *GetString(void);
79
80 // Routines for reading arbitrary sized bit fields from the stream.
81 // Always call start bits before gettings bits and do not intermix
82 // these calls with GetByte, etc...
83 void InitBits();
84 S32 GetSBits(S32 n);
85 U32 GetBits(S32 n);
86
87 // Tag subcomponent parsing methods
88 void ParseFillStyle(long getAlpha = 0);
89 void ParseLineStyle(long getAlpha = 0);
90 int ParseShapeRecord(long getAlpha = 0);
91 ButtonRecord * ParseButtonRecord(long getCxform = 0);
92 ActionRecord * ParseActionRecord();
93 TextRecord * ParseTextRecord(int hasAlpha = 0);
94 void ParseShapeData(int getAlpha, int getStyles);
95
96 // Parsing methods.
97 void ParseEnd(); // 00: stagEnd
98 void ParseShowFrame(U32 frame, U32 offset);// 01: stagShowFrame
99 void ParseDefineShape(int level); // 02: stagDefineShape
100 void ParseFreeCharacter(); // 03: stagFreeCharacter
101 void ParsePlaceObject(); // 04: stagPlaceObject
102 void ParseRemoveObject(); // 05: stagRemoveObject
103 void ParseDefineBits(); // 06: stagDefineBits
104 void ParseDefineButton(); //x 07: stagDefineButton
105 void ParseJPEGTables(); // 08: stagJPEGTables
106 void ParseSetBackgroundColor(); // 09: stagSetBackgroundColor
107 void ParseDefineFont(); //x 10: stagDefineFont
108 void ParseDefineText(int hasAplha); //x 11: stagDefineText 33: stagDefineText2
109 void ParseDoAction(); // 12: stagDoAction
110 void ParseDefineFontInfo(); //x 13: stagDefineFontInfo
111 void ParseDefineSound(); // 14: stagDefineSound
112 void ParseStartSound(); // 15: stagStartSound
113 void ParseStopSound(); // 16: stagStopSound
114 void ParseDefineButtonSound(); // 17: stagDefineButtonSound
115 void ParseSoundStreamHead(); // 18: stagSoundStreamHead
116 void ParseSoundStreamBlock(); // 19: stagSoundStreamBlock
117 void ParseDefineBitsLossless(int level); // 20: stagDefineBitsLossless 36: stagDefineBitsLossless2
118 void ParseDefineBitsJPEG2(); // 21: stagDefineBitsJPEG2
119 void ParseDefineButtonCxform(); // 23: stagDefineButtonCxform
120 void ParseProtect(); // 24: stagProtect
121 void ParsePlaceObject2(); // 26: stagPlaceObject2
122 void ParseRemoveObject2(); // 28: stagRemoveObject2
123 void ParseDefineButton2(); //x 34: stagDefineButton2
124 void ParseDefineBitsJPEG3(); // 35: stagDefineBitsJPEG3
125 void ParseDefineMouseTarget(); // 38: stagDefineMouseTarget
126 void ParseDefineSprite(); //x 39: stagDefineSprite
127 void ParseNameCharacter(); // 40: stagNameCharacter
128 void ParseFrameLabel(); // 43: stagFrameLabel
129 void ParseSoundStreamHead2(); // 45: stagSoundStreamHead2
130 void ParseDefineMorphShape(); //x 46: stagDefineMorphShape
131 void ParseDefineFont2(); //x 48: stagDefineFont2
132 void ParseUnknown(long,long);
133
134 void ParseTags(int *);
135 int ParseData(FlashMovie *movie, char * data, long size);
136 void S_DumpImageGuts();
137
138#ifdef DUMP
139 long save(char *filenam);
140#endif
141};
142
143
144#endif /* _SCRIPT_H_ */
diff --git a/core/multimedia/opieplayer/libflash/shape.cc b/core/multimedia/opieplayer/libflash/shape.cc
new file mode 100644
index 0000000..0d8df93
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/shape.cc
@@ -0,0 +1,1205 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29#define PRINT 0
30
31#define ABS(v) ((v) < 0 ? -(v) : (v))
32
33static void prepareStyles(GraphicDevice *gd, Matrix *matrix, Cxform *cxform, FillStyleDef *f, long n);
34
35static void clearStyles(GraphicDevice *gd, FillStyleDef *f, long n);
36
37static void drawShape(GraphicDevice *gd, Matrix *matrix1, Cxform *cxform, Shape *shape,
38 ShapeAction shapeAction, void *id,ScanLineFunc scan_line_func);
39
40// Constructor
41
42Shape::Shape(long id, int level) : Character(ShapeType, id)
43{
44 defLevel = level;
45
46 defaultFillStyle.type = f_Solid;
47 defaultFillStyle.color.red = 0;
48 defaultFillStyle.color.green = 0;
49 defaultFillStyle.color.blue = 0;
50 defaultFillStyle.color.alpha = ALPHA_OPAQUE;
51
52 defaultLineStyle.width = 0;
53
54 // This is to force a first update
55 lastMat.a = 0;
56 lastMat.d = 0;
57 shape_size += sizeof(Shape);
58 shape_nb ++;
59
60 file_ptr = NULL;
61 getStyles = 0;
62 getAlpha = 0;
63}
64
65Shape::~Shape()
66{
67 if (file_ptr) {
68 free(file_ptr);
69 }
70}
71
72void
73Shape::setBoundingBox(Rect rect)
74{
75 boundary = rect;
76}
77
78void
79Shape::getBoundingBox(Rect *bb, DisplayListEntry *e)
80{
81 *bb = boundary;
82}
83
84int
85Shape::execute(GraphicDevice *gd, Matrix *matrix, Cxform *cxform)
86{
87 //printf("TagId = %d\n", getTagId());
88 //if (getTagId() != 220) return 0;
89
90 if (cxform) {
91 defaultFillStyle.color = cxform->getColor(gd->getForegroundColor());
92 } else {
93 defaultFillStyle.color = gd->getForegroundColor();
94 }
95 defaultFillStyle.color.pixel = gd->allocColor(defaultFillStyle.color);
96
97 drawShape(gd, matrix, cxform, this, ShapeDraw, NULL, 0);
98 return 0;
99}
100
101void
102Shape::getRegion(GraphicDevice *gd, Matrix *matrix, void *id, ScanLineFunc scan_line_func)
103{
104 gd->setClipping(0);
105 drawShape(gd,matrix,0,this,ShapeGetRegion,id,scan_line_func);
106 gd->setClipping(1);
107}
108
109/************************************************************************/
110
111/* create a new path */
112
113static void newPath(ShapeParser *shape,
114 long x, long y)
115{
116 Path *p;
117 long x1,y1;
118
119 p=&shape->curPath;
120
121 x1 = shape->matrix->getX(x, y);
122 y1 = shape->matrix->getY(x, y);
123
124 p->lastX = x1;
125 p->lastY = y1;
126
127 p->nb_edges = 0;
128 p->nb_segments = 0;
129}
130
131
132static void addSegment1(ShapeParser *shape,
133 long x, long y,
134 FillStyleDef *f0,
135 FillStyleDef *f1,
136 LineStyleDef *l)
137{
138 Path *p;
139 p=&shape->curPath;
140
141 if (l) {
142 /* a line is defined ... it will be drawn later */
143 LineSegment *ls;
144
145 ls = new LineSegment;
146 if (ls != NULL) {
147 ls->l = l;
148 ls->x1 = p->lastX;
149 ls->y1 = p->lastY;
150 ls->x2 = x;
151 ls->y2 = y;
152 ls->first = (p->nb_segments == 0);
153 ls->next = NULL;
154 if (shape->last_line == NULL) {
155 shape->first_line = ls;
156 } else {
157 shape->last_line->next = ls;
158 }
159 shape->last_line = ls;
160 }
161 }
162
163 /* anti antialiasing not needed if line */
164 if (!shape->reverse) {
165 shape->gd->addSegment(p->lastX,p->lastY,x,y,f0,f1,l ? 0 : 1);
166 } else {
167 shape->gd->addSegment(p->lastX,p->lastY,x,y,f1,f0,l ? 0 : 1);
168 }
169
170 p->lastX = x;
171 p->lastY = y;
172
173 p->nb_segments++;
174}
175
176
177static void addLine(ShapeParser *shape, long x, long y,
178 FillStyleDef *f0,
179 FillStyleDef *f1,
180 LineStyleDef *l)
181{
182 long x1,y1;
183 Path *p;
184
185 p=&shape->curPath;
186
187 x1 = shape->matrix->getX(x, y);
188 y1 = shape->matrix->getY(x, y);
189
190 addSegment1(shape,x1,y1,f0,f1,l);
191
192 p->nb_edges++;
193}
194
195
196// This is based on Divide and Conquer algorithm.
197
198#define BFRAC_BITS 0
199#define BFRAC (1 << BFRAC_BITS)
200
201static void
202bezierBuildPoints (ShapeParser *s,
203 int subdivisions,
204 long a1X, long a1Y,
205 long cX, long cY,
206 long a2X, long a2Y)
207{
208 long c1X,c1Y;
209 long c2X,c2Y;
210 long X,Y;
211 long xmin,ymin,xmax,ymax;
212
213 if (subdivisions != 0) {
214
215 /* find the bounding box */
216
217 if (a1X < cX) {
218 xmin = a1X;
219 xmax = cX;
220 } else {
221 xmin = cX;
222 xmax = a1X;
223 }
224 if (a2X < xmin) xmin = a2X;
225 if (a2X > xmax) xmax = a2X;
226
227 if (a1Y < cY) {
228 ymin = a1Y;
229 ymax = cY;
230 } else {
231 ymin = cY;
232 ymax = a1Y;
233 }
234 if (a2Y < ymin) ymin = a2Y;
235 if (a2Y > ymax) ymax = a2Y;
236
237 if (((xmax - xmin) + (ymax - ymin)) >= (BFRAC*FRAC*2)) {
238 // Control point 1
239 c1X = (a1X+cX) >> 1;
240 c1Y = (a1Y+cY) >> 1;
241
242 // Control point 2
243 c2X = (a2X+cX) >> 1;
244 c2Y = (a2Y+cY) >> 1;
245
246 // New point
247 X = (c1X+c2X) >> 1;
248 Y = (c1Y+c2Y) >> 1;
249
250 subdivisions--;
251
252 bezierBuildPoints(s, subdivisions,
253 a1X, a1Y, c1X, c1Y, X, Y);
254 bezierBuildPoints(s, subdivisions,
255 X, Y, c2X, c2Y, a2X, a2Y);
256
257 return;
258 }
259 }
260
261 addSegment1(s, (a2X+(BFRAC/2)) >> BFRAC_BITS,
262 (a2Y+(BFRAC/2)) >> BFRAC_BITS, s->f0, s->f1, s->l);
263}
264
265/* this code is broken, but useful to get something */
266static void flushPaths(ShapeParser *s)
267{
268 LineSegment *ls;
269 LineStyleDef *l;
270 long nx,ny,nn,w;
271 GraphicDevice *gd = s->gd;
272
273 /* draw the filled polygon */
274 gd->drawPolygon();
275
276 /* draw the lines */
277 ls = s->first_line;
278 if (ls != NULL) {
279 do {
280 l = ls->l;
281
282#if 0
283 printf("line %d %d %d %d width=%d\n",
284 ls->x1, ls->y1, ls->x2, ls->y2, l->width);
285#endif
286
287 /* XXX: this width is false, but it is difficult (and expensive)
288 to have the correct one */
289 w = ABS((long)(s->matrix->a * l->width));
290
291 if (w <= ((3*FRAC)/2)) {
292 w = FRAC;
293 }
294#ifdef THIN_LINES
295 if (w <= ((3*FRAC)/2)) {
296 // draw the thin lines only in shapeAction == shapeDraw
297 if (gd->scan_line_func == NULL) {
298 gd->setForegroundColor(l->fillstyle.color);
299 gd->drawLine(ls->x1, ls->y1, ls->x2, ls->y2, w);
300 }
301 } else {
302#else
303 {
304#endif
305 /* compute the normal vector */
306
307 nx = -(ls->y2 - ls->y1);
308 ny = (ls->x2 - ls->x1);
309
310 /* normalize & width */
311 nn = 2 * (long) sqrt(nx * nx + ny * ny);
312
313#define UL ls->x1 + nx -ny, ls->y1 + ny +nx
314#define UR ls->x2 + nx +ny, ls->y2 + ny -nx
315#define LL ls->x1 - nx -ny, ls->y1 - ny +nx
316#define LR ls->x2 - nx +ny, ls->y2 - ny -nx
317
318 if (nn > 0) {
319 nx = (nx * w) / nn;
320 ny = (ny * w) / nn;
321
322 /* top segment */
323 gd->addSegment(UL, UR, NULL, &l->fillstyle, 1);
324
325 /* bottom segment */
326 gd->addSegment(LL, LR, &l->fillstyle, NULL, 1);
327
328 /* right segment */
329 gd->addSegment(UR, LR, &l->fillstyle, NULL, 1);
330
331 /* left segment */
332 gd->addSegment(UL, LL, NULL, &l->fillstyle, 1);
333
334 /* draw the line polygon */
335 gd->drawPolygon();
336 }
337 }
338
339 ls = ls->next;
340 } while (ls != NULL);
341
342 /* delete the line structures */
343
344 ls = s->first_line;
345 while (ls != NULL) {
346 LineSegment *ls1;
347 ls1 = ls->next;
348 delete ls;
349 ls = ls1;
350 }
351
352 /* reset the line pointers */
353 s->first_line = NULL;
354 s->last_line = NULL;
355 }
356}
357
358
359static void addBezier(ShapeParser *shape,
360 long ctrlX1, long ctrlY1,
361 long newX1, long newY1,
362 FillStyleDef *f0,
363 FillStyleDef *f1,
364 LineStyleDef *l)
365{
366 long newX,newY,ctrlX,ctrlY;
367 Path *p;
368
369 p=&shape->curPath;
370
371 /* note: we do the matrix multiplication before calculating the
372 bezier points (faster !) */
373
374 ctrlX = shape->matrix->getX(ctrlX1, ctrlY1);
375 ctrlY = shape->matrix->getY(ctrlX1, ctrlY1);
376 newX = shape->matrix->getX(newX1, newY1);
377 newY = shape->matrix->getY(newX1, newY1);
378
379 shape->f0 = f0;
380 shape->f1 = f1;
381 shape->l = l;
382
383 bezierBuildPoints(shape, 3,
384 p->lastX<<BFRAC_BITS,p->lastY<<BFRAC_BITS,
385 ctrlX<<BFRAC_BITS,ctrlY<<BFRAC_BITS,
386 newX<<BFRAC_BITS,newY<<BFRAC_BITS);
387
388 p->nb_edges++;
389}
390
391/***********************************************************************/
392
393
394/* bit parser */
395
396static void InitBitParser(struct BitParser *b,U8 *buf)
397{
398 b->ptr = buf;
399}
400
401static void InitBits(struct BitParser *b)
402{
403 // Reset the bit position and buffer.
404 b->m_bitPos = 0;
405 b->m_bitBuf = 0;
406}
407
408
409
410static inline U8 GetByte(struct BitParser *b)
411{
412 U8 v;
413 v = *b->ptr++;
414 return v;
415}
416
417static inline U16 GetWord(struct BitParser *b)
418{
419 U8 *s;
420 U16 v;
421 s = b->ptr;
422 v = s[0] | ((U16) s[1] << 8);
423 b->ptr = s + 2;
424 return v;
425}
426
427static inline U32 GetDWord(struct BitParser *b)
428{
429 U32 v;
430 U8 * s = b->ptr;
431 v = (U32) s[0] | ((U32) s[1] << 8) |
432 ((U32) s[2] << 16) | ((U32) s [3] << 24);
433 b->ptr = s + 4;
434 return v;
435}
436
437static inline U32 GetBit (struct BitParser *b)
438{
439 U32 v;
440 S32 m_bitPos = b->m_bitPos;
441 U32 m_bitBuf = b->m_bitBuf;
442
443 if (m_bitPos == 0) {
444 m_bitBuf = (U32)(*b->ptr++) << 24;
445 m_bitPos = 8;
446 }
447
448 v = (m_bitBuf >> 31);
449
450 m_bitPos--;
451 m_bitBuf <<= 1;
452
453 b->m_bitPos = m_bitPos;
454 b->m_bitBuf = m_bitBuf;
455
456 return v;
457}
458
459static inline U32 GetBits (struct BitParser *b, int n)
460{
461 U32 v;
462 S32 m_bitPos = b->m_bitPos;
463 U32 m_bitBuf = b->m_bitBuf;
464
465 if (n == 0)
466 return 0;
467
468 while (m_bitPos < n) {
469 m_bitBuf |= (U32)(*b->ptr++) << (24 - m_bitPos);
470 m_bitPos += 8;
471 }
472
473 v = m_bitBuf >> (32 - n);
474 m_bitBuf <<= n;
475 m_bitPos -= n;
476
477 b->m_bitPos = m_bitPos;
478 b->m_bitBuf = m_bitBuf;
479 return v;
480}
481
482// Get n bits from the string with sign extension.
483static inline S32 GetSBits (struct BitParser *b,S32 n)
484{
485 // Get the number as an unsigned value.
486 S32 v = (S32) GetBits(b,n);
487
488 // Is the number negative?
489 if (v & (1L << (n - 1)))
490 {
491 // Yes. Extend the sign.
492 v |= -1L << n;
493 }
494
495 return v;
496}
497
498
499
500/************************************************************************/
501
502static void GetMatrix(BitParser *b, Matrix* mat)
503{
504 InitBits(b);
505
506 // Scale terms
507 if (GetBit(b))
508 {
509 int nBits = (int) GetBits(b,5);
510 mat->a = (float)(GetSBits(b,nBits))/(float)0x10000;
511 mat->d = (float)(GetSBits(b,nBits))/(float)0x10000;
512 }
513 else
514 {
515 mat->a = mat->d = 1.0;
516 }
517
518 // Rotate/skew terms
519 if (GetBit(b))
520 {
521 int nBits = (int)GetBits(b,5);
522 mat->c = (float)(GetSBits(b,nBits))/(float)0x10000;
523 mat->b = (float)(GetSBits(b,nBits))/(float)0x10000;
524 }
525 else
526 {
527 mat->b = mat->c = 0.0;
528 }
529
530 // Translate terms
531 int nBits = (int) GetBits(b,5);
532 mat->tx = GetSBits(b,nBits);
533 mat->ty = GetSBits(b,nBits);
534}
535
536static FillStyleDef * ParseFillStyle(ShapeParser *shape, long *n, long getAlpha)
537{
538 BitParser *b = &shape->bit_parser;
539 FillStyleDef *defs;
540 U16 i = 0;
541
542 // Get the number of fills.
543 U16 nFills = GetByte(b);
544
545 // Do we have a larger number?
546 if (nFills == 255)
547 {
548 // Get the larger number.
549 nFills = GetWord(b);
550 }
551
552 *n = nFills;
553 defs = new FillStyleDef[ nFills ];
554 if (defs == NULL) return NULL;
555
556 // Get each of the fill style.
557 for (i = 0; i < nFills; i++)
558 {
559 U16 fillStyle = GetByte(b);
560
561 defs[i].type = (FillType) fillStyle;
562
563 if (fillStyle & 0x10)
564 {
565 defs[i].type = (FillType) (fillStyle & 0x12);
566
567 // Get the gradient matrix.
568 GetMatrix(b,&(defs[i].matrix));
569
570 // Get the number of colors.
571 defs[i].gradient.nbGradients = GetByte(b);
572
573 // Get each of the colors.
574 for (U16 j = 0; j < defs[i].gradient.nbGradients; j++)
575 {
576 defs[i].gradient.ratio[j] = GetByte(b);
577 defs[i].gradient.color[j].red = GetByte(b);
578 defs[i].gradient.color[j].green = GetByte(b);
579 defs[i].gradient.color[j].blue = GetByte(b);
580 if (getAlpha) {
581 defs[i].gradient.color[j].alpha = GetByte(b);
582 } else {
583 defs[i].gradient.color[j].alpha = ALPHA_OPAQUE;
584 }
585 }
586 }
587 else if (fillStyle & 0x40)
588 {
589 defs[i].type = (FillType) (fillStyle & 0x41);
590
591 // Get the bitmapId
592 defs[i].bitmap = (Bitmap *)shape->dict->getCharacter(GetWord(b));
593 // Get the bitmap matrix.
594 GetMatrix(b,&(defs[i].matrix));
595 }
596 else
597 {
598 defs[i].type = (FillType) 0;
599
600 // A solid color
601 defs[i].color.red = GetByte(b);
602 defs[i].color.green = GetByte(b);
603 defs[i].color.blue = GetByte(b);
604 if (getAlpha) {
605 defs[i].color.alpha = GetByte(b);
606 } else {
607 defs[i].color.alpha = ALPHA_OPAQUE;
608 }
609 }
610 }
611
612 return defs;
613}
614
615static LineStyleDef * ParseLineStyle(ShapeParser *shape, long *n, long getAlpha)
616{
617 BitParser *b = &shape->bit_parser;
618 LineStyleDef *defs,*def;
619 FillStyleDef *f;
620 long i;
621
622 // Get the number of lines.
623 U16 nLines = GetByte(b);
624
625 // Do we have a larger number?
626 if (nLines == 255)
627 {
628 // Get the larger number.
629 nLines = GetWord(b);
630 }
631
632 *n = nLines;
633 defs = new LineStyleDef[ nLines ];
634 if (defs == NULL) return NULL;
635
636 // Get each of the line styles.
637 for (i = 0; i < nLines; i++)
638 {
639 def=&defs[i];
640 def->width = GetWord(b);
641 def->color.red = GetByte(b);
642 def->color.green = GetByte(b);
643 def->color.blue = GetByte(b);
644 if (getAlpha) {
645 def->color.alpha = GetByte(b);
646 } else {
647 def->color.alpha = ALPHA_OPAQUE;
648 }
649
650 f=&def->fillstyle;
651 f->type = f_Solid;
652 f->color = def->color;
653 if (shape->cxform) {
654 f->color = shape->cxform->getColor(f->color);
655 }
656 f->color.pixel = shape->gd->allocColor(f->color);
657 }
658
659 return defs;
660}
661
662/* 0 = end of shape */
663static int ParseShapeRecord(ShapeParser *shape, ShapeRecord *sr, long getAlpha)
664{
665 BitParser *b = &shape->bit_parser;
666
667 // Determine if this is an edge.
668 BOOL isEdge = (BOOL) GetBit(b);
669
670 if (!isEdge)
671 {
672 // Handle a state change
673 U16 flags = (U16) GetBits(b,5);
674
675 // Are we at the end?
676 if (flags == 0)
677 {
678 // End of shape
679 return 0;
680 }
681
682 sr->type = shapeNonEdge;
683 sr->flags = (ShapeFlags)flags;
684
685 // Process a move to.
686 if (flags & flagsMoveTo)
687 {
688 U16 nBits = (U16) GetBits(b,5);
689 sr->x = GetSBits(b,nBits);
690 sr->y = GetSBits(b,nBits);
691 }
692
693 // Get new fill info.
694 if (flags & flagsFill0)
695 {
696 sr->fillStyle0 = GetBits(b,shape->m_nFillBits);
697 }
698 if (flags & flagsFill1)
699 {
700 sr->fillStyle1 = GetBits(b,shape->m_nFillBits);
701 }
702
703 // Get new line info
704 if (flags & flagsLine)
705 {
706 sr->lineStyle = GetBits(b,shape->m_nLineBits);
707 }
708
709 // Check to get a new set of styles for a new shape layer.
710 if (flags & flagsNewStyles)
711 {
712 FillStyleDef *fillDefs;
713 LineStyleDef *lineDefs;
714 long n;
715
716 // Parse the style.
717 fillDefs = ParseFillStyle(shape, &n, getAlpha);
718 if (fillDefs == NULL) return 0;
719
720 sr->newFillStyles = fillDefs;
721 sr->nbNewFillStyles = n;
722
723 lineDefs = ParseLineStyle(shape, &n, getAlpha);
724 if (lineDefs == NULL) return 0;
725
726 sr->newLineStyles = lineDefs;
727 sr->nbNewLineStyles = n;
728
729 InitBits(b);// Bug !
730
731 // Reset.
732 shape->m_nFillBits = (U16) GetBits(b,4);
733 shape->m_nLineBits = (U16) GetBits(b,4);
734 }
735
736 //if (flags & flagsEndShape)
737 //printf("\tEnd of shape.\n\n");
738
739 return flags & flagsEndShape ? 0 : 1;
740 }
741 else
742 {
743 if (GetBit(b))
744 {
745 sr->type = shapeLine;
746
747 // Handle a line
748 U16 nBits = (U16) GetBits(b,4) + 2;// nBits is biased by 2
749
750 // Save the deltas
751 if (GetBit(b))
752 {
753 // Handle a general line.
754 sr->dX = GetSBits(b,nBits);
755 sr->dY = GetSBits(b,nBits);
756 }
757 else
758 {
759 // Handle a vert or horiz line.
760 if (GetBit(b))
761 {
762 // Vertical line
763 sr->dY = GetSBits(b,nBits);
764 sr->dX = 0;
765 }
766 else
767 {
768 // Horizontal line
769 sr->dX = GetSBits(b,nBits);
770 sr->dY = 0;
771 }
772 }
773 }
774 else
775 {
776 sr->type = shapeCurve;
777
778 // Handle a curve
779 U16 nBits = (U16) GetBits(b,4) + 2;// nBits is biased by 2
780
781 // Get the control
782 sr->ctrlX = GetSBits(b,nBits);
783 sr->ctrlY = GetSBits(b,nBits);
784
785 // Get the anchor
786 sr->anchorX = GetSBits(b,nBits);
787 sr->anchorY = GetSBits(b,nBits);
788 }
789
790 return 1;
791 }
792}
793
794static void drawShape(GraphicDevice *gd, Matrix *matrix1, Cxform *cxform, Shape *shape,
795 ShapeAction shapeAction, void *id,ScanLineFunc scan_line_func)
796{
797 LineStyleDef *l;
798 FillStyleDef *f0;
799 FillStyleDef *f1;
800 ShapeRecord sr1,*sr = &sr1;
801 int firstPoint;
802 long lastX,lastY;
803 LineStyleDef *curLineStyle;
804 long curNbLineStyles;
805 FillStyleDef *curFillStyle;
806 long curNbFillStyles;
807 StyleList *sl;
808 ShapeParser sp1,*sp=&sp1;
809 BitParser *b;
810 Matrix mat,*matrix;
811
812 mat = (*gd->adjust) * (*matrix1);
813 matrix = &mat;
814
815 sp->reverse = (mat.a * mat.d) < 0;
816
817 curLineStyle = NULL;
818 curNbLineStyles = 0;
819 curFillStyle = NULL;
820 curNbFillStyles = 0;
821 sp->style_list = NULL;
822
823 sp->shape = shape;
824 sp->gd = gd;
825 sp->matrix = matrix;
826 sp->cxform = cxform;
827 sp->dict = shape->dict;
828
829 if (shapeAction == ShapeGetRegion) {
830 gd->scan_line_func = scan_line_func;
831 gd->scan_line_func_id = id;
832 } else {
833 gd->scan_line_func = NULL;
834 }
835
836 b = &sp->bit_parser;
837 InitBitParser(b,shape->file_ptr);
838
839 if (shape->getStyles) {
840 // ShapeWithStyle
841 curFillStyle = ParseFillStyle(sp, &curNbFillStyles, shape->getAlpha);
842 if (curFillStyle == NULL) return;
843
844 curLineStyle = ParseLineStyle(sp, &curNbLineStyles, shape->getAlpha);
845 if (curLineStyle == NULL) return;
846
847 sl = new StyleList;
848 if (sl == NULL) return;
849
850 sl->next = NULL;
851 sl->newFillStyles = curFillStyle;
852 sl->nbNewFillStyles = curNbFillStyles;
853 sl->newLineStyles = curLineStyle;
854 sl->nbNewLineStyles = curNbLineStyles;
855
856 sp->style_list = sl;
857
858 if (shapeAction == ShapeDraw) {
859 prepareStyles(gd, matrix, cxform, curFillStyle, curNbFillStyles);
860 }
861 }
862
863 InitBits(b);
864 sp->m_nFillBits = (U16) GetBits(b,4);
865 sp->m_nLineBits = (U16) GetBits(b,4);
866
867 l = 0;
868 f0 = 0;
869 f1 = 0;
870 firstPoint = 1;
871 lastX = 0;
872 lastY = 0;
873 sp->curPath.nb_edges = 0;
874 sp->first_line = NULL;
875 sp->last_line = NULL;
876
877 for(;;) {
878 if (ParseShapeRecord(sp, sr, shape->getAlpha) == 0) break;
879
880 switch (sr->type)
881 {
882 case shapeNonEdge:
883 if (sr->flags & flagsNewStyles) {
884
885 curFillStyle = sr->newFillStyles;
886 curNbFillStyles = sr->nbNewFillStyles;
887 curLineStyle = sr->newLineStyles;
888 curNbLineStyles = sr->nbNewLineStyles;
889
890 sl = new StyleList;
891 sl->next = sp->style_list;
892 sl->newFillStyles = sr->newFillStyles;
893 sl->nbNewFillStyles = sr->nbNewFillStyles;
894 sl->newLineStyles = sr->newLineStyles;
895 sl->nbNewLineStyles = sr->nbNewLineStyles;
896
897 sp->style_list = sl;
898
899 if (shapeAction == ShapeDraw) {
900 prepareStyles(gd, matrix, cxform, curFillStyle, curNbFillStyles);
901 }
902 }
903 if (sr->flags & flagsFill0) {
904 if (sr->fillStyle0) {
905 if (curFillStyle) {
906 f0 = &curFillStyle[sr->fillStyle0-1];
907 } else {
908 f0 = &shape->defaultFillStyle;
909 }
910 } else {
911 f0 = 0;
912 }
913 }
914 if (sr->flags & flagsFill1) {
915 if (sr->fillStyle1) {
916 if (curFillStyle) {
917 f1 = &curFillStyle[sr->fillStyle1-1];
918 } else {
919 f1 = &shape->defaultFillStyle;
920 }
921 } else {
922 f1 = 0;
923 }
924 }
925 if (sr->flags & flagsLine) {
926 if (sr->lineStyle) {
927 l = &curLineStyle[sr->lineStyle-1];
928 } else {
929 l = 0;
930 }
931 }
932 if (sr->flags & flagsMoveTo) {
933 if (sp->curPath.nb_edges == 0) {
934 /* if no edges, draw the polygon, then the lines */
935 flushPaths(sp);
936 }
937
938 newPath(sp, sr->x, sr->y);
939 firstPoint = 0;
940
941 lastX = sr->x;
942 lastY = sr->y;
943
944#if PRINT
945 printf("---------\nX,Y = %4d,%4d\n", sr->x/20, sr->y/20);
946#endif
947 }
948 break;
949 case shapeCurve:
950 // Handle Bezier Curves !!!
951 if (firstPoint) {
952 newPath(sp, 0, 0);
953 firstPoint = 0;
954 }
955 {
956 long newX,newY,ctrlX,ctrlY;
957
958 ctrlX = lastX+sr->ctrlX;
959 ctrlY = lastY+sr->ctrlY;
960 newX = ctrlX+sr->anchorX;
961 newY = ctrlY+sr->anchorY;
962
963#if 1
964 addBezier(sp, ctrlX, ctrlY, newX, newY, f0 , f1, l);
965#else
966 addLine(sp, newX, newY, f0, f1, l);
967#endif
968
969 lastX = newX;
970 lastY = newY;
971 }
972 break;
973 case shapeLine:
974 if (firstPoint) {
975 newPath(sp, 0, 0);
976 firstPoint = 0;
977 }
978
979 lastX += sr->dX;
980 lastY += sr->dY;
981
982 addLine(sp, lastX, lastY, f0, f1, l);
983#if PRINT
984 printf(" X, Y = %4d,%4d\n", lastX/20, lastY/20);
985#endif
986 break;
987 }
988 }
989
990 /* XXX: should test if there is something to draw */
991 flushPaths(sp);
992
993 /* free the styles */
994 while (sp->style_list) {
995 StyleList *sl;
996
997 sl=sp->style_list;
998 sp->style_list = sl->next;
999
1000 if (shapeAction == ShapeDraw) {
1001 clearStyles(gd, sl->newFillStyles, sl->nbNewFillStyles);
1002 }
1003
1004 delete[] sl->newFillStyles;
1005 delete[] sl->newLineStyles;
1006
1007 delete sl;
1008 }
1009}
1010
1011static void
1012prepareStyles(GraphicDevice *gd, Matrix *matrix, Cxform *cxform,
1013 FillStyleDef *ftab, long n)
1014{
1015 long fs;
1016 FillStyleDef *f;
1017
1018 for(fs = 0; fs < n; fs++)
1019 {
1020 f = ftab + fs;
1021 switch (f->type)
1022 {
1023 case f_None:
1024 break;
1025 case f_Solid:
1026 if (cxform) {
1027 f->color = cxform->getColor(f->color);
1028 }
1029 f->color.pixel = gd->allocColor(f->color);
1030 break;
1031 case f_LinearGradient:
1032 case f_RadialGradient:
1033 {
1034 Matrix mat;
1035 int n,r,l;
1036 long red, green, blue, alpha;
1037 long dRed, dGreen, dBlue, dAlpha;
1038 long min,max;
1039 Matrix *m;
1040
1041 mat = *(matrix) * f->matrix;
1042 // Compute inverted matrix
1043 f->gradient.imat = mat.invert();
1044
1045 /* renormalize the matrix */
1046 m=&f->gradient.imat;
1047 if (f->type == f_LinearGradient) {
1048 m->a = m->a * FRAC * (1/128.0) * 65536.0;
1049 m->b = m->b * FRAC * (1/128.0) * 65536.0;
1050 m->tx = (long) ((m->tx + 16384) * (1/128.0) * 65536.0);
1051 } else {
1052 m->a = m->a * FRAC * (1/64.0) * 65536.0;
1053 m->b = m->b * FRAC * (1/64.0) * 65536.0;
1054 m->c = m->c * FRAC * (1/64.0) * 65536.0;
1055 m->d = m->d * FRAC * (1/64.0) * 65536.0;
1056 m->tx = (long) (m->tx * (1/64.0) * 65536.0);
1057 m->ty = (long) (m->ty * (1/64.0) * 65536.0);
1058 }
1059
1060 // Reset translation in inverted matrix
1061 f->gradient.has_alpha = 0;
1062
1063 // Build a 256 color ramp
1064 f->gradient.ramp = new Color[256];
1065 if (f->gradient.ramp == NULL) {
1066 // Invalidate fill style
1067 f->type = f_None;
1068 continue;
1069 }
1070
1071 // Store min and max
1072 min = f->gradient.ratio[0];
1073 max = f->gradient.ratio[f->gradient.nbGradients-1];
1074 for(r=0; r < f->gradient.nbGradients-1; r++)
1075 {
1076 Color start,end;
1077
1078 l = f->gradient.ratio[r+1]-f->gradient.ratio[r];
1079 if (l == 0) continue;
1080
1081 if (cxform) {
1082 start = cxform->getColor(f->gradient.color[r]);
1083 end = cxform->getColor(f->gradient.color[r+1]);
1084 } else {
1085 start = f->gradient.color[r];
1086 end = f->gradient.color[r+1];
1087 }
1088
1089 if (start.alpha != ALPHA_OPAQUE ||
1090 end.alpha != ALPHA_OPAQUE) {
1091 f->gradient.has_alpha = 1;
1092 }
1093
1094 dRed = end.red - start.red;
1095 dGreen = end.green - start.green;
1096 dBlue = end.blue - start.blue;
1097 dAlpha = end.alpha - start.alpha;
1098
1099 dRed = (dRed<<16)/l;
1100 dGreen = (dGreen<<16)/l;
1101 dBlue = (dBlue<<16)/l;
1102 dAlpha = (dAlpha<<16)/l;
1103
1104 red = start.red <<16;
1105 green = start.green <<16;
1106 blue = start.blue <<16;
1107 alpha = start.alpha <<16;
1108
1109 for (n=f->gradient.ratio[r]; n<=f->gradient.ratio[r+1]; n++) {
1110 f->gradient.ramp[n].red = red>>16;
1111 f->gradient.ramp[n].green = green>>16;
1112 f->gradient.ramp[n].blue = blue>>16;
1113 f->gradient.ramp[n].alpha = alpha>>16;
1114
1115 f->gradient.ramp[n].pixel = gd->allocColor(f->gradient.ramp[n]);
1116 red += dRed;
1117 green += dGreen;
1118 blue += dBlue;
1119 alpha += dAlpha;
1120 }
1121 }
1122 for(n=0; n<min; n++) {
1123 f->gradient.ramp[n] = f->gradient.ramp[min];
1124 }
1125 for(n=max; n<256; n++) {
1126 f->gradient.ramp[n] = f->gradient.ramp[max];
1127 }
1128 }
1129 break;
1130 case f_TiledBitmap:
1131 case f_clippedBitmap:
1132 if (f->bitmap) {
1133 Matrix *m;
1134
1135 f->cmap = gd->getColormap(f->bitmap->colormap,
1136 f->bitmap->nbColors, cxform);
1137 if (f->cmap == NULL) {
1138 /* Get the normal cmap anyway */
1139 f->cmap = f->bitmap->colormap;
1140 }
1141
1142 f->bitmap_matrix = *(matrix) * f->matrix;
1143
1144 f->bitmap_matrix = f->bitmap_matrix.invert();
1145
1146 m=&f->bitmap_matrix;
1147 m->a = m->a * FRAC * 65536.0;
1148 m->b = m->b * FRAC * 65536.0;
1149 m->c = m->c * FRAC * 65536.0;
1150 m->d = m->d * FRAC * 65536.0;
1151 m->tx = (long) (m->tx * 65536.0);
1152 m->ty = (long) (m->ty * 65536.0);
1153
1154 f->alpha_table = NULL;
1155
1156 if (f->bitmap->alpha_buf && cxform) {
1157 unsigned char *alpha_table;
1158 int i;
1159
1160 alpha_table = (unsigned char *)malloc (256);
1161 if (alpha_table != NULL) {
1162 for(i=0;i<256;i++) {
1163 alpha_table[i] = cxform->getAlpha(i);
1164 }
1165 }
1166 f->alpha_table = alpha_table;
1167 }
1168 }
1169 break;
1170 }
1171 }
1172}
1173
1174static void
1175clearStyles(GraphicDevice *gd, FillStyleDef *ftab, long n)
1176{
1177 long fs;
1178 FillStyleDef *f;
1179
1180 for(fs = 0; fs < n; fs++)
1181 {
1182 f = ftab + fs;
1183 switch (f->type)
1184 {
1185 case f_Solid:
1186 break;
1187 case f_LinearGradient:
1188 case f_RadialGradient:
1189 if (f->gradient.ramp) {
1190 delete f->gradient.ramp;
1191 }
1192 break;
1193 case f_TiledBitmap:
1194 case f_clippedBitmap:
1195 if (f->bitmap) {
1196 if (f->cmap && f->cmap != f->bitmap->colormap) delete f->cmap;
1197 if (f->alpha_table) free(f->alpha_table);
1198 }
1199 break;
1200 case f_None:
1201 break;
1202 }
1203 }
1204}
1205
diff --git a/core/multimedia/opieplayer/libflash/shape.h b/core/multimedia/opieplayer/libflash/shape.h
new file mode 100644
index 0000000..120ec94
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/shape.h
@@ -0,0 +1,181 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _SHAPE_H_
21#define _SHAPE_H_
22
23struct LineStyleDef {
24 long width;
25 Color color;
26 FillStyleDef fillstyle;
27};
28
29enum ShapeRecordType {
30 shapeNonEdge,
31 shapeCurve,
32 shapeLine
33};
34
35enum ShapeFlags {
36 flagsMoveTo = 0x01,
37 flagsFill0 = 0x02,
38 flagsFill1 = 0x04,
39 flagsLine = 0x08,
40 flagsNewStyles = 0x10,
41 flagsEndShape = 0x80
42};
43
44struct ShapeRecord {
45 ShapeRecordType type;
46
47 // Non Edge
48 ShapeFlags flags;
49 long x,y;// Moveto
50 long fillStyle0;
51 long fillStyle1;
52 long lineStyle;
53 FillStyleDef*newFillStyles; // Array
54 long nbNewFillStyles;
55 LineStyleDef*newLineStyles; // Array
56 long nbNewLineStyles;
57
58 // Curve Edge
59 long ctrlX, ctrlY;
60 long anchorX, anchorY;
61
62 // Straight Line
63 long dX,dY;
64
65 struct ShapeRecord *next;
66
67 ShapeRecord() {
68 shaperecord_size += sizeof(ShapeRecord);
69 shaperecord_nb++;
70 }
71
72};
73
74enum ShapeAction {
75 ShapeDraw,
76 ShapeGetRegion
77};
78
79struct LineSegment {
80 long x1,y1,x2,y2;
81 char first;
82 LineStyleDef *l;
83 struct LineSegment *next;
84};
85
86struct Path {
87 long lastX,lastY;
88 int nb_edges;
89 int nb_segments;
90};
91
92struct StyleList {
93 FillStyleDef*newFillStyles; // Array
94 long nbNewFillStyles;
95 LineStyleDef*newLineStyles; // Array
96 long nbNewLineStyles;
97
98 StyleList *next;
99};
100
101
102/* fast bit parser */
103struct BitParser {
104 // Bit Handling
105 S32 m_bitPos;
106 U32 m_bitBuf;
107
108 U8 *ptr;
109};
110
111class Shape;
112
113/* state of the shape parser */
114struct ShapeParser {
115 Dict *dict; /* XXX: should be put elsewhere */
116
117 BitParser bit_parser;
118 S32 m_nFillBits;
119 S32 m_nLineBits;
120
121 StyleList *style_list;
122 Matrix *matrix;
123 Path curPath;
124 int reverse;
125
126 /* line rasteriser */
127 LineSegment *first_line,*last_line;
128 GraphicDevice *gd;
129 Cxform *cxform;
130 Shape *shape;
131
132 FillStyleDef *f0;
133 FillStyleDef *f1;
134 LineStyleDef *l;
135};
136
137class Shape : public Character {
138 public:
139 int defLevel; // 1,2 or 3
140
141
142 Rect boundary;
143 FillStyleDef defaultFillStyle;
144 LineStyleDef defaultLineStyle;
145
146 Matrix lastMat;
147 /* parsing for the rendering stage (saves a lot of memory &
148 may not reduce significantly the size). These variables
149 should be in another structure (no state need to be
150 maintained between two renderings) */
151 int getAlpha, getStyles;
152 unsigned char *file_ptr;
153 Dict *dict; /* XXX: should be put elsewhere */
154
155protected:
156 void drawLines(GraphicDevice *gd, Matrix *matrix, Cxform *cxform, long, long);
157 void buildSegmentList(Segment **segs, int height, long &n, Matrix *matrix, int update, int reverse);
158 Segment *progressSegments(Segment *, long);
159 Segment *newSegments(Segment *, Segment *);
160
161public:
162 Shape(long id = 0 , int level = 1);
163 ~Shape();
164
165 void setBoundingBox(Rect rect);
166 int execute(GraphicDevice *gd, Matrix *matrix, Cxform *cxform);
167 void getRegion(GraphicDevice *gd, Matrix *matrix,
168 void *id, ScanLineFunc scan_line_func);
169
170 void getBoundingBox(Rect *bb, DisplayListEntry *);
171
172#ifdef DUMP
173 void dump(BitStream *bs);
174 void dumpShapeRecords(BitStream *bs, int alpha);
175 void dumpFillStyles(BitStream *bs, FillStyleDef *defs, long n, int alpha);
176 void dumpLineStyles(BitStream *bs, LineStyleDef *defs, long n, int alpha);
177 void checkBitmaps(BitStream *bs);
178#endif
179};
180
181#endif /* _SHAPE_H_ */
diff --git a/core/multimedia/opieplayer/libflash/sound.cc b/core/multimedia/opieplayer/libflash/sound.cc
new file mode 100644
index 0000000..e93f9b5
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/sound.cc
@@ -0,0 +1,439 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#include <unistd.h>
26#include <fcntl.h>
27#include <sys/ioctl.h>
28#ifndef NOSOUND
29#include <linux/soundcard.h>
30#endif
31
32#ifdef RCSID
33static char *rcsid = "$Id$";
34#endif
35
36#define PRINT 0
37
38//////////// SOUND
39
40Sound::Sound(long id) : Character(SoundType, id)
41{
42 samples = 0;
43 stereo = 0;
44 soundRate = 0;
45 sampleSize = 1;
46}
47
48Sound::~Sound()
49{
50 if (samples) {
51 delete samples;
52 }
53}
54
55void
56Sound::setSoundFlags(long f) {
57 switch (GET_SOUND_RATE_CODE(f)) {
58 case 0:
59 soundRate = 5500;
60 break;
61 case 1:
62 soundRate = 11000;
63 break;
64 case 2:
65 soundRate = 22000;
66 break;
67 case 3:
68 soundRate = 44000;
69 break;
70 }
71 if (f & soundIs16bit) {
72 sampleSize = 2;
73 }
74 if (f & soundIsStereo) {
75 stereo = 1;
76 }
77
78#if PRINT
79 printf("-----\nFlags = %2x\n", f);
80 printf("Rate = %d kHz ", soundRate);
81 printf("SampleSize = %d byte(s) ", sampleSize);
82 if (f & soundIsStereo) {
83 printf("Stereo ");
84 } else {
85 printf("Mono ");
86 }
87 if (f & soundIsADPCMCompressed) {
88 printf("ADPCM\n");
89 } else {
90 printf("Raw\n");
91 }
92#endif
93}
94
95char *
96Sound::setNbSamples(long n) {
97 long size;
98
99 nbSamples = n;
100
101 size = nbSamples * (stereo ? 2 : 1) * sampleSize;
102
103 samples = new char[ size ];
104
105 memset((char *)samples,0, size);
106
107 return samples;
108}
109
110long
111Sound::getRate() {
112 return soundRate;
113}
114
115long
116Sound::getChannel() {
117 return stereo ? 2 : 1;
118}
119
120long
121Sound::getNbSamples() {
122 return nbSamples;
123}
124
125long
126Sound::getSampleSize() {
127 return sampleSize;
128}
129
130char *
131Sound::getSamples() {
132 return samples;
133}
134
135//////////// SOUND MIXER
136
137 long SoundMixer::dsp = -1;// Init of descriptor
138 long SoundMixer::blockSize = 0;// Driver sound buffer size
139 long SoundMixer::nbInst = 0;// Nb SoundMixer instances
140long SoundMixer::sampleSize = 0;
141long SoundMixer::stereo = 0;
142long SoundMixer::soundRate = 0;
143char *SoundMixer::buffer = 0;
144
145SoundMixer::SoundMixer(char *device)
146{
147#ifndef NOSOUND
148 int status;
149 long fmt;
150
151 list = 0;// No sound to play
152
153 if (nbInst++) {
154 // Device is already open
155 return;
156 }
157
158 dsp = open(device,O_WRONLY);
159 if (dsp < 0) {
160 perror("open dsp");
161 return;
162 }
163
164 // Reset device
165 status = ioctl(dsp, SNDCTL_DSP_RESET);
166 if (status < 0) perror("ioctl SNDCTL_DSP_RESET");
167
168 // Set sample size
169 fmt = AFMT_S16_LE;
170 sampleSize = 2;
171 status = ioctl(dsp, SNDCTL_DSP_SETFMT, &fmt);
172 if (status < 0) perror("ioctl SNDCTL_DSP_SETFMT");
173
174 if (status) {
175 fmt = AFMT_U8;
176 sampleSize = 1;
177 status = ioctl(dsp, SNDCTL_DSP_SETFMT, &fmt);
178 if (status < 0) perror("ioctl SNDCTL_DSP_SETFMT");
179 }
180
181 // Set stereo channel
182 stereo = 1;
183 status = ioctl(dsp, SNDCTL_DSP_STEREO, &stereo);
184
185 if (status) {
186 stereo = 0;
187 }
188
189 // Set sound rate in Hertz
190 soundRate = 11000;
191 status = ioctl(dsp, SNDCTL_DSP_SPEED, &soundRate);
192 if (status < 0) perror("ioctl SNDCTL_DSP_SPEED");
193
194 // Get device buffer size
195 status = ioctl(dsp, SNDCTL_DSP_GETBLKSIZE, &blockSize);
196 if (status < 0) perror("ioctl SNDCTL_DSP_GETBLKSIZE");
197 if (blockSize < 1024) {
198 blockSize = 32768;
199 }
200 blockSize *= 2;
201
202 buffer = (char *)malloc(blockSize);
203 if (buffer == 0) {
204 close(dsp);
205 dsp = -1;
206 }
207
208#if PRINT
209 int caps;
210
211 ioctl(dsp,SNDCTL_DSP_GETCAPS, &caps);
212 printf("Audio capabilities = %x\n", caps);
213 printf("Sound Rate = %d\n", soundRate);
214 printf("Stereo = %d\n", stereo);
215 printf("Sample Size = %d\n", sampleSize);
216 printf("Buffer Size = %d\n", blockSize);
217#endif /* PRINT */
218
219 #endif/* NOSOUND */
220}
221
222SoundMixer::~SoundMixer()
223{
224 if (--nbInst == 0) {
225 if (dsp > 0) {
226 close(dsp);
227 free(buffer);
228 }
229 }
230}
231
232void
233SoundMixer::stopSounds()
234{
235#ifndef NOSOUND
236 SoundList *sl,*del;
237
238 for(sl = list; sl; ) {
239 del = sl;
240 sl = sl->next;
241 delete del;
242 }
243 list = 0;
244#endif
245}
246
247void
248SoundMixer::startSound(Sound *sound)
249{
250#ifndef NOSOUND
251 SoundList *sl;
252
253 if (sound) {
254 // Add sound in list
255 sl = new SoundList;
256 sl->rate = sound->getRate();
257 sl->stereo = (sound->getChannel() == 2);
258 sl->sampleSize = sound->getSampleSize();
259 sl->current = sound->getSamples();
260 sl->remaining = sound->getSampleSize()*sound->getNbSamples()*sound->getChannel();
261 sl->next = list;
262 list = sl;
263 }
264#endif
265}
266
267long
268SoundMixer::playSounds()
269{
270#ifndef NOSOUND
271 audio_buf_info bufInfo;
272 long nbBytes, n;
273 SoundList*sl,*prev;
274 int status;
275
276 // Init failed
277 if (dsp < 0) return 0;
278
279 // No sound to play
280 if (list == 0) return 0;
281
282 // Get free DMA buffer space
283 status = ioctl(dsp, SNDCTL_DSP_GETOSPACE, &bufInfo);
284
285 // Free space is not large enough to output data without blocking
286 // But there are still sounds to play. We must wait.
287 if (bufInfo.bytes < blockSize) return 1;
288
289 nbBytes = 0;
290
291 // Fill buffer with silence.
292 memset((void*)buffer, 0, blockSize);
293
294 prev = 0;
295 sl = list;
296 while(sl) {
297
298 // Ask sound to fill the buffer
299 // according to device capabilities
300 n = fillSoundBuffer(sl, buffer, blockSize);
301
302 // Remember the largest written size
303 if (n > nbBytes) {
304 nbBytes = n;
305 }
306
307 // No more samples for this sound
308 if (sl->remaining == 0) {
309 // Remove sound from list
310 if (prev) {
311 prev->next = sl->next;
312 delete sl;
313 sl = prev->next;
314 } else {
315 list = sl->next;
316 delete sl;
317 sl = list;
318 }
319 } else {
320 sl = sl->next;
321 }
322 }
323
324 if (nbBytes) {
325 // At last ! Play It !
326 write(dsp,buffer,nbBytes);
327 status = ioctl(dsp, SNDCTL_DSP_POST);
328 }
329
330 return nbBytes;
331#else
332 return 0;
333#endif
334}
335
336long
337SoundMixer::fillSoundBuffer(SoundList *sl, char *buff, long buffSize)
338{
339 long sampleLeft, sampleRight;
340 long skipOut, skipOutInit;
341 long skipIn, skipInInit;
342 long freqRatio;
343 long totalOut = 0;
344
345 sampleLeft = sampleRight = 0;
346 skipOutInit = skipInInit = 0;
347
348 freqRatio = sl->rate / soundRate;
349 if (freqRatio) {
350 skipOutInit = freqRatio - 1;
351 skipInInit = 0;
352 }
353
354 freqRatio = soundRate / sl->rate;
355 if (freqRatio) {
356 skipInInit = freqRatio - 1;
357 skipOutInit = 0;
358 }
359
360 skipOut = skipOutInit;
361 skipIn = skipInInit;
362 while (buffSize && sl->remaining) {
363 if (skipIn-- == 0) {
364 // Get sampleLeft
365 if (sl->sampleSize == 2) {
366 sampleLeft = (long)(*(short *)(sl->current));
367 if (sampleSize == 1) {
368 sampleLeft = (sampleLeft >> 8) &0xff;
369 }
370 } else {
371 sampleLeft = (long)*(sl->current);
372 if (sampleSize == 2) {
373 sampleLeft <<= 8;
374 }
375 }
376 sl->current += sl->sampleSize;
377 sl->remaining -= sl->sampleSize;
378
379 if (sl->stereo) {
380 // Get sampleRight
381 if (sl->sampleSize == 2) {
382 sampleRight = (long)(*(short *)(sl->current));
383 if (sampleSize == 1) {
384 sampleRight = (sampleRight >> 8) &0xff;
385 }
386 } else {
387 sampleRight = (long)*(sl->current);
388 if (sampleSize == 2) {
389 sampleRight <<= 8;
390 }
391 }
392 sl->current += sl->sampleSize;
393 sl->remaining -= sl->sampleSize;
394
395 } else {
396 sampleRight = sampleLeft;
397 }
398
399 skipIn = skipInInit;
400 }
401
402 if (skipOut-- == 0) {
403 // Output
404 if (stereo) {
405 if (sampleSize == 2) {
406 *((short *)buff) += sampleLeft/2;
407 buffSize -= sampleSize;
408 buff += sampleSize;
409 *((short *)buff) += sampleRight/2;
410 buffSize -= sampleSize;
411 buff += sampleSize;
412 } else {
413 *((char *)buff) += sampleLeft/2;
414 buffSize -= sampleSize;
415 buff += sampleSize;
416 *((char *)buff) += sampleRight/2;
417 buffSize -= sampleSize;
418 buff += sampleSize;
419 }
420 totalOut += 2*sampleSize;
421 } else {
422 if (sampleSize == 2) {
423 *((short *)buff) += (sampleLeft+sampleRight)>>2;
424 buffSize -= sampleSize;
425 buff += sampleSize;
426 } else {
427 *((char *)buff) += (sampleLeft+sampleRight)>>2;
428 buffSize -= sampleSize;
429 buff += sampleSize;
430 }
431 totalOut += sampleSize;
432 }
433
434 skipOut = skipOutInit;
435 }
436 }
437
438 return totalOut;
439}
diff --git a/core/multimedia/opieplayer/libflash/sound.h b/core/multimedia/opieplayer/libflash/sound.h
new file mode 100644
index 0000000..c53773d
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/sound.h
@@ -0,0 +1,83 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _SOUND_H_
21#define _SOUND_H_
22
23#define GET_SOUND_RATE_CODE(f) (((f)&0x0c)>>2)
24
25class Sound : public Character {
26 long soundRate;// In hz
27 long stereo;// True if stereo sound
28 long sampleSize;// 1 or 2 bytes
29
30 char *samples; // Array of samples
31 long nbSamples;
32
33public:
34 Sound(long id);
35 ~Sound();
36 void setSoundFlags(long f);
37 char *setNbSamples(long n);
38
39 long getRate();
40 long getChannel();
41 long getNbSamples();
42 long getSampleSize();
43 char *getSamples();
44};
45
46struct SoundList {
47 long rate;
48 long stereo;
49 long sampleSize;
50 long nbSamples;
51 long remaining;
52 char*current;
53
54 SoundList *next;
55};
56
57class SoundMixer {
58
59 SoundList*list;
60
61// Class variables
62 static long dsp; // Descriptor for /dev/dsp
63 static char * buffer;// DMA buffer
64 static long blockSize;
65 static long nbInst;// Number of instances
66
67 // Sound Device Capabilities
68 static long soundRate;// In hz
69 static long stereo;// True if stereo sound
70 static long sampleSize;// 1 or 2 bytes
71
72public:
73 SoundMixer(char*);
74 ~SoundMixer();
75
76 void startSound(Sound *sound);// Register a sound to be played
77 void stopSounds(); // Stop every current sounds in the instance
78
79 long playSounds(); // Actually play sounds of all instances
80 long fillSoundBuffer(SoundList *, char *buffer, long bufferSize); // Fill sound buffer
81};
82
83#endif /* _SOUND_H_ */
diff --git a/core/multimedia/opieplayer/libflash/sprite.cc b/core/multimedia/opieplayer/libflash/sprite.cc
new file mode 100644
index 0000000..de53095
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/sprite.cc
@@ -0,0 +1,91 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29Sprite::Sprite(FlashMovie *movie, long id, long frameCount) : Character(SpriteType, id)
30{
31 program = new Program(movie, frameCount);
32 if (program == NULL) return;
33 if (program->totalFrames == 0) {
34 delete program;
35 program = NULL;
36 return;
37 }
38 program->dl->isSprite = 1;
39}
40
41Sprite::~Sprite()
42{
43 delete program;
44}
45
46void
47Sprite::reset()
48{
49 program->rewindMovie();
50}
51
52int
53Sprite::isSprite(void)
54{
55 return 1;
56}
57
58Program *
59Sprite::getProgram()
60{
61 return program;
62}
63
64int
65Sprite::execute(GraphicDevice *gd, Matrix *matrix, Cxform *cxform)
66{
67 return program->dl->render(gd,matrix,cxform);
68}
69
70ActionRecord *
71Sprite::eventHandler(GraphicDevice *gd, FlashEvent *event)
72{
73#if 0
74 DisplayList *dl;
75 ActionRecord *actions;
76
77 dl = program->getDisplayList();
78 actions = dl->processEvent(gd, event);
79 if (actions) {
80 program->doAction(actions,0);
81 }
82 return actions;
83#endif
84 return NULL;
85}
86
87void
88Sprite::getBoundingBox(Rect *bb, DisplayListEntry *e)
89{
90 program->dl->getBoundary(bb);
91}
diff --git a/core/multimedia/opieplayer/libflash/sprite.h b/core/multimedia/opieplayer/libflash/sprite.h
new file mode 100644
index 0000000..2ea64bc
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/sprite.h
@@ -0,0 +1,38 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _SPRITE_H_
21#define _SPRITE_H_
22
23class Sprite : public Character {
24public:
25 Program *program;
26
27 Sprite(FlashMovie *movie, long id, long frameCount);
28 ~Sprite();
29 Program *getProgram();
30 int execute(GraphicDevice *gd, Matrix *matrix, Cxform *cxform);
31 int hasEventHandler();
32 void reset();
33 ActionRecord*eventHandler(GraphicDevice *, FlashEvent *);
34 int isSprite(void);
35 void getBoundingBox(Rect *bb, DisplayListEntry *de);
36};
37
38#endif /* _SPRITE_H_ */
diff --git a/core/multimedia/opieplayer/libflash/sqrt.cc b/core/multimedia/opieplayer/libflash/sqrt.cc
new file mode 100644
index 0000000..0d8295e
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/sqrt.cc
@@ -0,0 +1,4099 @@
1unsigned char SQRT[] = {
2
30,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,
44,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,
55,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,
66,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
78,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
88,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
99,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,
1010,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,
1111,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
1212,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
1312,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,
1413,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
1513,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,
1614,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
1714,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
1815,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
1916,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
2016,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
2116,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
2217,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
2317,17,17,17,18,18,18,18,18,18,18,18,18,18,18,18,
2418,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
2518,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,
2619,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,
2719,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,
2820,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
2920,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
3020,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,
3121,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,
3221,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,
3321,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,
3422,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
3522,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
3622,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
3723,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
3823,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
3924,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
4024,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
4124,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
4224,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
4325,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
4425,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
4525,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,
4626,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
4726,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
4826,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,
4927,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,
5027,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,
5127,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,
5228,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,
5328,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,
5428,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,
5528,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,
5629,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
5729,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
5829,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
5929,29,29,29,30,30,30,30,30,30,30,30,30,30,30,30,
6030,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
6130,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
6230,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
6330,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
6431,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
6531,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
6631,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
6732,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
6832,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
6932,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
7032,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
7132,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,
7233,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,
7333,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,
7433,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,
7533,33,33,33,34,34,34,34,34,34,34,34,34,34,34,34,
7634,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,
7734,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,
7834,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,
7934,34,34,34,34,34,34,34,34,35,35,35,35,35,35,35,
8035,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,
8135,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,
8235,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,
8335,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,
8436,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
8536,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
8636,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
8736,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
8836,36,36,36,36,36,36,36,36,37,37,37,37,37,37,37,
8937,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
9037,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
9137,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
9237,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
9337,37,37,37,38,38,38,38,38,38,38,38,38,38,38,38,
9438,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,
9538,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,
9638,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,
9738,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,
9838,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,
9939,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,
10039,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,
10139,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,
10239,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,
10340,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,
10440,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,
10540,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,
10640,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,
10740,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,
10840,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
10941,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
11041,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
11141,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
11241,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
11341,41,41,41,42,42,42,42,42,42,42,42,42,42,42,42,
11442,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,
11542,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,
11642,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,
11742,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,
11842,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,
11943,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
12043,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
12143,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
12243,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
12343,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
12444,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,
12544,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,
12644,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,
12744,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,
12844,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,
12944,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,
13045,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
13145,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
13245,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
13345,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
13445,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
13545,45,45,45,46,46,46,46,46,46,46,46,46,46,46,46,
13646,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
13746,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
13846,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
13946,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
14046,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
14146,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,
14247,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,
14347,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,
14447,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,
14547,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,
14647,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,
14748,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,
14848,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,
14948,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,
15048,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,
15148,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,
15248,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,
15348,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,
15449,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,
15549,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,
15649,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,
15749,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,
15849,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,
15949,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,
16050,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
16150,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
16250,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
16350,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
16450,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
16550,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,
16651,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,
16751,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,
16851,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,
16951,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,
17051,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,
17151,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,
17252,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,
17352,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,
17452,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,
17552,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,
17652,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,
17752,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,
17852,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,
17953,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,
18053,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,
18153,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,
18253,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,
18353,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,
18453,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,
18553,53,53,53,54,54,54,54,54,54,54,54,54,54,54,54,
18654,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,
18754,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,
18854,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,
18954,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,
19054,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,
19154,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,
19254,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,
19355,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,
19455,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,
19555,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,
19655,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,
19755,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,
19855,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,
19956,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
20056,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
20156,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
20256,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
20356,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
20456,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
20556,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
20656,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,
20757,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,
20857,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,
20957,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,
21057,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,
21157,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,
21257,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,
21357,57,57,57,58,58,58,58,58,58,58,58,58,58,58,58,
21458,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
21558,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
21658,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
21758,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
21858,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
21958,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
22058,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,
22159,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,
22259,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,
22359,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,
22459,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,
22559,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,
22659,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,
22759,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,
22860,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,
22960,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,
23060,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,
23160,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,
23260,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,
23360,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,
23460,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,
23560,60,60,60,60,60,60,60,60,61,61,61,61,61,61,61,
23661,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,
23761,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,
23861,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,
23961,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,
24061,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,
24161,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,
24261,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,
24361,61,61,61,62,62,62,62,62,62,62,62,62,62,62,62,
24462,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,
24562,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,
24662,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,
24762,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,
24862,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,
24962,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,
25062,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,
25162,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
25263,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
25363,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
25463,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
25563,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
25663,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
25763,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
25863,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
25964,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
26064,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
26164,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
26264,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
26364,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
26464,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
26564,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
26664,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
26764,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
26865,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
26965,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
27065,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
27165,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
27265,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
27365,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
27465,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
27565,65,65,65,66,66,66,66,66,66,66,66,66,66,66,66,
27666,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,
27766,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,
27866,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,
27966,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,
28066,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,
28166,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,
28266,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,
28366,66,66,66,66,66,66,66,66,67,67,67,67,67,67,67,
28467,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,
28567,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,
28667,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,
28767,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,
28867,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,
28967,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,
29067,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,
29167,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,
29268,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,
29368,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,
29468,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,
29568,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,
29668,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,
29768,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,
29868,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,
29968,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,
30068,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,
30169,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,
30269,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,
30369,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,
30469,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,
30569,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,
30669,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,
30769,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,
30869,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,
30969,69,69,69,70,70,70,70,70,70,70,70,70,70,70,70,
31070,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,
31170,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,
31270,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,
31370,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,
31470,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,
31570,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,
31670,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,
31770,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,
31870,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,
31971,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,
32071,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,
32171,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,
32271,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,
32371,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,
32471,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,
32571,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,
32671,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,
32772,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,
32872,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,
32972,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,
33072,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,
33172,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,
33272,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,
33372,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,
33472,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,
33572,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,
33672,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,
33773,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,
33873,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,
33973,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,
34073,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,
34173,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,
34273,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,
34373,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,
34473,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,
34573,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,
34674,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,
34774,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,
34874,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,
34974,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,
35074,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,
35174,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,
35274,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,
35374,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,
35474,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,
35575,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
35675,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
35775,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
35875,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
35975,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
36075,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
36175,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
36275,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
36375,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,
36476,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,
36576,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,
36676,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,
36776,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,
36876,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,
36976,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,
37076,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,
37176,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,
37276,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,
37376,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,
37477,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
37577,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
37677,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
37777,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
37877,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
37977,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
38077,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
38177,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
38277,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
38377,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,
38478,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,
38578,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,
38678,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,
38778,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,
38878,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,
38978,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,
39078,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,
39178,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,
39278,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,
39378,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,
39479,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,
39579,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,
39679,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,
39779,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,
39879,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,
39979,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,
40079,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,
40179,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,
40279,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,
40380,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,
40480,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,
40580,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,
40680,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,
40780,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,
40880,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,
40980,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,
41080,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,
41180,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,
41280,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,
41380,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
41481,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
41581,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
41681,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
41781,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
41881,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
41981,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
42081,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
42181,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
42281,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
42381,81,81,81,82,82,82,82,82,82,82,82,82,82,82,82,
42482,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,
42582,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,
42682,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,
42782,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,
42882,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,
42982,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,
43082,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,
43182,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,
43282,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,
43382,82,82,82,82,82,82,82,82,83,83,83,83,83,83,83,
43483,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,
43583,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,
43683,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,
43783,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,
43883,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,
43983,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,
44083,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,
44183,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,
44283,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,
44383,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,
44484,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
44584,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
44684,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
44784,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
44884,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
44984,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
45084,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
45184,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
45284,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
45384,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
45484,84,84,84,84,84,84,84,84,85,85,85,85,85,85,85,
45585,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
45685,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
45785,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
45885,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
45985,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
46085,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
46185,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
46285,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
46385,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
46485,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
46585,85,85,85,86,86,86,86,86,86,86,86,86,86,86,86,
46686,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,
46786,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,
46886,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,
46986,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,
47086,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,
47186,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,
47286,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,
47386,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,
47486,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,
47586,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,
47686,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
47787,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
47887,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
47987,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
48087,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
48187,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
48287,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
48387,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
48487,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
48587,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
48687,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,
48788,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
48888,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
48988,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
49088,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
49188,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
49288,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
49388,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
49488,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
49588,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
49688,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
49788,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,
49888,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
49989,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
50089,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
50189,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
50289,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
50389,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
50489,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
50589,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
50689,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
50789,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
50889,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
50989,89,89,89,90,90,90,90,90,90,90,90,90,90,90,90,
51090,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,
51190,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,
51290,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,
51390,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,
51490,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,
51590,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,
51690,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,
51790,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,
51890,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,
51990,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,
52090,90,90,90,90,90,90,90,90,91,91,91,91,91,91,91,
52191,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
52291,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
52391,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
52491,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
52591,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
52691,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
52791,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
52891,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
52991,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
53091,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
53191,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,
53292,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
53392,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
53492,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
53592,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
53692,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
53792,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
53892,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
53992,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
54092,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
54192,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
54292,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
54392,92,92,92,92,92,92,92,92,93,93,93,93,93,93,93,
54493,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
54593,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
54693,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
54793,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
54893,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
54993,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
55093,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
55193,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
55293,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
55393,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
55493,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,
55593,93,93,93,94,94,94,94,94,94,94,94,94,94,94,94,
55694,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
55794,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
55894,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
55994,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
56094,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
56194,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
56294,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
56394,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
56494,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
56594,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
56694,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
56794,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
56895,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
56995,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
57095,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
57195,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
57295,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
57395,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
57495,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
57595,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
57695,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
57795,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
57895,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,
57996,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
58096,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
58196,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
58296,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
58396,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
58496,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
58596,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
58696,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
58796,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
58896,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
58996,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
59096,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
59196,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
59297,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
59397,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
59497,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
59597,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
59697,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
59797,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
59897,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
59997,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
60097,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
60197,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
60297,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,
60397,97,97,97,98,98,98,98,98,98,98,98,98,98,98,98,
60498,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
60598,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
60698,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
60798,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
60898,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
60998,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
61098,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
61198,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
61298,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
61398,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
61498,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,
61598,98,98,98,98,98,98,98,98,99,99,99,99,99,99,99,
61699,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
61799,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
61899,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
61999,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
62099,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
62199,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
62299,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
62399,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
62499,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
62599,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
62699,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
62799,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
628100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
629100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
630100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
631100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
632100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
633100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
634100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
635100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
636100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
637100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
638100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
639100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
640100,100,100,100,100,100,100,100,100,101,101,101,101,101,101,101,
641101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
642101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
643101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
644101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
645101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
646101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
647101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
648101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
649101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
650101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
651101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
652101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,
653101,101,101,101,102,102,102,102,102,102,102,102,102,102,102,102,
654102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
655102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
656102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
657102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
658102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
659102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
660102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
661102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
662102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
663102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
664102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
665102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,
666102,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
667103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
668103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
669103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
670103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
671103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
672103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
673103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
674103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
675103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
676103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
677103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
678103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,
679104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
680104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
681104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
682104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
683104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
684104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
685104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
686104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
687104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
688104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
689104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
690104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
691104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
692104,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
693105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
694105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
695105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
696105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
697105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
698105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
699105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
700105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
701105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
702105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
703105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
704105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,
705105,105,105,105,106,106,106,106,106,106,106,106,106,106,106,106,
706106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
707106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
708106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
709106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
710106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
711106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
712106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
713106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
714106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
715106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
716106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
717106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
718106,106,106,106,106,106,106,106,106,107,107,107,107,107,107,107,
719107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
720107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
721107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
722107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
723107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
724107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
725107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
726107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
727107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
728107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
729107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
730107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
731107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
732108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
733108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
734108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
735108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
736108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
737108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
738108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
739108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
740108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
741108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
742108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
743108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
744108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,
745108,108,108,108,108,108,108,108,108,109,109,109,109,109,109,109,
746109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
747109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
748109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
749109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
750109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
751109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
752109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
753109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
754109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
755109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
756109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
757109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
758109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
759109,109,109,109,110,110,110,110,110,110,110,110,110,110,110,110,
760110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
761110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
762110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
763110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
764110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
765110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
766110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
767110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
768110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
769110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
770110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
771110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
772110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
773110,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
774111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
775111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
776111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
777111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
778111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
779111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
780111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
781111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
782111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
783111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
784111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
785111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
786111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
787112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
788112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
789112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
790112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
791112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
792112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
793112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
794112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
795112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
796112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
797112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
798112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
799112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
800112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
801112,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
802113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
803113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
804113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
805113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
806113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
807113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
808113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
809113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
810113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
811113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
812113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
813113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
814113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
815113,113,113,113,114,114,114,114,114,114,114,114,114,114,114,114,
816114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
817114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
818114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
819114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
820114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
821114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
822114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
823114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
824114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
825114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
826114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
827114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
828114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
829114,114,114,114,114,114,114,114,114,115,115,115,115,115,115,115,
830115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
831115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
832115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
833115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
834115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
835115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
836115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
837115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
838115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
839115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
840115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
841115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
842115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
843115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
844116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
845116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
846116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
847116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
848116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
849116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
850116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
851116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
852116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
853116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
854116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
855116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
856116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
857116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,
858116,116,116,116,116,116,116,116,116,117,117,117,117,117,117,117,
859117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
860117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
861117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
862117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
863117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
864117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
865117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
866117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
867117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
868117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
869117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
870117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
871117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
872117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,
873117,117,117,117,118,118,118,118,118,118,118,118,118,118,118,118,
874118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
875118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
876118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
877118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
878118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
879118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
880118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
881118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
882118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
883118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
884118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
885118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
886118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
887118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,
888118,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
889119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
890119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
891119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
892119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
893119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
894119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
895119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
896119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
897119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
898119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
899119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
900119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
901119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
902119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
903120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
904120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
905120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
906120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
907120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
908120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
909120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
910120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
911120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
912120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
913120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
914120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
915120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
916120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
917120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
918120,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
919121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
920121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
921121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
922121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
923121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
924121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
925121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
926121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
927121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
928121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
929121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
930121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
931121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
932121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
933121,121,121,121,122,122,122,122,122,122,122,122,122,122,122,122,
934122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
935122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
936122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
937122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
938122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
939122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
940122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
941122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
942122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
943122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
944122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
945122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
946122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
947122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
948122,122,122,122,122,122,122,122,122,123,123,123,123,123,123,123,
949123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
950123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
951123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
952123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
953123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
954123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
955123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
956123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
957123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
958123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
959123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
960123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
961123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
962123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
963123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,
964124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
965124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
966124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
967124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
968124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
969124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
970124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
971124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
972124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
973124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
974124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
975124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
976124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
977124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
978124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
979124,124,124,124,124,124,124,124,124,125,125,125,125,125,125,125,
980125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
981125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
982125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
983125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
984125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
985125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
986125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
987125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
988125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
989125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
990125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
991125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
992125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
993125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
994125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,
995125,125,125,125,126,126,126,126,126,126,126,126,126,126,126,126,
996126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
997126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
998126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
999126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1000126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1001126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1002126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1003126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1004126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1005126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1006126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1007126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1008126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1009126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1010126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
1011126,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1012127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1013127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1014127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1015127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1016127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1017127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1018127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1019127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1020127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1021127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1022127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1023127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1024127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1025127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1026127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
1027128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1028128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1029128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1030128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1031128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1032128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1033128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1034128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1035128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1036128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1037128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1038128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1039128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1040128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1041128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1042128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
1043128,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1044129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1045129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1046129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1047129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1048129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1049129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1050129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1051129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1052129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1053129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1054129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1055129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1056129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1057129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1058129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,
1059129,129,129,129,130,130,130,130,130,130,130,130,130,130,130,130,
1060130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1061130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1062130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1063130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1064130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1065130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1066130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1067130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1068130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1069130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1070130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1071130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1072130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1073130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1074130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
1075130,130,130,130,130,130,130,130,130,131,131,131,131,131,131,131,
1076131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1077131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1078131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1079131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1080131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1081131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1082131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1083131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1084131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1085131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1086131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1087131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1088131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1089131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1090131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1091131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
1092132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1093132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1094132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1095132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1096132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1097132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1098132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1099132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1100132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1101132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1102132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1103132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1104132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1105132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1106132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1107132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,
1108132,132,132,132,132,132,132,132,132,133,133,133,133,133,133,133,
1109133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1110133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1111133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1112133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1113133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1114133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1115133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1116133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1117133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1118133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1119133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1120133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1121133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1122133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1123133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1124133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
1125133,133,133,133,134,134,134,134,134,134,134,134,134,134,134,134,
1126134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1127134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1128134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1129134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1130134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1131134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1132134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1133134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1134134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1135134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1136134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1137134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1138134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1139134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1140134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1141134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
1142134,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1143135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1144135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1145135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1146135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1147135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1148135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1149135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1150135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1151135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1152135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1153135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1154135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1155135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1156135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1157135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1158135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,
1159136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1160136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1161136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1162136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1163136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1164136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1165136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1166136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1167136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1168136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1169136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1170136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1171136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1172136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1173136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1174136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1175136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1176136,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1177137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1178137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1179137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1180137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1181137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1182137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1183137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1184137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1185137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1186137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1187137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1188137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1189137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1190137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1191137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1192137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
1193137,137,137,137,138,138,138,138,138,138,138,138,138,138,138,138,
1194138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1195138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1196138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1197138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1198138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1199138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1200138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1201138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1202138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1203138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1204138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1205138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1206138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1207138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1208138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1209138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
1210138,138,138,138,138,138,138,138,138,139,139,139,139,139,139,139,
1211139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1212139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1213139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1214139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1215139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1216139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1217139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1218139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1219139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1220139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1221139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1222139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1223139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1224139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1225139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1226139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1227139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
1228140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1229140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1230140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1231140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1232140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1233140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1234140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1235140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1236140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1237140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1238140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1239140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1240140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1241140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1242140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1243140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1244140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,
1245140,140,140,140,140,140,140,140,140,141,141,141,141,141,141,141,
1246141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1247141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1248141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1249141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1250141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1251141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1252141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1253141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1254141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1255141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1256141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1257141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1258141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1259141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1260141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1261141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1262141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1263141,141,141,141,142,142,142,142,142,142,142,142,142,142,142,142,
1264142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1265142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1266142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1267142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1268142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1269142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1270142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1271142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1272142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1273142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1274142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1275142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1276142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1277142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1278142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1279142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1280142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,
1281142,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1282143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1283143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1284143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1285143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1286143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1287143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1288143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1289143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1290143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1291143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1292143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1293143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1294143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1295143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1296143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1297143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1298143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
1299144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1300144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1301144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1302144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1303144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1304144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1305144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1306144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1307144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1308144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1309144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1310144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1311144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1312144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1313144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1314144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1315144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1316144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,
1317144,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1318145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1319145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1320145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1321145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1322145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1323145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1324145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1325145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1326145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1327145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1328145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1329145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1330145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1331145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1332145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1333145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1334145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
1335145,145,145,145,146,146,146,146,146,146,146,146,146,146,146,146,
1336146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1337146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1338146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1339146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1340146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1341146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1342146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1343146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1344146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1345146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1346146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1347146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1348146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1349146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1350146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1351146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1352146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,
1353146,146,146,146,146,146,146,146,146,147,147,147,147,147,147,147,
1354147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1355147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1356147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1357147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1358147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1359147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1360147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1361147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1362147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1363147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1364147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1365147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1366147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1367147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1368147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1369147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1370147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1371147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
1372148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1373148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1374148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1375148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1376148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1377148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1378148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1379148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1380148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1381148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1382148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1383148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1384148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1385148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1386148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1387148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1388148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1389148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,
1390148,148,148,148,148,148,148,148,148,149,149,149,149,149,149,149,
1391149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1392149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1393149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1394149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1395149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1396149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1397149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1398149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1399149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1400149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1401149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1402149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1403149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1404149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1405149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1406149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1407149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1408149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,
1409149,149,149,149,150,150,150,150,150,150,150,150,150,150,150,150,
1410150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1411150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1412150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1413150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1414150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1415150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1416150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1417150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1418150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1419150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1420150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1421150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1422150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1423150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1424150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1425150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1426150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1427150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
1428150,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1429151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1430151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1431151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1432151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1433151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1434151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1435151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1436151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1437151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1438151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1439151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1440151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1441151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1442151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1443151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1444151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1445151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1446151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
1447152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1448152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1449152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1450152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1451152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1452152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1453152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1454152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1455152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1456152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1457152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1458152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1459152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1460152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1461152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1462152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1463152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1464152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1465152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
1466152,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1467153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1468153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1469153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1470153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1471153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1472153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1473153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1474153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1475153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1476153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1477153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1478153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1479153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1480153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1481153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1482153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1483153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1484153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
1485153,153,153,153,154,154,154,154,154,154,154,154,154,154,154,154,
1486154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1487154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1488154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1489154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1490154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1491154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1492154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1493154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1494154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1495154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1496154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1497154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1498154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1499154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1500154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1501154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1502154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1503154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,
1504154,154,154,154,154,154,154,154,154,155,155,155,155,155,155,155,
1505155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1506155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1507155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1508155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1509155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1510155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1511155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1512155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1513155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1514155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1515155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1516155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1517155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1518155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1519155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1520155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1521155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1522155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1523155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,
1524156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1525156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1526156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1527156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1528156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1529156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1530156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1531156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1532156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1533156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1534156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1535156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1536156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1537156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1538156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1539156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1540156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1541156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1542156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
1543156,156,156,156,156,156,156,156,156,157,157,157,157,157,157,157,
1544157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1545157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1546157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1547157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1548157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1549157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1550157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1551157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1552157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1553157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1554157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1555157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1556157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1557157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1558157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1559157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1560157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1561157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1562157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,
1563157,157,157,157,158,158,158,158,158,158,158,158,158,158,158,158,
1564158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1565158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1566158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1567158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1568158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1569158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1570158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1571158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1572158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1573158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1574158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1575158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1576158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1577158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1578158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1579158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1580158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1581158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1582158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,
1583158,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1584159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1585159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1586159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1587159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1588159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1589159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1590159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1591159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1592159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1593159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1594159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1595159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1596159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1597159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1598159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1599159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1600159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1601159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1602159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,
1603160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1604160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1605160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1606160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1607160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1608160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1609160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1610160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1611160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1612160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1613160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1614160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1615160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1616160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1617160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1618160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1619160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1620160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1621160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1622160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
1623160,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1624161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1625161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1626161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1627161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1628161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1629161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1630161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1631161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1632161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1633161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1634161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1635161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1636161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1637161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1638161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1639161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1640161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1641161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1642161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,
1643161,161,161,161,162,162,162,162,162,162,162,162,162,162,162,162,
1644162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1645162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1646162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1647162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1648162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1649162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1650162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1651162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1652162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1653162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1654162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1655162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1656162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1657162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1658162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1659162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1660162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1661162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1662162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,
1663162,162,162,162,162,162,162,162,162,163,163,163,163,163,163,163,
1664163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1665163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1666163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1667163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1668163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1669163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1670163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1671163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1672163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1673163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1674163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1675163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1676163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1677163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1678163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1679163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1680163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1681163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1682163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1683163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
1684164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1685164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1686164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1687164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1688164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1689164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1690164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1691164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1692164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1693164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1694164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1695164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1696164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1697164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1698164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1699164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1700164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1701164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1702164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1703164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
1704164,164,164,164,164,164,164,164,164,165,165,165,165,165,165,165,
1705165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1706165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1707165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1708165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1709165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1710165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1711165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1712165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1713165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1714165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1715165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1716165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1717165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1718165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1719165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1720165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1721165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1722165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1723165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1724165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,
1725165,165,165,165,166,166,166,166,166,166,166,166,166,166,166,166,
1726166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1727166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1728166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1729166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1730166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1731166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1732166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1733166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1734166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1735166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1736166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1737166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1738166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1739166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1740166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1741166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1742166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1743166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1744166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1745166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,
1746166,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1747167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1748167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1749167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1750167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1751167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1752167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1753167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1754167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1755167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1756167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1757167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1758167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1759167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1760167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1761167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1762167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1763167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1764167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1765167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1766167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,
1767168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1768168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1769168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1770168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1771168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1772168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1773168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1774168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1775168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1776168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1777168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1778168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1779168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1780168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1781168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1782168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1783168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1784168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1785168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1786168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1787168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,
1788168,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1789169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1790169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1791169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1792169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1793169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1794169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1795169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1796169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1797169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1798169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1799169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1800169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1801169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1802169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1803169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1804169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1805169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1806169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1807169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1808169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,
1809169,169,169,169,170,170,170,170,170,170,170,170,170,170,170,170,
1810170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1811170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1812170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1813170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1814170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1815170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1816170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1817170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1818170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1819170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1820170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1821170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1822170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1823170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1824170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1825170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1826170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1827170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1828170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1829170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
1830170,170,170,170,170,170,170,170,170,171,171,171,171,171,171,171,
1831171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1832171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1833171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1834171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1835171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1836171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1837171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1838171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1839171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1840171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1841171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1842171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1843171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1844171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1845171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1846171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1847171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1848171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1849171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1850171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1851171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
1852172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1853172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1854172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1855172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1856172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1857172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1858172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1859172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1860172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1861172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1862172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1863172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1864172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1865172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1866172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1867172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1868172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1869172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1870172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1871172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1872172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
1873172,172,172,172,172,172,172,172,172,173,173,173,173,173,173,173,
1874173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1875173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1876173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1877173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1878173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1879173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1880173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1881173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1882173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1883173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1884173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1885173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1886173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1887173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1888173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1889173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1890173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1891173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1892173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1893173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1894173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
1895173,173,173,173,174,174,174,174,174,174,174,174,174,174,174,174,
1896174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1897174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1898174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1899174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1900174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1901174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1902174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1903174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1904174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1905174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1906174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1907174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1908174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1909174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1910174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1911174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1912174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1913174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1914174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1915174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1916174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
1917174,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1918175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1919175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1920175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1921175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1922175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1923175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1924175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1925175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1926175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1927175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1928175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1929175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1930175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1931175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1932175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1933175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1934175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1935175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1936175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1937175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1938175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
1939176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1940176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1941176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1942176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1943176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1944176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1945176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1946176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1947176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1948176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1949176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1950176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1951176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1952176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1953176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1954176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1955176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1956176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1957176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1958176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1959176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1960176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
1961176,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1962177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1963177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1964177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1965177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1966177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1967177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1968177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1969177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1970177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1971177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1972177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1973177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1974177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1975177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1976177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1977177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1978177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1979177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1980177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1981177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1982177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
1983177,177,177,177,178,178,178,178,178,178,178,178,178,178,178,178,
1984178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1985178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1986178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1987178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1988178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1989178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1990178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1991178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1992178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1993178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1994178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1995178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1996178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1997178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1998178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
1999178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
2000178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
2001178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
2002178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
2003178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
2004178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
2005178,178,178,178,178,178,178,178,178,179,179,179,179,179,179,179,
2006179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2007179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2008179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2009179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2010179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2011179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2012179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2013179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2014179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2015179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2016179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2017179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2018179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2019179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2020179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2021179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2022179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2023179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2024179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2025179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2026179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2027179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,
2028180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2029180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2030180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2031180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2032180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2033180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2034180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2035180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2036180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2037180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2038180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2039180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2040180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2041180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2042180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2043180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2044180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2045180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2046180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2047180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2048180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2049180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,
2050180,180,180,180,180,180,180,180,180,181,181,181,181,181,181,181,
2051181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2052181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2053181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2054181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2055181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2056181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2057181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2058181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2059181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2060181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2061181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2062181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2063181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2064181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2065181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2066181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2067181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2068181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2069181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2070181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2071181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2072181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
2073181,181,181,181,182,182,182,182,182,182,182,182,182,182,182,182,
2074182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2075182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2076182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2077182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2078182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2079182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2080182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2081182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2082182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2083182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2084182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2085182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2086182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2087182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2088182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2089182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2090182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2091182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2092182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2093182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2094182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2095182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
2096182,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2097183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2098183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2099183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2100183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2101183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2102183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2103183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2104183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2105183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2106183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2107183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2108183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2109183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2110183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2111183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2112183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2113183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2114183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2115183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2116183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2117183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2118183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,
2119184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2120184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2121184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2122184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2123184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2124184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2125184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2126184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2127184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2128184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2129184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2130184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2131184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2132184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2133184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2134184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2135184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2136184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2137184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2138184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2139184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2140184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2141184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
2142184,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2143185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2144185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2145185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2146185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2147185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2148185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2149185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2150185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2151185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2152185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2153185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2154185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2155185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2156185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2157185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2158185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2159185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2160185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2161185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2162185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2163185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2164185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
2165185,185,185,185,186,186,186,186,186,186,186,186,186,186,186,186,
2166186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2167186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2168186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2169186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2170186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2171186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2172186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2173186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2174186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2175186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2176186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2177186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2178186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2179186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2180186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2181186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2182186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2183186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2184186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2185186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2186186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2187186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
2188186,186,186,186,186,186,186,186,186,187,187,187,187,187,187,187,
2189187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2190187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2191187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2192187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2193187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2194187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2195187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2196187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2197187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2198187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2199187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2200187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2201187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2202187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2203187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2204187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2205187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2206187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2207187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2208187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2209187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2210187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2211187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,187,
2212188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2213188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2214188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2215188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2216188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2217188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2218188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2219188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2220188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2221188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2222188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2223188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2224188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2225188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2226188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2227188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2228188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2229188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2230188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2231188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2232188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2233188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2234188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,
2235188,188,188,188,188,188,188,188,188,189,189,189,189,189,189,189,
2236189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2237189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2238189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2239189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2240189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2241189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2242189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2243189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2244189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2245189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2246189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2247189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2248189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2249189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2250189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2251189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2252189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2253189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2254189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2255189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2256189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2257189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2258189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
2259189,189,189,189,190,190,190,190,190,190,190,190,190,190,190,190,
2260190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2261190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2262190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2263190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2264190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2265190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2266190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2267190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2268190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2269190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2270190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2271190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2272190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2273190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2274190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2275190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2276190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2277190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2278190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2279190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2280190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2281190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2282190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
2283190,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2284191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2285191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2286191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2287191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2288191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2289191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2290191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2291191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2292191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2293191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2294191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2295191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2296191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2297191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2298191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2299191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2300191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2301191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2302191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2303191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2304191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2305191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2306191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
2307192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2308192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2309192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2310192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2311192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2312192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2313192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2314192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2315192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2316192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2317192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2318192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2319192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2320192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2321192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2322192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2323192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2324192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2325192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2326192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2327192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2328192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2329192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2330192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
2331192,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2332193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2333193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2334193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2335193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2336193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2337193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2338193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2339193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2340193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2341193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2342193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2343193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2344193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2345193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2346193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2347193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2348193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2349193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2350193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2351193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2352193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2353193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2354193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
2355193,193,193,193,194,194,194,194,194,194,194,194,194,194,194,194,
2356194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2357194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2358194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2359194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2360194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2361194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2362194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2363194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2364194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2365194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2366194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2367194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2368194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2369194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2370194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2371194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2372194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2373194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2374194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2375194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2376194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2377194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2378194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,
2379194,194,194,194,194,194,194,194,194,195,195,195,195,195,195,195,
2380195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2381195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2382195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2383195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2384195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2385195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2386195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2387195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2388195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2389195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2390195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2391195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2392195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2393195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2394195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2395195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2396195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2397195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2398195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2399195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2400195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2401195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2402195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2403195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
2404196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2405196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2406196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2407196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2408196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2409196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2410196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2411196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2412196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2413196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2414196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2415196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2416196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2417196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2418196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2419196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2420196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2421196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2422196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2423196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2424196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2425196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2426196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2427196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
2428196,196,196,196,196,196,196,196,196,197,197,197,197,197,197,197,
2429197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2430197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2431197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2432197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2433197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2434197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2435197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2436197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2437197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2438197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2439197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2440197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2441197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2442197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2443197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2444197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2445197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2446197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2447197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2448197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2449197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2450197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2451197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2452197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,
2453197,197,197,197,198,198,198,198,198,198,198,198,198,198,198,198,
2454198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2455198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2456198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2457198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2458198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2459198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2460198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2461198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2462198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2463198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2464198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2465198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2466198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2467198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2468198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2469198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2470198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2471198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2472198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2473198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2474198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2475198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2476198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2477198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
2478198,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2479199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2480199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2481199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2482199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2483199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2484199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2485199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2486199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2487199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2488199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2489199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2490199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2491199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2492199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2493199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2494199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2495199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2496199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2497199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2498199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2499199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2500199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2501199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2502199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
2503200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2504200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2505200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2506200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2507200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2508200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2509200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2510200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2511200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2512200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2513200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2514200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2515200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2516200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2517200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2518200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2519200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2520200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2521200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2522200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2523200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2524200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2525200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2526200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2527200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
2528200,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2529201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2530201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2531201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2532201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2533201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2534201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2535201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2536201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2537201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2538201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2539201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2540201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2541201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2542201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2543201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2544201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2545201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2546201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2547201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2548201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2549201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2550201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2551201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2552201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
2553201,201,201,201,202,202,202,202,202,202,202,202,202,202,202,202,
2554202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2555202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2556202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2557202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2558202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2559202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2560202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2561202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2562202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2563202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2564202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2565202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2566202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2567202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2568202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2569202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2570202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2571202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2572202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2573202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2574202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2575202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2576202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2577202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
2578202,202,202,202,202,202,202,202,202,203,203,203,203,203,203,203,
2579203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2580203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2581203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2582203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2583203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2584203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2585203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2586203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2587203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2588203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2589203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2590203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2591203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2592203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2593203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2594203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2595203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2596203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2597203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2598203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2599203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2600203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2601203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2602203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2603203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
2604204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2605204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2606204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2607204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2608204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2609204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2610204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2611204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2612204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2613204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2614204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2615204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2616204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2617204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2618204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2619204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2620204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2621204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2622204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2623204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2624204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2625204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2626204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2627204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2628204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
2629204,204,204,204,204,204,204,204,204,205,205,205,205,205,205,205,
2630205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2631205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2632205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2633205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2634205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2635205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2636205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2637205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2638205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2639205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2640205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2641205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2642205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2643205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2644205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2645205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2646205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2647205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2648205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2649205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2650205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2651205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2652205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2653205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2654205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
2655205,205,205,205,206,206,206,206,206,206,206,206,206,206,206,206,
2656206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2657206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2658206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2659206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2660206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2661206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2662206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2663206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2664206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2665206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2666206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2667206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2668206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2669206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2670206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2671206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2672206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2673206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2674206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2675206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2676206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2677206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2678206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2679206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2680206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
2681206,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2682207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2683207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2684207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2685207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2686207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2687207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2688207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2689207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2690207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2691207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2692207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2693207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2694207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2695207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2696207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2697207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2698207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2699207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2700207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2701207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2702207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2703207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2704207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2705207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2706207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
2707208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2708208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2709208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2710208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2711208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2712208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2713208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2714208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2715208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2716208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2717208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2718208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2719208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2720208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2721208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2722208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2723208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2724208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2725208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2726208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2727208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2728208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2729208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2730208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2731208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2732208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,
2733208,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2734209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2735209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2736209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2737209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2738209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2739209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2740209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2741209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2742209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2743209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2744209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2745209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2746209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2747209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2748209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2749209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2750209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2751209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2752209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2753209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2754209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2755209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2756209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2757209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2758209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
2759209,209,209,209,210,210,210,210,210,210,210,210,210,210,210,210,
2760210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2761210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2762210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2763210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2764210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2765210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2766210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2767210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2768210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2769210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2770210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2771210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2772210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2773210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2774210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2775210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2776210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2777210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2778210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2779210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2780210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2781210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2782210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2783210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2784210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
2785210,210,210,210,210,210,210,210,210,211,211,211,211,211,211,211,
2786211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2787211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2788211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2789211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2790211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2791211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2792211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2793211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2794211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2795211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2796211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2797211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2798211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2799211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2800211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2801211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2802211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2803211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2804211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2805211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2806211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2807211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2808211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2809211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2810211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2811211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
2812212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2813212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2814212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2815212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2816212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2817212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2818212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2819212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2820212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2821212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2822212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2823212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2824212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2825212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2826212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2827212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2828212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2829212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2830212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2831212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2832212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2833212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2834212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2835212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2836212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2837212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
2838212,212,212,212,212,212,212,212,212,213,213,213,213,213,213,213,
2839213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2840213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2841213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2842213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2843213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2844213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2845213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2846213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2847213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2848213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2849213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2850213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2851213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2852213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2853213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2854213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2855213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2856213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2857213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2858213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2859213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2860213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2861213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2862213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2863213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2864213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,
2865213,213,213,213,214,214,214,214,214,214,214,214,214,214,214,214,
2866214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2867214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2868214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2869214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2870214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2871214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2872214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2873214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2874214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2875214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2876214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2877214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2878214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2879214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2880214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2881214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2882214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2883214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2884214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2885214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2886214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2887214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2888214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2889214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2890214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2891214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
2892214,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2893215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2894215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2895215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2896215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2897215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2898215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2899215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2900215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2901215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2902215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2903215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2904215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2905215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2906215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2907215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2908215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2909215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2910215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2911215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2912215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2913215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2914215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2915215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2916215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2917215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2918215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
2919216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2920216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2921216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2922216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2923216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2924216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2925216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2926216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2927216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2928216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2929216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2930216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2931216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2932216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2933216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2934216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2935216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2936216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2937216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2938216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2939216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2940216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2941216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2942216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2943216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2944216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2945216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
2946216,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2947217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2948217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2949217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2950217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2951217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2952217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2953217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2954217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2955217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2956217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2957217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2958217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2959217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2960217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2961217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2962217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2963217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2964217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2965217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2966217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2967217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2968217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2969217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2970217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2971217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2972217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,
2973217,217,217,217,218,218,218,218,218,218,218,218,218,218,218,218,
2974218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2975218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2976218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2977218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2978218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2979218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2980218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2981218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2982218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2983218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2984218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2985218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2986218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2987218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2988218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2989218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2990218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2991218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2992218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2993218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2994218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2995218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2996218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2997218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2998218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
2999218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
3000218,218,218,218,218,218,218,218,218,219,219,219,219,219,219,219,
3001219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3002219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3003219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3004219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3005219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3006219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3007219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3008219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3009219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3010219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3011219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3012219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3013219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3014219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3015219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3016219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3017219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3018219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3019219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3020219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3021219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3022219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3023219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3024219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3025219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3026219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3027219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,
3028220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3029220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3030220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3031220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3032220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3033220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3034220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3035220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3036220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3037220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3038220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3039220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3040220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3041220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3042220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3043220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3044220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3045220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3046220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3047220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3048220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3049220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3050220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3051220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3052220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3053220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3054220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,
3055220,220,220,220,220,220,220,220,220,221,221,221,221,221,221,221,
3056221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3057221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3058221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3059221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3060221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3061221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3062221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3063221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3064221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3065221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3066221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3067221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3068221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3069221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3070221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3071221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3072221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3073221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3074221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3075221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3076221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3077221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3078221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3079221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3080221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3081221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3082221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
3083221,221,221,221,222,222,222,222,222,222,222,222,222,222,222,222,
3084222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3085222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3086222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3087222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3088222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3089222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3090222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3091222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3092222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3093222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3094222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3095222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3096222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3097222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3098222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3099222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3100222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3101222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3102222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3103222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3104222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3105222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3106222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3107222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3108222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3109222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3110222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
3111222,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3112223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3113223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3114223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3115223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3116223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3117223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3118223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3119223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3120223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3121223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3122223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3123223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3124223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3125223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3126223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3127223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3128223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3129223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3130223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3131223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3132223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3133223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3134223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3135223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3136223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3137223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3138223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
3139224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3140224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3141224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3142224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3143224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3144224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3145224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3146224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3147224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3148224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3149224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3150224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3151224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3152224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3153224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3154224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3155224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3156224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3157224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3158224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3159224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3160224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3161224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3162224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3163224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3164224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3165224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3166224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
3167224,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3168225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3169225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3170225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3171225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3172225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3173225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3174225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3175225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3176225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3177225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3178225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3179225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3180225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3181225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3182225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3183225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3184225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3185225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3186225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3187225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3188225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3189225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3190225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3191225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3192225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3193225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3194225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
3195225,225,225,225,226,226,226,226,226,226,226,226,226,226,226,226,
3196226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3197226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3198226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3199226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3200226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3201226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3202226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3203226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3204226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3205226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3206226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3207226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3208226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3209226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3210226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3211226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3212226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3213226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3214226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3215226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3216226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3217226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3218226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3219226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3220226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3221226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3222226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
3223226,226,226,226,226,226,226,226,226,227,227,227,227,227,227,227,
3224227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3225227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3226227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3227227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3228227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3229227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3230227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3231227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3232227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3233227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3234227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3235227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3236227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3237227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3238227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3239227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3240227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3241227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3242227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3243227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3244227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3245227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3246227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3247227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3248227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3249227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3250227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3251227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,
3252228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3253228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3254228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3255228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3256228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3257228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3258228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3259228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3260228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3261228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3262228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3263228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3264228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3265228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3266228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3267228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3268228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3269228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3270228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3271228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3272228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3273228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3274228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3275228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3276228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3277228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3278228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3279228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,
3280228,228,228,228,228,228,228,228,228,229,229,229,229,229,229,229,
3281229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3282229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3283229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3284229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3285229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3286229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3287229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3288229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3289229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3290229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3291229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3292229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3293229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3294229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3295229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3296229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3297229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3298229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3299229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3300229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3301229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3302229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3303229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3304229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3305229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3306229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3307229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3308229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,
3309229,229,229,229,230,230,230,230,230,230,230,230,230,230,230,230,
3310230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3311230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3312230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3313230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3314230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3315230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3316230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3317230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3318230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3319230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3320230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3321230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3322230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3323230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3324230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3325230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3326230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3327230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3328230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3329230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3330230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3331230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3332230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3333230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3334230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3335230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3336230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3337230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,
3338230,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3339231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3340231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3341231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3342231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3343231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3344231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3345231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3346231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3347231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3348231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3349231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3350231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3351231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3352231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3353231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3354231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3355231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3356231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3357231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3358231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3359231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3360231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3361231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3362231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3363231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3364231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3365231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3366231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
3367232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3368232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3369232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3370232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3371232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3372232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3373232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3374232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3375232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3376232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3377232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3378232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3379232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3380232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3381232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3382232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3383232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3384232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3385232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3386232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3387232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3388232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3389232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3390232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3391232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3392232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3393232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3394232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3395232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
3396232,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3397233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3398233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3399233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3400233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3401233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3402233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3403233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3404233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3405233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3406233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3407233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3408233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3409233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3410233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3411233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3412233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3413233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3414233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3415233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3416233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3417233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3418233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3419233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3420233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3421233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3422233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3423233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3424233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
3425233,233,233,233,234,234,234,234,234,234,234,234,234,234,234,234,
3426234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3427234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3428234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3429234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3430234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3431234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3432234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3433234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3434234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3435234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3436234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3437234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3438234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3439234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3440234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3441234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3442234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3443234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3444234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3445234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3446234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3447234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3448234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3449234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3450234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3451234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3452234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3453234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
3454234,234,234,234,234,234,234,234,234,235,235,235,235,235,235,235,
3455235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3456235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3457235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3458235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3459235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3460235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3461235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3462235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3463235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3464235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3465235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3466235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3467235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3468235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3469235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3470235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3471235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3472235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3473235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3474235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3475235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3476235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3477235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3478235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3479235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3480235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3481235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3482235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3483235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
3484236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3485236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3486236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3487236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3488236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3489236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3490236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3491236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3492236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3493236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3494236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3495236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3496236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3497236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3498236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3499236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3500236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3501236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3502236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3503236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3504236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3505236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3506236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3507236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3508236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3509236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3510236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3511236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3512236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
3513236,236,236,236,236,236,236,236,236,237,237,237,237,237,237,237,
3514237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3515237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3516237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3517237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3518237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3519237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3520237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3521237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3522237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3523237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3524237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3525237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3526237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3527237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3528237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3529237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3530237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3531237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3532237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3533237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3534237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3535237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3536237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3537237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3538237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3539237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3540237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3541237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3542237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,
3543237,237,237,237,238,238,238,238,238,238,238,238,238,238,238,238,
3544238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3545238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3546238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3547238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3548238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3549238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3550238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3551238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3552238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3553238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3554238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3555238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3556238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3557238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3558238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3559238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3560238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3561238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3562238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3563238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3564238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3565238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3566238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3567238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3568238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3569238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3570238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3571238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3572238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
3573238,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3574239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3575239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3576239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3577239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3578239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3579239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3580239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3581239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3582239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3583239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3584239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3585239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3586239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3587239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3588239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3589239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3590239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3591239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3592239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3593239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3594239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3595239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3596239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3597239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3598239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3599239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3600239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3601239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3602239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
3603240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3604240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3605240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3606240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3607240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3608240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3609240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3610240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3611240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3612240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3613240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3614240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3615240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3616240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3617240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3618240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3619240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3620240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3621240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3622240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3623240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3624240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3625240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3626240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3627240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3628240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3629240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3630240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3631240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3632240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
3633240,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3634241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3635241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3636241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3637241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3638241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3639241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3640241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3641241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3642241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3643241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3644241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3645241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3646241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3647241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3648241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3649241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3650241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3651241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3652241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3653241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3654241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3655241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3656241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3657241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3658241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3659241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3660241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3661241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3662241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
3663241,241,241,241,242,242,242,242,242,242,242,242,242,242,242,242,
3664242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3665242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3666242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3667242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3668242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3669242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3670242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3671242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3672242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3673242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3674242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3675242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3676242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3677242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3678242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3679242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3680242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3681242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3682242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3683242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3684242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3685242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3686242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3687242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3688242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3689242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3690242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3691242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3692242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
3693242,242,242,242,242,242,242,242,242,243,243,243,243,243,243,243,
3694243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3695243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3696243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3697243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3698243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3699243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3700243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3701243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3702243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3703243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3704243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3705243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3706243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3707243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3708243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3709243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3710243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3711243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3712243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3713243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3714243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3715243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3716243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3717243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3718243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3719243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3720243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3721243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3722243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3723243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,
3724244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3725244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3726244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3727244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3728244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3729244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3730244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3731244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3732244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3733244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3734244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3735244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3736244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3737244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3738244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3739244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3740244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3741244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3742244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3743244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3744244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3745244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3746244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3747244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3748244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3749244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3750244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3751244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3752244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3753244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
3754244,244,244,244,244,244,244,244,244,245,245,245,245,245,245,245,
3755245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3756245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3757245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3758245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3759245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3760245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3761245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3762245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3763245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3764245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3765245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3766245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3767245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3768245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3769245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3770245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3771245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3772245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3773245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3774245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3775245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3776245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3777245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3778245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3779245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3780245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3781245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3782245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3783245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3784245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
3785245,245,245,245,246,246,246,246,246,246,246,246,246,246,246,246,
3786246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3787246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3788246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3789246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3790246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3791246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3792246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3793246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3794246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3795246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3796246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3797246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3798246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3799246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3800246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3801246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3802246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3803246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3804246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3805246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3806246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3807246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3808246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3809246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3810246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3811246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3812246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3813246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3814246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3815246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,
3816246,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3817247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3818247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3819247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3820247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3821247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3822247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3823247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3824247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3825247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3826247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3827247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3828247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3829247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3830247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3831247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3832247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3833247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3834247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3835247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3836247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3837247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3838247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3839247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3840247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3841247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3842247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3843247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3844247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3845247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3846247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
3847248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3848248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3849248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3850248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3851248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3852248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3853248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3854248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3855248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3856248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3857248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3858248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3859248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3860248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3861248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3862248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3863248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3864248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3865248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3866248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3867248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3868248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3869248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3870248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3871248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3872248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3873248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3874248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3875248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3876248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3877248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
3878248,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3879249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3880249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3881249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3882249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3883249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3884249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3885249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3886249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3887249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3888249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3889249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3890249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3891249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3892249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3893249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3894249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3895249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3896249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3897249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3898249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3899249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3900249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3901249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3902249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3903249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3904249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3905249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3906249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3907249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3908249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
3909249,249,249,249,250,250,250,250,250,250,250,250,250,250,250,250,
3910250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3911250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3912250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3913250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3914250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3915250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3916250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3917250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3918250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3919250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3920250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3921250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3922250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3923250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3924250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3925250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3926250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3927250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3928250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3929250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3930250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3931250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3932250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3933250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3934250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3935250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3936250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3937250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3938250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3939250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
3940250,250,250,250,250,250,250,250,250,251,251,251,251,251,251,251,
3941251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3942251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3943251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3944251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3945251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3946251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3947251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3948251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3949251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3950251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3951251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3952251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3953251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3954251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3955251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3956251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3957251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3958251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3959251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3960251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3961251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3962251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3963251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3964251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3965251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3966251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3967251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3968251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3969251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3970251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3971251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
3972252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3973252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3974252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3975252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3976252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3977252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3978252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3979252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3980252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3981252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3982252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3983252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3984252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3985252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3986252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3987252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3988252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3989252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3990252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3991252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3992252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3993252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3994252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3995252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3996252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3997252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3998252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
3999252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
4000252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
4001252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
4002252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
4003252,252,252,252,252,252,252,252,252,253,253,253,253,253,253,253,
4004253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4005253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4006253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4007253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4008253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4009253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4010253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4011253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4012253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4013253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4014253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4015253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4016253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4017253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4018253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4019253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4020253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4021253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4022253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4023253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4024253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4025253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4026253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4027253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4028253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4029253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4030253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4031253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4032253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4033253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4034253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
4035253,253,253,253,254,254,254,254,254,254,254,254,254,254,254,254,
4036254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4037254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4038254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4039254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4040254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4041254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4042254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4043254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4044254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4045254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4046254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4047254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4048254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4049254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4050254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4051254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4052254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4053254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4054254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4055254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4056254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4057254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4058254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4059254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4060254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4061254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4062254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4063254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4064254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4065254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4066254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
4067254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4068255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4069255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4070255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4071255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4072255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4073255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4074255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4075255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4076255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4077255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4078255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4079255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4080255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4081255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4082255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4083255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4084255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4085255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4086255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4087255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4088255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4089255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4090255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4091255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4092255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4093255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4094255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4095255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4096255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4097255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
4098255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
4099};
diff --git a/core/multimedia/opieplayer/libflash/swf.h b/core/multimedia/opieplayer/libflash/swf.h
new file mode 100644
index 0000000..5f5e4f7
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/swf.h
@@ -0,0 +1,229 @@
1#ifndef _SWF_H_
2#define _SWF_H_
3
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7#include <setjmp.h>
8#include <assert.h>
9#include <limits.h>
10
11#ifdef DUMP
12#include "bitstream.h"
13#endif
14
15#include "flash.h"
16
17extern int debug;
18
19// Global Types
20typedef unsigned long U32, *P_U32, **PP_U32;
21typedef signed long S32, *P_S32, **PP_S32;
22typedef unsigned short U16, *P_U16, **PP_U16;
23typedef signed short S16, *P_S16, **PP_S16;
24typedef unsigned char U8, *P_U8, **PP_U8;
25typedef signed char S8, *P_S8, **PP_S8;
26typedef signed long SFIXED, *P_SFIXED;
27typedef signed long SCOORD, *P_SCOORD;
28typedef unsigned long BOOL;
29
30#define ZOOM(v,f) ((v)/(f))
31
32#include "matrix.h"
33#include "cxform.h"
34#include "rect.h"
35
36#include <sys/time.h>
37#define ST struct timeval t1,t2;
38#define START gettimeofday(&t1,0)
39#define STOP(msg) gettimeofday(&t2,0); printf("%s Delta = %d ms\n", msg, (t2.tv_sec-t1.tv_sec)*1000+(t2.tv_usec-t1.tv_usec)/1000); fflush(stdout);
40
41// Start Sound Flags
42enum {
43 soundHasInPoint = 0x01,
44 soundHasOutPoint= 0x02,
45 soundHasLoops = 0x04,
46 soundHasEnvelope= 0x08
47
48 // the upper 4 bits are reserved for synchronization flags
49};
50
51// Flags for Sound Format
52enum SounfFlags {
53 soundIsStereo = 0x01,
54 soundIs16bit = 0x02,
55 soundIsADPCMCompressed= 0x10
56};
57
58// Flags for defining Button States
59enum ButtonState {
60 stateHitTest = 0x08,
61 stateDown = 0x04,
62 stateOver = 0x02,
63 stateUp = 0x01
64};
65
66// Actions
67enum Action {
68 // Internal actions
69 ActionRefresh = 0x00,
70 ActionPlaySound = 0x01,
71 // Normal actions
72 ActionGotoFrame = 0x81,
73 ActionGetURL = 0x83,
74 ActionNextFrame = 0x04,
75 ActionPrevFrame = 0x05,
76 ActionPlay = 0x06,
77 ActionStop = 0x07,
78 ActionToggleQuality= 0x08,
79 ActionStopSounds= 0x09,
80 ActionWaitForFrame= 0x8a,
81 ActionSetTarget = 0x8b,
82 ActionGoToLabel = 0x8c
83};
84
85class Sound;
86
87struct ActionRecord {
88 Action action;
89
90 // GotoFrame & WaitForFrame
91 long frameIndex;
92
93 // GetURL
94 char *url;
95 char *target;
96
97 // GotoLabel
98 char *frameLabel;
99
100 // WaitForFrame
101 long skipCount;
102
103 // Sound
104 Sound *sound;
105
106 struct ActionRecord*next;
107
108 ActionRecord() {
109 frameLabel = 0;
110 url = 0;
111 target = 0;
112 sound = 0;
113 };
114
115 ~ActionRecord() {
116 if (frameLabel) free(frameLabel);
117 if (url) free(url);
118 if (target) free(target);
119 };
120};
121
122enum FontFlags {
123 fontUnicode = 0x20,
124 fontShiftJIS = 0x10,
125 fontANSI = 0x08,
126 fontItalic = 0x04,
127 fontBold = 0x02,
128 fontWideCodes = 0x01
129};
130
131enum TextFlags {
132 isTextControl = 0x80,
133
134 textIsLarge = 0x70,
135 textHasFont = 0x08,
136 textHasColor = 0x04,
137 textHasYOffset= 0x02,
138 textHasXOffset= 0x01
139};
140
141#ifndef NULL
142#define NULL 0
143#endif
144
145// Tag values that represent actions or data in a Flash script.
146enum
147{
148 stagEnd = 0,
149 stagShowFrame = 1,
150 stagDefineShape = 2,
151 stagFreeCharacter = 3,
152 stagPlaceObject = 4,
153 stagRemoveObject = 5,
154 stagDefineBits = 6,
155 stagDefineButton = 7,
156 stagJPEGTables = 8,
157 stagSetBackgroundColor= 9,
158 stagDefineFont = 10,
159 stagDefineText = 11,
160 stagDoAction = 12,
161 stagDefineFontInfo = 13,
162 stagDefineSound = 14,// Event sound tags.
163 stagStartSound = 15,
164 stagStopSound = 16,
165 stagDefineButtonSound= 17,
166 stagSoundStreamHead = 18,
167 stagSoundStreamBlock= 19,
168 stagDefineBitsLossless = 20,// A bitmap using lossless zlib compression.
169 stagDefineBitsJPEG2 = 21,// A bitmap using an internal JPEG compression table.
170 stagDefineShape2 = 22,
171 stagDefineButtonCxform= 23,
172 stagProtect = 24,// This file should not be importable for editing.
173
174 // These are the new tags for Flash 3.
175 stagPlaceObject2 = 26,// The new style place w/ alpha color transform and name.
176 stagRemoveObject2 = 28,// A more compact remove object that omits the character tag (just depth).
177 stagDefineShape3 = 32,// A shape V3 includes alpha values.
178 stagDefineText2 = 33,// A text V2 includes alpha values.
179 stagDefineButton2 = 34,// A button V2 includes color transform, alpha and multiple actions
180 stagDefineBitsJPEG3 = 35,// A JPEG bitmap with alpha info.
181 stagDefineBitsLossless2 = 36,// A lossless bitmap with alpha info.
182 stagDefineSprite = 39,// Define a sequence of tags that describe the behavior of a sprite.
183 stagNameCharacter = 40,// Name a character definition, character id and a string, (used for buttons, bitmaps, sprites and sounds).
184 stagFrameLabel = 43,// A string label for the current frame.
185 stagSoundStreamHead2 = 45,// For lossless streaming sound, should not have needed this...
186 stagDefineMorphShape = 46,// A morph shape definition
187 stagDefineFont2 = 48,
188
189 notEnoughData = 0xffff,// Special code
190};
191
192#ifndef false
193#define false 0
194#endif
195#ifndef true
196#define true 1
197#endif
198
199extern int shape_size,shape_nb,shaperecord_size,shaperecord_nb,style_size,style_nb;
200
201typedef void (*ScanLineFunc)(void *id, long y, long start, long end);
202
203class Bitmap;
204struct FlashMovie;
205
206extern "C" {
207#include "jpeglib.h"
208};
209extern "C" {
210//#include "zlib.h"
211#include "../src/3rdparty/zlib/zlib.h"
212};
213
214#include "graphic.h"
215#include "character.h"
216#include "bitmap.h"
217#include "shape.h"
218#include "displaylist.h"
219#include "sound.h"
220#include "button.h"
221#include "font.h"
222#include "text.h"
223#include "adpcm.h"
224#include "program.h"
225#include "sprite.h"
226#include "script.h"
227#include "movie.h"
228
229#endif /* _SWF_H_ */
diff --git a/core/multimedia/opieplayer/libflash/text.cc b/core/multimedia/opieplayer/libflash/text.cc
new file mode 100644
index 0000000..1b6cb5e
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/text.cc
@@ -0,0 +1,246 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29Text::Text(long id) : Character(TextType, id)
30{
31 textRecords = 0;
32}
33
34Text::~Text()
35{
36 TextRecord *cur,*del;
37
38 for(cur = textRecords; cur;)
39 {
40 del = cur;
41 cur = cur->next;
42 delete del;
43 }
44}
45
46void
47Text::setTextBoundary(Rect rect)
48{
49 boundary = rect;
50}
51
52void
53Text::setTextMatrix(Matrix m)
54{
55 textMatrix = m;
56}
57
58void
59Text::addTextRecord(TextRecord *tr)
60{
61 SwfFont *font = 0;
62 long n;
63
64 tr->next = 0;
65
66 if (textRecords == 0) {
67 textRecords = tr;
68 font = tr->font;
69 } else {
70 TextRecord *current;
71 long fontHeight = 0;
72
73 for(current = textRecords; current->next; current = current->next) {
74 if (current->flags & textHasFont) {
75 font = current->font;
76 fontHeight = current->fontHeight;
77 }
78 }
79
80 current->next = tr;
81 if (current->flags & textHasFont) {
82 font = current->font;
83 fontHeight = current->fontHeight;
84 }
85
86 if (tr->flags & textHasFont) {
87 font = tr->font;
88 } else {
89 tr->font = font;
90 tr->fontHeight = fontHeight;
91 }
92 }
93
94 if (tr->nbGlyphs) {
95 for(n=0; n < tr->nbGlyphs; n++) {
96 tr->glyphs[n].code = font->getGlyphCode(tr->glyphs[n].index);
97 }
98 }
99}
100
101int
102Text::execute(GraphicDevice *gd, Matrix *matrix, Cxform *cxform)
103{
104 return doText(gd, matrix, cxform, ShapeDraw, NULL, NULL);
105}
106
107void
108Text::getRegion(GraphicDevice *gd, Matrix *matrix,
109 void *id, ScanLineFunc scan_line_func)
110{
111 doText(gd, matrix, 0, ShapeGetRegion, id, scan_line_func);
112}
113
114void
115Text::getBoundingBox(Rect *bb, DisplayListEntry *e)
116{
117 *bb = boundary;
118}
119
120TextRecord *
121Text::getTextRecords()
122{
123 return textRecords;
124}
125
126int
127Text::doText(GraphicDevice *gd, Matrix *matrix, Cxform *cxform, ShapeAction action,
128 void *id, ScanLineFunc scan_line_func)
129{
130 TextRecord*tr;
131 long x,y; // Current position
132 SwfFont *font = 0;// Current font
133 long fontHeight;
134 Matrix tmat,fmat;
135 long g;
136
137 x = y = 0;
138 fontHeight = 0;
139
140 // Compute final text matrix
141 tmat = (*matrix) * textMatrix;
142
143 for(tr = textRecords; tr; tr = tr ->next)
144 {
145 if (tr->flags & isTextControl) {
146 if (tr->flags & textHasXOffset) {
147 x = tr->xOffset;
148 }
149 if (tr->flags & textHasYOffset) {
150 y = tr->yOffset;
151 }
152 if (tr->flags & textHasColor) {
153 if (action == ShapeDraw) {
154 if (cxform) {
155 gd->setForegroundColor(cxform->getColor(tr->color));
156 } else {
157 gd->setForegroundColor(tr->color);
158 }
159 }
160 }
161 }
162
163 font = tr->font;
164 fontHeight = tr->fontHeight;
165 // Update font matrix
166 fmat.a = fontHeight/1000.0;
167 fmat.d = fontHeight/1000.0;
168
169 assert(font != 0);
170 for (g = 0; g < tr->nbGlyphs; g++)
171 {
172 Shape *shape;
173 Matrix cmat;
174
175 shape = font->getGlyph( tr->glyphs[g].index );
176
177#ifdef PRINT
178 printf("%c", font->getGlyphCode(tr->glyphs[g].index));
179#endif
180
181 // Update font matrix
182 fmat.tx = x;
183 fmat.ty = y;
184
185 // Compute Character matrix
186 cmat = tmat * fmat;
187
188 if (action == ShapeDraw) {
189 shape->execute(gd, &cmat, cxform);
190 } else {
191 shape->getRegion(gd, &cmat, id, scan_line_func);
192 }
193
194 // Advance
195 x += tr->glyphs[g].xAdvance;
196 }
197#ifdef PRINT
198 printf("\n");
199#endif
200 }
201
202 if (gd->showMore) {
203 tmat = (*gd->adjust) * (*matrix);
204
205 long x1,x2,y1,y2;
206
207 x1 = boundary.xmin;
208 y1 = boundary.ymin;
209 x2 = boundary.xmax;
210 y2 = boundary.ymax;
211 gd->drawLine(tmat.getX(x1,y1),tmat.getY(x1,y1),tmat.getX(x2,y1),tmat.getY(x2,y1),FRAC);
212 gd->drawLine(tmat.getX(x2,y1),tmat.getY(x2,y1),tmat.getX(x2,y2),tmat.getY(x2,y2),FRAC);
213 gd->drawLine(tmat.getX(x2,y2),tmat.getY(x2,y2),tmat.getX(x1,y2),tmat.getY(x1,y2),FRAC);
214 gd->drawLine(tmat.getX(x1,y2),tmat.getY(x1,y2),tmat.getX(x1,y1),tmat.getY(x1,y1),FRAC);
215 }
216
217 return 0;
218}
219
220////////// TextRecord Methods
221TextRecord::TextRecord() {
222 flags = (TextFlags)0;
223 font = 0;
224 fontHeight = 0;
225 nbGlyphs = 0;
226 glyphs = 0;
227 xOffset = 0;
228 yOffset = 0;
229}
230
231TextRecord::~TextRecord() {
232 if (nbGlyphs) delete glyphs;
233}
234
235char *
236TextRecord::getText() {
237 static char text[256];
238 long g;
239
240 for(g=0; g < nbGlyphs; g++) {
241 text[g] = glyphs[g].code;
242 }
243 text[g] = 0;
244
245 return text;
246}
diff --git a/core/multimedia/opieplayer/libflash/text.h b/core/multimedia/opieplayer/libflash/text.h
new file mode 100644
index 0000000..1ba7b74
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/text.h
@@ -0,0 +1,77 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20#ifndef _TEXT_H_
21#define _TEXT_H_
22
23struct Glyph {
24 longindex;
25 longxAdvance;
26 long code;// Ascii code
27};
28
29struct TextRecord {
30
31 // Normal text record
32 Glyph *glyphs;
33 long nbGlyphs;
34
35 // Control text record
36 TextFlags flags;
37 SwfFont *font;
38 long fontHeight;
39 Color color;
40 long xOffset;
41 long yOffset;
42
43 TextRecord *next;
44
45 TextRecord();
46 ~TextRecord();
47
48 char *getText();
49};
50
51class Text : public Character {
52
53 Rect boundary;
54 Matrix textMatrix;
55 TextRecord *textRecords;// List
56
57public:
58 Text(long id);
59 ~Text();
60
61 void setTextBoundary(Rect rect);
62 void setTextMatrix(Matrix m);
63 void addTextRecord(TextRecord *tr);
64 int execute(GraphicDevice *gd, Matrix *matrix, Cxform *cxform);
65 void getRegion(GraphicDevice *gd, Matrix *matrix,
66 void *id, ScanLineFunc scan_line_func);
67 int doText(GraphicDevice *gd, Matrix *matrix, Cxform *cxform, ShapeAction action,
68 void *id, ScanLineFunc scan_line_func);
69 void getBoundingBox(Rect *bb, DisplayListEntry *e);
70 TextRecord *getTextRecords();
71
72#ifdef DUMP
73 void dump(BitStream *bs);
74#endif
75};
76
77#endif /* _TEXT_H_ */