-
Notifications
You must be signed in to change notification settings - Fork 254
Allow creating images with a different grid for the gain map. #2397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -774,7 +774,7 @@ typedef struct avifSequenceHeader | |
| AVIF_NODISCARD avifBool avifSequenceHeaderParse(avifSequenceHeader * header, const avifROData * sample, avifCodecType codecType); | ||
|
|
||
| // --------------------------------------------------------------------------- | ||
| // gain maps | ||
| // Gain maps | ||
|
|
||
| #if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) | ||
|
|
||
|
|
@@ -786,6 +786,37 @@ avifResult avifFindMinMaxWithoutOutliers(const float * gainMapF, int numPixels, | |
|
|
||
| #endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP | ||
|
|
||
| // --------------------------------------------------------------------------- | ||
| // Internal encode | ||
| // | ||
| // These functions/options give extra flexibility to create non standard images for use in testing. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: non standard => nonstandard |
||
|
|
||
| typedef struct avifEncoderInternalOptions | ||
| { | ||
| #if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) | ||
| // Options related to the 'tmap' (tone mapped image) box. | ||
| uint8_t tmapVersion; // Value that should be written for the 'version' field (use default if 0) | ||
| uint16_t tmapMinimumVersion; // Value that should be written for the 'minimum_version' field (use default if 0) | ||
| uint16_t tmapWriterVersion; // Value that should be written for the 'writerVersion' field (use default if 0) | ||
| avifBool tmapAddExtraBytes; // Add arbitrary bytes at the end of the box | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: replace "the box" with the name of the class (ToneMapImage or GainMapMetadata?) |
||
| #endif | ||
| char dummy; // Avoid emptry struct error when AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP is off | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: dummy => unused |
||
| } avifEncoderInternalOptions; | ||
|
|
||
| // Sets extra encoding options. | ||
| void avifEncoderSetInternalOptions(avifEncoder * encoder, const avifEncoderInternalOptions * internalOptions); | ||
|
|
||
| // Variant of avifEncoderAddImageGrid() that allows creating images where 'gridCols' and 'gridRows' differ for | ||
| // the base image and the gain map image. | ||
| avifResult avifEncoderAddImageGridInternal(avifEncoder * encoder, | ||
| uint32_t gridCols, | ||
| uint32_t gridRows, | ||
| const avifImage * const * cellImages, | ||
| uint32_t gainMapGridCols, | ||
| uint32_t gainMapGridRows, | ||
| const avifImage * const * gainMapCellImages, | ||
| avifAddImageFlags addImageFlags); | ||
|
|
||
| #define AVIF_INDEFINITE_DURATION64 UINT64_MAX | ||
| #define AVIF_INDEFINITE_DURATION32 UINT32_MAX | ||
|
|
||
|
|
||
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This is a comment on the pull request.) I probably would add the generated test images to the source tree rather than generate them on the fly during testing.
This PR consists of two parts. The
avifEncoderInternalOptionspart is straightforward. On the other hand, it is also easy to rewrite this part from scratch when necessary -- one just needs to make simple changes to theavifWriteToneMappedImagePayload()function. So it is less valuable to check in this part.The
avifEncoderAddImageInternalpart is more complicated. It could be difficult to maintain. The new function parameters also need to be documented.