From: Mischa POSLAWSKY Date: Fri, 29 Oct 2021 13:57:29 +0000 (+0200) Subject: codec: categorise related features in groups X-Git-Tag: v1.13~117 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/1676865de8be5f051b97cc3d4b4fcc959732d3ef codec: categorise related features in groups --- diff --git a/codec.inc.pl b/codec.inc.pl index 2e157fc..925c2fe 100644 --- a/codec.inc.pl +++ b/codec.inc.pl @@ -31,6 +31,9 @@ codec => { }, }, feature => { + default => { + children => [qw( quality_photo quality_art speed limits features royalties )], + }, quality_photo => { name => 'compression (photo)', score => { @@ -42,8 +45,10 @@ feature => { avif => 5, jxl => 5, }, + children => [qw( quality_photo_1 quality_photo_2 quality_photo_3 quality_photo_ll )], }, quality_photo_1 => { + parent => 'quality_photo', name => 'low fidelity', score => { jpeg => 2, @@ -56,6 +61,7 @@ feature => { }, }, quality_photo_2 => { + parent => 'quality_photo', name => 'medium fidelity', score => { jpeg => 3, @@ -68,6 +74,7 @@ feature => { }, }, quality_photo_3 => { + parent => 'quality_photo', name => 'high fidelity', score => { jpeg => 3, @@ -80,6 +87,7 @@ feature => { }, }, quality_photo_ll => { + parent => 'quality_photo', name => 'lossless', score => { jpeg => 1, @@ -102,6 +110,7 @@ feature => { avif => 4.5, jxl => 5, }, + children => [qw( quality_art_2 quality_art_ll quality_art_mixed )], }, quality_art_2 => { name => 'lossy non-photographic', @@ -149,8 +158,10 @@ feature => { avif => 3, jxl => 5, }, + children => [qw( speed_encode speed_decode speed_parallel )], }, speed_encode => { + parent => 'speed', name => 'single-core encode', score => { jpeg => 5, @@ -163,6 +174,7 @@ feature => { }, }, speed_decode => { + parent => 'speed', name => 'single-core decode', score => { jpeg => 5, @@ -175,6 +187,7 @@ feature => { }, }, speed_parallel => { + parent => 'speed', name => 'pararellizable', score => { jpeg => 2, @@ -196,8 +209,10 @@ feature => { avif => 4.5, jxl => 5, }, + children => [qw( max_dimensions max_bitdepth color_444 hdr max_channels )], }, max_dimensions => { + parent => 'limits', name => 'maximum image dimensions', score => { jpeg => 3, @@ -219,6 +234,7 @@ feature => { }, }, max_bitdepth => { + parent => 'limits', name => 'precision (max. bit depth)', score => { jpeg => 2, @@ -240,6 +256,7 @@ feature => { }, }, color_444 => { + parent => 'limits', name => 'can do (lossy) 4:4:4', score => { jpeg => 'y', @@ -252,6 +269,7 @@ feature => { }, }, hdr => { + parent => 'limits', name => 'wide gamut/HDR', score => { jpeg => 'n', @@ -264,6 +282,7 @@ feature => { }, }, max_channels => { + parent => 'limits', name => 'maximum number of channels', score => { jpeg => 2, @@ -294,8 +313,10 @@ feature => { avif => 4, jxl => 5, }, + children => [qw( animation progressive alpha depthmap overlays authoring reencode compat_jpeg )], }, animation => { + parent => 'features', name => 'supports animation', score => { jpeg => 2, @@ -313,6 +334,7 @@ feature => { }, }, progressive => { + parent => 'features', name => 'progressive decoding', score => { jpeg => 4, @@ -325,6 +347,7 @@ feature => { }, }, alpha => { + parent => 'features', name => 'alpha transparency', score => { jpeg => 'n', @@ -337,6 +360,7 @@ feature => { }, }, depthmap => { + parent => 'features', name => 'depth map', score => { jpeg => 'n', @@ -349,6 +373,7 @@ feature => { }, }, overlays => { + parent => 'features', name => 'overlays', score => { jpeg => 'n', @@ -361,6 +386,7 @@ feature => { }, }, authoring => { + parent => 'features', name => 'authoring workflow suitability', score => { jpeg => 2, @@ -373,6 +399,7 @@ feature => { }, }, reencode => { + parent => 'features', name => 'generation loss resilience', score => { jpeg => 4, @@ -388,6 +415,7 @@ feature => { }, }, compat_jpeg => { + parent => 'features', name => 'lossless JPEG recompression', score => { jpeg => 0, @@ -414,6 +442,7 @@ feature => { avif => 4, jxl => 4, }, + children => [], }, }, } diff --git a/codec.plp b/codec.plp index 2cc454a..27a6cb7 100644 --- a/codec.plp +++ b/codec.plp @@ -1,5 +1,7 @@ <(common.inc.plp)><: +my @feat = split m{/+}, $Request || 'default'; + Html({ title => 'Codecs', version => '1.0', @@ -32,9 +34,11 @@ print "\n"; print '', $_->{available} for @{$info->{codec}}{@codecs}; say ''; -print ''; -for my $feat (sort keys %{$info->{feature}}) { - my $featinfo = $info->{feature}->{$feat}; +while (defined (my $feat = shift @feat)) { + my $featinfo = $info->{feature}->{$feat} or next; + unshift @feat, @{$_} for $featinfo->{children} // (); + $featinfo->{score} or $featinfo->{data} or next; + print '' if $featinfo->{children}; printf '%s', $featinfo->{name} // $feat; printf('%s', (map { $_ && $BOOLSCORE{$_} || $_ || 0 } $featinfo->{score}->{$_}),