Friday, November 27, 2009

How to flash your BIOS from a CD with free software

  • First, get your BIOS from your motherboard manufacturer.
  • Extract the files to a place you can remember.
  • Install CDBurnerXP.
  • Grab the FreeDOS "Balder" image.
  • Fire up CDBurnerXP.
  • Create a new data disc.
  • Drag the BIOS and flasher to the disc.
  • Go to "Disk," "Boot options."
  • Enable "Make disc bootable" and point the image to the FreeDOS "Balder" image.
  • Burn the CD.
  • You now have a CD you can use to flash your BIOS, all with free software.

Thursday, September 17, 2009

How to manually draw to an OpenGL ES texture

// Create steam texture. It's just a transparent circle
texture = 0;
GLubyte *textureData = malloc(sizeof(GLubyte) * 4 * (radius * 2) * (radius * 2));
memset(textureData, 0, sizeof(GLubyte) * 4 * (radius * 2) * (radius * 2));
unsigned int index = 0;
for (int y = 0; y <>
for (int x = 0; x <>
float d = sqrt((x - radius) * (x - radius) + (y - radius) * (y - radius));
if (d <= radius) {
GLubyte alpha = 255 * (int)(radius - d) / radius;
textureData[index++] = 250;
textureData[index++] = 250;
textureData[index++] = 255;
textureData[index++] = alpha;
} else {
index += 4;

// allocate a texture name
glGenTextures(1, &texture);
// select our current texture
glBindTexture(GL_TEXTURE_2D, texture);
// build our texture mipmaps
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, radius * 2, radius * 2,
0, GL_RGBA, GL_UNSIGNED_BYTE, textureData);
// free buffer

Sunday, July 5, 2009

TV color calibration

Recently, I had a TV I needed to calibrate the color on. I found a great guide, but it called for a Digital Video Essentials calibration DVD for just a few gray frames that were hidden--and some missing--on the DVD. If you have a DVD player or TV that can show jpegs from either flash or a CD/DVD, this might be easier than using a feature-laden DVD.

With the first image (PLUGE), the idea is to be able to see the lightest dark square (IRE 4), but not the darkest square.

The following set of images is used to measure red, green, and blue levels of grays and varrying intensities and to try to get them as close to the same as possible. You need some sort of color meter (the X-Rite Eye-One and Datacolor Spyder are covered in the guide) and software like ColorHCFR to measure the output. Again, see the guide for more details. I'm just providing IRE and PLUGE files hoping to save people time and money. Like the DVE DVD, the IRE corresponds to the k values (as in CMYK) of the color, not linear RGB values.

Tuesday, May 12, 2009

Generational loss

When working on a large project, it often gets compressed multiple times. Typically--and especially for non-commercial use--the quality loss between 3 generations is irrelevant, but it got me thinking: what happens after more generations? Can a common lossy compression algorithms detect that they already compressed the data and can recompress without additional loss? Short answer: no.


Procedure: I used this script (LAME, 192kbps) to recompress a 30 second clip of "Hey Jealousy" performed by Hit the Lights, originally by Gin Blossoms.

1st generation
10th generation
25th generation
50th generation
100th generation
200th generation
400th generation

Within 10 generations, high frequencies are distorted, making it sound like an over-compressed clip from a camera phone.

By the 25th generation, the distortions are more severe, and the volume is decreasing.

At the 100th generation, random blippy distortions overpower the significantly quieter music.

By the 400th generation, the clip is practically silent.


For JPEG, I threw a wrench into the mix. I've tried recompressing an image with identical settings, but the results weren't identical, so I decided to do something that abuses the compression scheme. JPEG uses 16x16 pixel blocks. At each generation, I shifted the image 8 pixels so blocks would never consist of the same data as in the parent generation. As a side effect, the black region that was revealed during the offset was introduced into the image.

Initially, it looks like noise is introduced and colors bleed and become harsher. Eventually, colors bleed so much that there are just a few, and finally, saturation is lost and the picture looks like a a two-bit dithered image.

the image continues to lose detail at a slow rate, favoring white.

JPEG is far more robust than mp3. Distortions not near the edges are minor for at least 50 generations, and images from 200 generations to 800 have an artistically-interesting grain.  JPEG, however, also had the luxury of increasing the file size, and it did; by the 10,000th generation, the image was roughly twice the size of the original.

Original image provided by kwerfeldein under the Creative Commons Attribution license.

Video showing the generational loss

Images are at generations 0, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192

Bonus: image resizing

For this test, I used Photoshop's highest quality bicubic resize for reductions. The left side was resized 13 times (5% each time), and the right side was reduced just once. Note the clarity of the branches in each and the detail in the foreground field. Not surprisingly, the consequence of too many resizes is a blurrier image.