Atkinson dither algorithm

2017-10-19 Thread Alejandro Tejada via use-livecode
Tom Glod wrote: > wow! my brain hurts. Still pending: 1) creating a command line application 2) compiling an external 3) building a widget In the forum thread, Hermann already demonstrated how to apply this algorithm using Javascript within the browser widget. But creating each one of these woul

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

Atkinson dither algorithm

2017-10-16 Thread Alejandro Tejada via use-livecode
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 Please, take a look at the script of Atkinson Dither 04 (Fastest Version) and make it faster. How would you do this? Making the Funct

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

Atkinson dither algorithm & 'for each' loop

2017-10-13 Thread Alejandro Tejada via use-livecode
After reading Mark Waddingham explanation, now i am using a sequential ordered array for this handler. Check this much shorter and faster version: on mouseUp put the millisecs into startTime set the cursor to busy put the alphadata of img "Image" into tAlphaData put the imagedata of

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. __

Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Alejandro Tejada via use-livecode
Hi Hermann, Hermann Hoch wrote: > So all considerations to improve the LCS script are, > TMHO, of rather theoretical value. Here are some more: > The Atkinson algorithm uses multiples of 1/8 = 0.125 for > the diffusion-error, the Floyd-Steinberg algorithm uses > multiples of 1/16 = 0.0625. > And h

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread hh via use-livecode
t handler. > My educated guess is that Atkinson dither algorithm requires > numbers with more than 2 numbers after the decimal point. > That is: 243.643578 instead of just 243.64 Conclude from the following: The Atkinson algorithm uses multiples of 1/8 = 0.125 for the diffusion-error, the F

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

Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Alejandro Tejada via use-livecode
ture and the result is that elements are processed with an out of order sequence. By the way, after reading all comments and recommendations about the atkinson dither algorithm, I wrote a new handler that is a lot faster that my first handler, but the result STILL is not visually identical to that ha

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

Atkinson dither algorithm

2017-10-06 Thread Alejandro Tejada via use-livecode
Hi All, I am stuck trying to make this code for Bill Atkinson dithering algorithm much more faster. Any ways to speed this code? Follow the recipe and watch out for lines broken by mail character length limit. Recipe: 1) Import an small image (200x200 pixels) and name it as "Image" (you could im