Wednesday, 11 July 2018

etcpak 0.6

A new version of etcpak has been released. There are a couple of small changes in 0.6, but the main one is newly added support for compressing ETC2 RGBA textures.

Example compression result (only showing alpha channel):


16K x 16K image benchmark:
ETC1: 113 ms (only RGB part)
ETC2 RGB: 213 ms (only RGB part)
ETC2 RGBA: 404 ms

Sunday, 29 January 2017

Archiwum usenetu stało się jeszcze lepsze

Narzędzia

 

Tekstowy czytnik

 

Od niedawna dostępny jest czytnik archiwum działający w trybie tekstowym. Użytkownicy slrn-a powinni poczuć się jak w domu.



tbrowser posiada wszystkie możliwości starego czytnika graficznego, przy czym działa szybciej i potrzebuje mniej pamięci. Jest to teraz podstawowy program do przeglądania archiwum. Wersja oparta na Qt staje się przestarzałą i nie będzie dalej rozwijana.

 

Galaktyka

 

Do tej pory poszczególne grupy dyskusyjne były niezależnymi bytami. Nowo wprowadzony tryb "galaxy" umożliwia przełączanie się między grupami, przejście do wiadomości z innej grupy na podstawie Message-ID, a także pozwala na śledzenie followup-ów i crosspostów.


Aby skorzystać z przygotowanej bazy danych, należy pobrać plik galaxy.7z z archiwum i rozpakować do katalogu, w którym umieszczone są pliki grup dyskusyjnych. Następnie wystarczy podać ścieżkę do katalogu galaxy jako parametr programu tbrowser.

Tryb galaxy nie wymaga obecności wszystkich grup dyskusyjnych. Gdy któregoś archiwum będzie brakowało, zostanie ono wyświetlone, ale nie będzie można go otworzyć.

 

 Wyszukiwanie

 

Zmieniony został algorytm punktacji wyników wyszukiwania. Wyniki, w których wyszukiwane słowa znajdują się blisko siebie są dodatkowo premiowane. Ponadto, w wyszukiwaniu biorą udział słowa podobne do podanych w zapytaniu, co pozwala znaleźć również wiadomości z literówkami.

Wyszukiwarka pozostawia jeszcze sporo do życzenia, szczególnie jeżeli chodzi o kwestię prezentacji wyników.

 

 Narzędzia i biblioteki

 

Wspólna część kodu doczekała się wielu drobnych optymalizacji, dzięki czemu oba czytniki działają jeszcze szybciej. Podobne usprawnienia trafiły do narzędzi służących do tworzenia archiwum. Pojawiło się również kilka nowych programów przetwarzających dane. Więcej szczegółów jest dostępnych pod adresem https://bitbucket.org/wolfpld/usenetarchive.

 

 Archiwum polskiego usenetu

 

Archiwum dostępne pod adresem https://archive.org/details/usenet-uat-pl zawiera teraz grupy zarówno z hierarchii pl.*, jak i alt.pl.*. Poza tym znalazło się tam również kilka innych polskich grup dyskusyjnych.

Zawartość archiwum została zaktualizowana o wiadomości wysłane do grudnia 2016 roku. Niektóre grupy zyskały też dodatkowy rok archiwalnych wiadomości. Najstarsze wpisy sięgają teraz 1995 roku. Archiwum zawiera teraz ponad 56 milionów unikalnych wiadomości.

 

 Kompatybilność

 

Poprzednie wersje archiwum w dalszym ciągu można otworzyć graficzną przeglądarką, ale wersja tekstowa nie jest z nimi kompatybilna. Aktualna wersja nie będzie działać ze starszymi wersjami programów. Niemniej, z uwagi na liczne poprawki i uzupełnienia zawartości, najlepiej usunąć wcześniej pobrane archiwa i pobrać je na nowo.

Wednesday, 27 January 2016

etcpak 0.5

etcpak strikes again, this time with version 0.5, which has the ability to calculate planar blocks from the ETC2 standard. Color gradients, which were a sore spot in the image quality previously, will now have a much smoother look. This new option is activated by passing -etc2 parameter and comes at a small time cost (152% of pure ETC1 mode, 77 ms vs 117 ms). Example compressed image:


Planar block count in this image is quite high, as can be seen on the following debug image, where blue color indicates planar mode:


It should be noted that AVX2 version of planar block compression does not produce the same results as scalar one. Keep that in mind on pre-Haswell machines.

Download: https://bitbucket.org/wolfpld/etcpak/downloads

Saturday, 2 January 2016

etcpak 0.4

New year, new etcpak. Previously etcpak was an order of magnitude faster than the competing ETC compressors. This new version is yet another order of magnitude faster.

