AcidWarp is an eye-candy program by Noah Spurrier. It draws patterns based on mathematical functions and then animates them via colour cycling. It originally ran in MS-DOS, and used the VGA 320x200 256 colour mode. In 2000 I was developing a library to emulate palletized 256 colour mode in the X Window System, and I modified the Linux SVGALib port of AcidWarp to use that library. Now I just had to modify it again to use SDL instead.
I was partly right about it being trivial. Using SDL for display was trivial. Adding keyboard input was very easy. However, full screen mode was a problem. Much to my surprise, SDL defaults to the windib driver, not directx (windx5). This means it uses the obsolete WinG interface to draw images instead of (the DirectDraw component of an older version of) DirectX. Windows doesn't normally allow programs to alter the whole palette, and SDL uses SetSystemPaletteUse to try to get access to the whole palette. Windows 2000 and XP can allow access to the whole palette (if the uUsage parameter is set to SYSPAL_NOSTATIC256) but other versions of Windows at least retain two entries for black and white (if uUsage is set to SYSPAL_NOSTATIC, which I think is an inappropriate name). This leads to some colours being remapped at the upper end of the palette, with multiple colours mapping to single colours. When this happens, part of the AcidWarp display is degraded, and with some patterns it's very obvious. It's easy to get around this by setting SDL_VIDEODRIVER to directx, but then Windows Vista turns off Aero when the program goes fullscreen, and Aero stays off until the program exits. The way around this problem is to totally shut down SDL with SDL_Quit and reinitialize it when switching from full screen to windowed mode. Aero is still shut down when in full screen mode, but that is not a problem. Initially I used the windib driver for full screen mode and directx for windowed mode. Soon I realized I probably only had to do the shutdown when leaving windowed mode and I could always use the directx driver, but when I made these changes I found that full screen mode sometimes becomes extremely slow (about 1 FPS animation) with high CPU usage. It seems like the version which switched between windib and directx didn't have this problem, but I'm not certain.
If you're not using Windows, you can ignore all that and try to compile the code for your operating system. The Makefile may need tweaking, but the code should be portable. All of the Windows-specific hack described above is conditional on WIN32 being defined.
Finally, here's a link to a zip file with the source and binaries. Take note of this notice which appears on Noah's page on AcidWarp: I do not accept responsibility for damage to persons or property that comes from the use or installation of this software. Use this software at your own risk. This software is free. Also, note that what I'm offering here is a new port which hasn't been tested extensively. I also think that the colour cycling patterns displayed by AcidWarp may cause seizures in individuals who are vulnerable to that sort of thing, especially if the animation is sped up, so please be careful.
[ Edit: Updated to latest version with some fixes in the Vista full screen workaround and a .reg file which should finally allow 256 colour full screen mode in Windows 7. ]
Friday, December 05, 2008
Wednesday, December 03, 2008
Bolt, RealD and circular polarization
Yesterday I watched Bolt in RealD 3D. I wasn't really expecting much from Bolt and I mainly went because I wanted to try out 3D. Many years ago I watched IMAX 3D at the Pacific Science Center in Seattle and I was quite impressed. It was exciting to see 3D technology available in ordinary cinemas. Bolt exceeded my expectations, and 3D failed to live up to them, but neither were a disappointment.
The trailers for Bolt made me imagine a movie that's amusing but shallow. I expected a storyline without much detail, and stereotypically cartoonish fun. I found a storyline with enough depth and detail so that it didn't seem at all hollow. There was certainly some stereotypically cartoonish fun, but there was far more to the movie, and it certainly seemed unique and creative.
The 3D effect was subtle but definite. With IMAX 3D, I remember things seeming to pop out far in front of the screen. With Bolt, I mostly just felt some subtle added depth information. It might have made the movie more engaging, and it might have even subconsciously made me feel better about it, but it generally wasn't amazing. On a few occasions when the 3D effect seemed underwhelming I removed the glasses to see distance between the two images, and it was surprisingly small. Some scenes were more impressive and a few felt intense. However, the intense feeling wasn't entirely pleasant, and on two such occasions I heard someone sitting nearby say it might make them sick. So, based on that, maybe high intensity needs to be avoided.
The glasses appeared new and they came sealed in their own plastic bag. I decided to keep them as a souvenir and for experimentation unless some notice told me I must return them. There was a message at the beginning to please return them for recycling, and there was a cardboard recycling bin for glasses at the exit, but nothing said that they were on loan and had to be returned. Therefore I decided to keep them.
(It's weird to say that's for recycling for environmental reasons. The environmentally sensible thing would probably be to reuse the glasses by inspecting, cleaning and disinfecting them. If they said they wanted the glasses back for reuse for environmental and/or cost-cutting reasons, I would have left my glasses behind. I wonder if they're using recycling and environmentalism as buzzwords that they expect people to be programmed to respond to.)
After coming home I already found one interesting thing about the glasses: they act differently based on the direction that light is coming from. If light comes from the front (as intended), rotating them changes most LCD screens from a blue tint to a yellow tint and back. If light comes from the back, the glasses behave more like polarized sunglasses, with the screen appearing normal when they are vertical and going almost totally black when they're horizontal, with only the dust on the screen glowing.
This led to me finally understanding circular polarizers. They consist of two components, a linear polarizer which selects for a particular linear polarization, and quarter wave plate which transforms light between linear and circular polarization. With the quarter wave plate before the polarizer, this combination selects for circularly polarized light by transforming it into linearly polarized light and then selecting for a particular linear polarization. This is what the RealD glasses do. The linear polarization of the output is irrelevant because human eyes don't see it any differently because of that. With the quarter wave plate after the polarizer, the combination selects for linearly polarized light and then circularly polarizes it. This is what camera circular polarizers do. To get the effect, one only needs to select for linearly polarized light. However, depending on orientation, linearly polarized output would reflect less from mirrors in the camera and cause problems, so the quarter-wave plate is used to transform it to circular polarization. The most serious problem would be through-the-lens (TTL) metering receiving less light, resulting in overexposed photos. Some cameras like typical non-SLR digital cameras do not have internal mirrors and they can work with linear polarizers (or even polarized sunglasses) without any problems.
The plastic pouch the glasses come in has multilingual and pictorial warnings not to use them as sunglasses. It is explained that they do not block UV light. Actually, wearing them outside would also be pointless because there is very little circular polarization in nature. For the familiar linear polarizing effect, the lenses are both backwards and sideways. So, for now I'm not sure what else I can do with these glasses, and they'll just be a souvenir. If I think of something interesting, I will probably post about it.
Finally, here's my favourite polarized photo, purely here as eye-candy:
The trailers for Bolt made me imagine a movie that's amusing but shallow. I expected a storyline without much detail, and stereotypically cartoonish fun. I found a storyline with enough depth and detail so that it didn't seem at all hollow. There was certainly some stereotypically cartoonish fun, but there was far more to the movie, and it certainly seemed unique and creative.
The 3D effect was subtle but definite. With IMAX 3D, I remember things seeming to pop out far in front of the screen. With Bolt, I mostly just felt some subtle added depth information. It might have made the movie more engaging, and it might have even subconsciously made me feel better about it, but it generally wasn't amazing. On a few occasions when the 3D effect seemed underwhelming I removed the glasses to see distance between the two images, and it was surprisingly small. Some scenes were more impressive and a few felt intense. However, the intense feeling wasn't entirely pleasant, and on two such occasions I heard someone sitting nearby say it might make them sick. So, based on that, maybe high intensity needs to be avoided.
The glasses appeared new and they came sealed in their own plastic bag. I decided to keep them as a souvenir and for experimentation unless some notice told me I must return them. There was a message at the beginning to please return them for recycling, and there was a cardboard recycling bin for glasses at the exit, but nothing said that they were on loan and had to be returned. Therefore I decided to keep them.
(It's weird to say that's for recycling for environmental reasons. The environmentally sensible thing would probably be to reuse the glasses by inspecting, cleaning and disinfecting them. If they said they wanted the glasses back for reuse for environmental and/or cost-cutting reasons, I would have left my glasses behind. I wonder if they're using recycling and environmentalism as buzzwords that they expect people to be programmed to respond to.)
After coming home I already found one interesting thing about the glasses: they act differently based on the direction that light is coming from. If light comes from the front (as intended), rotating them changes most LCD screens from a blue tint to a yellow tint and back. If light comes from the back, the glasses behave more like polarized sunglasses, with the screen appearing normal when they are vertical and going almost totally black when they're horizontal, with only the dust on the screen glowing.
This led to me finally understanding circular polarizers. They consist of two components, a linear polarizer which selects for a particular linear polarization, and quarter wave plate which transforms light between linear and circular polarization. With the quarter wave plate before the polarizer, this combination selects for circularly polarized light by transforming it into linearly polarized light and then selecting for a particular linear polarization. This is what the RealD glasses do. The linear polarization of the output is irrelevant because human eyes don't see it any differently because of that. With the quarter wave plate after the polarizer, the combination selects for linearly polarized light and then circularly polarizes it. This is what camera circular polarizers do. To get the effect, one only needs to select for linearly polarized light. However, depending on orientation, linearly polarized output would reflect less from mirrors in the camera and cause problems, so the quarter-wave plate is used to transform it to circular polarization. The most serious problem would be through-the-lens (TTL) metering receiving less light, resulting in overexposed photos. Some cameras like typical non-SLR digital cameras do not have internal mirrors and they can work with linear polarizers (or even polarized sunglasses) without any problems.
The plastic pouch the glasses come in has multilingual and pictorial warnings not to use them as sunglasses. It is explained that they do not block UV light. Actually, wearing them outside would also be pointless because there is very little circular polarization in nature. For the familiar linear polarizing effect, the lenses are both backwards and sideways. So, for now I'm not sure what else I can do with these glasses, and they'll just be a souvenir. If I think of something interesting, I will probably post about it.
Finally, here's my favourite polarized photo, purely here as eye-candy:
Thursday, November 27, 2008
I need a place to host arbitrary files.
There are plenty of places where one can host photos for free. I have an account at Picasa Web Albums which Blogger uses by default. However, what about hosting arbitrary files? I'm aware of sites like RapidShare, but they annoy the downloader with captchas, waits and annoying ads. They seem to mainly be used for piracy (eg. search Google for rapidshare), probably because that's the only use where such a level of annoyance is accepted. I want a place for legal content, so there must be a better alternative. I asked Reddit about this and got a few suggestions.
Warped suggested file dropper. It seemed familiar and I wondered if it was the site which had a promotion a while ago, giving out free premium accounts. I was right, I was able to log in and I was told "Storage: 0Mb / 250Gb Paid Until: Jan 18th, 2038". I was impressed that the site is still up and responsive. However, they also say "The files are kept forever as long as they are being downloaded.", which means that I have no idea how long files would stay up. Other sites at least give some specific number of days since last download.
Picklegnome suggested drop.io. It's a site I didn't know about. What I see there seems impressive. Drops can be set to remain for up to a year since last view, and the demo video shows an amazing array of features. So I created my drop at http://drop.io/dreamlayers. There's nothing there now, but I expect to start using it soon, relating to some upcoming posts.
Warped suggested file dropper. It seemed familiar and I wondered if it was the site which had a promotion a while ago, giving out free premium accounts. I was right, I was able to log in and I was told "Storage: 0Mb / 250Gb Paid Until: Jan 18th, 2038". I was impressed that the site is still up and responsive. However, they also say "The files are kept forever as long as they are being downloaded.", which means that I have no idea how long files would stay up. Other sites at least give some specific number of days since last download.
Picklegnome suggested drop.io. It's a site I didn't know about. What I see there seems impressive. Drops can be set to remain for up to a year since last view, and the demo video shows an amazing array of features. So I created my drop at http://drop.io/dreamlayers. There's nothing there now, but I expect to start using it soon, relating to some upcoming posts.
Friday, November 21, 2008
Looking back on how I stopped scrobbling to last.fm
Occasionally when listening to music I remember it's not scrobbled to last.fm anymore, and for a moment I feel as if that's a bad thing. Then I remember wasn't useful. I also remember how memorable times involving music are memories in my mind, not lists of songs on a web site.
It might be cool if last.fm supported journal entries linked to a particular range time and playlist of tracks listened then. I'm not sure if that would be useful because I'm not sure if I could put those experiences into words in an appropriate way, and I'm not sure if they'd be useful later. However, I'd be interested in trying.
It might be cool if last.fm supported journal entries linked to a particular range time and playlist of tracks listened then. I'm not sure if that would be useful because I'm not sure if I could put those experiences into words in an appropriate way, and I'm not sure if they'd be useful later. However, I'd be interested in trying.
Copying Vista firewall rules
The Windows Firewall with Advanced Security in Vista has a way to export a list of rules, but it has no way to import rules. The only import I could see was for policies, and that to a warning that the current policy will be overwritten. So I searched through the registry for a rule name using regedit and I found
I exported that to a .reg file. I used
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules. All the rules are there, in human readable format. I exported that to a .reg file. I used
find "Dir=Out" to extract the outgoing rules I wanted and then I edited it in a text editor to remove some more rules and the registry file header. (Grep didn't work initially because the file was UTF-16. Find converted it to an 8 bit encoding but that was okay.) After importing the .reg file on another computer, the rules appeared in the console, but they were not in effect, and attempts to disable or enable them caused errors. I thought the firewall hadn't loaded the rules, so I rebooted. Finally everything worked properly.
Friday, November 07, 2008
Olympus C-770 Super Zoom button circuit board replacement
Earlier I posted about how my camera broke and Olympus refused to help me get the part I needed. Fortunately Black's Photo referred me to another local photo store, which referred me to Nortown Photo, who were helpful and willing to order the part and ship it to me.
Here's the new part, VG052500:


Here is the old one, still glued to a metal plate which also supports the big LCD:

Here are the slide switch contacts. The problem is the connection to the left bottom contact, which is cut at the horizontal line caused by wear from switch sliding. Note that the new part came with the whole slide switch already installed on the board.

The old circuit board had to be removed from the metal plate. It came off like tape. The glue held quite well but it wasn't too hard. Most of the glue stayed on the circuit board, but some remained on the metal plate.

The new circuit board did not come with any glue on the back, and the glue remaining on the metal was insufficient and insufficiently sticky. I cleaned the metal plate with isopropyl alcohol and my nails. Then I used some contact cement to glue the new circuit board, making sure it was properly aligned.

Here's the inside of the camera's back with the buttons (separate plastic pieces) in their positions:

Now it was time to attach the metal plate with the button circuit board and large LCD using four flat head screws:

After that, there is a black plastic film which covers the metal part. It was still sufficiently sticky so no additional glue was needed. The rubber backing for the slide switch and copper foil for grounding the top metal plate (backing for top three buttons) were already attached to the plastic. After sticking on the plastic, I attached the top metal plate with two flat screws. Here is the result:

Since it was almost time to attach the back, I took some photos of the camera with the back removed. In the second photo, note the small indentation in the back border of the battery and card compartment. The switch which detects if the compartment is open is there.


Now it was time to connect the three cables. There's the LCD data cable, a two conductor cable which I assume is the LCD backlight, and the button circuit board. The LCD data cable connector has a latch, so I thought it would be easy, but it was the hardest one. Here is the result:

After this I was able to test the camera a bit. Now it was time to figure out what to do with the remaining screws:

The exploded parts diagram was quite helpful and it was all pretty straightforward. I only took photos of the hot shoe because that was tricky to disassemble. There are no screws visible there, but actually the shiny metal is a springy clip which can be pried out to reveal four screws which hold the thick metal hot shoe channel. Below that is one screw which holds the back.


Finally, here is a photo taken using the repaired C-770. At the top you can see the underside of the slide switch and the edges which rub against the circuit board. Below that you can see the old circuit board.
Here's the new part, VG052500:


Here is the old one, still glued to a metal plate which also supports the big LCD:

Here are the slide switch contacts. The problem is the connection to the left bottom contact, which is cut at the horizontal line caused by wear from switch sliding. Note that the new part came with the whole slide switch already installed on the board.

The old circuit board had to be removed from the metal plate. It came off like tape. The glue held quite well but it wasn't too hard. Most of the glue stayed on the circuit board, but some remained on the metal plate.

The new circuit board did not come with any glue on the back, and the glue remaining on the metal was insufficient and insufficiently sticky. I cleaned the metal plate with isopropyl alcohol and my nails. Then I used some contact cement to glue the new circuit board, making sure it was properly aligned.

Here's the inside of the camera's back with the buttons (separate plastic pieces) in their positions:

Now it was time to attach the metal plate with the button circuit board and large LCD using four flat head screws:

After that, there is a black plastic film which covers the metal part. It was still sufficiently sticky so no additional glue was needed. The rubber backing for the slide switch and copper foil for grounding the top metal plate (backing for top three buttons) were already attached to the plastic. After sticking on the plastic, I attached the top metal plate with two flat screws. Here is the result:

Since it was almost time to attach the back, I took some photos of the camera with the back removed. In the second photo, note the small indentation in the back border of the battery and card compartment. The switch which detects if the compartment is open is there.


Now it was time to connect the three cables. There's the LCD data cable, a two conductor cable which I assume is the LCD backlight, and the button circuit board. The LCD data cable connector has a latch, so I thought it would be easy, but it was the hardest one. Here is the result:

After this I was able to test the camera a bit. Now it was time to figure out what to do with the remaining screws:

The exploded parts diagram was quite helpful and it was all pretty straightforward. I only took photos of the hot shoe because that was tricky to disassemble. There are no screws visible there, but actually the shiny metal is a springy clip which can be pried out to reveal four screws which hold the thick metal hot shoe channel. Below that is one screw which holds the back.


Finally, here is a photo taken using the repaired C-770. At the top you can see the underside of the slide switch and the edges which rub against the circuit board. Below that you can see the old circuit board.
Sunday, November 02, 2008
APC BackUPS ES BE500U-CN pinout
I already found the USB pinout for the RJ45-10 connector on my APC BackUPS ES BE500U-CN UPS, and I constructed a temporary adaptor which works. APC's list of cables implies only USB is supported, but before making the permanent cable, I wanted to see what else is accessible via that connector and maybe find a way to do remote on/off.
Dumb (voltage level) signalling is present. When unplugged, pin 2 goes to just over 12 volts, and applying 12 volts to pin 8 for over a second causes the UPS to shut off with a single short beep one minute later. I didn't test the low battery signal which is supposed to be on pin 3.
Smart (serial communication) signalling doesn't seem to be present. Sending Y at 2400 baud 8,n,1 does not do anything. This agrees with what I've read online about it not working.
I wonder what pins 5 and 6 are for. None of these signalling methods use them and there is no voltage or resistance to ground at them. Maybe they're not used.
Dumb (voltage level) signalling is present. When unplugged, pin 2 goes to just over 12 volts, and applying 12 volts to pin 8 for over a second causes the UPS to shut off with a single short beep one minute later. I didn't test the low battery signal which is supposed to be on pin 3.
Smart (serial communication) signalling doesn't seem to be present. Sending Y at 2400 baud 8,n,1 does not do anything. This agrees with what I've read online about it not working.
I wonder what pins 5 and 6 are for. None of these signalling methods use them and there is no voltage or resistance to ground at them. Maybe they're not used.
My first impression of Vista Media Centre
I normally don't use Windows Media Center in Vista, and I had almost forgotten of its existence. I recently tried it out, both from my computer and via a TV and remote.
At first, whenever I tried to view photos I'd get the spinning circle and have to wait a long time. After trying various things, I found this was due to a turned off network scanner. This problem made no sense; why would Media Center access the scanner when I try to access a folder of photos on my hard drive? After I disabled that imaging device in device manager, the delays were gone.
The next annoying and stupid thing I noticed was file browsing. Videos and photos need to be browsed separately and music must be accessed via a database. What a terrible way to dumb down a computer!
When browsing my photos subdirectory for videos, I found that videos in .MP4 and .MOV containers aren't recognized. Both can play properly in Windows Media Player and .MP4 videos play while browsing photos in Windows Photo Gallery. It's as if they forgot about cameras which record videos in those formats! I was pleasantly surprised by one thing however: .MKV videos played.
Overall the interface was acceptable for selecting and playing supported videos. It certainly wasn't efficient even then however. For example, folders I added were put at the end of the list of folders, and they were added to both photos and videos.
Note that I didn't mention a tuner card. That's because I don't have a supported tuner card. For whatever stupid reason, Media Center has stringent requirements and video in devices supported by Vista aren't automatically supported by Media Center.
I guess Windows Media Centre is okay for occasionally using Vista via a TV. However, I can't imagine dedicating a computer to it.
At first, whenever I tried to view photos I'd get the spinning circle and have to wait a long time. After trying various things, I found this was due to a turned off network scanner. This problem made no sense; why would Media Center access the scanner when I try to access a folder of photos on my hard drive? After I disabled that imaging device in device manager, the delays were gone.
The next annoying and stupid thing I noticed was file browsing. Videos and photos need to be browsed separately and music must be accessed via a database. What a terrible way to dumb down a computer!
When browsing my photos subdirectory for videos, I found that videos in .MP4 and .MOV containers aren't recognized. Both can play properly in Windows Media Player and .MP4 videos play while browsing photos in Windows Photo Gallery. It's as if they forgot about cameras which record videos in those formats! I was pleasantly surprised by one thing however: .MKV videos played.
Overall the interface was acceptable for selecting and playing supported videos. It certainly wasn't efficient even then however. For example, folders I added were put at the end of the list of folders, and they were added to both photos and videos.
Note that I didn't mention a tuner card. That's because I don't have a supported tuner card. For whatever stupid reason, Media Center has stringent requirements and video in devices supported by Vista aren't automatically supported by Media Center.
I guess Windows Media Centre is okay for occasionally using Vista via a TV. However, I can't imagine dedicating a computer to it.
Subscribe to:
Posts (Atom)