Bug 48696 - [PATCH] AFP rendering of bitmap images broke between revs 829021 and 829061
Summary: [PATCH] AFP rendering of bitmap images broke between revs 829021 and 829061
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: images (show other bugs)
Version: trunk
Hardware: PC Linux
: P2 major
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-08 04:02 UTC by Peter Hancock
Modified: 2012-03-28 06:30 UTC (History)
0 users



Attachments
example of bug (239.61 KB, application/zip)
2010-02-08 04:11 UTC, Peter Hancock
Details
Quick fix (634 bytes, patch)
2010-02-09 03:52 UTC, Peter Hancock
Details | Diff
A fix (1.65 KB, patch)
2010-02-11 11:45 UTC, Peter Hancock
Details | Diff
A revised fix (1.92 KB, patch)
2010-04-16 10:05 UTC, Peter Hancock
Details | Diff
patch against trunk@1051874 (1.71 KB, patch)
2010-12-23 05:39 UTC, Peter Hancock
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Hancock 2010-02-08 04:02:56 UTC
This bug manifests when printing.

Attached are afps generated at rev 829021 (ok) and rev 829061 (broken).
The jpgs show scans of the printed output and an error message printed for rev 829061.

The resources used to generate the documents are also attached.

Note that changes were made to the Xml Graphics Commons library at the same time.
Comment 1 Peter Hancock 2010-02-08 04:11:35 UTC
Created attachment 24938 [details]
example of bug
Comment 2 Harald G. Henne 2010-02-08 06:04:25 UTC
Hi,

there is only a small diff between 829021 and 829061
and the resuling print out depends on some printer characteristic.

                   |829021   |829061
-------------------+---------+-------------------------------------------+
IBM Infoprint IP70 | OK      | 0420-486 either not valid or not supported|
OCE printer        | OK      | OK                                        | 
                   |         |                                           | 
IBM workbench      | OK      | OK                                        | ver 2.05.04.01
BTB Afp Browser    | no image| OK                                        | ver 1.30
ISIS plugin        | no image| no image                                  | ISIS Papyrus AFP Viewer V.7.01/w3

Both writes out a IOCA function set 11 image and 829061 write out an
additional 0x9B IDE Structure parameter. 

        0x9B: IDE Structure parameter [6]
              Flags:    0x00 (- Additive)
                             (- Gray Coding: off)
              Format:   0x01 (RGB)
              Reserved: 00 00 00 
              Size1:    0x08 (8)
              
Accouding to ioca_S550-1142-00.pdf the only valid format bytes for
IDESZ=8 is 
   X'02' YCrCb (see Note 2) 
   X'12' YCbCr (see Note 2)
Note 2:
   Notes on parameters used when IDESZ=4 or IDESZ=8:
   Grayscale images only. Grayscale IDEs are composed of the Y component only of the YCrCb or YCbCr color model.
   

--
dump of revison 829061:
  0xD3A8CE: BR Begin Resource [20] (Offset ???)
            "RES00002"
            Reserved: 00 00 
            T21: Resource Object Type (R) [8]
                 ObjType:    0x06 (Image (IOCA) object (retired))
                 ConData:    00 00 00 00 00 00 00 
    {
    0xD3A8FB: BIM Begin Image Object [8] (Offset ???)
              "IMG00002"
      {
      0xD3A8C7: BOG Begin Object Environment Group [8] (Offset ???)
                "OEG00002"
        {
        0xD3A66B: OBD Object Area Descriptor [20] (Offset ???)
                  T43: Descriptor Position [1]
                       DesPosID:   0x01 (1)
                  T4B: Object Area Measurement Units [6]
                       XoaBase:    0x00 (10 inches)
                       YoaBase:    0x00 (10 inches)
                       XoaUnits:   0x0960 (2400)
                       YoaUnits:   0x0960 (2400)
                  T4C: Object Area Size [7]
                       SizeType:   0x02 (2)
                       XoaSize:    0x0001E0 (480)
                       YoaSize:    0x0001E0 (480)
        0xD3AC6B: OBP Object Area Position [24] (Offset ???)
                  OAPosID:    0x01 (1)
                  RGLength:   0x17 (23)
                  XoaOSet:    0x000000 (0)
                  YoaOSet:    0x000000 (0)
                  XoaOrent:   0x0000 (0 degree)
                  YoaOrent:   0x2D00 (90 degree)
                  Reserved:   00 
                  XocaOSet:   0x000000 (0)
                  YocaOSet:   0x000000 (0)
                  XocaOrent:  0x0000 (0 degree)
                  YocaOrent:  0x2D00 (90 degree)
                  RefCSys:    0x00 (origin defined by IPS)
        0xD3ABFB: MIO Map IO Image Object [5] (Offset ???)
                  000 RGLength: 0x0005 (5)
                      T04: Mapping Option [1]
                           MapValue:   0x60 (Scale to Fill)
        0xD3A6FB: IDD Image Data Descriptor IO [13] (Offset ???)
                  UnitBase:   0x00 (10 inches)
                  XResol:     0x02D0 (720)
                  YResol:     0x02D0 (720)
                  XSize:      0x0258 (600)
                  YSize:      0x0258 (600)
                  0xF7: IOCA Function Set Identification [2]
                        Category:   0x01 (Function Set identifier)
                        FcnSet:     0x0B (11)
        }
      0xD3A9C7: EOG End Object Environment Group [8] (Offset ???)
                "OEG00002"
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [8192] (Offset ???)
      0xD3EEFB: IPD Image Picture Data IO [7803] (Offset ???)
                IPD Image Picture Data IO [360059] (44 combined records)
        {
        0x70: Begin Segment [0]
        0x91: Begin Image Content [1]
              ObjType:  0xFF (IOCA Image Object)
        0x94: Image Size parameter [9]
              UnitBase: 0x00 (10 inches)
              HResol:   0x02D0 (720)
              VResol:   0x02D0 (720)
              HSize:    0x0258 (600)
              VSize:    0x0258 (600)
        0x95: Image Encoding parameter [2]
              CompID:   0x03 (No compression)
              RecID:    0x01 (RIDIC (Recording Image Data Inline Coding))
        0x96: IDE Size parameter [1]
              IDESize:  0x08 (8)
        0x9B: IDE Structure parameter [6]
              Flags:    0x00 (- Additive)
                             (- Gray Coding: off)
              Format:   0x01 (RGB)
              Reserved: 00 00 00 
              Size1:    0x08 (8)
        0x92: Image Data [65535]
              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
              ...
        0x92: Image Data [65535]
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              ...
        0x92: Image Data [65535]
              77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 
              77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 
              77 8B AC FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              ...
        0x92: Image Data [65535]
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              ...
        0x92: Image Data [65535]
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF FF FF FF FF FF FF FF 80 D0 D0 
              D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 
              D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 00 00 D0 D0 D0 
              ...
        0x92: Image Data [32325]
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
              FF FF FF FF FF FF 77 77 77 77 77 77 77 77 77 77 
              ...
        0x93: End Image Content [0]
        0x71: End Segment [0]
        }
      }
    0xD3A9FB: EIM End Image Object [8] (Offset ???)
              "IMG00002"
    }
  0xD3A9CE: ER End Resource [8] (Offset ???)
            "RES00002"
