Monday, 6 July 2020

Re: possible bug: libnsgif does not handle DISPOSE_PREVIOUS correctly

Thank you Michael! It now renders that test case correctly, and runs
cleanly with valgrind.

I had a couple of other small ideas for improvements to libnsgif, if
changes are being made. I'd be happy to have a go at a patch if they
sound useful.

First, line 438 modifies the input buffer:

http://source.netsurf-browser.org/libnsgif.git/tree/src/libnsgif.c?id=8442a27c2bb8df48029ceea6e64c4930106a57fc#n438

This feels a bit ugly to me, and it doesn't work for us, since the
input buffer can be a mmaped file. I patched this to just return
GIF_INSUFFICIENT_FRAME_DATA.

Second, gif_decode_frame(gif, frame_number) seems like the wrong API.
You can only call this function with frame_number ascending, and you
must always start from 0 and loop, but this restriction is not obvious
from the function.

How about having frame_number as a member, and renaming it to
gif_decode_next_frame(gif)? It could handle looping too.

gif_decode_frame() could be marked as deprecated, and just call
gif_decode_next_frame() without using the frame_number parameter. It
should be compatible and the API would be simpler and clearer. I may
well have misunderstood things, of course.

John

On Mon, 6 Jul 2020 at 17:03, Michael Drake
<michael.drake@codethink.co.uk> wrote:
>
> On 06/07/2020 10:07, Michael Drake wrote:
> > On 04/07/2020 15:25, jcupitt@gmail.com wrote:
> >> On Fri, 3 Jul 2020 at 12:16, <jcupitt@gmail.com> wrote:
>
> >>> https://user-images.githubusercontent.com/580843/86457777-18bd1400-bd1c-11ea-923a-adeed2eba031.gif
>
> >>> Frame 6 is DISPOSE_PREVIOUS and should unpaint the tips of the wings.
>
> > Thanks for this! I hope to have a fix for you to test later today.
>
> Please try with this:
>
> http://source.netsurf-browser.org/libnsgif.git/commit/?id=8442a27c2bb8df48029ceea6e64c4930106a57fc
>
> Cheers,
>
> --
> Michael Drake https://www.codethink.co.uk/
> _______________________________________________
> netsurf-dev mailing list -- netsurf-dev@netsurf-browser.org
> To unsubscribe send an email to netsurf-dev-leave@netsurf-browser.org
_______________________________________________
netsurf-dev mailing list -- netsurf-dev@netsurf-browser.org
To unsubscribe send an email to netsurf-dev-leave@netsurf-browser.org

Re: possible bug: libnsgif does not handle DISPOSE_PREVIOUS correctly

On 06/07/2020 10:07, Michael Drake wrote:
> On 04/07/2020 15:25, jcupitt@gmail.com wrote:
>> On Fri, 3 Jul 2020 at 12:16, <jcupitt@gmail.com> wrote:

>>> https://user-images.githubusercontent.com/580843/86457777-18bd1400-bd1c-11ea-923a-adeed2eba031.gif

>>> Frame 6 is DISPOSE_PREVIOUS and should unpaint the tips of the wings.

> Thanks for this! I hope to have a fix for you to test later today.

Please try with this:

http://source.netsurf-browser.org/libnsgif.git/commit/?id=8442a27c2bb8df48029ceea6e64c4930106a57fc

Cheers,

--
Michael Drake https://www.codethink.co.uk/
_______________________________________________
netsurf-dev mailing list -- netsurf-dev@netsurf-browser.org
To unsubscribe send an email to netsurf-dev-leave@netsurf-browser.org

Re: possible bug: libnsgif does not handle DISPOSE_PREVIOUS correctly

On 04/07/2020 15:25, jcupitt@gmail.com wrote:
> On Fri, 3 Jul 2020 at 12:16, <jcupitt@gmail.com> wrote:
>> Thank you for libnsgif. I think I might have come across a gif that
>> fails to render correctly in libnsgif-0.2.1:
>>
>> https://user-images.githubusercontent.com/580843/86457777-18bd1400-bd1c-11ea-923a-adeed2eba031.gif
>>
>> Frame 6 is DISPOSE_PREVIOUS and should unpaint the tips of the wings.
>> libnsgif does not seem to handle this though, and the tips are left
>> behind.
>
> Hello again, I spent a little time looking at the code.
>
> tldr: I think GIFs which have a COMBINE frame followed by a RESTORE
> frame will not render correctly in libnsgif.

Thanks for this! I hope to have a fix for you to test later today.

Cheers,

