zoukankan      html  css  js  c++  java
  • Introduction to x265 Rate Control Algorithm

    The rate control in x265 is the same as x264's implementation, which is mostly empirical. It includes one two-pass and three one-pass modes(ABR, CRF and CQP). We describe ABR and CRF modes below.

    Average Bitrate(ABR)

    This is a one-pass scheme which produces near-constant quality within a specified file size. The ABR mode is implemented as follows:

    1. Run a fast motion estimation algorithm over a half-resolution version of current frame and then get SATD[i].
    2. Calculate blurred complexity of current frame  according to SATD[i].
      blurredComplexity [i] =  cplxsum [i] / ( cplxcount [i] )
      cplxsum [i]   = cplxsum [i - 1]  ∗ 0.5 + SATD [i]
      cplxcount [i] = cplxcount [i - 1]  ∗ 0.5 + 1
    3. Calculate qscale of current frame according to blurredComplexity [i] .
       qscale [i] =  blurredComplexity [i] ^ (1 - qcomp)
    4. Clip qscale [i] twice in order to get it more accurate.
      qscale [i] =  qscale[i] / rateFactor[i]
      qscale [i] = qscale[i] ∗ overflow
      rateFactor [i] = wanted_bits_windows[i] / cplxsum[i]
      overflow = clip3f(1 + (totalBits - wanted_bits) / abr_buffer, 0.5, 2)
    5. Call clipQscale function to guarantee that the buffer is in a reasonable state by the end of the lookahead.
    6. Calculate QP according to qscale.
      QP = 12 + 6 * log2 (qscale[i] / 0.85)

    Constant Rate Factor(CRF)

    The CRF mode is a one-pass mode that is optimal if the user specifies quality instead of bitrate. It is the same as ABR, except that the scaling factor is a constant and no overflow compensation is done. The steps are given below:

    1. Run a fast motion estimation algorithm over a half-resolution version of current frame and then get SATD[i].
    2. Calculate blurred complexity of current frame  according to SATD[i].
      blurredComplexity [i] =  cplxsum [i] / ( cplxcount [i] )
      cplxsum [i]   = cplxsum [i - 1]  ∗ 0.5 + SATD [i]
      cplxcount [i] = cplxcount [i - 1]  ∗ 0.5 + 1
    3. Calculate qscale of current frame according to blurredComplexity [i].
       qscale [i] =  blurredComplexity [i] ^ (1 - qcomp)
    4. Scale qscale [i] with a constant.
      qscale [i] =  qscale[i] / rateFactor
    5. Call clipQscale function to guarantee that the buffer is in a reasonable state by the end of the lookahead.
    6. Calculate QP according to qscale.
      QP = 12 + 6 * log2 (qscale[i] / 0.85)
  • 相关阅读:
    IIS6.0服务器架站无法访问解决方案总结
    DNN中做支持多语言的模块
    在dotnetnuke中创建 parent portal
    DNN,Rainbow资源
    2005年岁末,各种主流CMS系统的比较和汇总
    在DNN中获取所有模块信息
    学习dnn的新资源,sooooooooo great!!
    DNN的电子商务模块
    DNN学习笔记
    也学ASP.NET 2.0 AJAX 之二:使用Timer控件
  • 原文地址:https://www.cnblogs.com/lakeone/p/5436481.html
Copyright © 2011-2022 走看看