Comment 3 Harald G. Henne 2010-02-08 06:07:07 UTC
sorry the table was messed up:

printer and viewer test

                   |829021   |829061
-------------------+---------+-------------------------------------------+
IBM Infoprint IP70 | OK      | 0420-486 either not valid or not supported|
OCE printer        | OK      | OK                                        |
                   |         |                                           |
IBM workbench      | OK      | OK                                        |
BTB Afp Browser    | no image| OK                                        |
ISIS plugin        | no image| no image                                  |

IBM workbench ver 2.05.04.01
BTB Afp Browser v 1.30
ISIS Papyrus AFP Viewer V.7.01/w3
Comment 4 Harald G. Henne 2010-02-08 06:29:43 UTC
Function Set 20 allows using FORMAT X'01' RGB, but my printtest 
with a IBM Infoprint IP70 results in the same error:

0420-486: ERROR The actual destiantion reported an OCA self-defining field
          code taht is either not valid or not supported.
          
Unfortunately i do not have a list of all supported 'Function Sets'
of my IP70 or any other printer. Maybe someone of the mailing list
afp-l@topica.com have such information.
Comment 5 Peter Hancock 2010-02-08 08:34:50 UTC
Thanks for your input, Harald.

Chaging the Format field of the IDE Structure parameter to YCrCb, produced a desirable printed output.  The IDEStructureParameter class defaults this property to RGB, and it is not set by the process for b+w color images.
Comment 6 Peter Hancock 2010-02-09 03:52:18 UTC
Created attachment 24951 [details]
Quick fix
Comment 7 Jeremias Maerki 2010-02-10 00:55:31 UTC
Verified and commited. Thanks, Peter.
http://svn.apache.org/viewvc?rev=908394&view=rev

BTW, while testing I found that the JPG in the demo ZIP, when encoded in RGB mode, comes out wrong (PNG is fine). I don't have time to look more closely at this right now.
Comment 8 Peter Hancock 2010-02-11 11:35:53 UTC
The commited fix breaks other functionality
Comment 9 Peter Hancock 2010-02-11 11:45:50 UTC
Created attachment 24970 [details]
A fix

The previous commited fix broke the printing of color images.
Comment 10 Peter Hancock 2010-03-22 10:54:17 UTC
Could a commiter please review the proposed amendments  to commit 908394 in attachment  24970 [details].  Commit 24970 introduced a bug.
Comment 11 Peter Hancock 2010-04-16 10:05:53 UTC
Created attachment 25308 [details]
A revised fix
Comment 12 Peter Hancock 2010-12-23 05:39:49 UTC
Created attachment 26443 [details]
patch against trunk@1051874

Differences fro mprevious patch:
No IDEStructureParameter for a YCBCR color model is required for 1 bit/pixel b+w images
The Subtactive IDEStructureParameter should only be set on subtractive images with bit/pixel > 1
Comment 13 Peter Hancock 2011-09-28 09:16:04 UTC
Final patch committed in http://svn.apache.org/viewvc?rev=1175808&view=rev