x265-1.8版本-common/framedata.h注释

注:问号以及未注释部分 会在x265-1.9版本内更新

/*****************************************************************************
* Copyright (C) 2013 x265 project
*
* Author: Steve Borho <steve@borho.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
*
* This program is also available under a commercial proprietary license.
* For more information, contact us at license @ x265.com.
*****************************************************************************/

#ifndef X265_FRAMEDATA_H
#define X265_FRAMEDATA_H

#include "common.h"
#include "slice.h"
#include "cudata.h"

namespace X265_NS {
// private namespace

class PicYuv;
class JobProvider;

#define INTER_MODES 4 // 2Nx2N, 2NxN, Nx2N, AMP modes
#define INTRA_MODES 3 // DC, Planar, Angular modes

/* Current frame stats for 2 pass */
struct FrameStats //被CTURow 和 FrameData 引用 用途:???
{
    int         mvBits;    /* MV bits (MV+Ref+Block Type) */
    int         coeffBits; /* Texture bits (DCT coefs) */
    int         miscBits;

    int         intra8x8Cnt;
    int         inter8x8Cnt;
    int         skip8x8Cnt;

    /* CU type counts stored as percentage */
    double      percent8x8Intra;
    double      percent8x8Inter;
    double      percent8x8Skip;
    double      avgLumaDistortion;
    double      avgChromaDistortion;
    double      avgPsyEnergy;
    double      avgLumaLevel;
    double      lumaLevel; //CTURow中 存放当前CTU行中的亮度像素值的平均值  FrameData???
    double      percentIntraNxN;
    double      percentSkipCu[NUM_CU_DEPTH];
    double      percentMergeCu[NUM_CU_DEPTH];
    double      percentIntraDistribution[NUM_CU_DEPTH][INTRA_MODES];
    double      percentInterDistribution[NUM_CU_DEPTH][3];           // 2Nx2N, RECT, AMP modes percentage

    uint64_t    cntIntraNxN;//CTURow  FrameData???计数当前intra CU是NxN划分的个数
    uint64_t    totalCu;//CTURow  FrameData???计数当前CU个数
    uint64_t    totalCtu;
    uint64_t    lumaDistortion;
    uint64_t    chromaDistortion;
    uint64_t    psyEnergy;
    uint64_t    cntSkipCu[NUM_CU_DEPTH];//CTURow  FrameData???计数当前是skip模式 并且不是Merge模式的个数
    uint64_t    cntMergeCu[NUM_CU_DEPTH];//CTURow  FrameData???计数当前是skip模式 并且是Merge模式的个数
    uint64_t    cntInter[NUM_CU_DEPTH];//CTURow  FrameData???计数当前不是skip模式 并且是inter的个数
    uint64_t    cntIntra[NUM_CU_DEPTH];//CTURow  FrameData???计数当前 intraCU处在当前深度的个数 注意:最底层NxN模式不会统计  例如:最大CU64x64 最小CU8x8 cntIntra[0]表示处于depth=0 64x64的CU个数 cntIntra[3] 表示cu是8x8但不是NxN划分的个数
    uint64_t    cuInterDistribution[NUM_CU_DEPTH][INTER_MODES];//CTURow  FrameData???计数当前interCU(非skip)在当前深度的划分个数 2Nx2N, 2NxN, Nx2N, AMP modes
    uint64_t    cuIntraDistribution[NUM_CU_DEPTH][INTRA_MODES];//CTURow  FrameData???计数当前亮度Planar、DC、角度模式在当前深度的个数
    uint16_t    maxLumaLevel; //CTURow中 存放当前CTU行中最大的亮度像素值  FrameData???

    FrameStats()//构造函数 初始化为0
    {
        memset(this, 0, sizeof(FrameStats));
    }
};

/* Per-frame data that is used during encodes and referenced while the picture
 * is available for reference. A FrameData instance is attached to a Frame as it
 * comes out of the lookahead. Frames which are not being encoded do not have a
 * FrameData instance. These instances are re-used once the encoded frame has
 * no active references. They hold the Slice instance and the 'official' CTU
 * data structures. They are maintained in a free-list pool along together with
 * a reconstructed image PicYuv in order to conserve memory. */
class FrameData
{
public:

    Slice*         m_slice; //slice数据,在本类中会实例化
    SAOParam*      m_saoParam;
    x265_param*    m_param;  //配置参数