--
Michael Drake https://www.codethink.co.uk/
_______________________________________________
netsurf-dev mailing list -- netsurf-dev@netsurf-browser.org
To unsubscribe send an email to netsurf-dev-leave@netsurf-browser.org

Sunday, 5 July 2020

[gccsdk] Rebuilding the autobuilder packages

I'm about to start rebuilding the autobuilder packages and uploading new versions where appropriate. If you have updated items or their packaging in the autobuilder recently and would like me to build and upload those first please let me know.

 

I'm not getting much time on this at the moment so any help in fixing packages or testing them will be much appreciated.

 

Regards,

Alan

 

[gccsdk] RISC OS GCC 4.7.4 release 4 has been released

I've finally managed to get all the bits and pieces together and have released GCC 4.7.4 release 4 based on the GCCSDK code this weekend.

 

I believe I've updated all the relevant pages and entries at www.riscos.info (e.g. http://www.riscos.info/index.php/GCC). If anyone want to check these and either edit them or let me know of any mistakes or omissions it would be appreciated.

 

I've also posted to comp.sys.acorn.announce and the ROOL forums that it's available.

 

Saturday, 4 July 2020

Re: possible bug: libnsgif does not handle DISPOSE_PREVIOUS correctly

On Fri, 3 Jul 2020 at 12:16, <jcupitt@gmail.com> wrote:
> Thank you for libnsgif. I think I might have come across a gif that
> fails to render correctly in libnsgif-0.2.1:
>
> https://user-images.githubusercontent.com/580843/86457777-18bd1400-bd1c-11ea-923a-adeed2eba031.gif
>
> Frame 6 is DISPOSE_PREVIOUS and should unpaint the tips of the wings.
> libnsgif does not seem to handle this though, and the tips are left
> behind.

Hello again, I spent a little time looking at the code.

tldr: I think GIFs which have a COMBINE frame followed by a RESTORE
frame will not render correctly in libnsgif.

1. The frames in this GIF (except for frame 5) have disposal_method 1,
GIF_FRAME_COMBINE, ie. the frame is not cleared and pixels accumulate.

2. Frame 5 is GIF_FRAME_RESTORE, meaning that after frame 5 is
rendered, the frame should be restored to frame 4. This is detected
when frame 6 rendering starts here:

https://source.netsurf-browser.org/libnsgif.git/tree/src/libnsgif.c#n794

And it calls gif_internal_decode_frame() recursively to put the pixels
for frame 4 back.

3. However, because frame 4 is GIF_FRAME_COMBINE, the frame 4 pixels
are incorrectly painted on top of frame 5.

4. gif_internal_decode_frame() then decode the pixels for frame 6, but
because frame 4 has not been restored, the wingtips are left behind.

The problem is that with GIF_FRAME_COMBINE, the state of a GIF frame
depends on all the previous frames. You can't just call
gif_internal_decode_frame() to put the pixels back --- you need to
re-render the entire animation.

It seems to me that the best way to implement GIF_FRAME_RESTORE is to
have an extra bitmap in the gif struct to hold the restore pixels.

When processing a frame with GIF_FRAME_RESTORE set, a copy should be
made of the frame before painting in the new pixels. When processing a
frame whose /previous/ frame is GIF_FRAME_RESTORE, the frame should be
initialised from the previous bitmap.

Does this sound reasonable? I could try to make a patch if there's interest.

John
_______________________________________________
netsurf-dev mailing list -- netsurf-dev@netsurf-browser.org
To unsubscribe send an email to netsurf-dev-leave@netsurf-browser.org

Friday, 3 July 2020

possible bug: libnsgif does not handle DISPOSE_PREVIOUS correctly

Hello all,

Thank you for libnsgif. I think I might have come across a gif that
fails to render correctly in libnsgif-0.2.1:

https://user-images.githubusercontent.com/580843/86457777-18bd1400-bd1c-11ea-923a-adeed2eba031.gif

Frame 6 is DISPOSE_PREVIOUS and should unpaint the tips of the wings.
libnsgif does not seem to handle this though, and the tips are left
behind. Unless I'm not calling libnsgif correctly.

Here's the original issue for context:

https://github.com/libvips/libvips/issues/1084

And our test libnsgif loader:

https://github.com/libvips/libvips/blob/add-libnsgif/libvips/foreign/gifnsload.c

John
_______________________________________________
netsurf-dev mailing list -- netsurf-dev@netsurf-browser.org
To unsubscribe send an email to netsurf-dev-leave@netsurf-browser.org