Time to compress 8K image:
etcpak 0.3: 655 ms
etcpak 0.4: 77 ms

This is thanks to Daniel Jungmann, who submitted patches implementing SSE 4.1 and AVX2 instructions. SSE 4.1 is now default and required (supported by Core 2 and AMD Bulldozer CPUs) and AVX2 is detected at runtime (support added in Haswell CPUs).

Other new features:
  • ETC1 dissection mode, allowing in-depth inspection of compressed images.
  • Mip-maps will be calculated only if needed (doh!).
  • Alpha channel compression is now deterministic.
  • Minor changes in compression precision. This will change checksums of most compressed images, compared with previous versions.
  • Multithreaded job dispatch algorithm was improved.
  • zlib/PNG checksum validation was removed, resulting in 12% improvement in image load times.
Download: https://bitbucket.org/wolfpld/etcpak/downloads

Friday, 30 May 2014

etcpak 0.3

New major version, new features:
  • Ability to create mipmaps (only POT, not in benchmark mode).
  • Optional dithering of input image.
  • Small quality improvements at basically no cost.
Image minification algorithm used for generating mipmaps is stupid simple, but it already beats the implementation in PVRTexTool:
Left: PVRTexTool, Right: etcpak
Notice the high frequency artifacts present in the PVRTexTool image, particularly near the eyes of parrots. etcpak generates smoother and more natural look. Further refinements will be able to improve the image quality even more.

Dithering basically improves the appearance of gradients or smooth areas in photos:
Left: no dithering, Right: dithering enabled
It comes at a small cost however. Here are the timings for normal compression:
$ x64/Release/etcpak.exe 8192.png -b
Image load time: 1352.646 ms
Mean compression time for 50 runs: 630.855 ms
And this is the run with dithering enabled:

$ x64/Release/etcpak.exe 8192.png -b -d
Image load time: 1312.084 ms
Mean compression time for 50 runs: 744.394 ms
Download: https://bitbucket.org/wolfpld/etcpak/downloads

Thursday, 13 March 2014

etcpak 0.2.2

This version contains some minor performance improvements and a benchmark mode, which can be activated using the -b parameter. It will perform 50 compression passes and print out the average time for one pass. It should provide better environment for measurements, as the PNG decode is the slowest component during normal operation.

I've also made an example 8192x8192 image available for test purposes. It is based on the Carina Nebula shot from Hubble.

For comparison, here's the previous method of speed measurement, heavily influenced by the PNG decoder:
$ time etcpak.exe 8192.png

real    0m1.471s
user    0m0.000s
sys     0m0.030s
And here's the new benchmark mode:
$ etcpak.exe 8192.png -b
Image load time: 1330.949 ms
Mean compression time for 50 runs: 631.308 ms

Download: https://bitbucket.org/wolfpld/etcpak/downloads

Saturday, 10 August 2013

etcpak 0.2.1

A new version of etcpak has been published today. What's new:
  • Reduced number of spawned threads and context switches.
  • Memory mapped files are used for output. This allows writing compressed data to disk during compression. The downside is that writing PVR output files no longer can be disabled.
  • 32 bit version has been discontinued. From now on only 64 bit version will be provided. It was always the recommended one to use, anyways, as it performed much better than the 32 bit one.
  • Various optimizations.
etcpak 0.2.1 is 10% faster than etcpak 0.2, with the compression time measured at 0.08 s (after deducting PNG load time).

Download: https://bitbucket.org/wolfpld/etcpak/downloads

Sunday, 7 July 2013

etcpak 0.2

It would appear that etcpak was programmed in quite inefficient way up until now. That's a funny way to talk about a program which was an order of magnitude faster than competing ones. And it's one of these obvious things which you wonder about afterwards, how wouldn't you think about it in the first place.

etcpak will no longer wait for compression to start until all image data is available. Data processing will now be performed simultaneously with PNG image decode process, which basically means that by the time the source image is fully loaded, we're almost done with the compression.

Some numbers.

TestTime (full)Time (minus PNG load)
etcpak 0.1 RGB1.12 s0.45 s
etcpak 0.1 RGB + alpha1.36 s0.69 s
etcpak 0.2 RGB0.83 s0.16 s
etcpak 0.2 RGB + alpha1.00 s0.33 s

This new version can be downloaded from https://bitbucket.org/wolfpld/etcpak/downloads.

Sunday, 9 June 2013

Fastest ETC compressor on the planet: etcpak

[edit: new version is available]

