Tuesday 22 October 2013

Thinking meat! You're asking me to believe in thinking meat!

Blogspot keeps failing to format the text properly (on windows, mac and linux :-D)
I decided to fiddle with my fire-effect code (at the end of this blog entry) again, simplify it a bit and have it compile on MacOS.


Typically I've been against macs, but I'm rather enjoying this one (MacBook Air 11") so far, they've come a long way. The keyboard takes some getting used to, but I find the laptop rather elegant in many ways. I especially like the battery lifetime which seems to be around 8 hours if I don't do too much heavy lifting on it. It can play 1080p videos smoothly, doesn't need a fan and  can even do some 3D, and is small. Wakes up instantly and boots in 10 seconds or so. Even built in audio is decent for such a small package. The software is fast and responsive, the screen image quality nice, though I suppose FullHD would have been nice, but this is still quite sufficient for a laptop such as this.
I use tinycc on windows because it's just so small, elegant and simple, and handles libraries to my liking...

http://bellard.org/tcc/

tcc winfire.c -lSDL -lopengl32

on mac I compile with gcc (I'm sure there's a better way, like Xcode, but I couldn't be bothered, I like to KeepItSimpleStupid):

gcc macfire.c -I/System/Library/Frameworks/OpenGL.framework/Headers -lSDL -lSDLmain -framework AppKit -framework Foundation -framework CoreFoundation -framework OpenGL


Yellow rose of texas (4k intro) seems to run fine on my MacBook Air 11" as well. A working binary wasn't available, but it's easy enough to compile your own.
I tried http://upx.sourceforge.net/ and http://www.crinkler.net/ but didn't seem to be able to compress it much, these are very small executables to begin with, but it seems tcc does something which these programs can't handle well. I suppose I should just write asm from the beginning, but it's just so bothersome. Maybe if I had plenty of time to fiddle. There's so much I'd like to do, like FTDT-simulator (http://en.wikipedia.org/wiki/Finite-difference_time-domain_method), but just can't be bothered right now. Perhaps Aristotle was right, and all paid jobs absorb and degrade the mind. Perhaps I should simply do something mundane for a living and save all the really interesting jobs for my hobby.

In another news, I was playing with simplicity...

http://alpinelinux.org/
(Later addition: http://tinycorelinux.net/)

I wish I could just get an operating system and hardware where I understand every single line of code it runs and there is almost zero redundancy. Like stripped down linux kernel (possibly on raspberry pi), running uClibc, tinycc, busybox, vim etc. without any autodetection and such. In fact I'm not sure even X-windows is needed. Just run everything from console and draw the graphics (like browser) on framebuffer in separate ALT+Fn:s (desktops or consoles or fullscreen windows or whatever you wish to call them) + hardware accelerated OpenGL of course. I really like the idea of a SoC (http://en.wikipedia.org/wiki/System_on_a_chip). If only the universe was full of stations (floating in space) which would provide all the bare essentials for the explorers and their space ships, food, gas and guns, and in practice all standard supplies, medicare and parts. :-D

...and why do we even needs wallets, cards, money, passports etc. these days. Should all this stuff be just software on our cellphones, laptops (or perhaps pads, which I don't believe in really).

There is some elegance in Linux as well, in fact quite a lot. All three Windows (7), Linux and MacOS have come a long way I have to say. They are finally getting mature. Though X on Linux is still insanely slow and there is annoying hardware and software incompatibility and immaturity issues in Linux still, but for homebrew, flexibility, control and servers it just rules. Linux kernel is rather nice already I should say, but X and some of the software it runs really needs some work. It still often can't manage even the simplest things like proper vsync  on videos which results in tearing.



I think I'll dump powerpoint for making presentation as well, LaTeX beamer seem to be nice enough and free for that stuff, I'll end up with cleaner outcome with it anyway, and I use LaTeX to write papers anyway so why bother with anything else. There are pretty much only a few commercial programs I really keep using, mainly Matlab and PhotoShop, both are more or less provided to me by the university. They can be replaced by octave and gimp, but neither are really as mature or pleasant to use as these. Additionally there is APLAC which I use for circuit simulation, there is Qucs, but it's again not quite as pleasant and can't do all the stuff APLAC can, perhaps with ngspice one could, but it's annoying and lacks a Josephson junction. If I really had to, I would just switch to Linux entirely. I still try to keep everything compatible even if I'm still waiting for better days. Mac is elegant and windows is diverse, but they are closed and commercial so they will eventually have to go. Then there is of course still minix, I haven't taken a look at that, but it might be a good place to start if I start writing my own kernel again one day. From windows alone I would miss this:

http://en.wikipedia.org/wiki/SmoothVideo_Project

Good to see that every once in a while some good ideas take a step forwards...

http://www.anandtech.com/show/7436/nvidias-gsync-attempting-to-revolutionize-gaming-via-smoothness

Was playing some GTA V today.
24 fps just isn't good enough for movies these days anymore, the pans are jerky. The new 48 fps is much better, though the movie makers needs to adjust to it a little bit to make it look natural. 60 fps would be better, perhaps sufficient for all material. And 4K, such a nice resolution, I can't wait to get some material, nature documentaries, but then again, why bother buying 4K when there's 8K coming soon, perhaps that is finally enough for resolution. When I get dead silent (without fan) 8K projector with 60 fps capacity and 1000000:1 static ANSI contrast, not some crappy dynamic bullshit values like everything today which are actually more like 300:1 static ANSI, maybe with OLED, then perhaps I'm finally happy with my home theater. 3D? No way, hurts my head, feels unnatural. Maybe when they make the holodeck (http://en.wikipedia.org/wiki/Holodeck). 3D isn't needed anyway, there's enough to be experienced in other ways. Not to mention someone investing in a decent plot instead of graphics and number crunching.

Though my audio system would require some improvements as well, it's pretty nice already, perhaps in some ways the biggest part of my system, but I'd prefer to go real loud real low. Now I can push maybe 130 dB(C) indoors respectably maybe at 30 Hz without distortion (4x15"), but what I would really like is to hit 140dB(C) outdoors to 10 meters or something at 20 Hz, well maybe for a concert at 35-40Hz would actually be sufficient. Perhaps impossible for my budget. Not the biggest problem though, bigger issue is that there are standing waves, frequency dependent constructive and destructive interference within the room. The whole room should be designed from the beginning to act as a horn or something to make decent acoustics and get rid of all this...

http://www.royaldevice.com/custom.htm

...like this perhaps.

Why is it that nobody present the real specs for any of this equipment these days, none of the good stuff. It's almost impossible to find the ANSI contrast figures, black levels etc. for any TV or projector and finding the frequency response, harmonic distortion vs. SPL vs. frequency for speakers is equally nonexistent. This is easy stuff to measure and very important when making decisions about the quality of your stuff, but none of this just seems to be available basically anywhere - ever.

Oh well, something for the better days maybe.
--

All life occurs between order and chaos. No life can exist at the two extremes. Perhaps the best place to be is right in the middle of everything, a true neutral if you will.


Physically all information processing appears to occur through nonlinear processes which couple different modes together. Often through switches or amplifiers or something similar. One signal controls another, one way or another. All nontrivial evolution is non-adiabatic and entropy changes occur.
Yes, this photo is from my balcony as well.
If it is true that Pi has all possible finite sequences, and the universe is finite, then the entire universe is somewhere described in the digits of Pi. Talk about your compression algorithms.
...but is the zip-code any shorter than the universe it is pointing to?-)
(It is not known for sure that Pi has all possible finite sequences, it is believed to be that case however.)
--
#include <SDL/SDL.h> #include <stdio.h> #include <GL/gl.h> // <OpenGL/gl.h> on macos main() { SDL_Event event; SDL_Surface *surface; unsigned int texture; int x, y, i, j; unsigned char stage1[140*100], stage2[256*200], stage3[256*256*4]; SDL_Init(SDL_INIT_VIDEO); surface = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL|SDL_GL_DOUBLEBUFFER|SDL_HWSURFACE); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glEnable(GL_TEXTURE_2D); while(event.type!=SDL_QUIT) { SDL_PollEvent(&event);  for(x=1; x<140; x++)  stage1[140*99+x] = 255-rand()%100; for(y=48; y<100; y++) for(x=0; x<140; x++) { i = stage1[y*140+x]; j = x+(y-1)*140; if(i<16)  stage1[j] = 0;          else  stage1[j+rand()%2] = i-rand()%12;        } for(y=48; y<100; y++) for(x=0; x<140; x++) stage2[2*x+2*y*256] = stage1[x+y*140];  for(y=96; y<199; y++) for(x=1; x<255; x++) stage2[x+y*256] = (stage2[(x-1)+y*256]+stage2[x+(y-1)*256]+stage2[(x+1)+y*256]+stage2[x+(y+1)*256])>>2; for(y=0; y<97; y++) for(x=0; x<256; x++) stage3[4*x+4*y*256] = stage2[x+(y+103)*256]; glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, 4, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, stage3); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(-1.07, 1.07); glTexCoord2f(1, 0); glVertex2f(1.07, 1.07); glTexCoord2f(1, 1); glVertex2f(1.07, -4.5); glTexCoord2f(0, 1); glVertex2f(-1.07, -4.5); glEnd(); SDL_Delay(20); SDL_GL_SwapBuffers(); } SDL_Quit(); }

No comments:

Post a Comment