ni_quadra_merge
The ni_quadra_merge filter will merge decoder ppu0 and ppu1 into one frame. The inputs are from decoder output directly with hardware AVFrames. The filter uses ppu0 Y as Y data and ppu1 UV as UV data, scale the Y size to UV size and merge into one. The ppu1 AVFrame cannot be used as Mult inputs because the Y data is changed by merge filter. The ppu0 and ppu1 must have the same format. The inputs only support YUV420P, NV12 YUV420P10LE and P010LE format. ni_quadra_merge only supports hardware AVFrames as input and output.
The ni_quadra_merge filter only accepts limited color range video (also known as “tv” range). Full range video (or “pc” range) is accepted; however, the ni_quadra_merge filter will always clamp to limited color range video before processing. This will cause a slight color shift in the output video.
Parameters
The following are the ni_quadra_merge parameters:
Filterblit
Specifies the merge algorithm.
The default is a simple blit function that uses an algorithm similar to the nearest neighbor algorithm.
When the filterblit parameter is set to 1, then the filterblit function will be used for scaling. The filterblit function uses an algorithm that is similar in quality to the bicubic algorithm.
When the filterblit parameter is set to 2, a bicubic algorithm is used.
When the filterblit parameter is set to 3, a bicubic variant algorithm 1 is used. Compared to filterblit 2, this algorithm can sacrifice image quality but avoid moiré effects under high downscaling ratios. It is recommended for compression ratios greater than 3:1.
When the filterblit parameter is set to 4, a bicubic variant algorithm 2 is used. Compared to filterblit 3, its moiré-reduction performance is slightly weaker, but it sacrifices less image quality. It is recommended for compression ratios between 2:1 and 3:1.
When the filterblit parameter is set to 5, a lanczos algorithm is used.
When the filterblit parameter is set to 6, allow customers to use their own scaling algorithm and configure kernel information.
The parameter only applies to ppu0 Y data.
| Supported Values | Integer in the range 0 to 6 |
| Defaults | 0 |
buffer_limit
Whether to limit the number of output buffers. If enabled, the buffering count of the filter is its buffer pool size(default 4) plus encoding buffering count if its downstream is encoder. It’s enabled by default in FFmpeg-n6.1, FFmpeg-n7.1, FFmpeg 7.1.3, FFmpeg-n8.0.1 and FFmpeg-n8.1.
| Supported Values | Integer 0 and 1 |
| Defaults | 0 |
param_b
Set parameter B of bicubic.This param only effect when filterblit set to 2.
Please try to use the same value on the same device. Otherwise, it may have some impact on FW load
| Supported Values | Double 0 to 5 |
| Defaults | 0.75 |
param_c
Set parameter C of bicubic.This param only effect when filterblit set to 2.
Please try to use the same value on the same device. Otherwise, it may have some impact on FW load
| Supported Values | Double 0 to 5 |
| Defaults | 0.75 |
Kernel_taps
Set number of active filter taps in the user kernel.
This param will be effect only with filterblit=6.
| Supported Values | int 1 to 5 |
| Defaults | 5 |
The following example shows how to use merge. The decoder decodes a H.264 input using the h264_ni_quadra_dec, ni_quadra_merge will scale ppu0 Y to the same size as ppu1, merge ppu0 Y and ppu1 UV and pass it to h265_ni_quadra_enc for encoding.
ffmpeg -c:v h264_ni_quadra_dec -dec 0 -xcoder-params out=hw:semiplanar0=1:enableOut1=1:scale1=1280x720:semiplanar1=1 -i test.h264 -vf “ni_quadra_merge=filterblit=2” -c:v h265_ni_quadra_enc –enc 0 merge.h265