New Picture Datatypes

miker1264 · 11617

miker1264

  • Legendary Member
  • *****
    • Posts: 1224
    • Karma: +80/-2
Reply #180 on: November 20, 2021, 07: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, 07:47:21 AM by miker1264 »



miker1264

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




OlafS3

  • Senior Member
  • ****
    • Posts: 317
    • Karma: +45/-0
Reply #182 on: November 20, 2021, 11:53:19 AM
Hi

thanks Miker

just updated all  :)

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



AMIGASYSTEM

  • Legendary Member
  • *****
    • Posts: 1509
    • Karma: +45/-1
  • AROS One
    • AROS One
Reply #183 on: November 20, 2021, 12:15:09 PM
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

  • Legendary Member
  • *****
    • Posts: 1509
    • Karma: +45/-1
  • AROS One
    • AROS One
Reply #184 on: November 20, 2021, 01:22:18 PM
Here is the working 68k JPEG datatype. Let me know if it works for you.

Works fine now on AROS One 68k ;)


OlafS3

  • Senior Member
  • ****
    • Posts: 317
    • Karma: +45/-0
Reply #185 on: November 20, 2021, 02:47:46 PM
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: 1224
    • Karma: +80/-2
Reply #186 on: November 20, 2021, 03:09:43 PM
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

  • Legendary Member
  • *****
    • Posts: 1509
    • Karma: +45/-1
  • AROS One
    • AROS One
Reply #187 on: November 20, 2021, 03:36:21 PM

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

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


AMIGASYSTEM

  • Legendary Member
  • *****
    • Posts: 1509
    • Karma: +45/-1
  • AROS One
    • AROS One
Reply #188 on: November 20, 2021, 05:05:20 PM
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, 05:10:30 PM by AMIGASYSTEM »



miker1264

  • Legendary Member
  • *****
    • Posts: 1224
    • Karma: +80/-2
Reply #189 on: November 20, 2021, 05:26:51 PM
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, 06:22:47 PM by miker1264 »



salvo

  • Legendary Member
  • *****
    • Posts: 1579
    • Karma: +20/-4
  • Peace an Love
    • TinyAros
Reply #190 on: November 26, 2021, 10:26:19 AM
great miker :)

TinyAros and shop  http://tinyaros.flazio.com
HP Z400 Workstation, Intel Xeon W3565 3.20 Ghz, 8 Gb Ram, SSD 120 Gb, HD 500 Gb, Quadro nvs 295 256 Mb Gallium Ready


salvo

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

TinyAros and shop  http://tinyaros.flazio.com
HP Z400 Workstation, Intel Xeon W3565 3.20 Ghz, 8 Gb Ram, SSD 120 Gb, HD 500 Gb, Quadro nvs 295 256 Mb Gallium Ready


miker1264

  • Legendary Member
  • *****
    • Posts: 1224
    • Karma: +80/-2
Reply #192 on: December 06, 2021, 12:34:36 AM
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 06, 2021, 04:19:30 AM by miker1264 »



AMIGASYSTEM

  • Legendary Member
  • *****
    • Posts: 1509
    • Karma: +45/-1
  • AROS One
    • AROS One
Reply #193 on: December 06, 2021, 08: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, 08:09:40 AM by AMIGASYSTEM »



miker1264

  • Legendary Member
  • *****
    • Posts: 1224
    • Karma: +80/-2
Reply #194 on: January 30, 2022, 12:38:29 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 :(

The GIF datatype was updated for ABOv1 some time ago.

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