本文共 4166 字,大约阅读时间需要 13 分钟。
注:问号以及未注释部分 会在x265-1.8版本内更新
/****************************************************************************** Copyright (C) 2013 x265 project** Author: Steve Borho** 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_FRAME_H#define X265_FRAME_H#include "common.h"#include "lowres.h"#include "threading.h"namespace x265 {// private namespaceclass FrameData;class PicYuv;struct SPS;#define IS_REFERENCED(frame) (frame->m_lowres.sliceType != X265_TYPE_B) class Frame{public: //frame进出队列史:Lookahead.m_inputQueue -> Lookahead.m_outputQueue -> DPB.m_picList -> /* These two items will be NULL until the Frame begins to be encoded, at which point * it will be assigned a FrameData instance, which comes with a reconstructed image PicYuv */ FrameData* m_encData; PicYuv* m_reconPic; //存储重构帧数据 在allocEncodeData中获取内存 /* Data associated with x265_picture */ PicYuv* m_fencPic; //存储编码数据 在Encoder中获取数据(copyFromPicture),有具体空间 (周边扩边无意义值) int m_poc; //当前POC int64_t m_pts; //显示时间戳,在编码器内环里一般就是poc的值,用于标记显示的顺序user provided presentation time stamp int64_t m_reorderedPts; //编码序号 int64_t m_dts; //???解码时间戳(值一般等于:编码顺序-2) int32_t m_forceqp; // Force to use the qp specified in qp file void* m_userData; // user provided pointer passed in with this picture Lowres m_lowres; // 对应下采样信息1/2 bool m_lowresInit; // 是否初始化 lowres init complete (pre-analysis) bool m_bChromaExtended; // 色度块是否已经扩边,初始化为false 加权分析函数 weightAnalyse 会对其进行扩边 orig chroma planes motion extended for weight analysis /* Frame Parallelism - notification between FrameEncoders of available motion reference rows */ ThreadSafeInteger m_reconRowCount; // count of CTU rows completely reconstructed and extended for motion reference volatile uint32_t m_countRefEncoders; // 计数当前参考帧的被参考次数(DPB::prepareEncode 函数中将对应参考帧的被参考次数加一 在compressFrame()之后对应参考帧的被参考次数减一) // 输出帧的时候减一 创建帧的时候加一(也就是说是含有自身一次以防止被释放????? 从2开始计数) 初始化值为 0count of FrameEncoder threads monitoring m_reconRowCount Frame* m_next; // 当前所在队列下一帧PicList doubly linked list pointers Frame* m_prev; x265_param* m_param; // 当前所在队列中前一帧Points to the latest param set for the frame. x265_analysis_data m_analysisData; /** 函数功能 :初始化Frmae /* 调用范围 :只在Encoder::encode函数中被调用 * \返回值 :null */ Frame(); /** 函数功能 :申请原始帧m_fencPic与1/2下采样帧空间并将其初始化 /* 调用范围 :只在Encoder::encode函数中被调用 * \返回值 :申请空间成功为ture,否则为false */ bool create(x265_param *param); /** 函数功能 :申请重构帧内存并初始化为0,申请一帧CTU的存储空间,初始化CTU、初始化统计信息 /* 调用范围 :只在Encoder::encode函数中被调用 * \返回值 :申请空间成功为ture,否则为false */ bool allocEncodeData(x265_param *param, const SPS& sps); void reinit(const SPS& sps); /** 函数功能 :释放内存 /* 调用范围 :只在Encoder::encode、Lookahead::destroy()和~DPB()函数中被调用 * \返回值 :null */ void destroy();};}#endif // ifndef X265_FRAME_H
转载地址:http://lauub.baihongyu.com/