    FrameData*     m_freeListNext;
    PicYuv*        m_reconPic;     //重构帧数据首地址 (只是指针,指向 frame->m_reconPic)
    bool           m_bHasReferences; // 表示是否有帧参考它(如果后向帧不再参考它设为false) 如果是X265_TYPE_B(不可参考B帧) 设置为false 否则为true 在新来帧计算RPS时会用到(对已经确定RPS的帧,其状态是不可靠的) /* used during DPB/RPS updates */
    int            m_frameEncoderID; //当前任务的job id  其对应的jobid,一个任务一个id如:4核单机中:m_frameEncoder[0]  m_jpId:0  m_frameEncoder[1]  m_jpId:1  m_lookahead m_jpId:2 /* the ID of the FrameEncoder encoding this frame */
    JobProvider*   m_jobProvider;   //当前帧所在的线程位置

    CUDataMemPool  m_cuMemPool;  //存储一帧CTU的全部空间
    CUData*        m_picCTU;     //存储当前帧的全部CTU (空间为一帧CTU个数,在本类中会实例化)

    /* Rate control data used during encode and by references */
    struct RCStatCU
    {
        uint32_t totalBits;     //编码完毕当前CTU占用的bits/* total bits to encode this CTU */
        uint32_t vbvCost;       //存储当前CTU对应所有下采样8x8的最优cost累加值/* sum of lowres costs for 16x16 sub-blocks */
        uint32_t intraVbvCost;  //存储当前CTU对应所有下采样8x8的intracost累加值/* sum of lowres intra costs for 16x16 sub-blocks */
        uint64_t avgCost[4];    /* stores the avg cost of CU's in frame for each depth */
        uint32_t count[4];      /* count and avgCost only used by Analysis at RD0..4 */
        double   baseQp;        //应用VBV:如果是下对角(含对角)CTU 为其右上角baseQP  如果是下对角CTU为当前行的对角diagQp  不应用VBV:在rateControlStart中 获取预估qp参数值(未四舍五入) /* Qp of Cu set from RateControl/Vbv (only used by frame encoder) */
    };
    
    struct RCStatRow//只在FrameData类中应用
    {
        uint32_t numEncodedCUs; //当前CTU行最后一个编码完毕的CTU位置 /* ctuAddr of last encoded CTU in row */
        uint32_t encodedBits;   //存储当前CTU行已经编码CTU占用的bits累加值/* sum of 'totalBits' of encoded CTUs */
        uint32_t satdForVbv;    //在Lookahead::getEstimatedPictureCost函数中存储每个CTU行对应所有8x8块的cost累加值 /* sum of lowres (estimated) costs for entire row */
        uint32_t intraSatdForVbv;//在Lookahead::getEstimatedPictureCost函数中存储每个CTU行对应所有8x8块的intracost累加值  /* sum of lowres (estimated) intra costs for entire row */
        uint32_t diagSatd;    //存储累加当前CTU行已编码CTU的对应下采样计算的SATD值 
        uint32_t diagIntraSatd;//存储累加当前CTU行已编码CTU的对应下采样计算的intraSATD值 
        double   diagQp;//当前行的对现线处修正的QP参数 当前帧未编码时第一行获取获取在rateControlStart中预估qp参数值(未四舍五入) 编码到对角线位置处 会对其修正最新的对角QP
        double   diagQpScale;//当前行的对现线处修正的qscale 当前帧未编码时第一行获取获取在rateControlStart中预估qp参数值(未四舍五入) 对应的qscale  编码到对角线位置处 会对其修正最新的对角qscale
        double   sumQpRc;  //存储当前行的所有CTU baseQp的累加和  baseQp:应用VBV:如果是下对角(含对角)CTU 为其右上角baseQP  如果是下对CTU为当前行的对角diagQp  不应用VBV:在rateControlStart中 获取预估qp参数值(未四舍五入)
        double   sumQpAq;//存储当前行所有CTU 中每个CU的mqp*CU占用4x4块个数  的累加值
    };

    RCStatCU*      m_cuStat; //申请空间为一帧CTU个数???
    RCStatRow*     m_rowStat;//申请空间为一帧CTU行数???
    FrameStats     m_frameStats; // stats of current frame for multi-pass encodes

