Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transients for moving pictures processing #3

Open
DTL2020 opened this issue May 1, 2023 · 9 comments
Open

Transients for moving pictures processing #3

DTL2020 opened this issue May 1, 2023 · 9 comments

Comments

@DTL2020
Copy link

DTL2020 commented May 1, 2023

The most important part at the generating new transient from old samples values to new samples values (like fill border with constant value) is about transient shaping. Making sharp transient (zero sampes width) is typically worst case because typical moving pictures scalers (like sinc-based and jinc for 2D) will create large ringing on the total scaler kernel size.

From the japan ARIB STD-B28 Version 1.0 https://www.arib.or.jp/english/html/overview/doc/6-STD-B28v1_0-E1.pdf ​for transients design for colour bars - it is required to have from 6 to 9 samples encoding good enough quality transient (up to high-end broadcast quality transient for quality check).

A.5 Transient
​Ringing may occur when the stripe level of this color bar is suddenly changed, then this may possibly
cause operational inconvenience. Therefore, it is necessary to carry out design while limiting
bandwidths for leading edge and falling edge.
​The number of samples to be used for the transient shall be 6 to 9, in the case of 1920
horizontal samples, although it may depend upon the scale of hardware, process performance
and the so-called “make up”.

In current AVS core the AddBorders also do not have any transients shaping. So it is required some workaround in scripting - cut transient area and apply directional blur or other filtering in some form and overlap back the processed transient area.

With external plugin it is expected some internal processing service to create good transient as single operation.

So for better plugin operation it is required new params like:

  1. Filter type for transient shaping (typical applicable from AVS core: Gauss, UserDefined2, SinPow, Blur())
  2. Width of transient in samples (default around 4..5, minimum 3). It may be even only number of samples if we expect center of new transient in-between last old (real) sample and first new (added) sample, so 2,4 and more. Or half-width in odd number from 1 or 2.
@Asd-g
Copy link
Owner

Asd-g commented May 2, 2023

A.5 Transient you referred to is for a case with two solid colors and the transient area between them when the original content size is changed.
I think this case is not relevant for this plugin. FillBorders is mainly meant for filling 1px line on any border of the image or padding. Depending on the used mode the filling is done by copying the next line (no transient area), by averaging the next 3 lines (no transient area).
Actually mode=4 can benefit of such transient area but I haven't saw anyone using that mode. I will no bother (at least in foreseeable future) to implement transient area for this mode.

@DTL2020
Copy link
Author

DTL2020 commented May 2, 2023 via email

@Asd-g
Copy link
Owner

Asd-g commented May 2, 2023

You cannot have a result (16), 16, 27, 132, 235, 16, 16, 16, (16) from (16), 16, 27, 132, 235, 132, 27, 16, (16) using FillBorders.

Also Fillborders is for filling only borders of the frame not internals of the frame.

Please read again what's the purpose of the filter and/or test it yourself.

@DTL2020
Copy link
Author

DTL2020 commented May 2, 2023 via email

@Asd-g
Copy link
Owner

Asd-g commented May 3, 2023

Well, I already mentioned mode=4 in my first comment:

Actually mode=4 can benefit of such transient area but I haven't saw anyone using that mode. I will no bother (at least in foreseeable future) to implement transient area for this mode.

Filling with solid color... - as you mentioned, there are already filters doing that job.

@DTL2020
Copy link
Author

DTL2020 commented May 3, 2023 via email

@Asd-g
Copy link
Owner

Asd-g commented May 3, 2023

You can fill after resizing to avoid artifacts.

I will not spend time to add a mode for filling with solid colors w/ or w/o transients. PRs are welcome or you could wait for response in the issue you already opened in avs+ repo.

I leave this issue opened to remind me about mode=4.

@DTL2020
Copy link
Author

DTL2020 commented May 4, 2023 via email

@DTL2020
Copy link
Author

DTL2020 commented May 6, 2023

I make example of simplest possible kernel (gauss) and only 1 new param (ts - transient size in half-size, so 0 (no processing),1,2,3,..) for transient filtering in pull-request of #4 . The left border processing looks like work OK for all widths (of left-fill param) and right still need some debug on low widths (about right=4 and ts=2). I think if you can re-design it in better C program it may not need to spent many time on right/top/bottom processing if you will redesign it in the possibly different way. The debug of handling of edge-conditions take many time with my poor programming skill. It takes me many hours to make and debug processing for left-only. The internals of frame processing far enough from frame edges is equal for all left/top/right/bottom transients and with equal kernel.

The no-resize filtering of transient with convolution is very simple but handling of edge-conditions add some complexity to function (the fetching must not run out of frame buffer and of edges of line/column, all out of border samples for convolution are copy of edge sample).

The gauss kernel param of 1.2f internal adjusted to have nice enough close to non-ringing transient at sincresize of a small with (to be sharp enough). May be also made of user-defined param if user like to adjust transient width to more blurry for example). If add more sharper kernels optionally (SinPow and UserDefined2) - the 2 more kernel adjusting params required as user-provided filter arguments.

Good enough results are with ts=2. The result of ts=1 is also much better in compare with nothing. So may be the C-convolution is fast enouth to compute. If not - the processing may be not very complex put to SIMD for better performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants