Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1035906 // testQOI - test Pure Java QOI compression & decompression (OK!)

JavaX fragment (include) [tags: use-pretranspiled]

Uses 38K of libraries. Click here for Pure Java version (9826L/55K).

// I get between 13 and 16 ms both for compressing and decompressing
// a 2.1 MP screenshot on my Ryzen 4700S.

static byte[] testQOI(BufferedImage img default shootScreen2()) {
  time "Compress" {
    byte[] qoi = toQOI(img);
  }
  
  print("Image size: " + str_megapixels(img));
  print("Compressed: " + nBytes(qoi);
  var bpp = bitsPerPixel(qoi, img);
  print("Bits per pixel: " + formatDouble2(bpp));
  print("Compression factor over RGB: " + formatDouble1(doubleRatio(24, bpp)));
  
  time "Decompress" {
    var restoredImage = fromQOI(qoi);
  }
  assertSameImage(img, restoredImage);
  print("Image restoration OK");
  
  ret qoi;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035906
Snippet name: testQOI - test Pure Java QOI compression & decompression (OK!)
Eternal ID of this version: #1035906/6
Text MD5: cdb3c6ca07887f69da8ba61a4b9aff3c
Transpilation MD5: 4aa9677bbc9ca4206eec7e4c6e62cf5b
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-11 19:31:35
Source code size: 660 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 132 / 205
Version history: 5 change(s)
Referenced in: [show references]