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

/*****************************************************************************
* 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_WAVEFRONT_H
#define X265_WAVEFRONT_H
#include "common.h"
#include "threadpool.h"
namespace X265_NS {
// x265 private namespace
// Generic wave-front scheduler, manages busy-state of CU rows as a priority
// queue (higher CU rows have priority over lower rows)
//
// Derived classes must implement ProcessRow().
class WaveFront : public JobProvider//被FrameEncoder继承  用于WPP并行
{
private:
// bitmaps of rows queued for processing, uses atomic intrinsics
// Dependencies are categorized as internal and external. Internal dependencies
// are caused by neighbor block availability.  External dependencies are generally
// reference frame reconstructed pixels being available.
uint32_t volatile *m_internalDependencyBitmap;//map 其对应位置为1 表示前面intra参考块已编码完毕,可以进行编码
uint32_t volatile *m_externalDependencyBitmap;//map 其对应位置为1 表示当前行的外部参考块(如参考帧对应参考块)已经解决,可以进行编码
// number of words in the bitmap
int m_numWords;//map占用uint32_t数目 m_numWords = (numRows + 31) >> 5;
int m_numRows;//一帧CTU行数*2  row*2 + x  x=0 为编码决策  x= 1 为滤波
/* 加上当前视频的CTU行为: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
则分为两类:
编码:0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32
滤波:1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
m_numWords = (17*2+ 31) >> 5 = 2
分为两组:
编码:(0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30),(32) 分别对应map: m_internalDependencyBitmap[0]、m_internalDependencyBitmap[1];m_externalDependencyBitmap[0]、m_externalDependencyBitmap[1]
滤波:(1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31),(33) 分别对应map: m_internalDependencyBitmap[0]、m_internalDependencyBitmap[1];m_externalDependencyBitmap[0]、m_externalDependencyBitmap[1]
而其map对应32位中对应组内的32行
**/
public:
//构造函数 初始化null
WaveFront()
: m_internalDependencyBitmap(NULL)
, m_externalDependencyBitmap(NULL)
{}
/** 函数功能       : 释放内存 析构函数
/*  调用范围       : 只在~FrameEncoder()函数中被调用
**/
virtual ~WaveFront();
// If returns false, the frame must be encoded in series.
/** 函数功能       : 初始化WaveFront
/*  调用范围       : 只在FrameEncoder::init函数中被调用
* \参数 numRows    : 一帧的CTU行数*2
*   返回值         : 成功返回ture 失败返回 false
**/
bool init(int numRows);
// Enqueue a row to be processed (mark its internal dependencies as resolved).
// A worker thread will later call processRow(row).
// This provider must be enqueued in the pool before enqueuing a row
/** 函数功能             : 将当前row对应位置的map置为1 标记可以执行
/*  调用范围             : 只在enqueueRowEncoder和enqueueRowFilter函数中被调用
* \参数 row              : CTU行号*2 + x  x= 0 为 enqueueRowEncoder  x= 1 为enqueueRowFilter
* \返回                  : null* */
void enqueueRow(int row);
// Mark a row as no longer having internal dependencies resolved. Returns
// true if bit clear was successful, false otherwise.
/** 函数功能             : 将当前row对应位置的map置为0 标记可以执行
/*  调用范围             : 只在processRowEncoder函数中被调用
* \参数 row              : CTU行号*2 + x  x= 0 为 enableRowEncoder  x= 1 为enableRowFilter
* \返回                  : 一般返回false* */
bool dequeueRow(int row);
// Mark the row's external dependencies as being resolved
/** 函数功能             : 将当前row对应位置的map置为1 标记可以执行
/*  调用范围             : 只在enableRowEncoder和enableRowFilter函数中被调用
* \参数 row              : CTU行号*2 + x  x= 0 为 enableRowEncoder  x= 1 为enableRowFilter
* \返回                  : null* */
void enableRow(int row);
// Mark all row external dependencies as being resolved. Some wavefront
// implementations (lookahead, for instance) have no recon pixel dependencies.
/** 函数功能             : 将外部map全部标记为可执行
/*  调用范围             : 无调用位置
* \返回                  : null* */
void enableAllRows();
// Mark all rows as having external dependencies which must be
// resolved before each row may proceed.
/** 函数功能             : 将当前WPPmap全部初始化为不可执行
/*  调用范围             : 只在FrameEncoder::compressFrame()函数中被调用
* \返回                  : null * */
void clearEnabledRowMask();
// WaveFront's implementation of JobProvider::findJob. Consults
// m_queuedBitmap and calls ProcessRow(row) for lowest numbered queued row
// processes available rows and returns when no work remains
/** 函数功能             : 触发WPP(在threadMain()主动发起) 只进行处理一个CTU行即退出(不一定执行完毕)(其它CTU需要重新触发)
/*  调用范围             : 只在WorkerThread::threadMain()(在compressFrame()、processRowEncoder通过tryWakeOne()中触发执行)
* \参数 threadId         : 当前的内核号
* \返回                  : null * */
void findJob(int threadId);
// Start or resume encode processing of this row, must be implemented by
// derived classes.
virtual void processRow(int row, int threadId) = 0;//虚函数 子类具体调用 执行具体CTU行(滤波或者编码)
};
} // end namespace X265_NS
#endif // ifndef X265_WAVEFRONT_H

