Bug reading gray PNG

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug reading gray PNG

Javier Diaz-Reinoso
Fail with a 217x125 gray PNG in PNGReadWriter>>copyPixelsGray:, reverting to the previous version works.

Reply | Threaded
Open this post in threaded view
|

Re: Bug reading gray PNG

Andreas.Raab
On 1/6/2011 10:53 PM, Javier Díaz Reinoso wrote:
> Fail with a 217x125 gray PNG in PNGReadWriter>>copyPixelsGray:, reverting to the previous version works.

Can you share the file you're using? Even better, write a test that
illustrates the failure?

Thanks,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Bug reading gray PNG

Javier Diaz-Reinoso
On 06/01/2011, at 17:02, Andreas Raab wrote:

> On 1/6/2011 10:53 PM, Javier Díaz Reinoso wrote:
>> Fail with a 217x125 gray PNG in PNGReadWriter>>copyPixelsGray:, reverting to the previous version works.
>
> Can you share the file you're using? Even better, write a test that illustrates the failure?
>
> Thanks,
>  - Andreas
>
Is not the image, is bad aritmethic, try with thisScanline -> 217:

> 0 to: thisScanline size - 1 // 4 do: [ :i |
> | ii word |
> ii := i * 4.
> "This somewhat weird mixture of (#* and #+) with (#bitShift: and #bitOr:)
> is to make use of faster arithmetic bytecodes, but not of slow largeintegers."
> word :=
> (((thisScanline at: ii + 1) * 256 +
> (thisScanline at: ii + 2) * 256 +
> (thisScanline at: ii + 3)) bitShift: 8) bitOr:
> (thisScanline at: ii + 4). <======

Reply | Threaded
Open this post in threaded view
|

Re: Bug reading gray PNG

Andreas.Raab
On 1/6/2011 11:20 PM, Javier Díaz Reinoso wrote:

> On 06/01/2011, at 17:02, Andreas Raab wrote:
>
>> On 1/6/2011 10:53 PM, Javier Díaz Reinoso wrote:
>>> Fail with a 217x125 gray PNG in PNGReadWriter>>copyPixelsGray:, reverting to the previous version works.
>>
>> Can you share the file you're using? Even better, write a test that illustrates the failure?
>>
>> Thanks,
>>   - Andreas
>>
> Is not the image, is bad aritmethic, try with thisScanline ->  217:

But do you have an example PNG file that causes the problem to happen?
I'm sure the issue it's obvious to you but it's not for me.

Cheers,
   - Andreas

>> 0 to: thisScanline size - 1 // 4 do: [ :i |
>> | ii word |
>> ii := i * 4.
>> "This somewhat weird mixture of (#* and #+) with (#bitShift: and #bitOr:)
>> is to make use of faster arithmetic bytecodes, but not of slow largeintegers."
>> word :=
>> (((thisScanline at: ii + 1) * 256 +
>> (thisScanline at: ii + 2) * 256 +
>> (thisScanline at: ii + 3)) bitShift: 8) bitOr:
>> (thisScanline at: ii + 4).<======
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Bug reading gray PNG

Javier Diaz-Reinoso
Sorry , I am attaching the image (gray, 8 bits with palette, non interlaced):


On 07/01/2011, at 03:27, Andreas Raab wrote:

> On 1/6/2011 11:20 PM, Javier Díaz Reinoso wrote:
>> On 06/01/2011, at 17:02, Andreas Raab wrote:
>>
>>> On 1/6/2011 10:53 PM, Javier Díaz Reinoso wrote:
>>>> Fail with a 217x125 gray PNG in PNGReadWriter>>copyPixelsGray:, reverting to the previous version works.
>>>
>>> Can you share the file you're using? Even better, write a test that illustrates the failure?
>>>
>>> Thanks,
>>>  - Andreas
>>>
>> Is not the image, is bad aritmethic, try with thisScanline ->  217:
>
> But do you have an example PNG file that causes the problem to happen? I'm sure the issue it's obvious to you but it's not for me.
>
> Cheers,
>  - Andreas
>
>>> 0 to: thisScanline size - 1 // 4 do: [ :i |
>>> | ii word |
>>> ii := i * 4.
>>> "This somewhat weird mixture of (#* and #+) with (#bitShift: and #bitOr:)
>>> is to make use of faster arithmetic bytecodes, but not of slow largeintegers."
>>> word :=
>>> (((thisScanline at: ii + 1) * 256 +
>>> (thisScanline at: ii + 2) * 256 +
>>> (thisScanline at: ii + 3)) bitShift: 8) bitOr:
>>> (thisScanline at: ii + 4).<======
>>
>>
>
>



00666.png.zip (22K) Download Attachment