Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binary standards for images and sounds



None which are easily implemented on a wide variety of architectures  
have been suggested yet, so please let me do so here.  These are just  
quick suggestions, so please do criticize (as if I had to ask) if you  
disapprove of them.

IMAGES
======
I believe the following format is fairly close to being as compact as  
it gets with small images.  Furthermore it should be easy to parse on  
virtually any architecture.  Finally, it is fair as I don't think _any_  
system uses it as its native format.

Byte  Meaning
 00   Unsigned char for the number of pixels in X direction
 01   Unsigned char for the number of pixels in Y direction
 02   Unsigned char indicating the number of components the image has
        01 = greyscale image with complete covering
	02 = greyscale image with alpha channel
	03 = color image with complete covering
	04 = color image with alpha channel
	00 or 05... error
 03..
 03+number of components
      Number of bit planes for the components (if they exist) in order:
        B/W, R, G, B, Alpha
 03+number of components+1 ..
 03+number of components+1+((tot number of bitplanes*xsize*ysize+7)/8)
      An array of bits which indicates the values for the above
      components (in the above order) in the pixel order 

      (x,y) = (0,0),(1,0)..(xsize-1,0),(0,1),...,...(xsize-1,ysize-1)

SOUND
=====
Would there be much of an outcry if we just chose a headerless stream  
of signed 8-bit mono samples to be played at 8 kHz ?  Virtually all  
sound hardware can play this easily and you can't get much simpler.  Or  
will the people with 44.1 kHz 16 bit stereo hardware feel cheated and  
demand multiple sound qualities ? :-)

	Carl Edman