My new (mobile) game has quite a lot of assets. Four different resolution sets, more than 23000 source images in each of them. After packing everything into atlases, the resulting data set is about 1106 Mpixels big. Since each pixel occupies 4 bytes (RGB + alpha channel), the raw data would roughly fit on a DVD disc.

Of course, 3D hardware supports texture compression basically since the beginning of 3D revolution, which is quite some time. In the mobile space there are two major texture compression formats. The first one (and the only one supported on iOS) is PVRTC. The second one is ETC (Ericsson Texture Compression) and it's supported by virtually all OpenGL ES devices. It's also here to stay, as ETC compression support is mandatory in OpenGL ES 3.0 and OpenGL 4.3.

Now, the problem is that compression takes time. A looong time. On a dedicated i7 CPU it takes about 3 hours to compress all my atlases to PVRTC format, using ImgTec's PVRTexTool utility. ETC is better with about half an hour, but that's still unacceptable for a quick, iterative development. There are various quality settings, you can choose between perceptual and non-perceptual processing, but even in the fastest mode the compression is still unbearably slow.

There are other compression utilities available, but they fare no better. I am aware of the following ones:
I have a test image, which is a real-life data 4096x4096 RGBA texture atlas filled up to about 87%. Since some tools load PNG files and other require PPM input, which is basically streaming raw image data from the disk, I have measured the load time of the PNG test image on my i3 540 to be 0.67 second. Every utility loading PNG image will have that time deducted from total time, even if the program reports it took longer (for example, crunch says it loads the texture in 1.029s).

ToolCommand lineTime
PVRTexToolCL 3.40PVRTexTool.exe -i atlas-base1.png -o pvr.pvr -f ETC1 -q etcfast24.71 s
ericsson ETCPACK 1.06etcpack.exe -s fast -e nonperceptual atlas-base1.ppm etc.ktx23.86 s
mali etcpack 4.0.1etcpack.exe atlas-base1.ppm . -s fast -e nonperceptual -c etc119.20 s
crunch (rg-etc1) 1.04crunch_x64 -ETC1 -fileformat KTX -mipMode none -uniformMetrics -dxtQuality superfast -file atlas-base1.png4.41 s

So, crunch is really fast, isn't it? Well, I didn't know that before I set out to write my own compression utility. And it runs circles around crunch. The compression time is 0.45 s. That's not a typo, it's 10x as fast as the fastest utility previously available. It's 50x as fast as PVRTexTool. And it has a special mode for processing alpha channel textures. Creating two ETC textures, one with RGB data and a second one with alpha channel takes 0.69 s. That's the time it takes to decompress the PNG image. And it's so fast you will be limited by HDD I/O wait.

As for the resulting image quality, my tool was never intended for production usage. And for testing during development it doesn't look that bad. Take a look.

OriginalCompressed

