From b17a9ad82ae61ea62bd6008df10c12594bc52def Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 3 Apr 2024 21:55:42 -0700 Subject: [PATCH] Tests/JBIG2: Add test cases for custom adaptive template pixels I manually wrote a bunch of .ini files and ran this script to produce the files: #!/bin/bash set -eu J=$HOME/Downloads/T-REC-T.88-201808-I\!\!SOFT-ZST-E/Software J=$J/JBIG2_SampleSoftware-A20180829/source/jbig2 for t in '' template1- template2- template3-; do for p in '' '-tpgdon'; do i=${t}customat$p echo $i.ini cat $i.ini $J -i Tests/LibGfx/test-inputs/bmp/bitmap -f bmp -o bitmap-$i \ -F jb2 -ini $i.ini cp bitmap-$i.jb2 Tests/LibGfx/test-inputs/jbig2/bitmap-$i.jbig2 done done The script's output (which shows the .ini file contents) was: ``` % ./make-custom-at.sh customat.ini -Gen -Seg 1 -Gen -Param -ATX1 -4 -Gen -Param -ATY1 -5 -Gen -Param -ATX2 6 -Gen -Param -ATY2 -7 -Gen -Param -ATX3 -8 -Gen -Param -ATY3 -9 -Gen -Param -ATX4 10 -Gen -Param -ATY4 -11 ENC Start ===>complete customat-tpgdon.ini -Gen -Seg 1 -Gen -Param -ATX1 -4 -Gen -Param -ATY1 -5 -Gen -Param -ATX2 6 -Gen -Param -ATY2 -7 -Gen -Param -ATX3 -8 -Gen -Param -ATY3 -9 -Gen -Param -ATX4 10 -Gen -Param -ATY4 -11 -Gen -Param -TpGDon 1 ENC Start ===>complete template1-customat.ini -Gen -Seg 1 -Gen -Param -Template 1 -Gen -Param -ATX1 17 -Gen -Param -ATY1 -2 ENC Start ===>complete template1-customat-tpgdon.ini -Gen -Seg 1 -Gen -Param -Template 1 -Gen -Param -ATX1 17 -Gen -Param -ATY1 -2 -Gen -Param -TpGDon 1 ENC Start ===>complete template2-customat.ini -Gen -Seg 1 -Gen -Param -Template 2 -Gen -Param -ATX1 17 -Gen -Param -ATY1 -2 ENC Start ===>complete template2-customat-tpgdon.ini -Gen -Seg 1 -Gen -Param -Template 2 -Gen -Param -ATX1 17 -Gen -Param -ATY1 -2 -Gen -Param -TpGDon 1 ENC Start ===>complete template3-customat.ini -Gen -Seg 1 -Gen -Param -Template 3 -Gen -Param -ATX1 17 -Gen -Param -ATY1 -2 ENC Start ===>complete template3-customat-tpgdon.ini -Gen -Seg 1 -Gen -Param -Template 3 -Gen -Param -ATX1 17 -Gen -Param -ATY1 -2 -Gen -Param -TpGDon 1 ENC Start ===>complete ``` --- Tests/LibGfx/TestImageDecoder.cpp | 8 ++++++++ .../jbig2/bitmap-customat-tpgdon.jbig2 | Bin 0 -> 343 bytes .../test-inputs/jbig2/bitmap-customat.jbig2 | Bin 0 -> 337 bytes .../jbig2/bitmap-template1-customat-tpgdon.jbig2 | Bin 0 -> 306 bytes .../jbig2/bitmap-template1-customat.jbig2 | Bin 0 -> 301 bytes .../jbig2/bitmap-template2-customat-tpgdon.jbig2 | Bin 0 -> 351 bytes .../jbig2/bitmap-template2-customat.jbig2 | Bin 0 -> 341 bytes .../jbig2/bitmap-template3-customat-tpgdon.jbig2 | Bin 0 -> 365 bytes .../jbig2/bitmap-template3-customat.jbig2 | Bin 0 -> 356 bytes 9 files changed, 8 insertions(+) create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-customat-tpgdon.jbig2 create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-customat.jbig2 create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-template1-customat-tpgdon.jbig2 create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-template1-customat.jbig2 create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-template2-customat-tpgdon.jbig2 create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-template2-customat.jbig2 create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-template3-customat-tpgdon.jbig2 create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-template3-customat.jbig2 diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index b4968c5bdd..3a1a8361bf 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -356,13 +356,21 @@ TEST_CASE(test_jbig2_decode) Array test_inputs = { TEST_INPUT("jbig2/bitmap.jbig2"sv), + TEST_INPUT("jbig2/bitmap-customat.jbig2"sv), TEST_INPUT("jbig2/bitmap-tpgdon.jbig2"sv), + TEST_INPUT("jbig2/bitmap-customat-tpgdon.jbig2"sv), TEST_INPUT("jbig2/bitmap-template1.jbig2"sv), + TEST_INPUT("jbig2/bitmap-template1-customat.jbig2"sv), TEST_INPUT("jbig2/bitmap-template1-tpgdon.jbig2"sv), + TEST_INPUT("jbig2/bitmap-template1-customat-tpgdon.jbig2"sv), TEST_INPUT("jbig2/bitmap-template2.jbig2"sv), + TEST_INPUT("jbig2/bitmap-template2-customat.jbig2"sv), TEST_INPUT("jbig2/bitmap-template2-tpgdon.jbig2"sv), + TEST_INPUT("jbig2/bitmap-template2-customat-tpgdon.jbig2"sv), TEST_INPUT("jbig2/bitmap-template3.jbig2"sv), + TEST_INPUT("jbig2/bitmap-template3-customat.jbig2"sv), TEST_INPUT("jbig2/bitmap-template3-tpgdon.jbig2"sv), + TEST_INPUT("jbig2/bitmap-template3-customat-tpgdon.jbig2"sv), TEST_INPUT("jbig2/bitmap-symbol.jbig2"sv), TEST_INPUT("jbig2/bitmap-symbol-textrefine.jbig2"sv), TEST_INPUT("jbig2/bitmap-symbol-symbolrefine.jbig2"sv), diff --git a/Tests/LibGfx/test-inputs/jbig2/bitmap-customat-tpgdon.jbig2 b/Tests/LibGfx/test-inputs/jbig2/bitmap-customat-tpgdon.jbig2 new file mode 100644 index 0000000000000000000000000000000000000000..3f13e74b9288c0684fb9aea6cbf017b953b083e6 GIT binary patch literal 343 zcmbR4o$Kqi zgDK0hOfMe)7Vq|t`9`GC`$aY{I(sV@^fOz;ZL{NOm-E~Ger`I$vP&mA;&}f@wr`$s zkX2GlXvHzc_)|5nMb@0m{-bhsk6lTYLFA8nVx|FGDbzgF`(lu7=6X^?O zS5Hu2&t`k~!I|}Zyx~NBc}(D}OaD?MW}o1yVYyxu!P<7y zgf-MoSyXAO+)~4ZyjQ25*#AyU=E;_rC%viin$H6*?yX9=>C?RTiqn*rZvKgKb49Kw zKXXWGypn5HStPIUcFnIfKOe2o?y%f3?U%}074FiS^xk5 literal 0 HcmV?d00001 diff --git a/Tests/LibGfx/test-inputs/jbig2/bitmap-customat.jbig2 b/Tests/LibGfx/test-inputs/jbig2/bitmap-customat.jbig2 new file mode 100644 index 0000000000000000000000000000000000000000..c110f70ce66f95f330cc26e327b1a2dcd9fa659e GIT binary patch literal 337 zcmbR4o$KrB zZ_)buuj$rR=dU$8m2hY8Wb>UyKW}Ju*G|9nc}tn(B;nOD)<)&BNpVpRUT(P76_;To zn~?4=kt7WbG(+&HjO zw8OW)?O)Fxx#dT~zWJpcSGZ#To!2vA-ra6vn_Z^_?(y34MVIk)=dLPTdb+Xg{@3g0 zzIE~0OgP6~xHOQxgyZJ6RWDtl3vNWEt-YZr7GJL1lAkDZd7b6Sa7W9qWoQ4_{{aRN IlOZIG0H4`}1^@s6 literal 0 HcmV?d00001 diff --git a/Tests/LibGfx/test-inputs/jbig2/bitmap-template1-customat-tpgdon.jbig2 b/Tests/LibGfx/test-inputs/jbig2/bitmap-template1-customat-tpgdon.jbig2 new file mode 100644 index 0000000000000000000000000000000000000000..4d3047a892762cc9aee72d42e43d07e5f3b8ff8b GIT binary patch literal 306 zcmbR4k^>NE0hI4HHcHEdy==(ADjq&=^ zWqL*ad6UX_iN`3Z;JvCYeF=-8#zDXJXqi;es?f9c|Ed9hty<})<@hx(|h zX3sQslv#6Z%F?G-eqFeHgjYWD!uv15Jj!?6_nz;O?GJsoRzH8%1gYiD5#cU!j!!I{ zWn?Cy0 V3A-Y-_E>FMZ~q_Yc_u@M{{eSfZ%F_E literal 0 HcmV?d00001 diff --git a/Tests/LibGfx/test-inputs/jbig2/bitmap-template2-customat-tpgdon.jbig2 b/Tests/LibGfx/test-inputs/jbig2/bitmap-template2-customat-tpgdon.jbig2 new file mode 100644 index 0000000000000000000000000000000000000000..f2635f42065a25de082854a46bc5b64f35adeb72 GIT binary patch literal 351 zcmbR4%jM=ceLPvh+#3Aq=JBkb#V6NvWiUm?MZUOj*z4Ze`W=(+)NqDRV_dX)?UqE& z?XyMC@xMK=I>NI=FmZC6Sy+728~5HN$(y3~CAKtgc=CPMqN%@kz7YC;Y`40kO0xXj z#*@q5E`I)b*V)}$a#~us_a(PWlrA!xE3rO1_~G@5(|o=^-T!FI2DUw)OxG{-kjw3v z%r2G3#=g|_Yk{dWOUZV2BQ3F%WheHokYe}0qjdNM!{VqDKW$epy2d``xWc@?viWIG zHQ3WbO-r9j-_<$Bwr8f)dx>-RX0P+9dA{J`gvc3^JVJ5zHtuQn`*i8^oK>O)q06I6 ao=0zQdcg8H-0RMXi}(KngNw-!5@G--P?2H) literal 0 HcmV?d00001 diff --git a/Tests/LibGfx/test-inputs/jbig2/bitmap-template2-customat.jbig2 b/Tests/LibGfx/test-inputs/jbig2/bitmap-template2-customat.jbig2 new file mode 100644 index 0000000000000000000000000000000000000000..935421ba1ac60c0c501f771520b79ac063157583 GIT binary patch literal 341 zcmbR4Fk6-CT=GUeC5?%nDwtIpM;sP~(-Rf8!2)-m$aGIA}#& z`$E-QFV`MC^Xh6%R?W5M7dfZwWEEOuk~Yu&nt57=?Vi!JySr9iD&4cK`S{!)X5TkF zRe!*fYko+5{=bu~|227cIohmZT;TR;fziY(I=^pcUKDAIuDi|^v!ZPx`@_o(W?S5@ z)qN~nu;tkHNgce+xttk_YDUj5#OFh4gcATH{)mA9 literal 0 HcmV?d00001 diff --git a/Tests/LibGfx/test-inputs/jbig2/bitmap-template3-customat-tpgdon.jbig2 b/Tests/LibGfx/test-inputs/jbig2/bitmap-template3-customat-tpgdon.jbig2 new file mode 100644 index 0000000000000000000000000000000000000000..85c0f3e0682f14f8c27f70ca5f66d6bd597c6722 GIT binary patch literal 365 zcmbR4wjE4amSuX; zD@pctc?h?n$@4(Z^x%ClXE(;CKCc&y_tx;LjegO!_4k~Hx#_B#t=k{xZh5*d>CGBT z{)qT!$=8m3vxB!Rb*xQVr!+UA;8)wO*pfLniwpStFMZr_)586akFolX%F7d@dUJ0z z{@q`k+rHjoDQnfy;|lIOY;PI=@;XtoO765oaOS+f%Y#22x5~_ZBcxPRbK?EFf6pC5 zU6T~-UdI+0=$#EHzIekm=w)!mowaIzqD~%QUc)%=p53G^iK}l`Px~k>6{f z7gkDj?o4xdPOs+M5UBs*4PVOg6g$7`v3sM+gfFMpJ!I^-y?^@pxpNLKzaNq{H|ok{ n-Ll;>9PjR3tbVeAZ_nqORbC1YIG!kXZM6Rn3_K=7NcaH&uxON} literal 0 HcmV?d00001 diff --git a/Tests/LibGfx/test-inputs/jbig2/bitmap-template3-customat.jbig2 b/Tests/LibGfx/test-inputs/jbig2/bitmap-template3-customat.jbig2 new file mode 100644 index 0000000000000000000000000000000000000000..c3c0a6118022a73dbde3bbd8f1e07d6f2bdc093d GIT binary patch literal 356 zcmbR4~yXkylR%k(cVG7tB}%~rk{?{?%z_dLX8T9>JBqVHdvk^bhA+$r;~+uO2v9k&|Ksdqb}CBW4` z;n6O8HV?;}2ih&W>nBT0dFJ`U>%zkd^UCw>&sXSV&02ZH)@@n3jHA?~r$4q{VO!6b z%4Kmd%6zX}^{S$&|M}Mc*uMPM>-hggy*K8Wtqqx;>+mGPM8|CQ*-O`s>l*9ZR=yW~ zb?L^-)ECkhZiOw`ytMz`+mL75)z1aZ@!q&MjjcH?!K=WUotNjL|Lr%`0+*B6q}96T e9K06hy|7q*nT1#Hg|3JHZWaFrh8dF~B-j9~JCthx literal 0 HcmV?d00001