SkGainmapEncoder: Add MP extensions to all individual images

In CIPA DC-007, it is not completely clear if it is required that
all images (the base image and the gainmap image) must include MP
extensions (the APP2 marker with MPF metadata).

It is also likely that we will need to include MP extensions if CIPA
DC-007 is updated to include gainmap support.

To be on the safe side, make SkJpegGainmapEncoder::MakeMPF add MP
extensions to all individual images, not just the first one.

To SkJpegMultiPictureParameters::serialize, add an individual
image number parameter, and conditionalize which parts are written
based on that (in particular only write the version for non-first
individual images).

Make SkJpegGainmapEncoder::MakeMPF add the MPF segment to all images.

Then add a bunch of tests.

Bug: b/338342146
Change-Id: I1f7fc59313fec478a243fddbbe6a6a02a104fb8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/857840
Commit-Queue: Christopher Cameron <ccameron@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Christopher Cameron <ccameron@google.com>
4 files changed