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)
  • 相关阅读:
    C# 获取指定目录下所有文件信息、移动目录、拷贝目录
    土地利用数据库地图自动缩编软件--地图缩编
    全国不动产登记交流
    [记录]好用的文件上传插件webuploader
    Petapoco Update在使用匿名对象修改时提示“给定关键字不在字典中”
    解决在MySQL使用PetaPoco T4生成数据的实体时得到当前MySQL数据库下所有表的错误方法
    [知识积累]MySQL外键约束条件
    Js判断QQ在线状态不准确的解决办法
    稍带迷茫的秋日小记
    假如你有个idea,你将怎么去实现它?
  • 原文地址:https://www.cnblogs.com/lakeone/p/5436481.html
Copyright © 2011-2022 走看看