View Full Version : Directional Cubic Convolution
luquinhas0021
23rd October 2015, 17:35
Hi,
I've seen a new and recently implemented upscaling algorithm, which is based on cubic convolution... Although I haven't seen a gorgeous similarity, and I have guessed D.C.C (Directional cubic convolution) much more easy to understand, and more precise. Here is the link:
https://en.m.wikipedia.org/wiki/Directional_Cubic_Convolution_Interp
olation
If you search on Google "Directional Cubic Convolution", you will see a paper called "Image zooming using Directional Cubic Convolution - Zhou". It is the P.D.F associated with this algorithm.
Read it and say me what you guessed. After, I will explain, in this thread, my thoughts.
wonkey_monkey
24th October 2015, 00:00
If you search on Google "Directional Cubic Convolution", you will see a paper called "Image zooming using Directional Cubic Convolution - Zhou". It is the P.D.F associated with this algorithm.
Or better still, you could just provide a link to the PDF, if you have one. Or some example images.
Read it and say me what you guessed. After, I will explain, in this thread, my thoughts.
Why don't you just explain your thoughts now?
Khanattila
24th October 2015, 23:41
I'm working on it. Stay tuned.
wonkey_monkey
25th October 2015, 00:18
I'm working on it. Stay tuned.
Ahead of ya ;)
Wasn't going to bother posting until the thread was active again, but anyway: it's a bit better than bicubic, but worse then NNEDI3.
Assuming I implemented it right. Which I think I did.
Khanattila
25th October 2015, 00:39
Ahead of ya ;)
Wasn't going to bother posting until the thread was active again, but anyway: it's a bit better than bicubic, but worse then NNEDI3.
Assuming I implemented it right. Which I think I did.
I'm curious. What test did you do?
Maybe a larger grid increase the quality.
wonkey_monkey
25th October 2015, 00:57
My "test" was to implement the algorithm... possibly incorrectly. I'm dubious of the "d1 ^ 5" which I assume implies that input pixel values are expected to be normalised to [0...1] (otherwise you would need 64-bit numbers to calculate the results).
http://horman.net/avisyth/dcci.png
http://horman.net/avisyth/dcci-sharp.png
Bloax
25th October 2015, 02:59
Output looks a lot like XBR.
Reel.Deel
25th October 2015, 13:31
What's the speed of DDCI vs nnedi3_rpow2? DDCI looks a bit waxy, so does some parts of nnedi3 but it's not as obvious.
feisty2
25th October 2015, 13:53
What's the speed of DDCI vs nnedi3_rpow2? DDCI looks a bit waxy, so does some parts of nnedi3 but it's not as obvious.
eedi3 is softer and not waxy like nnedi3
but it suffers from some different sort of artifacts as well
wonkey_monkey
25th October 2015, 19:43
Right now, my test implentation of DCCI is running at 50fps vs 25fps for nnedi3_rpow2.
And that's with a rather inefficient implementation, separating out red/green/blue channels into y8 clips and passing each through two rounds of my rgba_rpn plugin (which is very fast itself, but the DCCI code also isn't very efficient).
I have some ideas for improvements that will require it to be a proper C++ plugin.
Edit: DCCI doesn't seem to do quite as well on slightly angled lines as nnedi3.
wonkey_monkey
25th October 2015, 21:45
Further tests show that nnedi3 is significantly less "waxy" (abstract/paint effect) than DCCI when enlarging more than double.
luquinhas0021
26th October 2015, 22:23
In eye's image, nnedi3, although softer than DCCI in some non-edge areas, is sharper than DCCI in some edges, and equally sharp in others (At least I realize that).
Well, I think DCCI is a good algorithm, but I have some sugestions to do in order to improve it:
Consider a 11 x 11 matrix for calculate the horizontal, vertical, 45º diagonal and 135º diagonal gradients. The form of calculate it is the same.
Use the method of adaptive dual-treshold present on enhanced Canny edge detector for detect weak and strong edges, instead of DECCI unique treshold. Below is the link, extracted from Canny edge detector's section on Wikipedia
https://en.wikipedia.org/wiki/Canny_edge_detector From top to bottom of page, start to read in "Robust method to determine the dual-threshold value", in bold.
Well, I'm thinking in more refined ways of make the calculus, but, by now, I guess my ideas will improves DCCI. Too, I'm making my own algorithm, so my ideas for improve DCCI is just for have fun!
What you think about my ideas? Can it improve DCCI?
wonkey_monkey
28th October 2015, 11:52
Consider a 11 x 11 matrix for calculate the horizontal, vertical, 45º diagonal and 135º diagonal gradients. The form of calculate it is the same.
What reason do you have for thinking that will give a better result?
luquinhas0021
28th October 2015, 12:06
bigger the neighbour matrix of a central pixel, better is gradient approximation. It`s what i think and what happens, generally.
feisty2
28th October 2015, 12:08
bigger the neighbour matrix of a central pixel, better is gradient approximation. It`s what i think and what happens, generally.
"better is gradient approximation", and with more aggressive ringing, there's a reason people don't generally use stuff like "sinc"
Khanattila
28th October 2015, 12:26
In eye's image, nnedi3, although softer than DCCI in some non-edge areas, is sharper than DCCI in some edges, and equally sharp in others (At least I realize that).
Well, I think DCCI is a good algorithm, but I have some sugestions to do in order to improve it:
Consider a 11 x 11 matrix for calculate the horizontal, vertical, 45º diagonal and 135º diagonal gradients. The form of calculate it is the same.
Use the method of adaptive dual-treshold present on enhanced Canny edge detector for detect weak and strong edges, instead of DECCI unique treshold. Below is the link, extracted from Canny edge detector's section on Wikipedia
https://en.wikipedia.org/wiki/Canny_edge_detector From top to bottom of page, start to read in "Robust method to determine the dual-threshold value", in bold.
Well, I'm thinking in more refined ways of make the calculus, but, by now, I guess my ideas will improves DCCI. Too, I'm making my own algorithm, so my ideas for improve DCCI is just for have fun!
What you think about my ideas? Can it improve DCCI?
What reason do you have for thinking that will give a better result?
The filter must know the direction of the edge, if any. A larger window would be less sensitive to small edge. You can still give it a try.
Also you can try to increase the sample points of the Cubic-Convolution.
2-sample: [1, 1] / 2
4-sample: [-1, 9, 9, -1] / 16
6-sample: [3, -25, 150, 150, -25, 3] / 256
8-sample: [-5, 49, -245, 1225, 1225, -245, 49, -5] / 2048
10-sample: [35, -405, 2268, -8820, 39690, 39690, -8820, 2268, -405, 35] / 65536
Etc.
luquinhas0021
28th October 2015, 12:53
"A larger window would be less sensitive to small edge." So the best choice is a 2 x 2, 2 x 3, 3 x 2 or 3 x 3 matrix, in order to have the maximum sensibility to strong, medium and weak edges? A pixel has only 3, 5 or 8 direct neighbours. 3 if it is on first or last column of first or last line. 5 if it is on first or last columns, between first and last lines; and on first and last lines, between first and last columns. 8, otherwise.
wonkey_monkey
28th October 2015, 13:19
So the best choice is a 2 x 2, 2 x 3, 3 x 2 or 3 x 3 matrix, in order to have the maximum sensibility to strong, medium and weak edges?
No. My point in questioning you is that bigger numbers don't automatically mean a better result; conversely, that doesn't mean the extreme opposite is automatically true.
A pixel has only 3, 5 or 8 direct neighbours.
Not in this algorithm (which you suggested!), where you're expanding the existing pixels and filling in the missing ones.
Khanattila
28th October 2015, 14:01
"A larger window would be less sensitive to small edge." So the best choice is a 2 x 2, 2 x 3, 3 x 2 or 3 x 3 matrix, in order to have the maximum sensibility to strong, medium and weak edges? A pixel has only 3, 5 or 8 direct neighbours. 3 if it is on first or last column of first or last line. 5 if it is on first or last columns, between first and last lines; and on first and last lines, between first and last columns. 8, otherwise.
The DCCI works in a different way.
When I can finally solve a problem of bit shift, I distribute a testing-plugin so we can make comparisons.
Khanattila
1st November 2015, 18:35
I enjoyed it a bit. It has several unsolved problems but it is a starting point.
KDCCInterpolationCL-r1.zip (http://www.mediafire.com/download/fjno6ocu64ox84q/KDCCInterpolationCL-r1.zip)
core.kcc.KDCCInterpolationCL(clip, threshold, exponent, device_type, device_id, info)
Default, threshold = 1.15, exponent = 5.
The two parameters (threshold and exponent) cannot be easily determined for a given LR image because they depend on the varying scene structure of images.
(Image Zooming Using Directional Cubic Convolution Interpolation - Zhou, Shen)
wonkey_monkey
1st November 2015, 19:12
At the point where you apply the exponent, did you scale the sampled pixels' values to between 0 and 1?
Khanattila
2nd November 2015, 09:17
At the point where you apply the exponent, did you scale the sampled pixels' values to between 0 and 1?
Is normalized [0, 1] when first read the memory. So G1 and G2 are in [0, 9] range.
The document does not refer to normalized values anyway.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.