def make_merge_image(context: Context, frame_inversion: Frame, frame_base: Frame, list_predictive: list, list_differences: list, list_corrections: list, list_fade: list): # Load context logger = logging.getLogger(__name__) out_image = Frame() out_image.create_new(frame_base.width, frame_base.height) # assess the two cases where out images are either duplicates or a new frame completely if not list_predictive and not list_differences: out_image.copy_image(frame_inversion) return out_image if list_predictive and not list_differences: out_image.copy_image(frame_base) return out_image # by copying the image first as the first step, all the predictive elements like # (0,0) -> (0,0) are also coppied out_image.copy_image(frame_base) # run the image through the same plugins IN ORDER it was ran in d2x_cpp out_image = pframe_image(context, out_image, frame_base, frame_inversion, list_differences, list_predictive) out_image = fade_image(context, out_image, list_fade) out_image = correct_image(context, out_image, list_corrections) return out_image
def make_merge_image(context: Context, frame_residual: Frame, frame_previous: Frame, list_predictive: list, list_residual: list, list_corrections: list, list_fade: list): """ This section can best be explained through pictures. A visual way of expressing what 'merging' is doing is this section in the wiki. https://github.com/aka-katto/dandere2x/wiki/How-Dandere2x-Works#part-2-using-observations-to-save-time Inputs: - frame(x) - frame(x+1)_residual - Residual vectors mapping frame(x+1)_residual -> frame(x+1) - Predictive vectors mapping frame(x) -> frame(x+1) Output: - frame(x+1) """ # Load context logger = logging.getLogger(__name__) out_image = Frame() out_image.create_new(frame_previous.width, frame_previous.height) # If list_predictive is empty, then the residual frame is simply the newly # produced image. if not list_predictive: out_image.copy_image(frame_residual) return out_image # By copying the image first as the first step, all the predictive elements of the form (x,y) -> (x,y) # are also copied. This allows us to ignore copying vectors (x,y) -> (x,y), which prevents redundant copying, # thus saving valuable computational time. out_image.copy_image(frame_previous) ################### # Plugins Section # ################### # Note: Run the plugins in the SAME order it was ran in dandere2x_cpp. If not, it won't work correctly. out_image = pframe_image(context, out_image, frame_previous, frame_residual, list_residual, list_predictive) out_image = fade_image(context, out_image, list_fade) out_image = correct_image(context, out_image, list_corrections) return out_image
def make_merge_image(context: Context, frame_residual: Frame, frame_previous: Frame, list_predictive: list, list_residual: list, list_corrections: list, list_fade: list): """ This section can best be explained through pictures. A visual way of expressing what 'merging' is doing is this section in the wiki. https://github.com/aka-katto/dandere2x/wiki/How-Dandere2x-Works#part-2-using-observations-to-save-time Inputs: - frame(x) - frame(x+1)_residual - Residual vectors mapping frame(x+1)_residual -> frame(x+1) - Predictive vectors mapping frame(x) -> frame(x+1) Output: - frame(x+1) """ # Load context logger = logging.getLogger(__name__) out_image = Frame() out_image.create_new(frame_previous.width, frame_previous.height) # If list_predictive and list_predictive are both empty, then the residual frame # is simply the new image. if not list_predictive and not list_predictive: out_image.copy_image(frame_residual) return out_image # by copying the image first as the first step, all the predictive elements like # (0,0) -> (0,0) are also coppied out_image.copy_image(frame_previous) # run the image through the same plugins IN ORDER it was ran in d2x_cpp out_image = pframe_image(context, out_image, frame_previous, frame_residual, list_residual, list_predictive) out_image = fade_image(context, out_image, list_fade) out_image = correct_image(context, out_image, list_corrections) return out_image