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)
  • 相关阅读:
    Learning Experience of Big Data:The First Day-Try to set up a network connection on my virtural machine
    Learning Experience of Big Data: Learn to install CentOs 6.5 on my laptop
    事物总线模式实例——EventBus实例详解
    软件架构——事件总线模式
    阅读《大型网站技术架构》,并结合"重大需求征集系统"有感
    淘宝网的六个质量属性
    读架构漫谈博文有感
    06软件需求读书笔记(六)
    .NET应用程序性能优化
    【转】消息队列设计精要
  • 原文地址:https://www.cnblogs.com/lakeone/p/5436481.html
Copyright © 2011-2022 走看看