From 6c6240c46c33a85f3c78f752d25416413a83e201 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 2 Nov 2021 01:02:43 +0100 Subject: [PATCH] codec: derive column groups from generation sequence Not specific to hardcoded image formats. --- codec-audio.inc.pl | 5 +++++ codec-image.inc.pl | 9 +++++++++ codec.plp | 16 +++++++++++----- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/codec-audio.inc.pl b/codec-audio.inc.pl index 5bd336d..4d14f9b 100644 --- a/codec-audio.inc.pl +++ b/codec-audio.inc.pl @@ -4,22 +4,27 @@ codec => { mp3 => { name => 'MP3', available => 1991, + generation => 0, }, vorbis => { name => 'Vorbis', available => 2000, + generation => 1, }, opus => { name => 'Opus', available => 2012, + generation => 1, }, aac => { name => 'AAC', available => 1997, + generation => 1, }, atrac => { name => 'ATRAC', available => 1992, + generation => 0, }, }, feature => { diff --git a/codec-image.inc.pl b/codec-image.inc.pl index 92e17d5..f9a544c 100644 --- a/codec-image.inc.pl +++ b/codec-image.inc.pl @@ -4,38 +4,47 @@ codec => { jpeg => { name => 'JPEG', available => 1992, + generation => 0, }, gif => { name => 'GIF', available => 1987, + generation => 0, }, png => { name => 'PNG', available => 1996, + generation => 1, }, jp2k => { name => 'JPEG 2000', available => 2000, + generation => 1, }, webp => { name => 'WebP', available => 2010, + generation => 1, }, heic => { name => 'HEIC', available => 2015, + generation => 2, }, avif => { name => 'AVIF', available => 2019, + generation => 2, }, jxl => { name => 'JPEG XL', available => 2021, + generation => 2, }, pnm => { name => 'PNM', available => 1988, + generation => 0, }, }, feature => { diff --git a/codec.plp b/codec.plp index b2c3407..4251df9 100644 --- a/codec.plp +++ b/codec.plp @@ -31,16 +31,22 @@ my %BOOLSCORE = (y => [5, '✔'], n => [1, '✘'], 0 => [0, 'n/a']);
- -"; -print ''; + my @spans; + $spans[ $_->{generation} ]++ for @codeccols; + print "" for @spans; +} +say ''; +print ''; while (defined (my $feat = shift @feat)) { -- 2.30.0
feature <: my @codecs = sort { $info->{codec}->{$a}->{available} <=> $info->{codec}->{$b}->{available} } keys $info->{codec}->%*; +my @codeccols = @{$info->{codec}}{@codecs}; -print '', $_->{name} for @{$info->{codec}}{@codecs}; -print "\n
', $_->{available} for @{$info->{codec}}{@codecs}; +{ + print '
'; +say "\t", '', $_->{name} for @codeccols; +print '
', $_->{available} for @codeccols; say '