pedrocr / pedrocr/rawloader

Apple proraw DNG support

Open
#44 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
379
Forks
75
PR merge metrics
No merged PRs in 30d

Description

Hi I would like to make a pull request for iphone pro raw DNG support (which is 3-component ljpeg, using predictor 7).

I have already implemented the decoding, very simple, but the design is not finalised. I see a few ways to proceed:

  1. Add a separate function like "proraw_decode" to decompressors.rs, just for decoding 3-component predictor 7 data.
    • Bad: It will be 80% identical to decode_ljpeg_3components.
    • Good: Specialising the implementation to proraw will help performance. As proraw is 12 bit, it is possible to do the predictor calculation within u16. But a more general implementation would need to convert to u32 which I guess would be slower (because 16 bit files might exist somewhere??).
  2. Same as first option, but a more general implementation (including u32 conversion).
  3. Write a whole set of general predictor 7 functions equivalent to the existing decode_ljpeg_(1|2|3|4)components
  4. Make predictor be a parameter of decode_ljpeg_(1|2|3|4)components, this will be slower.
  5. Combine decode_ljpeg_(1|2|3|4)components in to one generic function - like fn decode_ljpeg<const N: usize>(...), where component number is a compile time parameter. and then have separate functions for each predictor:
    - fn decode_ljpeg_predictor_1<const N: usize>(...)
    - fn decode_ljpeg_predictor_7<const N: usize>(...)
    This will generate separate code paths for different component counts, so should not lose performance compared to the current duplicate implementations (will need testing of course) all while reducing repetition. This option would require upgrading to rust 2021 for const generics though.

Please let me know what would be best as a pull request!

Also, the data seems to be BGR not RGB, but I guess that can be considered later Nevermind, that was an issue with how I was saving test files. The data is indeed RGB.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in decompressors.rs by reviewing decode_ljpeg_(1|2|3|4)components and the proposed predictor 7 implementation. Compare the design options, including const generics and Rust 2021 requirements, before choosing an approach. Done means an agreed design decodes three-component, 12-bit ProRAW DNG data correctly without regressing existing JPEG decoding.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.