    double         m_avgQpRc;    //在rateControlStart中 获取预估qp参数值(未四舍五入) rateControlEnd 如果应用VBV 获取当前帧所有QP的平均值(多加了一次估计的QP值)  如果没有应用VBV 依然为在rateControlStart中 获取预估qp参数值(未四舍五入)/* avg QP as decided by rate-control */
    double         m_avgQpAq;   //在rateControlStart中 获取预估qp参数值(未四舍五入)rateControlEnd 如果应用自适应量化 获取当前帧所有CUqp的平均值(按照CU大小加权,多加了一次估计的QP值) 如果没有应用自适应量化 获取m_avgQpRc值  /* avg QP as decided by AQ in addition to rate-control */
    double         m_rateFactor; //一般分辨率越大 此值越大 一般在0.0x之间 在rateControlEnd  只是CRF模式应用 获取具体值/* calculated based on the Frame QP */
    /** 函数功能    :初始化
    /*  调用范围    :只在Frame::allocEncodeData函数中被调用
    */
    FrameData();
    /** 函数功能    :申请一帧CTU的存储空间,初始化CTU、初始化统计信息
    /*  调用范围    :只在Frame::allocEncodeData函数中被调用
    * \返回值       :申请空间成功为ture,否则为false
    */
    bool create(x265_param *param, const SPS& sps);
    /** 函数功能    :初始化统计信息为0
    /*  调用范围    :只在FrameData::create和Frame::reinit函数中被调用
    * \返回值       :null
    */
    void reinit(const SPS& sps);
    /** 函数功能    :释放内存
    /*  调用范围    :只在Frame::destroy()和DPB::~DPB()函数中被调用
    */
    void destroy();
    /** 函数功能    :获取在当前帧对应号的CTU   
    * \参数  ctuAddr: CTU在帧中的编号 */
    CUData* getPicCTU(uint32_t ctuAddr) { return &m_picCTU[ctuAddr]; }
};
}

#endif // ifndef X265_FRAMEDATA_H



 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
In file included from /home/acceler/code/apollo_ros/apollo_ros/src/apollo.ros-1.0.0-master/apollo_common/include/apollo_common/apollo_app.h:46:0, from /home/acceler/code/apollo_ros/apollo_ros/src/apollo.ros-1.0.0-master/apollo_common/src/apollo_app.cc:33: /home/acceler/code/apollo_ros/apollo_ros/src/apollo.ros-1.0.0-master/apollo_common/include/apollo_common/log.h:40:10: fatal error: glog/logging.h: No such file or directory #include <glog/logging.h> ^~~~~~~~~~~~~~~~ compilation terminated. apollo.ros-1.0.0-master/apollo_common/CMakeFiles/apollo_common.dir/build.make:62: recipe for target 'apollo.ros-1.0.0-master/apollo_common/CMakeFiles/apollo_common.dir/src/apollo_app.cc.o' failed make[2]: *** [apollo.ros-1.0.0-master/apollo_common/CMakeFiles/apollo_common.dir/src/apollo_app.cc.o] Error 1 make[2]: *** Waiting for unfinished jobs.... In file included from /home/acceler/code/apollo_ros/apollo_ros/src/apollo.ros-1.0.0-master/apollo_common/include/apollo_common/adapters/adapter_manager.h:48:0, from /home/acceler/code/apollo_ros/apollo_ros/src/apollo.ros-1.0.0-master/apollo_common/src/adapters/adapter_manager.cc:33: /home/acceler/code/apollo_ros/apollo_ros/src/apollo.ros-1.0.0-master/apollo_common/include/apollo_common/adapters/adapter.h:49:10: fatal error: glog/logging.h: No such file or directory #include <glog/logging.h> ^~~~~~~~~~~~~~~~ compilation terminated. apollo.ros-1.0.0-master/apollo_common/CMakeFiles/apollo_common.dir/build.make:110: recipe for target 'apollo.ros-1.0.0-master/apollo_common/CMakeFiles/apollo_common.dir/src/adapters/adapter_manager.cc.o' failed make[2]: *** [apollo.ros-1.0.0-master/apollo_common/CMakeFiles/apollo_common.dir/src/adapters/adapter_manager.cc.o] Error 1 CMakeFiles/Makefile2:3894: recipe for target 'apollo.ros-1.0.0-master/apollo_common/CMakeFiles/apollo_common.dir/all' failed make[1]: *** [apollo.ros-1.0.0-master/apollo_common/CMakeFiles/apollo_common.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 54%] Linking CXX executable /home/acceler/code/apollo_ros/apollo_ros/devel/lib/IntegratedNavigation/IntegratedNavigation_node [ 54%] Built target IntegratedNavigation_node [ 55%] Linking CXX executable /home/acceler/code/apollo_ros/apollo_ros/devel/lib/TimeSynchronierProcess/timeSynchronierProcess_node [ 55%] Built target timeSynchronierProcess_node Makefile:140: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j4 -l4" failed
最新发布
07-23
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值