codec: technical values or details om hover
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 29 Oct 2021 16:29:00 +0000 (18:29 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 9 Nov 2021 03:14:15 +0000 (04:14 +0100)
Explain disputable ratings like royalties, and other optional annotations
to clarify included source values and maybe prevent complaints.

codec.inc.pl
codec.plp

index c70fc38a2dc94395b5d8a7f9a2c5d6c344024878..2b1f59031ab95c10428bf8c09b2c500a3dcd60c1 100644 (file)
@@ -238,8 +238,8 @@ feature => {
                        png  => [4,  '2G²'],   # 2**31
                        jp2k => [5,  '4G²'],   # 2**32
                        webp => [1, '16k²'],   # 2**14
-                       heic => [2, '8k×4k+'], # 8193x4320
-                       avif => [3, '65k²+'],  # 2**16, 8193x4320 with profile
+                       heic => [2,'8k×4k+', 'tilable, only 512×512 on Apple'], # 8193x4320
+                       avif => [3, '65k²+', 'tilable, 7680×4320 with Advanced profile'], # 2**16
                        jxl  => [4,  '1G²'],   # 2**30
                },
        },
@@ -248,27 +248,27 @@ feature => {
                name => 'precision (max. bit depth)',
                score => {
                        jpeg => [2,  8],
-                       gif  => [2,  8],
+                       gif  => [1,  8, '256 colour palette per frame'],
                        png  => [4, 16],
                        jp2k => [5, 38],
                        webp => [2,  8],
-                       heic => [3, 10],
-                       avif => [3, 10],
-                       jxl  => [5, 32],
+                       heic => [3, 10], #TODO 16?
+                       avif => [3, 12, '8, 10, 12 bit'],
+                       jxl  => [5, 32, '24-bit integer or 32-bit float'],
                },
        },
        color_444 => {
                parent => 'limits',
-               name => 'can do (lossy) 4:4:4',
+               name => 'chroma subsampling',
                score => {
-                       jpeg => 'y',
-                       gif  => 'y',
-                       png  => 'y',
+                       jpeg => ['y', undef, '4:2:0, 4:2:2, 4:4:4'],
+                       gif  => [4, '✘'],
+                       png  => [4, '✘'],
                        jp2k => 'y',
-                       webp => 'n',
-                       heic => 'n',
-                       avif => 'y',
-                       jxl  => 'y',
+                       webp => [1, '4:2:0'],
+                       heic => [1, '4:2:0'],
+                       avif => ['y', undef, '4:2:0, 4:2:2, 4:4:4'],
+                       jxl  => ['y', undef, 'for JPEG compatibility'],
                },
        },
        hdr => {
@@ -289,14 +289,14 @@ feature => {
                parent => 'limits',
                name => 'maximum number of channels',
                score => {
-                       jpeg => [2, 4], # cmyk
-                       gif  => [1, 3],
-                       png  => [2, 4], # cmyk
+                       jpeg => [3, 4, 'RGB or CMYK'],
+                       gif  => [3, 3, 'RGB palette'],
+                       png  => [3, 4, 'RGBA'],
                        jp2k => [5, 2**15],
-                       webp => [2, 4],
-                       heic => [3, 5],
-                       avif => [3, 5],
-                       jxl  => [4, 4099],
+                       webp => [3, 4, 'RGBA'],
+                       heic => [3, 3, 'RGB, separate alpha and depth'],
+                       avif => [3, 3, 'RGB, separate alpha and depth'],
+                       jxl  => [4, 4099, 'native XYB'],
                },
        },
        features => {
@@ -318,7 +318,7 @@ feature => {
                score => {
                        jpeg => [2, 'MJPEG'],
                        gif  => 'y',
-                       png  => [4, 'APNG'],
+                       png  => [4, 'APNG', 'later backwards-compatible extension'],
                        jp2k => [2, 'MJP2'],
                        webp => 'y',
                        heic => 'y',
@@ -428,13 +428,13 @@ feature => {
                name => 'royalty-free',
                score => {
                        jpeg => 5,
-                       gif  => 5, # patents expired
+                       gif  => [5, undef, 'patented before 2003'],
                        png  => 5,
-                       jp2k => 3, # specs not freely available
-                       webp => 4, # submarine risk
-                       heic => 'n', # patents enforced
-                       avif => 4,
-                       jxl  => 4,
+                       jp2k => [3, undef, 'ISO specification not freely available'],
+                       webp => [4, undef, 'free format, low remaining risk of patent trolls'],
+                       heic => ['n', undef, 'heavily patented'],
+                       avif => [4, undef, 'free format, risk of patent trolls'],
+                       jxl  => [4, undef, 'free format, risk of patent trolls'],
                },
                children => [],
        },
index 1ae734aee72c00659ec338ffa69ccd57e242a86c..2e5079487e792c6147425a8c9dd36354c5f118ae 100644 (file)
--- a/codec.plp
+++ b/codec.plp
@@ -41,7 +41,7 @@ while (defined (my $feat = shift @feat)) {
        print '<tbody>' if $featinfo->{children};
        printf '<tr><th>%s', $featinfo->{name} // $feat;
        for (@codecs) {
-               my ($score, $data) = map { ref ? @$_ : $_ } $featinfo->{score}->{$_};
+               my ($score, $data, $title) = map { ref ? @$_ : $_ } $featinfo->{score}->{$_};
                if (not defined $data) {
                        if (my $override = $BOOLSCORE{$score}) {
                                ($score, $data) = @{$override};
@@ -50,7 +50,9 @@ while (defined (my $feat = shift @feat)) {
                                $data = '•' x ($score - 1);
                        }
                }
-               printf '<td class="l%d">%s', $score, $data;
+               printf '<td class="l%d"', $score;
+               printf ' title="%s"', $_ for $title // ();
+               print '>', $data;
        }
        say '</td>';
 }