[Mono-winforms-list] Weird issues reading pixels of jpg file on osx

Sebastien Pouliot sebastien at ximian.com
Thu Aug 31 08:25:26 EDT 2006


Hello Dan,

It may be unrelated to endian issues (but I still like your answers,
multiple problems are common ;-) as I also found out differences between
Mono on Linux i386 and Windows. 

It seems, in my test case, that the first two lines of the decoded jpeg
aren't correct. In the first line all 2nd and 4th bytes are identical,
while on the second line all 3rd and 4th bytes are identical (on the
mono side, the 4th byte being correct). All other lines looks correct
(but needs more investigation).

I'm re-enabling the JpegCodec unit tests (not sure why they were
commented, the ChangeLog says "fixed") and adding new test cases.

Thanks for noticing this.

On Wed, 2006-08-30 at 20:08 -0400, Sebastien Pouliot wrote:
> Hello Dan,
> 
> Did the same code worked on a previous version of Mono ? (if so which
> version ?) or are you testing this for the first time ?
> 
> Because I recently fixed many endian issues affecting Mac OS X (and
> other architectures). It is possible that one of them has broken
> something else :-(
> 
> I'll try to build a similar test case using one of the embedded bitmap
> files we have in the unit tests and see how to bots reacts to it.
> 
> On Wed, 2006-08-30 at 15:56 -0700, Dan Shryock wrote:
> > When attempting to read the pixel bytes of a jpg on osx (using the
> > 1.1.17 build just released) I am getting different results on windows
> > versus osx.  Does anybody have any ideas why I am getting these
> > different results?  Any information is very appreciated.
> > 
> > Dan
> > 
> > 
> > The code being used is as follows:
> > 
> > Bitmap bmp = new Bitmap("file.jpg");
> > BitmapData bmpdata = bmp.LockBits(new Rectangle(0,0,bmp.Width,
> > bmp.Height),ImageLockMode.ReadOnly,PixelFormat.Format24bppRgb);
> > 
> > unsafe{
> > 	byte* scandata = (byte*) bmpdata.Scan0;
> > 	for(int i=0; i<30; i++){
> > 		Console.WriteLine(scandata[i]);
> > 	}
> > }
> > 
> > 
> > and the results using mono on windows are:
> > 187
> > 144
> > 77
> > 187
> > 144
> > 77
> > 186
> > 144
> > 75
> > 188
> > 143
> > 75
> > 188
> > 144
> > 73
> > 189
> > 145
> > 74
> > 192
> > 147
> > 74
> > 192
> > 147
> > 74
> > 192
> > 150
> > 75
> > 191
> > 149
> > 74
> > 
> > while the results on osx are:
> > 255
> > 255
> > 255
> > 255
> > 255
> > 77
> > 255
> > 255
> > 255
> > 255
> > 77
> > 255
> > 255
> > 255
> > 144
> > 75
> > 255
> > 143
> > 75
> > 255
> > 255
> > 73
> > 255
> > 188
> > 255
> > 255
> > 188
> > 144
> > 255
> > 189
> > _______________________________________________
> > Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-winforms-list
-- 
Sebastien Pouliot  <sebastien at ximian.com>
Blog: http://pages.infinit.net/ctech/



More information about the Mono-winforms-list mailing list