You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Maruan Sahyoun (Jira)" <ji...@apache.org> on 2026/04/16 14:42:00 UTC
[jira] [Comment Edited] (PDFBOX-6155) AT (Adaptive template pixels) -1 byte skipped
[ https://issues.apache.org/jira/browse/PDFBOX-6155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18074016#comment-18074016 ]
Maruan Sahyoun edited comment on PDFBOX-6155 at 4/16/26 2:41 PM:
-----------------------------------------------------------------
[~tilman] I changed GenericRefinementRegion.updateOverride() to
{code}
case 0:
if (grAtX[0] != -1 || grAtY[0] != -1)
{
grAtOverride[0] = true;
override = true;
}
if (grAtX[1] != -1 || grAtY[1] != -1)
{
grAtOverride[1] = true;
override = true;
}
break;
{code}
as I think the {{&&}} was wrong here as if I'm not mistaken it's about the AT not being in it's default position. Now excluding {{bitmap-symbol-textrefine-customat.jbig2}} from the ignores
{code}
if (name.equals("bitmap-refine-template1-tpgron.jbig2") ||
name.equals("bitmap-symbol-context-reuse.jbig2") ||
name.equals("bitmap-symbol-symhuffrefine-textrefine.jbig2")) // ||
// name.equals("bitmap-symbol-textrefine-customat.jbig2"))
{
{code}
the tests still pass - WDYT?
was (Author: msahyoun):
[~tilman] I changed GenericRefinementRegion.updateOverride() to
{code}
case 0:
if (grAtX[0] != -1 || grAtY[0] != -1)
{
grAtOverride[0] = true;
override = true;
}
if (grAtX[1] != -1 || grAtY[1] != -1)
{
grAtOverride[1] = true;
override = true;
}
break;
{code}
as I think the {{&&}} was wrong here. Now excluding {{bitmap-symbol-textrefine-customat.jbig2}} from the ignores
{code}
if (name.equals("bitmap-refine-template1-tpgron.jbig2") ||
name.equals("bitmap-symbol-context-reuse.jbig2") ||
name.equals("bitmap-symbol-symhuffrefine-textrefine.jbig2")) // ||
// name.equals("bitmap-symbol-textrefine-customat.jbig2"))
{
{code}
the tests still pass - WDYT?
> AT (Adaptive template pixels) -1 byte skipped
> ---------------------------------------------
>
> Key: PDFBOX-6155
> URL: https://issues.apache.org/jira/browse/PDFBOX-6155
> Project: PDFBox
> Issue Type: Sub-task
> Components: JBIG2
> Affects Versions: 3.0.4 JBIG2
> Reporter: Tilman Hausherr
> Assignee: Tilman Hausherr
> Priority: Major
> Attachments: bitmap-symbol-textrefine-customat.pdf, bitmap-symbol-textrefine-negative-delta-width.pdf, bitmap-symbol-textrefine.pdf
>
>
> bitmap-symbol-textrefine-customat.pdf has a garbled shape, however bitmap-symbol-textrefine.pdf doesn't. The difference is that the problematic one has 4 AT bytes.
> [https://github.com/SerenityOS/serenity/blob/master/Tests/LibGfx/test-inputs/jbig2/json/bitmap-symbol-textrefine-customat.json]
> {code:json}
> "refinement_adaptive_template_pixels": [
> 10,
> -1,
> 4,
> 15
> ],
> {code}
> After a lot of reading and searching and trying I was able to trace it to {{GenericRefinementRegion.updateOverride()}} which ignores AT bytes if they are -1. However the specification says no such thing:
> 6.3.5.3 Fixed templates and adaptive templates
> The AT pixel RA1 can be located anywhere in the field shown in Figure 7, not including the current pixel. The AT pixel
> RA2 can be located anywhere in the range (-128, -128) to (127, 127) in the reference bitmap.
> See also figure 7 earlier in the specification, which has (-1,-1) values.
> Just removing the two lines fixes the problem but ruins bitmap-symbol-textrefine-negative-delta-width.pdf, which has all -1 so I'll research that.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org