x265-1.8版本-common/wavefront.h注释
生活随笔
收集整理的這篇文章主要介紹了
x265-1.8版本-common/wavefront.h注释
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
注:問號以及未注釋部分 會在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 bitmapint 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 33m_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://構造函數 初始化nullWaveFront(): 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注释的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C 宏定义实现字符大小写转换
- 下一篇: html div.menus,性感的CS