Friday, November 18, 2011

KrzFlopt 1.23

What is KrzFlopt? KrzFlopt is rebranded KrzYoptimizer (renamed) that again is developped by me. The program is written in VB6. Why? Because I wrote my first VBS script with GUI at the age of 16 and I liked this programming language. It also is much faster than .NET platform. Also it is too simply to be rewritten to .NET, although using ConsoleRead would be nice to create some log windows/status bar information what programs KrzFlopt is using are doing in the background.

By using some advanced deflate tools like kzip, DeflOpt, 7-zip, pngout and more KrzFlopt is able to reduce file size by optimizing Deflate streams. With build in ZIP to GZ, and ExtPK to PK header and vice versa conversions the user is able to open GZ and JAR files for processing. My program directy reads data from ZIP, GZ and JAR files that I programmed basing on online documents containing information on how file headers in those files are stored. This means it doesn't require any tools to at least: Open files, convert ZIP to GZ, ExtPK to PK headers and vice versa, calculate CRC32. You can add multiple files for optimisation.

User is free to chose 3 predefined optimisation methods or define his own and select Custom Mode. For Example in Fast mode program will only try blocks from 1-16, it's good for small files. It's still recommended to create Custom mode with settings: 16 or 32 blocks to try first, search for up to 1024 blocks (kzip/pngout limit) and run at least 100 random Huffman table inits.

KrzFlopt tries to find best number of blocks to split file to by extending searching range. When it successfully found best settings and number of blocks found is equal or higher maximum blocks in this range*66% (for example 13 block is > than 16*66%) then it extends it to maximum blocks*2, till it reaches 1024.

Optimised PNG files are saved on-fly but ZIP/GZ/JAR files are stored only when it ends optimising each file in Deflate archive. Of course the program discards any data that is larger than original file.

Although program may crash from time to time (for example when opening ZIP containing MeGUI profiles - dunno why, I need to research it where the overflow occurs), it should be very stable.

Changes in this version let users send/retrieve data to/from server. This means that my server stores best results for files optimised and sends it to users to save a lot of time. For example file that is 6MB takes very long time to find best settings when searching for up to 1024 blocks. If program finds a file that its best settings data is stored on server then it jumps directly to best settings and later only random huffman table inits are run to eventually futher reduce its size a bit.

Time for some changelog on what was changed sinve fersion 1.22 till 1.23 final.

