SkJpegCodec: Add JpegR gainmap extraction support

Add the function SkJpegGetJpegRGainmapParseXMP which extracts the
offset of the gainmap image from the EndOfImage of the base image,
along with the size and range scaling factor.

Add SkJpegGetJpegRGainmap which pulls these parameters from the XMP
metadata, extracts an SkStream for the gainmap image, and translates
the range scaling factor to the common SkGainmapInfo.

Include a type in SkGainmapInfo. This might be needed to add encoding
support for gainmap based files, or to support gainmaps that are
intended to be displayed as HLG or PQ.

In SkJpegSegmentScan, add a custom peek function for seekable
SkStreams. This is because SkFILEStream (among others) does not
implement peek.

Bug: skia:14031
Change-Id: If4a2866bb38a190899171953a7c00cf36db84dff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/625928
Commit-Queue: Christopher Cameron <ccameron@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
7 files changed