Fix to make 32 bit AVI files readable for AVI_Reader.java plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fix to make 32 bit AVI files readable for AVI_Reader.java plugin

Yasunari Tosa
Hi,

We just got a 32 bit AVI file, which AVI_Reader plugin refused to
load,saying that it is not 8 bit nor 24 bit.
This may have been fixed, but my AVI_Reader.java plugin did this.

Here is a quick fix for AVI_Reader.java plugin.

1.  In void readStrf()

from
    ...
    if (BMPbitsPerPixel != 8 && BMPbitsPerPixel != 24) {
      throw new Exception("Unsupported bits-per-pixel value (8 or 24
bits required)");
    }
to
    if (BMPbitsPerPixel != 8 && BMPbitsPerPixel != 24 && BMPbitsPerPixel
!= 32)  {
      throw new Exception("Unsupported bits-per-pixel value (8 or 24
bits required)");
    }

2.  In  void unpack(byte[] rawData, int rawOffset, int[] intData, int
intOffset, int w)

from
      ...
      int  b2  = (((int) (rawData[k++])) & mask) << 16;
      intData[j] = 0xff000000 | b0 | b1 | b2;
      ...
to
      int  b2  = (((int) (rawData[k++])) & mask) << 16;
      if (BMPbitsPerPixel==32)
         k++; // just inclement to ignore 4th byte (alpha value)
      intData[j] = 0xff000000 | b0 | b1 | b2;

Recompile the plugin.

--
Yasunari Tosa, Ph.D.

Senior Scientist
Retica Systems Inc.           Phone: 781-547-0405
201 Jones Road                Fax  : 781-894-0008
Waltham, MA 02454             Email: [hidden email]
USA