Page 1 of 8

Pictoric (was: New conversion algorithm)

Posted: Fri Aug 30, 2019 10:19 pm
by sam
Dbug wrote: Fri Dec 15, 2017 9:40 pm Well, I only need to look a the picture with a 6x8 grid to tell you it's not Oric compatible :)
(..)
Hello, it's been a while since I went here. The reason is that I studied the oric video organisation and tried to adapt my algorithms to the oric constraints.

I've made numerous experiments and found an algorithm which, I think, works pretty well and produces really oric-compatible pictures this times Main features of the algorithm are:
  • It uses Ostromoukhov's error-diffusion coefficients which reduces the worm-effects usually observed with error-diffusion technique.
  • It uses an approximation of CIE's Delta-E 2000 to compare colors. Delta-E better represent color difference than euclidean distance in RGB color-space.
  • The error is filtered according to the saturation of the original color. This allows saturated colors to stay "pure", reducing the noise, hence inducing less color-clashes and improving quality a lot. (This is original idea #1) This also can be used to make the piture being too artificial by abusing saturated colors.)
  • Using harmless simplifications about propagation of effors between octets (idea #2), it capable of exploring the whole depth of the decision-tree for a line (pipi.exe only seem to explore depth 2 max). This ensure that the minimal delta-E is obtained for each row.
  • It is fast. It takes around 20sec/image under grafX2 (interpreted LUA).
  • It is simple and straightforward. There are very few black-magick tricks in there. It is just idea #1 and #2 working together.
During my summer vacation I wanted to create a C plugin for XnView allowing to read/write oric tap files with that algorithm. Unfortunately, the vacation is nearly over, and I didn't get enough time to finish the C code (I was fine-tuning the filtering algorithm on a huge corpus of images). Anyway, I can give you the latest experiment-script I use in GrafX2 as well with a set of random examples I got with it..

Some images are good and some others are... well.. could be... better ;) Actually the algorithm has a pair of parameters in error filtering that can improve the quality. I need more work to find one set of param that works best for all of my corpus. Anyway, the provided ones are quite good at the moment (but I know I can have even better quality).

And you, what do you think about these results?

Re: New conversion algorithm

Posted: Fri Aug 30, 2019 11:07 pm
by Symoon
As you said, some pictures are very good, others could be better ;)
BUT the result on colors is really amazing!

Please keep up the good work, this is the trickiest part on Orics!

Re: New conversion algorithm

Posted: Sat Aug 31, 2019 12:20 am
by sam
sam wrote: Fri Aug 30, 2019 10:19 pm (but I know I can have even better quality)
Indeed! Actually using

Code: Select all

z = 0.9974 - math.exp(-1/z)*0.0152 -- *a^2
in line 424 makes better images (the formula doesn't depend on the intensity of the color anymore). Unfortunately it is too late tonight for me to regenerate the pictures. But here is what I get with it on a "difficult" image (eg. and image which has some fine details)

Re: New conversion algorithm

Posted: Sat Aug 31, 2019 7:31 am
by ibisum
I'm still struck with awe whenever I see pictures like this on the Oric. Well done!

Re: New conversion algorithm

Posted: Mon Sep 02, 2019 11:49 pm
by iss
This is very good, thanks for the converter, @sam!
yoda-3.png
I've modified tap generation to include an BASIC stub to set HIRES and after processing to call Oricutron: :)

Code: Select all

  if ok then 
    -- http://caca.zoy.org/browser/libpipi/trunk/pipi/codec/oric.c
    local out = io.open(fullname,"wb")
    
    -- write basic stub
    -- 10 PAPER0:INK7:HIRES:CLOAD""
    out:write(string.char(0x16,0x16,0x16,0x16,0x24,
      0xff,0xff,0x00,0xc7,0x05,0x13,0x05,0x01,0xff,
      0x00,0x11,0x05,0x0a,0x00,0xb1,0x30,0x3a,0xb2,
      0x37,0x3a,0xa2,0x3a,0xb6,0x22,0x22,0x00,0x00,
      0x00,0x00))
    
    out:write(string.char(0x16,0x16,0x16,0x16,0x24,
      0x00,0xff,0x80,0x00,0xbf,0x3f,0xa0,0x00,0x00) .. 
      name .. 
      string.char(0) ..
      buf)
    out:close()
    
    -- run emulator
    os.execute("oric " .. fullname)
  end
Congrats again for the converter and for the good LUA skils ;).

Re: New conversion algorithm

Posted: Thu Sep 05, 2019 3:37 pm
by sam
I've found a new evolution of the algorithm that improves the quality alot on many images but might reduce it on very few ones. I need to work on this, but if anyone is willing to make a Cauldron-like game, here is a picture I recently converted:

Re: New conversion algorithm

Posted: Thu Sep 05, 2019 4:00 pm
by ibisum
Wow. Someone needs to make a Cauldron-like game, stat! :)

Re: New conversion algorithm

Posted: Thu Sep 05, 2019 4:06 pm
by iss
Nice improvement, indeed!
What about to release a standalone version? If you don't want to bother with all different input formats then simple BMP should be enough.
I think I already have some BMP file handling in LUA but it's easy to be coded from scratch anytime... ;)

Re: New conversion algorithm

Posted: Sun Sep 08, 2019 6:54 pm
by sam
It is too early to make a stand-alone version. This is still W.I.P. and using it in graphX2 is quite handy (undo/redo, support for many file format, etc). I still need to do some research to make the algorithm more robust in order to have images of constant (and predictible) quality. I think I'm getting close to the definitive algorithm. For instance this weekend I get some nice results on heroic-fantasies images with my latest revision of the algorithm. See the enclosed zip file (which includes the new algorithm in "oric_tst5.lua").

Re: New conversion algorithm

Posted: Sun Sep 08, 2019 7:14 pm
by sam
sam wrote: Sun Sep 08, 2019 6:54 pm I think I'm getting close to the definitive algorithm. For instance this weekend I get some nice results on heroic-fantasies images with my latest revision of the algorithm.
Yeah, the algorithm works quite well on other type of image as well :D

Re: New conversion algorithm

Posted: Mon Sep 09, 2019 6:25 pm
by ibisum
Extraordinary!

Re: New conversion algorithm

Posted: Mon Sep 09, 2019 9:06 pm
by Chema
Impressive... :o

Re: New conversion algorithm

Posted: Tue Sep 10, 2019 2:04 pm
by sam
Just for fun :lol:

Re: New conversion algorithm

Posted: Tue Sep 10, 2019 2:24 pm
by ibisum
Oh man, thanks for doing the octopus! I was going to ask for that. ;)

Re: New conversion algorithm

Posted: Tue Sep 10, 2019 3:12 pm
by sam
I forgot to translate Chema's avatar, but it is already Oric compatible :)

The octopus looks quite nice with the latest slight modification of the algorithm. I tried to compare the result of productions done by IoCero.com, but although I can find the oric pictures he made, I could'nt get the original pictures to test the algorithm.