Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4944464
Votes 0
Synopsis Convolution using mediaLib returns a blank image
Category jai:medialib
Reported Against 1.1.2
Release Fixed 1.1.3-beta
State 10-Fix Delivered, Needs Verification, bug
Priority: 2-High
Related Bugs
Submit Date 28-OCT-2003
Description
Convolution using mediaLib returns a blank image.
Work Around
N/A
Evaluation
  xxxxx@xxxxx   2003-10-27
I could reproduce the problem on WinNT with both C and MMX versions of
mediaLib.  No problem was seen on Solaris (C/VIS/x86) or Linux.  I am
sending the test case to MCST for further investigation.

--- BEGIN ---   xxxxx@xxxxx   2003-10-29

The MCST team pointed out that the problem actually shows up on all
platforms when mediaLib is available.  And they saw the following
abnormality in the printouts of a debugging version of mediaLib wrapper:

For 5x4 kernel JAI called mlib_ImageConvKernelConvert once and then
mlib_ImageConvMxN 9 times.  But for 4x4 kernel JAI called
mlib_ImageSConvKernelConvert once and no other mediaLib function
calls (mlib_ImageConv4x4 or mlib_ImageConvMxN, for example).

Then as MCST team suggested, I went to look at JAI's code for convolution
parameters analysis.  Here is what I saw in MlibConvolveRIF.java

        if (kJAI.isSeparable() &&
            kWidth >= 3 && kWidth <= 7 &&  kWidth == kHeight) {
            return new MlibSeparableConvolveOpImage(source,

and in MlibSeparableConvolveOpImage.java

                switch (kw) {
                case 3:
                     Image.SConv3x3(dstML[i],
                         srcML[i], hIntData, vIntData, shift,
                         ((1 << numBands)-1) ,
                         Constants.MLIB_EDGE_DST_NO_WRITE);
                    break;
                case 5:
                     Image.SConv5x5(dstML[i],
                         srcML[i], hIntData, vIntData, shift,
                         ((1 << numBands)-1) ,
                         Constants.MLIB_EDGE_DST_NO_WRITE);
                    break;
                case 7:
                     Image.SConv7x7(dstML[i],
                         srcML[i], hIntData, vIntData, shift, 
                         ((1 << numBands)-1) ,
                         Constants.MLIB_EDGE_DST_NO_WRITE);
                    break;
                }

It seems to me that cases like 4x4 and 6x6 are not covered here.
A default branch is needed.

I am recategorizing this bug to "implementation".

--- END ---   xxxxx@xxxxx   2003-10-29

--- BEGIN ---   xxxxx@xxxxx   2004-06-01

As pointed out, MlibConvolveRIF.java contained incorrect logic, which was causing some kernel sizes to simply fall through without any medialib function being called to do the convolution, thus producing the blank image. The logic in MlibConvolveRIF.java has now been fixed, and the 4x4 case falls to MlibConvolveNxNOpImage, which no longer produces a blank image. However the 4x4 case produces an image with a horizontal black line running through the image very close to the topmost edge. The 5x4 case does not show this, nor does the pure Java implementation for 4x4, therefore re-categorizing the bug to "medialib"

--- END ---   xxxxx@xxxxx   2004-06-01

  xxxxx@xxxxx   2004-06-03
Indeed, there is a problem in Conv4x4 when the destination image is smaller
than the source image.  See Comments for details.

The problem in Conv4x4 and other similar functions were due to a center-to-center
mapping used when the dst image is smaller than the src image.  Now the mapping
has been changed to that the upper-left pixel of the dst image is backward mapped
to the first pixel from the upper-left corner which has enough neighbor pixels
for the operation.  The fix was integrated in the 20050215 build of mlib4jai for
JAI-1.1.3-alpha.  In the meantime, the fix on the Java side has been integrated
into the jai-core.dev.java.net workspace.
Posted Date : 2005-08-16 00:55:51.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang