Recent

Author Topic: Lepton Test Program with Packing and unpacking of JPEGs  (Read 399 times)

Boleeman

  • Hero Member
  • *****
  • Posts: 886
Lepton Test Program with Packing and unpacking of JPEGs
« on: March 06, 2025, 10:03:56 am »
Made a small Lepton test program using Tomxe's Lepton Reader Writer at

https://github.com/Xelitan/Lepton-reader-and-writer-for-Delphi-Lazarus

I noticed LeptonImage.pas was missing 

procedure DecodeLepton(InStr, OutStr: TStream);
procedure EncodeLepton(InStr, OutStr: TStream);   


here:
Code: Pascal  [Select][+][-]
  1. interface
  2.  
  3. uses Classes, Graphics, SysUtils, Math, Types, Dialogs;
  4.  
  5. const LIB_LEPTON = 'lepton.dll';
  6.  
  7.   function WrapperDecompressImage(input_buffer: Pointer; input_buffer_size: UInt64;
  8.     output_buffer: Pointer; output_buffer_size: UInt64; number_of_threads: Integer;
  9.     result_size: PUInt64): Integer; cdecl; external LIB_LEPTON;
  10.   function WrapperCompressImage(input_buffer: PByte; input_buffer_size: UInt64;
  11.     output_buffer: PByte; output_buffer_size: UInt64; number_of_threads: Int32;
  12.     result_size: PUInt64): Int32; cdecl; external LIB_LEPTON;
  13.  
  14.   procedure DecodeLepton(InStr, OutStr: TStream);
  15.   procedure EncodeLepton(InStr, OutStr: TStream);
  16.  
  17.   { TLeptonImage }
  18. type
  19.   TLeptonImage = class(TGraphic)  


Now I can do Packing and unpacking of JPEGs using TFileStream

Attached is a small Lazarus Test program


The 469 kb test.bmp gets reduced in size to a 10 kb test.lep picture file.

Thanks Tomxe for the Lepton magic.
« Last Edit: March 06, 2025, 10:09:28 am by Boleeman »

Key-Real

  • Sr. Member
  • ****
  • Posts: 386
Re: Lepton Test Program with Packing and unpacking of JPEGs
« Reply #1 on: March 14, 2025, 10:23:09 pm »
found nanojpeg.pas

I use this to decode .jpg

Boleeman

  • Hero Member
  • *****
  • Posts: 886
Re: Lepton Test Program with Packing and unpacking of JPEGs
« Reply #2 on: March 15, 2025, 12:29:20 am »
In that "nanojpeg.pas" file //Original code by Martin Fiedler http://keyj.s2000.ws/?p=137    does not exist.

This is the new working page:  https://www.emix8.org/static.php?page=nanoJpeg

Thanks Key-Real for that jpg decoder.

And the Lazarus source code for the jpg loader is here:

https://www.emix8.org/files/NanoJpegLazarus.zip
« Last Edit: March 15, 2025, 01:37:15 am by Boleeman »

 

TinyPortal © 2005-2018