Giter Club home page Giter Club logo

Comments (1)

jonsneyers avatar jonsneyers commented on June 2, 2024

More generally it would be good if we have a better way to treat "semantically meaningful" tail data when transcoding JPEG files. Besides these "MotionPhoto" cases, there is also UltraHDR (which has a gain map in the tail data) and MPF in general (Multi Picture Format) like some examples I've seen where the main image has fake bokeh applied to the background but the original image with a sharp background is still there in the tail data; also just a concatenation of JPEG files (which is something e.g. ffmpeg can ingest) could be seen as an example of this.

Currently tail data is stored in the jbrd and just treated like any other "unknown" data, like unknown APP markers or padding bits: it simply gets Brotli-compressed and in that way it becomes "hidden" in the JXL file, in the sense that the only way to retrieve such info is to apply the JPEG bitstream reconstruction procedure first.

It would be cleaner if we would define some kind of recursive structure in the file format where there is an optional box, name TBD but for the purpose of discussion we could call it tail, which contains the "tail data" of the main image. Then if the tail data is a movie, it could simply be copied into such a tail box, but if the tail data is another JPEG bitstream, then JXL's JPEG bitstream recompression could be applied recursively to that tail JPEG, and the tail box of the main image would then contain another JXL file. This could be nested arbitrarily deep, e.g. if you would concatenate three JPEGs then the third one would be in the tail box of the JXL file corresponding to the second one, which would be in the tail box of the first one.

Maybe instead of tail it could be called next or something. Such a structure would not allow seeking (it's a linked list, not a random access data structure), but for sequential access it would be fine. It would also make it straightforward to strip the tail data while still allowing reconstruction of the main image.

This method could also be used to extend the JXL file format to allow representing sequences of images that are coded completely independently (i.e. not as frames within a single JXL codestream), which can be useful since multi-frame single-codestream JXL has the limitation that all frames need to have the same dimensions and colorspace.

I am turning this issue into a discussion since this is not just a libjxl issue but changing anything here would require extending the spec (ISO/IEC 18181-2 in this case).

from libjxl.

Related Issues (20)

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.