x265-1.7版本-encoder/dpb.h注释

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

/*****************************************************************************
 * Copyright (C) 2013 x265 project
 *
 * Authors: 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_DPB_H
#define X265_DPB_H

#include "piclist.h"

namespace x265 {
// private namespace for x265

class Frame;
class FrameData;
class Slice;

class DPB//DPB 是:Decoding Picture Buffer
{
public:

    int                m_lastIDR;//在openGOP关闭下 最近的一个关键帧位置
    int                m_pocCRA; //在openGOP打开下 最近的一个关键帧位置
    int                m_maxRefL0;//L0最大帧数(只有前向帧)即配置的参考帧最大数目
    int                m_maxRefL1;//L1最大帧数(只有后向帧) 如果B帧可参考为2 其它为1
    int                m_bOpenGOP;//打开表示,除第一帧为 X265_TYPE_IDR外,其它I帧为 X265_TYPE_I,打开可以提高压缩率,但是要保留前一个I帧,目的是可以获取当前I帧(IDR无须参考任何帧,I帧可能参考其它I帧)
                                  //关闭表示,全部I帧都为IDR帧  默认为打开,但是打开不适用随机访问
                                  //打开即其关键帧为CAR 关闭为IDR
    bool               m_bRefreshPending;//表示有CRA前置帧,遇到CRA帧 设置为true 新帧在CRA后之后 置为false  始化为false  
    bool               m_bTemporalSublayer;//是否应用时域子层
    PicList            m_picList;//存储当前还需要参考的帧(可能未编码) 编码顺序倒序排序 第一帧是离当前编码最近的帧
    PicList            m_freeList;//???更新在PicList的解释
    FrameData*         m_picSymFreeList;

    DPB(x265_param *param)
    {
        m_lastIDR = 0;
        m_pocCRA = 0;
        m_bRefreshPending = false;
        m_picSymFreeList = NULL;
        m_maxRefL0 = param->maxNumReferences;
        m_maxRefL1 = param->bBPyramid ? 2 : 1;
        m_bOpenGOP = param->bOpenGOP;
        m_bTemporalSublayer = !!param->bEnableTemporalSubLayers;
    }

    ~DPB();
    /** 函数功能       : 设置NAL单元类型,将待编码帧加入DPB列表,获取slice参考帧列表等slice参量,将该帧的参考帧的被参考次数加一
    /*  调用范围       : 只在Encoder::encode函数中被调用
    * \参数 newFrame   : 待编码帧
    *   返回值         : null
    **/
    void prepareEncode(Frame*);

    void recycleUnreferenced();

protected:
    /** 函数功能           : slice中rps获取参考帧列表
    /*  调用范围           : 只在DPB::prepareEncode函数中被调用
    * \参数 curPoc         : 当前帧的POC
    * \参数 isRAP          : 是否关键帧
    * \参数 rps            : slice中的rps &slice->m_rps
    * \参数 maxDecPicBuffer: 解码需要的最大buffer大小
    *   返回值             : null
    **/
    void computeRPS(int curPoc, bool isRAP, RPS * rps, unsigned int maxDecPicBuffer);
    /** 函数功能           : 将DPB m_picList列表中在不属于当前帧的参考帧列表的参考状态置为false
    /*  调用范围           : 只在DPB::prepareEncode函数中被调用
    * \参数 rps            : slice中的rps &slice->m_rps
    * \参数 curPoc         : 当前帧的POC
    *   返回值             : null
    **/
    void applyReferencePictureSet(RPS *rps, int curPoc);
    /** 函数功能       : 遇到关键帧,设置关键帧前的被参考状态(一般置为false)
    /*  调用范围       : 只在DPB::prepareEncode函数中被调用
    * \参数 pocCurr    : 当前帧的POC
    * \参数 nalUnitType: 帧类型
    *   返回值         : null
    **/
    void decodingRefreshMarking(int pocCurr, NalUnitType nalUnitType);
    /** 函数功能       : 返回前置图像NAL类型,后置图像NAL类型,关键帧NAL类型(并不是最终类型)
    /*  调用范围       : 只在DPB::prepareEncode函数中被调用
    * \参数 curPOC     : 当前poc
    * \参数 bIsKeyFrame: 是否为IDR帧
    *   返回值         : 返回前置图像NAL类型,后置图像NAL类型,关键帧NAL类型
    **/
    NalUnitType getNalUnitType(int curPoc, bool bIsKeyFrame);
};
}

#endif // X265_DPB_H


 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值