Editor for convolutions filters

Started by Grincheux, March 22, 2021, 07:59:39 PM

Previous topic - Next topic

John Z

Très bien.
J'espère que plus que moi en profiterons.

Merci beaucoup mon ami.

John Z

Grincheux

#16
Here is the las version.
Improved speed and corrected bugs.

Nom: myGimp.7z
Taille: 720138 octets (703 KiB)
CRC32: 751FF826
CRC64: EA209118B8E05293
SHA256: 1D08CC8ECD05742366A45614712096D7F84D72A9D9BA37BA9FD2FB09773429E5
SHA1: C6B628A0E4D8D949725D8C35C1C3A00D309AAD0E
BLAKE2sp: 54A86B585E39463362A24EAD4FB9587997D161C5F9AE5653E1BA547BDF1CBEC6

Grincheux

And the missing Sqlite3

Nom: sqlite3.7z
Taille: 678152 octets (662 KiB)
CRC32: 9D4966E7
CRC64: E5C887B0205A29F5
SHA256: 633FD9732A44662C804B1E81F717C4309E945526DC44D0EEC3FE27AD0FF16A66
SHA1: DB5C34039C6DC14080A4DE1454269CED7F907682
BLAKE2sp: 6B73618D93B6898388A3CB1D23B66C21EF0254FD160DFB30961FD8DF8EF517FD

Grincheux

#18
Original



Once the filter is applied:


Last Version



Quote
Datas :
Name : Flt 0017
Record Number 17
Size : 3x3
Divisor : -50
Bias : 0
Grey : 0
Datas :
   745,  -646,  -279
   371,  -378,   652
   140,  -624,   -32

Stefan Pendl

The resulting image is really scary ;-)
---
Stefan

Proud member of the UltraDefrag Development Team

Grincheux

I am testing Median filter, Min and Max filters, Distance and Variance too.
After I have no idea.
I re-read my code to try to improve it.
In a few days I will create a page on google blogger for downloading the program and try to understand how it works.


Thank you for your comment. ;D

Grincheux

#21
Final update ?




I have added pdf files in French and in english.
Thank You Google Translate

https://www.mediafire.com/file/h7ydmq0u2bbhn0v/Cfe-en.pdf/file

John Z

 :)
I note the name change....

Thanks, the pdf is helpful.  Should it mention the need for SQLite? 

John Z

Grincheux


John Z

 :) Was just going to say I see the DLL  :)

John Z

Grincheux

#25
I have added a file name Cfe.ini
It contains:
Quote[Cfe]
Database=0
Inf File=0

When "Database" is equal to 0, that means that no filter record will be added into to file User Filters.db3
When "Inf File" is equal to 0, no image description file will be created.

Grincheux

#26
I do not publish any changes from now within two months.
I made a lot of changes and corrected a mountain of bugs:
Everyday I work with the program during many hours to find what is wrong.
For now it seems clean.

Source code = Binaries

Play with it you will be very surprised if you think you where pretty... I test on me and did not recognized myself.

There is an other domain that I would like to include, it is the CNN seems not too complicated...

Telle me what is wrong or what could be improved, that would help me.

John Z

Ran across this and remembered reading you were interested in optimization as well as assembly code.

Software optimization resources
https://www.agner.org/optimize/

John Z

Grincheux

#28
I know this and read it it many times.

Agner has a good code but don't forget you can't always use it for all the programs.
For example, his function StrCpy is good for large strings, but for small strings, we don't need it.
There are very good ideas because he does not speak about asm only, he introduces optimizations for many languages.
I apply his rules for unrolling loops, when I have a loop like this:

for(i = 0 i < 256 ; i=i+4)
{
    DoSomething(i) ;
    DoSomething(i + 1) ;
    DoSomething(i + 2) ;
    DoSomething(i + 3) ;
}

In my program I need to transform the image from RGB to Grey.
I make the transformation using the average of Red, Green and Blue.

Rather than making Average = (Red + Green = Blue) / 3;
I have a table fo 256 entries nto which I already have computed the average.
I get it doing _r = _g = _b = TabDiv3[_r + _g + _b] ;
If I would repect the standard, it is not for today, I would have three tables, one for Red, one for Green and an other for Blue.
_r = TabStdRed[_r] ;
_g = TabStdGreen[_g] ;
_b = TabStdBlue[_b] ;
Grey = _r + _g + _b ;

I think it is quicker. An other idea is to replace the division by 3 using magic numbers, difficult in C.

I would finish repeating what Mr Pelles told me, having a good algorithm is the best thing.
I think he is TRUE.

But for finishing, Mr Pelle or Frankie must have good ideas on the subject that would be very interesting if they would...


Pelle

To avoid writing a whole book, I just have a few random comments:

1) The compiler will use magic numbers for division and multiplication when it can, but sometimes C language promotion rules can confuse things.

2) Running the profiler on an interactive program like this is only partially helpful, since most of the time is recorded in some Windows function waiting for the next message (so application times are often seen as 0.nn% and easy to miss). What it reveals is pretty obvious: a function like Convolve() takes some time (but still pretty fast on my machine, even for a large image). Doing the traditional "start clock" + "stop clock" in a function like this may be more helpful.

3) I just looked briefly at Convolve(), and not sure how much it matters in practice (without changing code and measuring time), but more variables could be "unsigned" and some conditions inside the loops seems to apply to the whole image, so perhaps use the condition to choose between two different (tighter) loops. This will complicate the code, but if you really want those last percent of performance, it may be worth investigating... (or not).

4) Not sure it applies, but have you considered using SIMD instructions/intrinsics (SSE/AVX/...)? Processing many pixels quickly is one thing they should be good at (in theory). In practice it may be too complicated and not worth it...
/Pelle