Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /jpegxl/hdr-pq-intensity-target.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>JPEG XL: intensity_target is the peak luminance of a PQ image</title>
<meta name="assert" content="Two PQ images with identical pixels but different intensity_target tone map differently: the one stating the lower peak is brighter on an SDR canvas.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/helpers.js"></script>
<script>
// All fixtures are a flat patch of 588 cd/m2 in BT.2100 PQ and differ only in
// intensity_target: 600 states a peak just above the content, 10000 is the
// peak of PQ itself (what encoders write by default), and in the 255 fixture
// the field is absent.
const sample = async (file) =>
samplePixel(await loadImage(`resources/${file}`), 4, 4);
promise_test(async () => {
const stated = await sample('pq_intensity_target_600.jxl');
const unstated = await sample('pq_intensity_target_10000.jxl');
assert_greater_than(stated[0], unstated[0],
'content peaking at its stated intensity_target should not be ' +
'compressed as if it peaked at 10000 cd/m2');
}, 'intensity_target sets the peak luminance that a PQ image tone maps from.');
promise_test(async () => {
const pq_default = await sample('pq_intensity_target_10000.jxl');
const absent = await sample('pq_intensity_target_255.jxl');
assert_approx_equals(pq_default[0], absent[0], 1,
'intensity_target 10000 states the peak of PQ itself, not a content ' +
'peak; it should tone map like a file with no intensity_target');
}, 'The default intensity_target of 10000 is not a content peak statement.');
</script>