Open longde123 opened 6 years ago
This does both Reader and decoding so it should be refactored to match format API by separating both levels.
Le jeu. 22 mars 2018 11:37, paling notifications@github.com a écrit :
https://github.com/HeapsIO/heaps/blob/master/hxd/res/NanoJpeg.hx
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/HaxeFoundation/format/issues/71, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-bwMJZPA8G7PB3u7J2sAaFE9nIDjipks5tg37kgaJpZM4S2z4Z .
I have rearranged the code and put it in my folder project, see reader here format.jpg.Reader.hx. folder is already set to help with loading images and it was easy accomodate JPG.
The reader is able to detect progressive JPG's fine ( we can't use them ).
And it Compiles on Neko and C++. which is a good start.
On C++ the pixels seem to be empty :( shame.
Runtime on Neko I get: Called from format.jpg.Reader::upsampleV line 547 Uncaught exception - Invalid operation (*)
package;
import hxPixels.Pixels; // https://github.com/azrafe7/hxPixels
import folder.Folder;
class Main{
var folder = new Folder();
static function main(){ new Main(); } public function new(){
var images = folder.getImages( './' );
var fileName = 'TestImage.png';
for( img in images ) if( img.fileSpec.name == fileName ) pixels = img.pixels;
var w = pixels.width;
var h = pixels.height;
for( x in 0...w ) for( y in 0...h ) trace( pixels.getPixel32( x, y ) );
}
}
compile code
-cp src
-main Main
-neko main.n
#-cpp main
-lib folder
-lib hxPixels
-lib format
#-debug
-cmd neko main.n
Do you have some good test images, I modified largest "RIP.jpg" from online wikipedia but it was progressive so modified in Krita, but I am unsure if it's an ideal representative jpg. If you have test samples jpg that would help. I am not really very knowledgable in debugging neko / c++, I can try but advise welcome, if you get a chance to take a quick look or send me your test jpgs, if we get this working what else is need prior to pull?
https://github.com/HeapsIO/heaps/blob/master/hxd/res/NanoJpeg.hx