x265-1.8版本-encoder/bitcost.h注释
来源:互联网 发布:怎么查找网络打印机 编辑:程序博客网 时间:2024/05/16 12:47
注:问号以及未注释部分 会在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_BITCOST_H#define X265_BITCOST_H#include "common.h"#include "threading.h"#include "mv.h"namespace X265_NS {// private x265 namespace//BitCost主要用于计算MVD-cost MVD = MV-MVP class BitCost //被MotionEstimate继承{public: //初始化 BitCost() : m_cost_mvx(0), m_cost_mvy(0), m_cost(0), m_mvp(0) {} /** 函数功能 :建立当前qp下的MVD占用的cost:λ*bits = 2^(qp/6-2) * s_bitsizes[i] * \参数 qp :当前ME下的qp大小 * \返回 :null * */ void setQP(unsigned int qp); /** 函数功能 :设置当前的MVP,并更新以当前MVP的MVD-cost表格:如当前MV=(3,6)MVP=(1,2),则MVD=(2,4) 期MVcost = m_cost_mvx[mv.x] + m_cost_mvy[mv.y] = m_cost_mvx[3] + m_cost_mvy[6] = m_cost[3-1] + m_cost[6-2] = m_cost[2] + m_cost[4] * \参数 mvp :设置当前ME搜索时选用的MVP,以及计算MVD cost的表格 * \返回 :null * */ void setMVP(const MV& mvp) { m_mvp = mvp; m_cost_mvx = m_cost - mvp.x; m_cost_mvy = m_cost - mvp.y; } // return bit cost of motion vector difference, multiplied by lambda /** 函数功能 :返回当前MV与MVP之间的差(MVD)占用的bits-cost * \参数 mv :当前待计算的MV * \返回 :null * */ inline uint16_t mvcost(const MV& mv) const { return m_cost_mvx[mv.x] + m_cost_mvy[mv.y]; } // return bit cost of motion vector difference, without lambda /** 函数功能 :返回当前MV与MVP之间的差(MVD)占用的bits,没有经过λ加权 * \参数 mv :当前待计算的MV * \返回 :null * */ inline uint32_t bitcost(const MV& mv) const { return (uint32_t)(s_bitsizes[abs(mv.x - m_mvp.x)] + s_bitsizes[abs(mv.y - m_mvp.y)] + 0.5f); } /** 函数功能 :返回当前MV与MVP之间的差(MVD)占用的bits,没有经过λ加权 * \参数 mv :当前待计算的MV * \参数 mvp :当前待计算的MVP * \返回 :null * */ static inline uint32_t bitcost(const MV& mv, const MV& mvp) { return (uint32_t)(s_bitsizes[abs(mv.x - mvp.x)] + s_bitsizes[abs(mv.y - mvp.y)] + 0.5f); } /** 函数功能 : 释放空间内存 * \返回 : null */ static void destroy();protected: uint16_t *m_cost_mvx;//计算当前MVD x坐标占用的bits-cost uint16_t *m_cost_mvy;//计算当前MVD y坐标占用的bits-cost uint16_t *m_cost; //当前qp下的MVD占用的cost:λ*bits = 2^(qp/6-2) * s_bitsizes[i],在setQP()中进行初始化 MV m_mvp; //当前ME搜索时选用的MVP BitCost& operator =(const BitCost&);private: /* default log2_max_mv_length_horizontal and log2_max_mv_length_horizontal * are 15, specified in quarter-pel luma sample units. making the maximum * signaled ful-pel motion distance 4096, max qpel is 32768 */ //最大整像素运动矢量为4096 1/4像素 最大为32768 enum { BC_MAX_MV = (1 << 15) }; enum { BC_MAX_QP = 82 }; static float *s_bitsizes; //申请空间大小为 2*32768+1 MVD估计占用bits表格,例如:当前MV.x = 3 ,则其占用bits 为 s_bitsizes[3] 2*(log2(3+1))+e-1 /* s_bitsizes[0] = e - 2 s_bitsizes[i]= 2*(log2(i+1))+e-1 log2 表示以2为底 s_bitsizes[1] = 2log2(2) + e -1 **/ static uint16_t *s_costs[BC_MAX_QP];//所有的me共有,每个qp只初始化一次 static Lock s_costCalcLock; //多线程锁 /** 函数功能 :建立MVD估计占用bits表格,例如:当前MV.x = 3 ,则其占用bits 为 s_bitsizes[3] 2*(log2(3+1))+e-1 * \返回 :null * */ static void CalculateLogs();};}#endif // ifndef X265_BITCOST_H
1 0
- x265-1.8版本-encoder/bitcost.h注释
- x265-1.7版本-encoder/bitcost.h注释
- x265-1.8版本-encoder/bitcost.cpp注释
- x265-1.7版本-encoder/bitcost.cpp注释
- x265-1.8版本-encoder/dpb.h注释
- x265-1.8版本-encoder/frameencoder.h注释
- x265-1.8版本-encoder/motion.h注释
- x265-1.8版本-encoder/ratecontrol.h注释
- x265-1.8版本-encoder/slicetype.h注释
- x265-1.7版本-encoder/encoder.h注释
- x265-1.7版本-encoder/dpb.h注释
- x265-1.7版本-encoder/frameencoder.h注释
- x265-1.7版本-encoder/motion.h注释
- x265-1.7版本-encoder/slicetype.h注释
- x265-1.8版本-encoder/dpb.cpp注释
- x265-1.8版本-encoder/frameencoder.cpp注释
- x265-1.8版本-encoder/level.cpp注释
- x265-1.8版本-encoder/motion.cpp注释
- 【PA2014】【BZOJ3711】Druzyny
- ELF文件学习
- C++类型转换
- MYSQL优化
- x265-1.8版本-encoder/bitcost.cpp注释
- x265-1.8版本-encoder/bitcost.h注释
- TI CC2540 BLE
- win10 无法访问移动硬盘 提示“参数错误”
- 三大工厂模式
- x265-1.8版本-encoder/dpb.cpp注释
- 小县城也被互联网+撞了一下腰
- 一个简单的画图的程序
- hdu2126 Buy the souvenirs(01背包变化)
- 新浪微博之微博分享