yigolden / jpeglibrary Goto Github PK
View Code? Open in Web Editor NEWJPEG decoder, encoder and optimizer implemented in C#.
License: MIT License
JPEG decoder, encoder and optimizer implemented in C#.
License: MIT License
I think I have run into and fixed a bug.
In a single component JPEG file the horizontal and vertical sampling values are ignored. See ITU T81 Section A.2.2
When Ns = 1 (where Ns is the number of components in a scan), the order of data units within a scan shall be left-to-right
and top-to-bottom, as shown in Figure A.2. This ordering applies whenever Ns = 1, regardless of the values of H1 and V1.
I have found a number of single component files with H1 and V1 not equal to one in the wild, and JpegLibrary chokes on them. The image below is one such image
I found that I can make them parse by forcing H1 and V1 to 1 in all single component files. In JpegFrameComponentSpecificationParameters I added a totalComponents parameter to both of the TryParse methods. This allows me to force H1 and V1 to 1 if there is only a single component.
byte quantizationTableSelector = buffer[2];
byte samplingFactor = buffer[1];
byte identifier = buffer[0];
if (totalComponents == 1) samplingFactor = 0x11;
This now parsers all of the JPEGs that I tested it on.
If you would welcome it, I would be happy to prepare a pull request that implements this change.
Hello,
I really appreciate the library and it was a real life saver because it implements so many encoding options. One problem I found was that it apparently uses two different versions of "System.Runtime.CompilerServices.Unsafe" (4.06.26919.2 and 4.700.20.12001). While not a breaking bug it led to some problems in one of our projects.
Many thanks and Kind Regards,
Dominik
Thanks for sharing this software. I had a bit of trouble getting it to work with the "Greaterthan8bit" example output buffer with a DNG file as input but I was able to kinda patchwork my way through it. See my RawBayer2DNG project if you're curious. Had to do some unsafe casting to ushort for example so that values would be correctly interpreted.
Was wondering if it would be possible to implement SOF3 encoding as well or if you can recommend anything that can be used in C# that does SOF3 encoding. Cheers
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.