New Picture Datatypes

miker1264 · 22852

miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #180 on: November 20, 2021, 12:34:21 AM
Well now. I seem to have fixed a long standing problem with saving JPEG in 68k.

I was a little perplexed by the new JPEG saving a JPEG file with 0 bytes! Why was it doing that?
So I compiled JPEG sources all the way back to 05-12-19. But each time on 68k it failed to save.
 
So then I enabled debug and put lots of debug messages in to test all the values. But they looked ok.
So what would cause an empty file on 68k but on x86 and x86_64 the Save JPEG works just fine?

While examining the code I found something suspicious. So I compared to Load_JPEG to confirm.
Sure enough there was an error in the code all this time. Filehandles are slightly different in 68k.
I believe we had that discussion with Nick and Michal Schultz when I was working with ABIv1.

    D(bug("jpeg.datatype/SaveJPEG(): Create compressor\n"));
    jpeg_create_compress(&cinfo);
    //jpeg_stdio_dest(&cinfo, (FILE *)filehandle);
    jpeg_stdio_dest(&cinfo, BADDR(filehandle));
    //Write to filehandle. jpeg_stdio_src(&cinfo, BADDR(filehandle.bptr));
    dest = (my_dest_ptr) cinfo.dest;
    dest->pub.empty_output_buffer = my_empty_output_buffer;
    dest->pub.term_destination = my_term_destination;

On the line immediately after:  jpeg_create_compress(&cinfo);
notice that it says  (FILE *)filehandle but in 68k you can't cast a BPTR into a FILE.
As you see in the Load_JPEG it instead used BADDR(filehandle) where filehandle is a BPTR.

So I made one change to the code and now the 68k JPEG datatype can now save 8bit & 24bit.
 jpeg_stdio_dest(&cinfo, BADDR(filehandle));

In order to convert BPTR filehandle to FILE we must use BADDR not (FILE*).

So now it works correctly. This only took about 5 hours of troubleshooting to find a small thing!  8)
« Last Edit: November 20, 2021, 12:47:21 AM by miker1264 »



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #181 on: November 20, 2021, 12:44:12 AM
Here is the working 68k JPEG datatype. Let me know if it works for you.




OlafS3

  • Legendary Member
  • *****
    • Posts: 544
    • Karma: +50/-8
Reply #182 on: November 20, 2021, 04:53:19 AM
Hi

thanks Miker

just updated all  :)

How can I test it if saving jpg works? With dtconvert?



AMIGASYSTEM

  • Global Moderator
  • Legendary Member
  • *****
    • Posts: 3740
    • Karma: +69/-2
  • AROS One
    • AROS One
Reply #183 on: November 20, 2021, 05:15:09 AM
Hi
How can I test it if saving jpg works? With dtconvert?

Just open a JPG Image with Multiview and then do a "Save AS", this will save the image in the same JPG format

If you do Save IFF instead, then the file will be saved in IFF (this worked even before the fix).

DTConv on AROS 68k crashes the system, I don't know if this also happens with your Aros Vision


AMIGASYSTEM

  • Global Moderator
  • Legendary Member
  • *****
    • Posts: 3740
    • Karma: +69/-2
  • AROS One
    • AROS One
Reply #184 on: November 20, 2021, 06:22:18 AM
Here is the working 68k JPEG datatype. Let me know if it works for you.

Works fine now on AROS One 68k ;)


OlafS3

  • Legendary Member
  • *****
    • Posts: 544
    • Karma: +50/-8
Reply #185 on: November 20, 2021, 07:47:46 AM
Hi
How can I test it if saving jpg works? With dtconvert?

Just open a JPG Image with Multiview and then do a "Save AS", this will save the image in the same JPG format

If you do Save IFF instead, then the file will be saved in IFF (this worked even before the fix).

DTConv on AROS 68k crashes the system, I don't know if this also happens with your Aros Vision

I get the same error. The conversion is executed successful



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #186 on: November 20, 2021, 08:09:43 AM
So the 68k JPEG datatype works with MultiView?

But DTConv has an illegal address error that crashes?

I'm more concerned to see if saving JPEG works for MultiView.



AMIGASYSTEM

  • Global Moderator
  • Legendary Member
  • *****
    • Posts: 3740
    • Karma: +69/-2
  • AROS One
    • AROS One
Reply #187 on: November 20, 2021, 08:36:21 AM

I'm more concerned to see if saving JPEG works for MultiView.

On AROS 68k both Save AS and Save IFF work well.


AMIGASYSTEM

  • Global Moderator
  • Legendary Member
  • *****
    • Posts: 3740
    • Karma: +69/-2
  • AROS One
    • AROS One
Reply #188 on: November 20, 2021, 10:05:20 AM
Here is the x86 targa (tga) datatype. Use with caution. Untested.

New x86 targa (tga) datatype and x86 bmp datatype They save well on AROS One x86
« Last Edit: November 20, 2021, 10:10:30 AM by AMIGASYSTEM »



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #189 on: November 20, 2021, 10:26:51 AM
Here is the x86 targa (tga) datatype. Use with caution. Untested.

New x86 targa (tga) datatype and x86 bmp datatype They save well on AROS One x86

Thanks for the update. I'm working on compiling x86 JPEG & PCX.

I tested the JPEG datatype containing the Filehandle Fix on 68k & x86_64.

Conversions using MultiView Save AS worked on both platforms.  :)
« Last Edit: November 20, 2021, 11:22:47 AM by miker1264 »



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #190 on: November 26, 2021, 03:26:19 AM
great miker :)



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #191 on: November 26, 2021, 03:38:54 AM
Miker you can have packages with dataType so I upload to Archives :D



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #192 on: December 05, 2021, 05:34:36 PM
Hmmm...

It seems our PNG Datatype doesn't accurately process the tRNS chunk data for 8bit PNG Images with Colormap and index data.

Windows 10 shows the 8bit PNG image with transparency, so does Linux. But AROS shows a black band around it instead.
« Last Edit: December 05, 2021, 09:19:30 PM by miker1264 »



AMIGASYSTEM

  • Global Moderator
  • Legendary Member
  • *****
    • Posts: 3740
    • Karma: +69/-2
  • AROS One
    • AROS One
Reply #193 on: December 06, 2021, 01:04:45 AM
I think that also the AROS picture.datatypes has some problem, I've tested a Web Page Viewer and the Gif images show up badly, on OS3 instead they show up perfectly :(
« Last Edit: December 06, 2021, 01:09:40 AM by AMIGASYSTEM »



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #194 on: January 29, 2022, 05:38:29 PM
I think that also the AROS picture.datatypes has some problem, I've tested a Web Page Viewer and the Gif images show up badly, on OS3 instead they show up perfectly :(

The GIF datatype was updated for ABOv1 some time ago.

I will compile and test the latest version to confirm it works.