x265-1.8版本-common/wavefront.h注释相关推荐

  1. x265-1.8版本-common/wavefront.cpp注释

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

  2. x265-1.8版本-common/contexts.h注释

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

  3. x265-1.8版本-common/cudata.h注释

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

  4. x265-1.7版本-common/cudata.h注释

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

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

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

  6. x265-1.8版本-common/lowres.h注释

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

  7. x265-1.7版本-common/lowres.h注释

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

  8. x265-1.8版本-encoder/frameencoder.h注释

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

  9. x265-1.7版本-encoder/frameencoder.h注释

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

最新文章

  1. 建军92周年,让我们了解那些先进的军用机器人
  2. python在读写文件之前需要创建文件对象-Python对象序列化写入文件对象
  3. 中国移动如何开具并下载打印电子发票?
  4. java中的json_java中的json使用
  5. SAP 电商云 Spartacus UI 的 feature module 设计原理
  6. 增压的jstack:如何以100mph的速度调试服务器
  7. 开源协议概谈[转载]
  8. 如何避免ajax重复请求?
  9. Redis教程:事件、客户端和服务器
  10. 使用无锁队列(环形缓冲区)注意事项
  11. Atititi 计算机系 教材 目录 1. 硬件类 2 1.1. 《微机系统与接口技术》 2 1.2. 《计算机组成与系统结构(第2版)》 2 2. Atitit 操作系统原理 操作系统原理(cpu
  12. Spring Security整合KeyCloak保护Rest API
  13. 手把手带你撸一个校园APP(七):校园文化模块(社团活动表白墙图说校园)
  14. 用php搭建微信公众号,用PHP搭建一个自己的微信公众号
  15. AE实践一:跑车动画
  16. 钰泰ETA2821,42V/1.5A降压转换器,集成OVP功能防浪涌
  17. thinksns+ 安装,处理安装过程中报错
  18. NDK开发-Android下摄像头YUV数据获取与H264编码(FFmpeg、x264)总结
  19. windows系统下MySQL中遇到1045问题
  20. emgucv之Matrix操作

热门文章

  1. 当小米MIX 2遇到iPhone X 你会怎么选?
  2. 关于仿写00片刻企业站
  3. 使用opencv-python读取多个(海康\华为)网络摄像头的视频流,解决实时读取延迟问题
  4. gitea 忘记密码 重设密码
  5. python寒假培训第二课
  6. [armv9]-PAC:Pointer authentication和BTI:Branch target instructions介绍
  7. ubuntu 18.04下greenplum安装笔记(二)安装Greenplum的失败的尝试
  8. EasyClick adb shell命令大全
  9. 【转载】深入了解scanf()/getchar()和gets()等函数,C++系列教程,C++实例教程,C++
  10. 读书笔记||控制论、信息论、系统论