Giter Site home page Giter Site logo

jpeglibrary's People

Contributors

yigolden avatar

Stargazers

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

Watchers

 avatar

jpeglibrary's Issues

Any interest in a pull request to fix a parsing bug in single component files.

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

JpegHuffmanBug

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.

Dependency Mix

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

SOF3 encoding support?

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

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.