Source code download
Barrier scanning was initially a solution to the problem of cathode ray tube (CRT) display in analog television broadcasting. It is designed to ensure the frequency bandwidth occupied by the signal while maintaining a high vertical resolution and a high enough field update rate. Maintaining a high field update rate is essential to prevent the visual blinking of the CRT.
On a modern high-resolution display device, this line-by-line scanning video has the disadvantages of blinking between lines and moving edges. To eliminate these shortcomings, we have proposed many de-interlacing algorithms. These algorithms include a simple on-site interpolation algorithm to a very complex motion compensation algorithm.
The simple de-interlacing algorithm has low overhead, but the obtained image quality is poor. The complex de-interlacing algorithm delivers good image quality, but the overhead is also amazing. This section describes a motion adaptive algorithm that balances image quality and overhead.
The basic idea of this algorithm is to use the inter-field Interpolation Algorithm for absolute static areas in the image to improve the vertical resolution. For absolute motion areas in the image, use the intra-field interpolation algorithm, improves the time-domain resolution and delivers a good effect in fast motion scenarios. When an image is in an absolute static or absolute motion area, the motion factor is calculated and the inter-field interpolation algorithm and intra-field interpolation algorithm are used.
The key of the algorithm is the motion detection part. If the motion detection fails, the inter-field interpolation algorithm is used in the motion area, which leads to ugly interweaving; if motion detection is too sensitive, the field interpolation algorithm is used in the static area, which significantly reduces the vertical resolution of the image. To strike a better balance between sensitivity and robustness, a fuzzy motion detector is used here.
Example of an algorithm:
One of the defects of an algorithm is to introduce a latency.
The algorithm can be optimized in at least two places. First, the motion_factor convolution computation uses a 3x3 convolution window, which can change the size of the convolution window, such as 5x5, or change the convolution weight. The second is the calculation of X. Here we use the inter-field interpolation and intra-field interpolation. We can consider adding Oblique Edge interpolation.
The source code uses GPU to implement the de-interlacing algorithm and rendering algorithm.
See: Motion Adaptive Video deinterlacing using one dimen1_fuzzy FIR filters.