Re: Atkinson dither algorithm

2017-10-19 Thread Tom Glod via use-livecode
wow! my brain hurts. On Tue, Oct 17, 2017 at 2:13 PM, Alejandro Tejada via use-livecode < use-livecode@lists.runrev.com> wrote: > Hermann, your script version won the > LiveCode Script speed contest! :-) > > I feel humbled and grateful that many of you > have taken time to look at this. Although

Re: Atkinson dither algorithm

2017-10-17 Thread Alejandro Tejada via use-livecode
Hermann, your script version won the LiveCode Script speed contest! :-) I feel humbled and grateful that many of you have taken time to look at this. Although an image dithering algorithm seems trivial an barely useful, the fact is that in this thread, we have pushed Livecode script almost to it's

Re: Atkinson dither algorithm

2017-10-17 Thread hh via use-livecode
@Alejandro and Alex. All that limit checking is not needed here. It is much faster, especially for fast images,to do a few unneeded additions than to do all these checks for each pixel. I translated my js-function into LC Script, using Alejandro's variable names and (inline) Alex's array creation

Re: Atkinson dither algorithm

2017-10-16 Thread Alejandro Tejada via use-livecode
Hi Alex, This is Amazing! :-D Alex, your function saved another 34% in the running time of this handler! In retrospect, only now it seems very obvious that merging two functions could save more running time in this handler... but I just keep wondering: How far can we go merging functions to save

Re: Atkinson dither algorithm

2017-10-16 Thread Alex Tweedly via use-livecode
On 17/10/2017 00:21, Alex Tweedly via use-livecode wrote: Sorry about the horrible formatting on the last post... I'll try to find my Forum password and post the modified version there I haven't tackled the second half (i.e. the actual dithering bit yet - maybe tomorrow). I can trim a

Re: Atkinson dither algorithm

2017-10-16 Thread Alex Tweedly via use-livecode
On 16/10/2017 19:37, Alejandro Tejada via use-livecode wrote: Hi Bob, Bob Sneidar wrote: I didn't post any code I don't think, but I will certainly take some credit for having done so! ;-) In fact, you are not late! :-D But I am too late - the file is called "...Final Version ..." :-) :-) Le

Re: Atkinson dither algorithm

2017-10-16 Thread Bob Sneidar via use-livecode
I didn't post any code I don't think, but I will certainly take some credit for having done so! ;-) Bob S > On Oct 14, 2017, at 21:57 , Alejandro Tejada via use-livecode > wrote: > > Hi All, > > This forum message contains the final version of this stack. > It includes a Color version of th

Re: Atkinson dither algorithm

2017-10-14 Thread Alejandro Tejada via use-livecode
Hi All, This forum message contains the final version of this stack. It includes a Color version of this algorithm. https://forums.livecode.com/viewtopic.php?f=10&p=159173#p159173 Thanks again to Malte Brill, Richard Gaskin, Hermann Hoch, Mark Waddingham, Peter Reid, Ben Rubinstein, Bob Sneidar

Re: Atkinson dither algorithm & 'for each' loop

2017-10-13 Thread Lagi Pittas via use-livecode
epending on the details of the loop body. > > If there was a "repeat for each sequenced..." form of loop in LC, any > speed-up could be very beneficial even if the amount of speed-up was only > 10 times faster! > > Cheers > > Peter > -- > Peter Reid > Lough

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread hh via use-livecode
@Al. For multiples of 1/8 (Atkinson) you need 8*256=2048 integers, that is 11 Bit. For multiples of 1/16 (Floyd-Steinberg) you need 16*256=4096 integers, that is 12 Bit. In 2 chars = 16 Bit fit even multiples of 1/256. No dither-algorithm uses such tiny diffusion-errors. __

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread hh via use-livecode
> Al wrote: > Please, check this new handler in the forum and suggest how to > make this faster and more precise. I already gave you a method that is, with a 500x500 image, at least 1000 (thousand) times faster than your script. Of course this is not due my special skills but the ability of javas

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Mark Waddingham via use-livecode
On 2017-10-12 19:35, Alejandro Tejada via use-livecode wrote: Peter Read wrote: One note of caution regarding the use of the "repeat for each" loop, whilst you will get a loop iteration for every value in the collection (fldhexa3 in your example), you are not guaranteed the order in which they w

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Richard Gaskin via use-livecode
Peter Reid wrote: > One note of caution regarding the use of the "repeat for each" loop, > whilst you will get a loop iteration for every value in the collection > (fldhexa3 in your example), you are not guaranteed the order in which > they will occur. Maybe I misunderstand, but are you thinking

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Bob Sneidar via use-livecode
That is correct Ben. It's not the repeat for each that is unreliable (probably a bad word to use here) but it is arrays which do not retain the sequence of key/values in the order they were put in. To get around this, when possible use numbered keys, then: put the keys of aMyArray into tKeyLi

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Ben Rubinstein via use-livecode
on the details of the loop body. If there was a "repeat for each sequenced..." form of loop in LC, any speed-up could be very beneficial even if the amount of speed-up was only 10 times faster! Cheers Peter -- Peter Reid Loughborough, UK On 9 Oct 2017, at 10:18am, use-livecode

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Peter Reid via use-livecode
f the amount of speed-up was only 10 times faster! Cheers Peter -- Peter Reid Loughborough, UK > On 9 Oct 2017, at 10:18am, use-livecode-requ...@lists.runrev.com wrote: > > Message: 12 > Date: Sat, 7 Oct 2017 15:53:44 +0200 > From: Malte Pfaff-Brill > To: use-livecode@lists.r

Re: Atkinson dither algorithm

2017-10-07 Thread Alejandro Tejada via use-livecode
Hi Malte, Malte Brill wrote: > I already posted on the forums, but for completeness also here: > a lot can be done by replacing repeat with with repeat for each where you can. > > --repeat with i = 1 to the number of words of fldhexa3 > --put 00 & word i of fldhexa3 & word i of fldhexa3 &

Re: Atkinson dither algorithm

2017-10-07 Thread Malte Pfaff-Brill via use-livecode
Hi Al, I already posted on the forums, but for completeness also here: a lot can be done by replacing repeat with with repeat for each where you can. --repeat with i = 1 to the number of words of fldhexa3 -- put 00 & word i of fldhexa3 & word i of fldhexa3 & word i of fldhexa3 aft

Re: Atkinson dither algorithm

2017-10-06 Thread Alejandro Tejada via use-livecode
I have posted a demo stack in the forums: https://forums.livecode.com/viewtopic.php?f=10&t=29935 Have a nice weekend! Al On Sat, Oct 7, 2017 at 1:52 AM, Alejandro Tejada wrote: > Hi All, > > I am stuck trying to make this code for Bill Atkinson > dithering algorithm much more faster. > Any ways