HEVC學習(十六) SAO函式解析之四

2021-06-13 22:27:40 字數 3038 閱讀 7077

void tencsampleadaptiveoffset::saocomponentparamdist(int allowmergeleft, int allowmergeup, saoparam *saoparam, int addr, int addrup, int addrleft, int ycbcr, double lambda, saolcuparam *compsaoparam, double *compdistortion)

if( currentrdcost < bestrdcosttablebo) //!< 更新最佳值 }

// re code all offsets

// code center

estdist = 0;

for(classidx = bestclasstablebo; classidx < bestclasstablebo+sao_bo_len; classidx++)

} //!< if( typeidx == sao_bo )

resetsaounit(&saolcuparamrdo);

saolcuparamrdo.length = m_inumclass[typeidx];

saolcuparamrdo.typeidx = typeidx;

saolcuparamrdo.mergeleftflag = 0;

saolcuparamrdo.mergeupflag = 0;

saolcuparamrdo.subtypeidx = (typeidx == sao_bo) ? bestclasstablebo : 0;

for (classidx = 0; classidx < saolcuparamrdo.length; classidx++)

m_pcrdgoonsbaccoder->load(m_pppcrdsbaccoder[0][ci_temp_best]);

m_pcrdgoonsbaccoder->resetbits();

m_pcentropycoder->encodesaooffset(&saolcuparamrdo, ycbcr);

estrate = m_pcentropycoder->getnumberofwrittenbits();

m_dcost[ycbcr][typeidx] = (double)((double)estdist + lambda * (double) estrate);

if(m_dcost[ycbcr][typeidx] < dcostpartbest) //!< 更新最佳值

} //!< for (typeidx=0; typeidxcompdistortion[0] += ((double)bestdist/lambda);

m_pcrdgoonsbaccoder->load(m_pppcrdsbaccoder[0][ci_temp_best]);

m_pcentropycoder->encodesaooffset(saolcuparam, ycbcr);

m_pcrdgoonsbaccoder->store( m_pppcrdsbaccoder[0][ci_temp_best] );

// merge left or merge up

for (int idxneighbor=0;idxneighbor<2;idxneighbor++)

else

if (allowmergeup && addrup>=0 && idxneighbor ==1) //!< 上鄰塊可用

if (saolcuparamneighbor!=null) }

else

copysaounit(&compsaoparam[idxneighbor], saolcuparamneighbor );

compsaoparam[idxneighbor].mergeupflag = idxneighbor;

compsaoparam[idxneighbor].mergeleftflag = !idxneighbor;

compdistortion[idxneighbor+1] += ((double)estdist/lambda);

} } }

void tencsampleadaptiveoffset::saocomponentparamdist(int allowmergeleft, int allowmergeup, saoparam *saoparam, int addr, int addrup, int addrleft, int ycbcr, double lambda, saolcuparam *compsaoparam, double *compdistortion)

} //!< for (typeidx=0; typeidxload(m_pppcrdsbaccoder[0][ci_temp_best]);

m_pcentropycoder->encodesaooffset(saolcuparam, ycbcr);

m_pcrdgoonsbaccoder->store( m_pppcrdsbaccoder[0][ci_temp_best] );

// merge left or merge up

for (int idxneighbor=0;idxneighbor<2;idxneighbor++)

else if (allowmergeup && addrup>=0 && idxneighbor ==1) //!< 上鄰塊可用

if (saolcuparamneighbor!=null)

}else

copysaounit(&compsaoparam[idxneighbor], saolcuparamneighbor );

compsaoparam[idxneighbor].mergeupflag = idxneighbor;

compsaoparam[idxneighbor].mergeleftflag = !idxneighbor;

compdistortion[idxneighbor+1] += ((double)estdist/lambda);

} }

}

HEVC學習(十四) SAO函式解析之二

rate distortion optimization of all sao units param saoparam sao parameters param lambda param lambdachroma if sao encoding choice void tencsampleadap...

C Primer Plus學習 十六 函式概述

首先,什麼是函式?函式 fimction 是用於完成特定任務的程式 的自包含單元。儘管c中的函式和 其他語言中的函式 子程式或子過程等扮演著相同的角色,但是在細節上會有所不同。某些函式會導致執行 某些動作,比如primf 可使資料呈現在螢幕上 還有一些函式能返回乙個值以供程式使用,如strlen 將...

c 學習筆記(十六) 函式模板

函式模板 1 函式模板可以像普通函式一樣被過載 2 c 編譯器優先考慮普通函式 3 如果函式模板可以產生乙個更好的匹配,那麼選擇模板 4 可以通過空模板實參列表的語法限定編譯器只通過模板匹配 測試 int max int a,int b template告訴編譯器,這裡開始進行泛型程式設計 type...