You can download the Windows executables (both 32 and 64 bit, but use 64 one, as it's a lot faster) from https://bitbucket.org/wolfpld/etcpak/downloads. As usual, MSVC redist is required.

Source code can be found at bitbucket.

Wednesday, 24 October 2012

N900 software rendering

Some time ago I wrote a software renderer and presented the video on N73 running it. Then I ported it to N900, updated the model and lighting, but never actually published the video of it in action. Well, here it is:
I think the low FPS values (around 12) were the reason it was not published. It is due to the amount of triangles the new model consists of. The old Caesar's one was much simpler and thus rendered faster. With proper low-poly model the above animation would run with at least 30 FPS without any problems.

Fun side note. The software renderer on N900 was actually faster than running the hardware accelerated version. Well, hardware and/or drivers sucked greatly on that phone.

Tuesday, 2 October 2012

CRT-like rendering on LCD monitors followup

Apparently some folks on some strange forum-like site have been wondering how the CRT effect works. Next time you should write a comment to the entry instead of relying on me watching site traffic analysis.

Anyway. I have prepared a stripped down version of the code and it should be simple enough for anybody competent to replicate the effect in his own code. As the ReadMe file says, the shaders are not optimized in any way whatsoever. Some of them are written in a blatantly bad way. But it's a good starting point for anyone interested.

Windows binary: http://team.pld-linux.org/~wolf/CRT%20demo.7z. You will probably need MSVC 2012 redistributable package.
Source code: http://team.pld-linux.org/~wolf/CRT%20demo%20src.7z

Sunday, 6 May 2012

CRT-like rendering on LCD monitors

The advances of technologly in the past few years have given us quite a nice improvement in the quality of images displayed by our monitors. Thanks to RAMDACs that don't suck, LCD monitors, digital video interfaces, then LCD monitors that don't suck we're now able to display sharp visuals of unprecedented quality, at rather big resolutions too.

But there is a problem. Some types of content looked great in the past, but there is something missing when it's viewed nowadays. There are people who may not even know how it's supposed to be, due to the old technology becoming obsolete. Text mode looks different. When you want to use 8x8 font it ends up looking either blurred or super blocky. Use modern TTF fonts and you get nice curved shapes, antialiasing, etc., but it looks just wrong. It's not how it should be anymore. Another good example are 8-bit emulators. What has happened? These games used to look good, but now they are ugly in their perfectness!

Well, some things need to look bad to look good. Thanks to programmable GPUs we can now re-introduce all these bad things that were plaguing us in the CRT days, so that we can be happy once more. Let me show some pictures, each split in half. The left side is post-processed and the right side is the original content.





Some notes:
  1. The effect is dynamic and looks better when it's watched live.
  2. This is not an emulator, these are just screenshots of 8-bit games. I am using the post-processing for other purposes.
  3. This is based on what I thought would look good, not on any comparison to a real CRT, or analysis of errors happening in the VRAM -> analog -> CRT path.

Monday, 14 November 2011

UTF-8 support added to dftpd

Thomas Brushington has send me patches adding UTF-8 support to Symbian builds of dftpd. In case someone might want to use such functionality, he also provided a new build.

http://team.pld-linux.org/~wolf/dftpd-utf8.SIS

(note that I have not checked if it actually works).

Sunday, 20 December 2009

Dumb FTP Server now on N900

Dump FTP Server is now available on the N900. It uses QT 4.6, which currently is only available in extras-devel, so beware.

Download location: http://team.pld-linux.org/~wolf/dftpd_0.1.3_armel.deb. Hopefully will be in extras soon.
Source repository: http://gitorious.org/dftpd

Changelog (0.1.2):
- Workaround for Firefox handling of PASV command.
- Maemo port.
- If binding to port 21 fails (for example as a result of lack of root priviliges), the server will try to listen on port 2121.

Changelog (0.1.3):
- Passive mode should now be working. Because of the used workaround only WIFI connections are supported.
- Bigger icon in application manager.
- Upload speed should now be at par with download speed.

Tuesday, 10 November 2009

Impossible?

Friday, 12 June 2009

UAC considered harmful

I have switched from XP to Windows 7 on my work machine recently. Everything was working fine until this has happened:
A quick research revealed the following (source):

Before a 32-bit process is created, the following attributes are checked to determine whether it is an installer:

  • The file name includes keywords such as "install," "setup," or "update."
This is confirmed by changing the file name of the offending exe:
The executable of course is not an installer of any kind and does not require any extra privileges. It just reads two files and creates a third one. Furthermore, it's a third-party application and I can't just change its file name without breaking things for everyone else. There seems to be some kind of white list of trusted applications, but nobody other than Microsoft can modify it.

Without the ability to take that application out of UAC "protection" the only viable thing to do is to turn the UAC off. Great work! I feel more secure already.

Thursday, 22 January 2009

dftpd 0.1.1 available

New version of symbian FTP server has been published.

Changes:
- Empty directories are now listed correctly.
- Directory creation and removal is now implemented.

Download.

Saturday, 22 November 2008

Major sound handling improvements in S60 SDL

Audio handling in S60v3 SDL port was thoroughly broken. Well, it managed to play something, but the way it did that was just horrid.

In case of OpenTTD, the difference between the 'sdl' and 'null' audio drivers was very much visible. The game had that smooth feeling to it when no audio was playing, but was jerky with the sounds enabled. To make things worse there were cracks and pops just about all the time, which added more of that unpleasant "the phone can't handle it" feeling. Fortunately, these problems are now a thing of the past.

The taxation problem was fixed by these commits. The original author has some really weird ideas there. Introduction of multiple audio buffers increases the audio lag without any benefits. And the handling of audio buffer is just crazy. I will quote the commit message here:
Audio buffer size is there to allow a balancing act between smooth sound playback (ie. big buffer) and low latency times (ie. small buffer). The original author clearly didn't understood this concept, as the buffer size here always was 256 bytes, which resulted in playback system that had all the minuses of the two approaches but no pluses.
With one problem handled, the next one was just around the corner. The cracks and pops may not be easy to hear, but you'll for sure get a feeling that something's wrong. I even have a waveform plot with the gaps in audio data shown: The solution of that problem was to remove some never-correct delay time calculations and use a mutex-like mechanism to handle internal SDL audio wait. With that done the sound is now flawless.

There's also some new functionality added:
  • With silent profile enabled SDL will mute the audio. Mixing will still be done, for the need of games expecting audio-timer synchronization.
  • When the game is out of focus the audio will be disabled as well as mixing, to reduce energy usage.
  • In out of focus situations the video blit incurs a 0.1s delay to reduce power usage. The wait time is rather short for better responsivity when focus is regained and for some rare situations when the screen needs to be redrawn.
Thanks to the above changes the phone with OpenTTD in background now consumes just 0.13W of energy. Comparing it to total idle consumption of 0.11W and previous OpenTTD consumption of 0.5W it's a substantial improvement.

Saturday, 18 October 2008

OpenTTD battery usage


Energy usage (ie. battery life) has been brought to my attention recently. As can be seen above, OpenTTD running in background doesn't handle things nice and battery drain is much greater than it should be.

The average value for "OpenTTD running" is 1,07W, for "OpenTTD in background" it's 0,51W and for "Idle" it's 0,11W.

Other Symbian SDL ports also will have this problem. So, quick advice: don't leave OpenTTD, C2Doom, ScummVM running on the phone in background, your battery will die very quickly if you do so.

Edit: The background energy usage of my SDL's port has been reduced to 0,13W.

Thursday, 9 October 2008

The sorry state of symbian SDL

Probably noone of you care about the fact that there are four different versions of the SDL library for symbian based devices. When I was starting my S60 OpenTTD port there were only three. What has happened in between?

The first one was created by Hannu Viitala and was targetted at antique devices, had no sound support, etc... we're not that much interested in it.

The second one, maintained by Marcus Mertama, is an evolution of the previous, with support for S60 3rd edition devices (basically anything worth considering for purchase right now), sound and a lot of problems. More on that later.

The third one is, again, based on the previous one. It's used by anotherguest in his ScummVM port and focuses on wide device range support (including UIQ, touch screen, etc). Since it had the same problems as the second version, I didn't looked too deeply into it.

The fourth option is constantly fixed (or rather stripped down from features) by yours truly. There were several issues in Markus' version which really bothered me.

The first was support for S60v1 and S60v2.
  • If I'm going to modify the code, I have no way to test if the code works.
  • The platform is severely limited by screen resolution, processor speed, available RAM, lack of Open C and Open C++ or even by inability to use static variables.
  • The platform is dead.
So, drop it. Leave only S60v3.

The next big issue was resolution support. Or rather lack of it. The game resolution was always stretched to the phone's display resolution, which resulted in something that can be seen on the images below. The left one is original, the right one is scaled one. Horrible. And barely playable, thanks to ultra slow symbian blitting procedures.





My version does it right (or rather should be doing, I didn't actually checked it) by setting the right display orientation and by not stretching the display. This is one of things where my and other authors views differ. I don't accept the scaling, Marcus and anotherguest say that users prefer when game is displayed on full screen, without borders.

Another big issue, display orientation support. All S60v3 devices can either be in portrait (normal use) or landscape (think "camera") mode. On most devices the landscape mode is hidden from user during normal usage, but there are devices, like N95 or N82, which rotate the display when user physically rotates the phone. On phones that lack this feature, orientation support can be faked in software by using small drawing hacks. So consider this: phone is in portrait orientation, user runs application and sees something like that:
"Oh, display is not distorted, I can rotate the phone and play, how nice" he thinks. And most of the time he's correct. But when he has that new and shiny N95 this happens:
The phone has switched orientation to landscape, the application didn't follow. MAJOR FAIL! My SDL version correctly handles such situations:



Marcus writes on his site that his SDL allows "S60 programming without pain of Symbian!" This is completly untrue, as Marcus promotes the use of symbian-ridden CSDL class, which more or less requires some arcane knowledge. And when we're at it, just look at the documentation. There's a plethora of bells and whistles to enable or disable, only you don't have the slightest idea which option does what and some of them are there just because they can be. Take virtual mouse cursor for example. I doubt it was used anywhere (not in C2Doom for sure) and my experiences with OpenTTD, which is a mouse-driven game, has proven that it's completly unusable.

The amount of such undocumented or useless features only makes the code harder to read (oh, you don't want to look at it; 5 different coding styles in just 20 lines of code), without giving any profits, so the most sane option for me was brutal removal. So long, virtual mouse cursor, bye, various display modes, adiós console view, пока display overlays. You won't be missed. Such Reduction Of Useless Features not only makes the code easier to read, but also reduces the number of potential bugs and makes adding new (but this time usable) features less daunting task.

Of course, the library is still not finished (will it be ever?). Despite the fixes mentioned above and all the smaller ones, like fixing palette animation, making sound play smoother, there's still a lot of work to be done before I will be able to just get some random game using SDL and compile it for my phone without much ado. But even with having that said, my SDL port is The Best* symbian SDL version currently available.

* for me.