Code Monkey home page Code Monkey logo

qoi-java's People

Contributors

saharnooby avatar sullis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

qoi-java's Issues

Question: Not worth to use QOI decoding over PNG decoding on Android?

Whether I use QOIUtil.readFile vs BitmapFactory.decodeFile of Android, or I use QOIUtil.readImage vs BitmapFactory.decodeStream , it seems that Android's implementation is faster to parse PNG files over QOI:

From inputStream of the resource (files are within the app) :
QOI took 84 ms
PNG took 25 ms

From a file outside the app:
QOI took 36 ms
PNG took 30 ms

And that's before getting Bitmap instance out of the QOIImage instance, which I don't understand how to do.

Tested on Pixel 4 with Android API 32 on the "wikipedia_008" image files, from here (got from here) :
https://qoiformat.org/qoi_test_images.zip

See attached project:

My Application.zip

How could it be?
Is there anything that can be improved in the implementation?
And how do you convert the output of the function to a working Bitmap instance?

Incorrect alpha handling in the encoder

Hey,

I have noticed that there is a bug in the encoder. Specifically https://github.com/saharNooby/qoi-java/blob/main/src/main/java/me/saharnooby/qoi/QOIEncoder.java#L174 here. The original C implementation is using signed arithmetic in this place https://github.com/phoboslab/qoi/blob/master/qoi.h#L465

This may not seem like a big issue since the encoding and decoding seems to be working fine but if you take a .qoi file, decode and then encode it back with this library then the resulting file will not always be identical to the original .qoi file.

You can verify this by performing a test like this:

  1. Download test files https://qoiformat.org/qoi_test_images.zip
  2. For each test file run a test:
    • decode the file
    • encode back the decoded file
    • compare the resulting file with the original test file byte by byte

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.