New conversion algorithm

The Oric video chip is not an easy beast to master, so any trick or method that allows to achieve nice visual results is welcome. Don't hesitate to comment (nicely) other people tricks and pictures :)
sam
2nd Star Corporal
Posts: 19
Joined: Sun Jul 09, 2017 3:28 pm
Location: France, Brest
Contact:

New conversion algorithm

Post by sam » Fri Aug 30, 2019 10:19 pm

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?
Attachments
oric_tst5.zip
Algorithm in LUA for GrafX2 + random samples
(334.71 KiB) Downloaded 15 times
sam.tap
all the samples assembled as single TAP file. CLOAD"" it and RUN, then press space to load the next image
(533.46 KiB) Downloaded 16 times
Last edited by sam on Fri Aug 30, 2019 11:12 pm, edited 1 time in total.

User avatar
Symoon
Archivist
Posts: 1643
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: New conversion algorithm

Post by Symoon » Fri Aug 30, 2019 11:07 pm

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!

sam
2nd Star Corporal
Posts: 19
Joined: Sun Jul 09, 2017 3:28 pm
Location: France, Brest
Contact:

Re: New conversion algorithm

Post by sam » Sat Aug 31, 2019 12:20 am

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)
Attachments
oric_tst5.zip
updated formula
(5.29 KiB) Downloaded 10 times
starwars-capa.gif
orig picture
sam_sw.gif
converted picture
sam_sw.gif (6.73 KiB) Viewed 452 times

User avatar
ibisum
Wing Commander
Posts: 1103
Joined: Fri Apr 03, 2009 8:56 am

Re: New conversion algorithm

Post by ibisum » Sat Aug 31, 2019 7:31 am

I'm still struck with awe whenever I see pictures like this on the Oric. Well done!

User avatar
iss
Squad Leader
Posts: 871
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: New conversion algorithm

Post by iss » Mon Sep 02, 2019 11:49 pm

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 ;).

sam
2nd Star Corporal
Posts: 19
Joined: Sun Jul 09, 2017 3:28 pm
Location: France, Brest
Contact:

Re: New conversion algorithm

Post by sam » Thu Sep 05, 2019 3:37 pm

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:
Attachments
cauldron.tap
Oric file
(7.87 KiB) Downloaded 9 times
cauldron.gif
Oric-converted file
cauldron.gif (4.7 KiB) Viewed 351 times
2583.jpg
Original file
2583.jpg (11.95 KiB) Viewed 351 times

User avatar
ibisum
Wing Commander
Posts: 1103
Joined: Fri Apr 03, 2009 8:56 am

Re: New conversion algorithm

Post by ibisum » Thu Sep 05, 2019 4:00 pm

Wow. Someone needs to make a Cauldron-like game, stat! :)

User avatar
iss
Squad Leader
Posts: 871
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: New conversion algorithm

Post by iss » Thu Sep 05, 2019 4:06 pm

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... ;)

sam
2nd Star Corporal
Posts: 19
Joined: Sun Jul 09, 2017 3:28 pm
Location: France, Brest
Contact:

Re: New conversion algorithm

Post by sam » Sun Sep 08, 2019 6:54 pm

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").
Attachments
Heroicfantasy.zip
(929.03 KiB) Downloaded 10 times

sam
2nd Star Corporal
Posts: 19
Joined: Sun Jul 09, 2017 3:28 pm
Location: France, Brest
Contact:

Re: New conversion algorithm

Post by sam » Sun Sep 08, 2019 7:14 pm

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
Attachments
scooby.gif
scooby.gif (8.12 KiB) Viewed 282 times
the-jones.gif
the-jones.gif (6.76 KiB) Viewed 282 times
butterfly.gif
butterfly.gif (7.5 KiB) Viewed 282 times

User avatar
ibisum
Wing Commander
Posts: 1103
Joined: Fri Apr 03, 2009 8:56 am

Re: New conversion algorithm

Post by ibisum » Mon Sep 09, 2019 6:25 pm

Extraordinary!

User avatar
Chema
Game master
Posts: 2466
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: New conversion algorithm

Post by Chema » Mon Sep 09, 2019 9:06 pm

Impressive... :o

sam
2nd Star Corporal
Posts: 19
Joined: Sun Jul 09, 2017 3:28 pm
Location: France, Brest
Contact:

Re: New conversion algorithm

Post by sam » Tue Sep 10, 2019 2:04 pm

Just for fun :lol:
Attachments
CLIPBOARD3.gif
CLIPBOARD3.gif (6.03 KiB) Viewed 191 times
CLIPBOARD2.gif
CLIPBOARD2.gif (4.2 KiB) Viewed 191 times
CLIPBOARD1.gif
CLIPBOARD1.gif (7.18 KiB) Viewed 191 times

User avatar
ibisum
Wing Commander
Posts: 1103
Joined: Fri Apr 03, 2009 8:56 am

Re: New conversion algorithm

Post by ibisum » Tue Sep 10, 2019 2:24 pm

Oh man, thanks for doing the octopus! I was going to ask for that. ;)

sam
2nd Star Corporal
Posts: 19
Joined: Sun Jul 09, 2017 3:28 pm
Location: France, Brest
Contact:

Re: New conversion algorithm

Post by sam » Tue Sep 10, 2019 3:12 pm

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.
Attachments
oric_tst5.zip
Latest version of the algorithm for grafx2 2.6.2475 (small enhancement + syntax corrections for the new builtin lua interpreter)
(6.25 KiB) Downloaded 10 times

Post Reply