digitalmars.D.learn - arsd png bug
- Joerg Joergonson (12/12) Jun 20 2016 1810:
- Alex Parrill (5/18) Jun 20 2016 You'd probably get better results by filing an issue with the
- Adam D. Ruppe (3/6) Jun 20 2016 It doesn't make much of a difference to me, it all just ends up
- Adam D. Ruppe (7/10) Jun 20 2016 So previousLine should be either the right length or null, so I
- Joerg Joergonson (9/20) Jun 20 2016 I'll update but can't do any tests since it's random. Seems to be
1810: case 3: auto arr = data.dup; foreach(i; 0 .. arr.length) { auto prev = i < bpp ? 0 : arr[i - bpp]; if (i >= previousLine.length) break; arr[i] += cast(ubyte) /*std.math.floor*/( cast(int) (prev + previousLine[i]) / 2); } adding if (i >= previousLine.length) break; prevents some crashes and seems to work.
Jun 20 2016
On Monday, 20 June 2016 at 21:39:45 UTC, Joerg Joergonson wrote:1810: case 3: auto arr = data.dup; foreach(i; 0 .. arr.length) { auto prev = i < bpp ? 0 : arr[i - bpp]; if (i >= previousLine.length) break; arr[i] += cast(ubyte) /*std.math.floor*/( cast(int) (prev + previousLine[i]) / 2); } adding if (i >= previousLine.length) break; prevents some crashes and seems to work.You'd probably get better results by filing an issue with the project's bug tracker [1]. Also by including a sample image that causes the crash. [1]: https://github.com/adamdruppe/arsd/issues
Jun 20 2016
On Monday, 20 June 2016 at 21:53:42 UTC, Alex Parrill wrote:You'd probably get better results by filing an issue with the project's bug tracker [1]. Also by including a sample image that causes the crash.It doesn't make much of a difference to me, it all just ends up in my email inbox anyway.
Jun 20 2016
On Monday, 20 June 2016 at 21:39:45 UTC, Joerg Joergonson wrote:adding if (i >= previousLine.length) break; prevents some crashes and seems to work.So previousLine should be either the right length or null, so I put in one test. Can you try it on your test image? BTW I do a few unnecessary duplications in here too. I think. But there's surely some potential for more memory/performance improvements here.
Jun 20 2016
On Tuesday, 21 June 2016 at 00:31:51 UTC, Adam D. Ruppe wrote:On Monday, 20 June 2016 at 21:39:45 UTC, Joerg Joergonson wrote:I'll update but can't do any tests since it's random. Seems to be something different with the png encoding. They are auto generated and I've already overwritten the ones that create the bug. (so if it's fixed it will just never occur again, if not it will happen sometime in the future again and I'll let you know). Every time I've checked it's been previousLine being null and simply putting in that check fixed it, so it is just probably some strange edge case.adding if (i >= previousLine.length) break; prevents some crashes and seems to work.So previousLine should be either the right length or null, so I put in one test. Can you try it on your test image? BTW I do a few unnecessary duplications in here too. I think. But there's surely some potential for more memory/performance improvements here.
Jun 20 2016