- Added additional information in TitleBar (Expert Settings)
- Added support for GnuZIP/gz (Unix) timestamp format
* File inside GZ has same time/date as file in ZIP (may reduce the time by 1h on new windowses, I need to fix it someday - it's cause by day savings)
- Added number of bytes reduced in random
tries for Randoms tab "bytesb (successes)"
- Added option to skip 7-zip 3-257 fast bytes test (only 258)
- Added End 7-zip button
- Added CRC32 calculation in File menu
- Added Strategy display: 9 /s 9 /c 9 /f 9 /d [PNG]
- Added Result sending/retrieving
* Program sends best results to server
* Program retrieves best results from server and jumps to best results
and, if selected, checks for randoms to futher reduce file length
* Works if appropriate check boxes in settings
are selected (either one or both)
* Should work fine for ZIP and PNG files.
- Fixed CRC Checking
- Fixed crash when license window was closed after being accessed
through about windows
- Fixed blocks sometimes not displaying in list. [PNG]
- Fixed: Random inits always used extreme strategy even when
it should not [PNG]
- Fixed program doing 1/2 of total maximum blocks to test for ZIP/GZ/JAR
- Fixed status not updating for PNG files
- Fixed strategy parameter not being remembered at all when PNG file
was inside Deflate file [PNG]
- Fixed compression strategy [/s] being sometimes -3 instead of 0 [PNG]
- !!Changed to new webserver:
- Skip 7-zip compression when file is in database (only KZIP-ped
files are stored anyway)
- Reduced 7-zip passes from 255 to 15 and added check for
all fast bytes settings (VERY RARERY produces file smaller
than with 258 fast bytes but DOES)
- Bugfixes for block/strategy algorithm
- now work automatically resumes when user answers NO on exit msg
- Updated CRC file on server
- Updated and fixed 'Download & Install' Module
- Code rearranging and optimisation
- Compiled without optimizations (for some reason 13KB smaller exe)
- Changed Deflate settings algorithm a bit. Now it starts checking from
block 1 and checks file size after each strategy pass (not block as before)
* May lead to better or worse results - need testing [PNG]
- Rewrote 'Limit CPU Usage' code (works better now)
- Rearranged GUI a bit
in ensuring best number of blocks mode
- Updated CRC file (pngout and jpegtran update)
- Hopefully Fixed PNG file not being repacked
* Sorry for that bug, didn't notice it earlier. Program wrongly
calculated reduced PNG size for zipslim.

Download it from here.

Sunday, October 9, 2011

OptiPNG ARM for Zyxel (ARM926EJ-S)

OptiPNG for optimizing PNG files directly on Your Zyxel NAS!

NEW: Now in installation package! Installs with funpkg command!

Now you can optimize Your PNG files directly on Your Zyxel NSA-210 or 220 Plus (other file
server basing on ARM CPU should be supported). This version is especially optimised for ARM926EJ-S that Zyxel NSA-220 Plus contains. This time I didn't test speed difference with previous non-optimised version but it should be 10% faster as LAME was ;)

Here is some data generated by compiled program. As you can see it's working perfectly:

root@seagate3tb:/i-data/2ee15731/Anime/Lupin III/Scans# optipng -zc1-9 -zm9 -zs0
-3 f0-5 -v "Lupin III - Greates Capers - VHS front.png"
OptiPNG 0.6.5: Advanced PNG optimizer.
Copyright (C) 2001-2011 Cosmin Truta.

This program is open-source software. See LICENSE for more details.

Portions of this software are based in part on the work of:
Jean-loup Gailly and Mark Adler (zlib)
Glenn Randers-Pehrson and the PNG Development Group (libpng)
Miyasaka Masaru (BMP support)
David Koblas (GIF support)

Using libpng version 1.4.5-optipng and zlib version 1.2.5-optipng

** Processing: f0-5
Error: Can't open the input file

** Processing: Lupin III - Greates Capers - VHS front.png
1214x2233 pixels, 3x8 bits/pixel, RGB
Input IDAT size = 4546256 bytes
Input file size = 4546394 bytes

zc = 9 zm = 9 zs = 0 f = 0 IDAT too big
zc = 8 zm = 9 zs = 0 f = 0 IDAT too big
zc = 7 zm = 9 zs = 0 f = 0 IDAT too big
zc = 6 zm = 9 zs = 0 f = 0 IDAT too big
zc = 5 zm = 9 zs = 0 f = 0 IDAT too big
zc = 4 zm = 9 zs = 0 f = 0 IDAT too big
zc = 3 zm = 9 zs = 0 f = 0 IDAT too big
zc = 2 zm = 9 zs = 0 f = 0 IDAT too big
zc = 1 zm = 9 zs = 0 f = 0 IDAT too big
zc = 9 zm = 9 zs = 1 f = 0 IDAT too big
zc = 8 zm = 9 zs = 1 f = 0 IDAT too big
zc = 7 zm = 9 zs = 1 f = 0 IDAT too big
zc = 6 zm = 9 zs = 1 f = 0 IDAT too big
zc = 5 zm = 9 zs = 1 f = 0 IDAT too big
zc = 4 zm = 9 zs = 1 f = 0 IDAT too big
zc = 3 zm = 9 zs = 1 f = 0 IDAT too big
zc = 2 zm = 9 zs = 1 f = 0 IDAT too big
zc = 1 zm = 9 zs = 1 f = 0 IDAT too big
zc = 1 zm = 9 zs = 2 f = 0 IDAT too big
zc = 9 zm = 9 zs = 3 f = 0 IDAT too big
zc = 9 zm = 9 zs = 0 f = 5 IDAT size = 4499076
zc = 8 zm = 9 zs = 0 f = 5 IDAT size = 4499076
zc = 7 zm = 9 zs = 0 f = 5 IDAT too big
zc = 6 zm = 9 zs = 0 f = 5 IDAT too big
zc = 5 zm = 9 zs = 0 f = 5 IDAT too big
zc = 4 zm = 9 zs = 0 f = 5 IDAT too big
zc = 3 zm = 9 zs = 0 f = 5 IDAT too big
zc = 2 zm = 9 zs = 0 f = 5 IDAT too big
zc = 1 zm = 9 zs = 0 f = 5 IDAT too big
zc = 9 zm = 9 zs = 1 f = 5 IDAT size = 4125865
zc = 8 zm = 9 zs = 1 f = 5 IDAT size = 4125863
zc = 7 zm = 9 zs = 1 f = 5 IDAT too big
zc = 6 zm = 9 zs = 1 f = 5 IDAT too big
zc = 5 zm = 9 zs = 1 f = 5 IDAT size = 4114417
zc = 4 zm = 9 zs = 1 f = 5 IDAT size = 4100526
zc = 3 zm = 9 zs = 1 f = 5 IDAT too big
zc = 2 zm = 9 zs = 1 f = 5 IDAT too big
zc = 1 zm = 9 zs = 1 f = 5 IDAT too big
zc = 1 zm = 9 zs = 2 f = 5 IDAT size = 4061378
zc = 9 zm = 9 zs = 3 f = 5 IDAT too big

Selecting parameters:
zc = 1 zm = 9 zs = 2 f = 5 IDAT size = 4061378

Output IDAT size = 4061378 bytes (484878 bytes decrease)
Output file size = 4061516 bytes (484878 bytes = 10.66% decrease)

** Status report
2 file(s) have been processed.
1 error(s) have been encountered.

Download Here!

* copy it to /home directory, login with putty, cd to it and run command: funpkg -i optipng-0.6.5-1.tgz
* then you can run it by simply typing optipng in any directory or read manual by typing man optipng

Tuesday, October 4, 2011

Lame MP3 ARM for Zyxel (ARM926EJ-S)

Lame less lame on ARM?

Yes, it is! There in a new compilation of Lame I did a long time ago for Zyxel NAS. This one is especially optimised for ARM cpu that is inside this NAS file server. It's still painful slow but it also is 10% faster than previous version. Here are short results of compressing 600 frames:

root@seagate3tb:/home# ./lame.2 lazy.mp3 lazy.2.mp3
ID3v2 found. Be aware that the ID3 tag is currently lost when transcoding.
LAME 3.98.4 32bits (
Using polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz
Encoding lazy.mp3 to lazy.2.mp3
Encoding as 44.1 kHz j-stereo MPEG-1 Layer III (11x) 128 kbps qval=3
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
600/11621 ( 5%)| 2:15/ 43:35| 2:22/ 46:02| 0.1161x| 43:39
kbps LR MS % long switch short %
128.0 0.5 99.5 94.3 3.3 2.4

root@seagate3tb:/home# ./lame.1 lazy.mp3 lazy.1.mp3
ID3v2 found. Be aware that the ID3 tag is currently lost when transcoding.
LAME 3.98.4 32bits (
Using polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz
Encoding lazy.mp3 to lazy.1.mp3
Encoding as 44.1 kHz j-stereo MPEG-1 Layer III (11x) 128 kbps qval=3
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
600/11621 ( 5%)| 2:28/ 47:50| 2:36/ 50:23| 0.1058x| 47:47
kbps LR MS % long switch short %
128.0 0.5 99.5 94.3 3.3 2.4

lame.2 is version is optimised especially for ARM located in Zyxel NAS.
lame.1 is version compilled with default settings.

Download it here

Wednesday, March 30, 2011

Webcameras around the world

I'm currently working on a worldwide webcameras project. I made simple webpage that lets You browse my webcam database that mainly contains controlable java, panasonic MJPEG and axis MJPEG ones (soon to add more). First two can be controlled by java or controls on my site (as long as they are not locked in camera settings). Site picks one randomly when accessed without special parameters. The list displays all webcams currently available in database. There is also simple search mode based on camera description (mainly location and URL). Everyone of them has original webpage url included incase original owner wants people to access their sites (good when You are in charge of tourism or some kind of hotel).

There was a time when I didn't have job and was browsing internet all day long. Then I found webcameras, mainly java ones then. I found it very interesting and very soon I was sighseeing world sitting behind my computer desk ;D . This time I wanted to easly access it from one database instead of googling webpages on and on. Since I'm now playing with php+mysql it is now possible! So here is the webpage! Have fun:

Wednesday, February 16, 2011

Small project

For some time now I'm writing some kind of database that can be easly accessed and edited. It contains essential data I'm in charge of at work. It helps a lot, because there is no need to "move your ass" in order to verify things. All information necessary for us to work are kept in database and accessed through WWW.

Unfortunately due to it containing a lot of information that is not supposed to be public available I can't reveal any screenshot or similar information.

I can at least provide you with changelog.

- Changed how the server reacts when textarea is left empty after clicking a button. It will now automatically asign '-' to it.
- Improved ajax function:
* Replace controls with text only when ajax is successful
* Button DISABLE'ing until ajax succedess or returns error. Error: re-enabled, Success: standard behaviour.
- Replaced input text with textarea
- Added support for ENTERs
- Added compare mode
- Changed 'Zatwierdz' button position to fix status div fully covering it

- Added ability to change password
- Added permission to prevent view, view or view&modify specified data
- Added ability to logout
- Switched from hardcoded login to SQL login

- Added jquery and AJAX to support editing directly on the webpage
- Added login and session timeout (set to 10 min)

- New generation version with tree

- First initial version to view database content of 3 columns in a table

Wednesday, January 19, 2011

Super BluKid renewed

Super BluKid by Fraser Ashworth from Bitwise Design now renewed! Extended Version v1.00.

I spend few days on this game in AMOS Basic (luckly it doesn't require deasembling tools and hexing to change the code). I was so into turning the cheats off that I even fixed few things and added a bit of extended functionality like m key.

Why did I do this?
My 7 years old sister were asking me to turn some game on my netbook connected to 42'' LED TV. I run Amiga emulator because games that were running on this computer were far better for kids this age in my opinion.

The Work:
I opened Super BluKid I downloaded from the net (please note that I owned such game on my R.I.P Amiga I had, not sure if it was original though). She started playing it but soon she discovered that SPACE KEY skips levels. What a shame... She could've played at least a bit fair (with hardcoded invinciblity).

The game was finished in no time and then I thought: "I'm going to find some hex editor and hex out that invinciblity mode, because there is too much cheating there...". I opened the disk with some binary viewer and then I started searching internet by the file tag at the beginning of binary data. I found out that it's AMOS and the file itself is sourcecode for it. Great!

After working for an hour I wiped the variable that was the culpit. The game now worked almost as original without modification. I didn't want to make it that way because it was the only version available on the internet, so I readded it by adding a title screen to switch it ON and OFF and that was it. The first version I wanted to release.

Then I started editing cracktro like intro to put message about how to re-enable disabled by default cheat mode. I couldn't get it to work though. I mean it worked but I wanted to leave original message inplace too. I wasted a day to find out that there are really 3 screens in the intro. One hidden behind that contains all text to display in scroll that is 2nd screen and 3rd is the "moving faces". So I was playing with the screen still with no full success. I could get other line of message to work but it still displayed only this one. Then I found out that coping function from 1st to 2nd screen contained X and Y pixels to copy. This was the key! By adding variable Z (btw. it was already there as Z=Rnd(100) but not used anywhere else there. I think cracktro autor wanted to use it for something but forgot to wipe it after failed attempt or something). This variable was added to Y telling it which line to fetch this time (after X - scroll - finishes scrolling turn). Bingo! This fixed everything and the cracktro was finished!

Editing game was actually quite easy. Full source reading was required thought to get familiar with it and know where every procedure lies and what it does. So then by adding additional key support, like "m" key to turn music on and off (essential!) was a piece of cake but wait... It didn't work the way I wanted it to... It worked only when pressing space and m or was very unresponsible to clicks. So then I found AMOS manual on the internet and found out that better way is to use it like this:

While D$<>""
If D$="m" then .....
If D$=" " then ......
This way it worked like a charm. It even fixed SPACE spam in BOSS LEVEL that could crash Your game when finishing 4th world! (I figured later - not 100% sure if that's the reason though ;P)

After that I sterted adding more options to title screen and playing with scroll to work the way I want. It was a lot easier than cracktro one because this one worked on a variable, not hidden screen. I split previous person idea from full invinciblity (energy+time+skip key) to energy only, time only, items only (YES! Now You can have unlimited baloons ;), ingame keys only (space, 1-6 keys) and even entering hidden time modifier and map maker! This is recent version. First worked on 3 keys only where first one enable invinciblity, 2nd space key and 3rd both - lame, wasn't it? ;D About hidden tools. Time modifier works, but it's a shame only one level can be modified at a time. Map Maker does work in a weird way. When run from title screen it doesn't display all textures and mouse. But if you run it before it, they show up properly. It's weird to use though and I don't have slightess idea how to save the friggin' map. Most likety it was some help tool for author, because all stages are really multicolor icons stored in the same file as resource banks. Oh well....

Ingame keys allow you to regenerate time, energy, lifes and tools by pressing a number from 1 to 6. Just look at your INFOBAR (energy, time etc), the number is the bar order, so 1 for time, 2 for energy and so on. Unfortunatelly adding lifes don't show up. It works but the graphic isn't there. I was trying to make it working but couldn't find proper Bob to paste there. Probably it's some bigger image and I don't have time to play with it all day long.

Last thing was to add ability to quit ending loop-screen. Well... We sometimes want to play the game again without resetting whole computer, don't we? xD
Then was the title screen scroll fixing to make it more beautiful and that's about it.

Few screens of code:

The full list of changes
  • Cheats turned off by default
  • Fully customizable cheating: unlimited energy, time, tools, ingame keys
  • Additional ingame keys: SPACE, M, 1, 2, 3, 4, 5, 6 (NO 1, 4-6 on BOSS LEVEL)
  • Fixed SPACE KEY breaking 4th WORLD boss (I think this was the bug)
  • Extended cracktro like intro scroll functionality
  • Added title screen scroll short stop without flash functionality ("-" character)
  • Ability to quit ENDING screen by pressing fire button
  • Few programs were removed like nuke, border etc
  • Few other fixes and various things I probably forgot


Download it here.