Tests/LibGfx: Add a jbig2 file using refinement in the text segment

This adds a test for the code added in #23696.

I created this file using `jbig2` (see below for details), but as
usual it required a bunch of changes to it to make it actually produce
spec-compliant output. See the PR adding this image for my local diff.

I created the test image file by running this shell script with
`jbig2` tweaked as described above:

    #!/bin/bash
    set -eu

    S=Tests/LibGfx/test-inputs/bmp/bitmap.bmp

    # See make-symbol-jbig.sh (the script in #23659) for the general
    # setup and some comments. Note that the symbol section here only
    # has 3 symbols, instead of 4 over there.
    #
    # `-RefID` takes 6 arguments:
    # 1. The symbol ID of the base symbol (like after an `-ID`)
    # 2. A bmp file that the base symbol gets refined to
    # 3. y, x (like after an `-ID`)
    # 4. dx, dy (note swapped order to previous item)
    #
    # We also explicitly set refinement adaptive pixels, because the
    # default adaptive refinement pixels aren't the nominal pixels from
    # the spec.

    cat << EOF > jbig2-symbol-textrefine.ini
    -sym -Seg 1
    -sym -file -numClass -HeightClass 3 -WidthClass 1
    -sym -file -numSymbol 3
    -sym -file -Height 250
    -sym -file -Width 120 -Simple 0 mouth-1bpp.bmp
    -sym -file -EndOfHeightClass
    -sym -file -Height 100
    -sym -file -Width 100 -Simple 1 nose-1bpp.bmp
    -sym -file -EndOfHeightClass
    -sym -file -Height 30
    -sym -file -Width 30 -Simple 2 top_eye-1bpp.bmp
    -sym -file -EndOfHeightClass
    -sym -Param -Huff_DH 0
    -sym -Param -Huff_DW 0

    -txt -Seg 2
    -txt -Param -numInst 4
        -ID 2 108 50 -RefID 2 bottom_eye-1bpp.bmp 265 60 0 0
        -ID 1 100 135 -ID 0 70 232
    -txt -Param -RefCorner 1
    -txt -Param -Xlocation 0
    -txt -Param -Ylocation 0
    -txt -Param -W 399
    -txt -Param -H 400
    -txt -Param -rATX1 -1
    -txt -Param -rATY1 -1
    -txt -Param -rATX2 -1
    -txt -Param -rATY2 -1
    EOF

    J=$HOME/Downloads/T-REC-T.88-201808-I\!\!SOFT-ZST-E/Software
    J=$J/JBIG2_SampleSoftware-A20180829/source/jbig2

    $J -i "${S%.bmp}" -f bmp -o symbol-textrefine -F jb2 -ini \
        jbig2-symbol-textrefine.ini
This commit is contained in:
Nico Weber 2024-03-25 08:39:44 -04:00 committed by Tim Flynn
parent 3b2f4a4041
commit 1e31753382
Notes: sideshowbarker 2024-07-17 18:46:30 +09:00
2 changed files with 1 additions and 0 deletions

View File

@ -363,6 +363,7 @@ TEST_CASE(test_jbig2_decode)
TEST_INPUT("jbig2/bitmap-template3.jbig2"sv),
TEST_INPUT("jbig2/bitmap-template3-tpgdon.jbig2"sv),
TEST_INPUT("jbig2/bitmap-symbol.jbig2"sv),
TEST_INPUT("jbig2/bitmap-symbol-textrefine.jbig2"sv),
};
for (auto test_input : test_inputs) {