encoder: h264: calculate a better slice_qp_delta in running time
Submitted by Wind Yuan
Link to original bug (#722082)
Description
gstvaapi H.264 encoder need set a proper slice_qp_delta in encoding slices. The currently code only set a fixed value. It's better to make slice_qp_delta more flexible in running. some possible options.
- CQP mode, keep 0.
- bitrate control mode, need to check the bitrate fluctution. always keep a window size there and compare the summary of last few encoded frame size, if larger than window, set slice_qp_delta > 0 to reduce next frame size. If less than avg, set to < 0 try to fill the window, but make sure init_qp + slice_qp_delta >= min_qp.
- none rate-control mode, maybe set to 0, or random between [init_qp - n, init_qp + m]. certainly if can consider about quality changes should be much better.
Any suggestions/comments welcome.