Add SkJpegGainmapEncoder::EncodeJpegR and EncodeHDRGM
Reland this patch with a default second argument for
skjpeg_destination_mgr, to avoid breaking code that uses that
Add a SkJpegGainmapEncoder class that is a friend of SkJpegEncoder and
add the functions SkJpegGainmapEncoder::EncodeJpegR and EncodeHDRGM.
This requires adding two new pieces of data to the SkJpegEncoder.
First is a list of new segments. For both JpegR and HDRGM, this
includes the XMP metadata. For HDRM this includes segments for the
encoded gainmap image. Second is a "suffix" to append to the end of
the base image. For JpegR, this is the encoded gainmap image.
Send the new segments to jpeg_write_marker (just like is currently
done for the ICC profile).
Plumb the "suffix" through to the skjpeg_destination_mgr, to be
appended after image is done writing (but before the stream is
In both EncodeJpegR and EncodeHDRGM function, hard-code the XMP
metadata string (rather than constructing and serializing an SkDOM).
Include the math to transcode from any gainmap representation to
Add a test that transcodes an MPF gainmap image to a JpegR and
HDRGM image, and ensures that the rendered results are the same (up
to rounding error).
Commit-Queue: Christopher Cameron <email@example.com>
Reviewed-by: Brian Osman <firstname.lastname@example.org>
8 files changed