summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/jpegxl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/jpegxl
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/jpegxl')
-rw-r--r--testing/web-platform/tests/jpegxl/3x3_jpeg_recompression-ref.html4
-rw-r--r--testing/web-platform/tests/jpegxl/3x3_jpeg_recompression.html8
-rw-r--r--testing/web-platform/tests/jpegxl/3x3_srgb_lossless-ref.html4
-rw-r--r--testing/web-platform/tests/jpegxl/3x3_srgb_lossless.html8
-rw-r--r--testing/web-platform/tests/jpegxl/3x3_srgb_lossy-ref.html4
-rw-r--r--testing/web-platform/tests/jpegxl/3x3_srgb_lossy.html8
-rw-r--r--testing/web-platform/tests/jpegxl/3x3a_srgb_lossless-ref.html4
-rw-r--r--testing/web-platform/tests/jpegxl/3x3a_srgb_lossless.html8
-rw-r--r--testing/web-platform/tests/jpegxl/3x3a_srgb_lossy-ref.html4
-rw-r--r--testing/web-platform/tests/jpegxl/3x3a_srgb_lossy.html8
-rw-r--r--testing/web-platform/tests/jpegxl/META.yml3
-rw-r--r--testing/web-platform/tests/jpegxl/resources/3x3_jpeg_recompression.jxlbin0 -> 422 bytes
-rw-r--r--testing/web-platform/tests/jpegxl/resources/3x3_jpeg_recompression.pngbin0 -> 169 bytes
-rw-r--r--testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossless.jxlbin0 -> 66 bytes
-rw-r--r--testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossless.pngbin0 -> 152 bytes
-rw-r--r--testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossy.jxlbin0 -> 200 bytes
-rw-r--r--testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossy.pngbin0 -> 156 bytes
-rw-r--r--testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossless.jxlbin0 -> 66 bytes
-rw-r--r--testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossless.pngbin0 -> 163 bytes
-rw-r--r--testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossy.jxlbin0 -> 215 bytes
-rw-r--r--testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossy.pngbin0 -> 167 bytes
-rwxr-xr-xtesting/web-platform/tests/jpegxl/resources/generate_resources.sh76
22 files changed, 139 insertions, 0 deletions
diff --git a/testing/web-platform/tests/jpegxl/3x3_jpeg_recompression-ref.html b/testing/web-platform/tests/jpegxl/3x3_jpeg_recompression-ref.html
new file mode 100644
index 0000000000..070243d6a7
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/3x3_jpeg_recompression-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<title>JPEG XL test reference</title>
+
+<img src="./resources/3x3_jpeg_recompression.png">
diff --git a/testing/web-platform/tests/jpegxl/3x3_jpeg_recompression.html b/testing/web-platform/tests/jpegxl/3x3_jpeg_recompression.html
new file mode 100644
index 0000000000..f28fca8fdc
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/3x3_jpeg_recompression.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<title>JPEG XL test</title>
+<meta name=fuzzy content="0-1;0-9">
+<link rel="help" href="https://jpeg.org/jpegxl/">
+<link rel="match" href="3x3_jpeg_recompression-ref.html">
+<meta name="assert" content="JPEG XL image is rendered correctly">
+
+<img src="./resources/3x3_jpeg_recompression.jxl">
diff --git a/testing/web-platform/tests/jpegxl/3x3_srgb_lossless-ref.html b/testing/web-platform/tests/jpegxl/3x3_srgb_lossless-ref.html
new file mode 100644
index 0000000000..1bb5083240
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/3x3_srgb_lossless-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<title>JPEG XL test reference</title>
+
+<img src="./resources/3x3_srgb_lossless.png">
diff --git a/testing/web-platform/tests/jpegxl/3x3_srgb_lossless.html b/testing/web-platform/tests/jpegxl/3x3_srgb_lossless.html
new file mode 100644
index 0000000000..589f11c68c
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/3x3_srgb_lossless.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<title>JPEG XL test</title>
+<meta name=fuzzy content="0-4;0-9">
+<link rel="help" href="https://jpeg.org/jpegxl/">
+<link rel="match" href="3x3_srgb_lossless-ref.html">
+<meta name="assert" content="JPEG XL image is rendered correctly">
+
+<img src="./resources/3x3_srgb_lossless.jxl">
diff --git a/testing/web-platform/tests/jpegxl/3x3_srgb_lossy-ref.html b/testing/web-platform/tests/jpegxl/3x3_srgb_lossy-ref.html
new file mode 100644
index 0000000000..a5e95baba3
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/3x3_srgb_lossy-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<title>JPEG XL test reference</title>
+
+<img src="./resources/3x3_srgb_lossy.png">
diff --git a/testing/web-platform/tests/jpegxl/3x3_srgb_lossy.html b/testing/web-platform/tests/jpegxl/3x3_srgb_lossy.html
new file mode 100644
index 0000000000..3a92b2b730
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/3x3_srgb_lossy.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<title>JPEG XL test</title>
+<meta name=fuzzy content="0-10;0-9">
+<link rel="help" href="https://jpeg.org/jpegxl/">
+<link rel="match" href="3x3_srgb_lossy-ref.html">
+<meta name="assert" content="JPEG XL image is rendered correctly">
+
+<img src="./resources/3x3_srgb_lossy.jxl">
diff --git a/testing/web-platform/tests/jpegxl/3x3a_srgb_lossless-ref.html b/testing/web-platform/tests/jpegxl/3x3a_srgb_lossless-ref.html
new file mode 100644
index 0000000000..75d8ba7452
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/3x3a_srgb_lossless-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<title>JPEG XL test reference</title>
+
+<img src="./resources/3x3a_srgb_lossless.png">
diff --git a/testing/web-platform/tests/jpegxl/3x3a_srgb_lossless.html b/testing/web-platform/tests/jpegxl/3x3a_srgb_lossless.html
new file mode 100644
index 0000000000..1de61a5ba2
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/3x3a_srgb_lossless.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<title>JPEG XL test</title>
+<meta name=fuzzy content="0-4;0-9">
+<link rel="help" href="https://jpeg.org/jpegxl/">
+<link rel="match" href="3x3a_srgb_lossless-ref.html">
+<meta name="assert" content="JPEG XL image is rendered correctly">
+
+<img src="./resources/3x3a_srgb_lossless.jxl">
diff --git a/testing/web-platform/tests/jpegxl/3x3a_srgb_lossy-ref.html b/testing/web-platform/tests/jpegxl/3x3a_srgb_lossy-ref.html
new file mode 100644
index 0000000000..3a1c22e8a2
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/3x3a_srgb_lossy-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<title>JPEG XL test reference</title>
+
+<img src="./resources/3x3a_srgb_lossy.png">
diff --git a/testing/web-platform/tests/jpegxl/3x3a_srgb_lossy.html b/testing/web-platform/tests/jpegxl/3x3a_srgb_lossy.html
new file mode 100644
index 0000000000..59583a11a9
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/3x3a_srgb_lossy.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<title>JPEG XL test</title>
+<meta name=fuzzy content="0-10;0-9">
+<link rel="help" href="https://jpeg.org/jpegxl/">
+<link rel="match" href="3x3a_srgb_lossy-ref.html">
+<meta name="assert" content="JPEG XL image is rendered correctly">
+
+<img src="./resources/3x3a_srgb_lossy.jxl">
diff --git a/testing/web-platform/tests/jpegxl/META.yml b/testing/web-platform/tests/jpegxl/META.yml
new file mode 100644
index 0000000000..d012c7f9ba
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/META.yml
@@ -0,0 +1,3 @@
+spec: https://jpeg.org/jpegxl/workplan.html
+suggested_reviewers:
+ - mo271
diff --git a/testing/web-platform/tests/jpegxl/resources/3x3_jpeg_recompression.jxl b/testing/web-platform/tests/jpegxl/resources/3x3_jpeg_recompression.jxl
new file mode 100644
index 0000000000..deee4257ff
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/3x3_jpeg_recompression.jxl
Binary files differ
diff --git a/testing/web-platform/tests/jpegxl/resources/3x3_jpeg_recompression.png b/testing/web-platform/tests/jpegxl/resources/3x3_jpeg_recompression.png
new file mode 100644
index 0000000000..b147cb57bd
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/3x3_jpeg_recompression.png
Binary files differ
diff --git a/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossless.jxl b/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossless.jxl
new file mode 100644
index 0000000000..bb9cf0bb2e
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossless.jxl
Binary files differ
diff --git a/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossless.png b/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossless.png
new file mode 100644
index 0000000000..f314145a13
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossless.png
Binary files differ
diff --git a/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossy.jxl b/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossy.jxl
new file mode 100644
index 0000000000..a2d7a898e1
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossy.jxl
Binary files differ
diff --git a/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossy.png b/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossy.png
new file mode 100644
index 0000000000..ad5ef8117f
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/3x3_srgb_lossy.png
Binary files differ
diff --git a/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossless.jxl b/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossless.jxl
new file mode 100644
index 0000000000..6bbb43d8e7
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossless.jxl
Binary files differ
diff --git a/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossless.png b/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossless.png
new file mode 100644
index 0000000000..3c5f9c4e6b
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossless.png
Binary files differ
diff --git a/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossy.jxl b/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossy.jxl
new file mode 100644
index 0000000000..0a4e952e3b
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossy.jxl
Binary files differ
diff --git a/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossy.png b/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossy.png
new file mode 100644
index 0000000000..885c5d0359
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/3x3a_srgb_lossy.png
Binary files differ
diff --git a/testing/web-platform/tests/jpegxl/resources/generate_resources.sh b/testing/web-platform/tests/jpegxl/resources/generate_resources.sh
new file mode 100755
index 0000000000..359b2afd9e
--- /dev/null
+++ b/testing/web-platform/tests/jpegxl/resources/generate_resources.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+# This generates the png and jxl images needed.
+
+# Function to check if a command exists
+command_exists() {
+ command -v "$1" &> /dev/null
+}
+
+# Function to convert and compress an image
+convert_and_compress() {
+ local input_image=$1
+ local base_name=$2
+ local color_space=$3
+
+ cjxl "$input_image" temp.jxl -d 0
+ djxl temp.jxl "${base_name}_${color_space}_lossless.png"
+ cjxl "${base_name}_${color_space}_lossless.png" "${base_name}_${color_space}_lossy.jxl" -d 0.0001 -e 7
+ djxl "${base_name}_${color_space}_lossy.jxl" "${base_name}_${color_space}_lossy.png"
+ cjxl "${base_name}_${color_space}_lossless.png" "${base_name}_${color_space}_lossless.jxl" -d 0
+}
+
+# Check for required tools
+for tool in convert cjxl djxl; do
+ if ! command_exists "$tool"; then
+ echo "$tool could not be found. Please install it and run the script again."
+ exit 1
+ fi
+done
+
+# Create a 3x3 transparent image
+convert -size 3x3 xc:none 3x3a.png
+
+# Draw colors with alpha values
+convert 3x3a.png \
+-fill "rgba(255,0,0,0.5)" -draw "point 0,0" \
+-fill "rgba(0,255,0,0.5)" -draw "point 1,0" \
+-fill "rgba(0,0,255,0.5)" -draw "point 2,0" \
+-fill "rgba(128,64,64,0.5)" -draw "point 0,1" \
+-fill "rgba(64,128,64,0.5)" -draw "point 1,1" \
+-fill "rgba(64,64,128,0.5)" -draw "point 2,1" \
+-fill "rgba(255,255,255,0.5)" -draw "point 0,2" \
+-fill "rgba(128,128,128,0.5)" -draw "point 1,2" \
+-fill "rgba(0,0,0,0.5)" -draw "point 2,2" \
+3x3a.png
+
+# Generate initial image with alpha values
+generate_image 3x3a.png
+
+# Generate a version without alpha channel
+convert 3x3a.png -alpha off 3x3.png
+
+# Define color spaces
+# TODO(firsching): add "RGB_D65_202_Rel_PeQ" and "RGB_D65_202_Rel_HLG" as color spaces here
+color_spaces=("srgb")
+
+# Loop through color spaces and convert/compress images
+for color_space in "${color_spaces[@]}"; do
+ convert_and_compress 3x3.png "3x3" "$color_space"
+ convert_and_compress 3x3a.png "3x3a" "$color_space"
+done
+
+convert 3x3.png -quality 70 3x3.jpg
+# lossless recompression
+cjxl 3x3.jpg 3x3_jpeg_recompression.jxl
+# checking that it was actually byte exact
+djxl 3x3_jpeg_recompression.jxl 3x3_recovered.jpg
+diff 3x3.jpg 3x3_recovered.jpg
+if [ $? -ne 0 ]; then
+ echo "The recovery of the recompressed jpg failed: 3x3.png and 3x3_recovered.jpg differ"
+ exit 1
+fi
+# generate reference png
+djxl 3x3_jpeg_recompression.jxl 3x3_jpeg_recompression.png
+
+# Cleanup temporary file
+rm -f temp.jxl 3x3.png 3x3a.png 3x3.jpg 3x3_recovered.jpg