|
Lines 177-182
const imageTests = {
a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3.js_sec1
|
| 177 |
}, |
177 |
}, |
| 178 |
}; |
178 |
}; |
| 179 |
|
179 |
|
|
|
180 |
// Each video: |
| 181 |
// * is 300x200 and has a single color |
| 182 |
// * has a filename base that indicates its contents: |
| 183 |
// |
| 184 |
// <color-space>-<8-or-10-bit-color-value> |
| 185 |
// |
| 186 |
// * was generated using commands like: |
| 187 |
// |
| 188 |
// W=300 H=200 Y=3F Cb=66 Cr=F0 ; \ |
| 189 |
// perl -e "print pack('c', 0x$Y) x ($W * $H), pack('c', 0x$Cb) x ($W * $H / 4), pack('c', 0x$Cr) x ($W * $H / 4)" | \ |
| 190 |
// ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${W}x$H -r 25 -i - -pix_fmt yuv420p -colorspace bt709 -color_primaries bt709 -color_trc iec61966_2_1 sRGB-FF0100.webm |
| 191 |
// |
| 192 |
// W=300 H=200 Y=0BB Cb=1BD Cr=2EF ; \ |
| 193 |
// perl -e "print pack('s', 0x$Y) x ($W * $H), pack('s', 0x$Cb) x ($W * $H / 4), pack('s', 0x$Cr) x ($W * $H / 4)" | \ |
| 194 |
// ffmpeg -f rawvideo -pix_fmt yuv420p10le -s:v ${W}x$H -r 25 -i - -c:v libx265 -vtag hvc1 -pix_fmt yuv420p10le -colorspace bt2020nc -color_primaries bt2020 -color_trc bt2020-10 Rec2020-222000000.mp4 |
| 195 |
// |
| 196 |
// W=300 H=200 Y=0BB Cb=1BD Cr=2EF ; \ |
| 197 |
// perl -e "print pack('s', 0x$Y) x ($W * $H), pack('s', 0x$Cb) x ($W * $H / 4), pack('s', 0x$Cr) x ($W * $H / 4)" | \ |
| 198 |
// ffmpeg -f rawvideo -pix_fmt yuv420p10le -s:v ${W}x$H -r 25 -i - -vcodec libvpx-vp9 -profile:v 2 -pix_fmt yuv420p10le -colorspace bt2020nc -color_primaries bt2020 -color_trc bt2020-10 Rec2020-222000000.webm |
| 199 |
// |
| 200 |
// where the Y'CbCr values were computed using https://jdashg.github.io/misc/colors/from-coeffs.html. |
| 201 |
const videoTests = { |
| 202 |
// Rec.709 Y'CbCr (0x3F, 0x66, 0xF0) = sRGB (0xFF, 0x01, 0x00) |
| 203 |
"sRGB-FF0100": { |
| 204 |
"srgb srgb": [255, 1, 0, 255], |
| 205 |
"srgb display-p3": [234, 51, 35, 255], |
| 206 |
"display-p3 srgb": [255, 0, 0, 255], |
| 207 |
"display-p3 display-p3": [234, 51, 35, 255], |
| 208 |
}, |
| 209 |
// Rec.709 Y'CbCr (0x32, 0x6D, 0xD2) = sRGB (0xBB, 0x00, 0x00) |
| 210 |
"sRGB-BB0000": { |
| 211 |
"srgb srgb": [187, 0, 0, 255], |
| 212 |
"srgb display-p3": [171, 35, 23, 255], |
| 213 |
"display-p3 srgb": [187, 1, 0, 255], |
| 214 |
"display-p3 display-p3": [171, 35, 23, 255], |
| 215 |
}, |
| 216 |
|
| 217 |
// 10 bit Rec.2020 Y'CbCr (0x126, 0x183, 0x3C0) = Rec.2020 (0x3FF, 0x000, 0x000) |
| 218 |
"Rec2020-3FF000000": { |
| 219 |
"srgb srgb": [255, 0, 0, 255], |
| 220 |
"srgb display-p3": [234, 51, 35, 255], |
| 221 |
"display-p3 srgb": [255, 0, 0, 255], |
| 222 |
"display-p3 display-p3": [255, 0, 9, 255], |
| 223 |
}, |
| 224 |
// 10 bit Rec.2020 Y'CbCr (0x0BB, 0x1BD, 0x2EF) = Rec.2020 (0x222, 0x000, 0x000) |
| 225 |
"Rec2020-222000000": { |
| 226 |
"srgb srgb": [186, 0, 0, 255], |
| 227 |
"srgb display-p3": [170, 34, 23, 255], |
| 228 |
"display-p3 srgb": [186, 0, 0, 255], |
| 229 |
"display-p3 display-p3": [169, 0, 3, 255], |
| 230 |
}, |
| 231 |
}; |
| 232 |
|
| 180 |
const fromSRGBToDisplayP3 = { |
233 |
const fromSRGBToDisplayP3 = { |
| 181 |
"255,0,0,255": [234, 51, 35, 255], |
234 |
"255,0,0,255": [234, 51, 35, 255], |
| 182 |
"255,0,0,204": [234, 51, 35, 204], |
235 |
"255,0,0,204": [234, 51, 35, 204], |