07.03.2024, 23:34
Hello Selur,
I found a way to stabilize DDColor, with a method that I called AdaptiveMerge, the problem is that is too slow.
Using this method the encoding speed is reduced by 50% and this method is very simple, I was unable to find a way to speed up the computation.
I don't know very well Vapoursynth and the available documentation is "poor". Maybe there is a way to get a faster encoding...
The current code is the following
Since DDColor on dark scenes shows a psychedelic effect (try to use it with the attached video), the adaptive merge "weight" the weight_merge parameter by the brightness of the image.
In order to not penalize too much DDColor I multiply this value by 1.2.
For example if the brightness is 45% and the weight_merge is 50% the effective weight used in the merge is given by = 50%*(1.2*45%) = 27%
This computation must executed at frame level.
Do you have any idea on how it is possible to speed up the function AdaptiveMerge3 ?
Thanks,
Dan
I found a way to stabilize DDColor, with a method that I called AdaptiveMerge, the problem is that is too slow.
Using this method the encoding speed is reduced by 50% and this method is very simple, I was unable to find a way to speed up the computation.
I don't know very well Vapoursynth and the available documentation is "poor". Maybe there is a way to get a faster encoding...
The current code is the following
def AdaptiveMerge3(clipa: vs.VideoNode = None, clipb: vs.VideoNode = None, clipb_weight: float = 0.0) -> vs.VideoNode:
#Vapoursynth version
def merge_frame(n, f):
clip1 = clipa[n]
clip2 = clipb[n]
clip2_yuv = clip2.resize.Bicubic(format=vs.YUV444PS, matrix_s="709", range_s="limited")
clip2_avg_y = vs.core.std.PlaneStats(clip2_yuv, plane=0)
luma = clip2_avg_y.get_frame(0).props['PlaneStatsAverage']
#vs.core.log_message(2, "Luma(" + str(n) + ") = " + str(luma))
brightness = min(1.5 * luma, 1)
w = max(clipb_weight * brightness, 0.15)
clip3 = vs.core.std.Merge(clip1, clip2, weight=w)
f_out = f.copy()
f_out = clip3.get_frame(0)
return f_out
clipm = clipa.std.ModifyFrame(clips=clipa, selector=merge_frame)
return clipm
Since DDColor on dark scenes shows a psychedelic effect (try to use it with the attached video), the adaptive merge "weight" the weight_merge parameter by the brightness of the image.
In order to not penalize too much DDColor I multiply this value by 1.2.
For example if the brightness is 45% and the weight_merge is 50% the effective weight used in the merge is given by = 50%*(1.2*45%) = 27%
This computation must executed at frame level.
Do you have any idea on how it is possible to speed up the function AdaptiveMerge3 ?
Thanks,
Dan