Merge pull request #1439 from sijchen/for_format

[Reformat] format cpp files for next release
This commit is contained in:
sijchen
2014-10-24 09:00:36 +08:00
14 changed files with 984 additions and 939 deletions

View File

@@ -68,7 +68,7 @@ void WelsLog (SLogContext* logCtx, int32_t iLevel, const char* kpFmt, ...) {
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Detail:");
break;
}
WelsStrcat(pTraceTag,MAX_LOG_SIZE,kpFmt);
WelsStrcat (pTraceTag, MAX_LOG_SIZE, kpFmt);
va_start (vl, kpFmt);
logCtx->pfLog (logCtx->pLogCtx, iLevel, pTraceTag, vl);
va_end (vl);

View File

@@ -1065,9 +1065,9 @@ void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) {
#endif
#ifdef HAVE_NEON_AARCH64
if (iCpu & WELS_CPU_NEON) {
pFunc->pWelsSetNonZeroCountFunc = SetNonZeroCount_AArch64_neon;
}
if (iCpu & WELS_CPU_NEON) {
pFunc->pWelsSetNonZeroCountFunc = SetNonZeroCount_AArch64_neon;
}
#endif
}

View File

@@ -365,11 +365,13 @@ EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum
* \brief Dump reconstruction for dependency layer
*/
extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend, SDqLayer* pDqLayer) {
extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend,
SDqLayer* pDqLayer) {
WelsFileHandle* pDumpRecFile = NULL;
int32_t iWrittenSize = 0;
const char* openMode = bAppend ? "ab" : "wb";
SWelsSPS* pSpsTmp = (kiDid> BASE_DEPENDENCY_ID)? &(pDqLayer->sLayerInfo.pSubsetSpsP->pSps) : pDqLayer->sLayerInfo.pSpsP;
SWelsSPS* pSpsTmp = (kiDid > BASE_DEPENDENCY_ID) ? & (pDqLayer->sLayerInfo.pSubsetSpsP->pSps) :
pDqLayer->sLayerInfo.pSpsP;
bool bFrameCroppingFlag = pSpsTmp->bFrameCroppingFlag;
SCropOffset* pFrameCrop = &pSpsTmp->sFrameCrop;
@@ -390,12 +392,15 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName
int32_t i = 0;
int32_t j = 0;
const int32_t kiStrideY = pCurPicture->iLineSize[0];
const int32_t kiLumaWidth = bFrameCroppingFlag?(pCurPicture->iWidthInPixel-(( pFrameCrop->iCropLeft + pFrameCrop->iCropRight ) << 1 )) : pCurPicture->iWidthInPixel;
const int32_t kiLumaHeight = bFrameCroppingFlag?(pCurPicture->iHeightInPixel-(( pFrameCrop->iCropTop + pFrameCrop->iCropBottom ) << 1 )) : pCurPicture->iHeightInPixel;
const int32_t kiLumaWidth = bFrameCroppingFlag ? (pCurPicture->iWidthInPixel - ((pFrameCrop->iCropLeft +
pFrameCrop->iCropRight) << 1)) : pCurPicture->iWidthInPixel;
const int32_t kiLumaHeight = bFrameCroppingFlag ? (pCurPicture->iHeightInPixel - ((pFrameCrop->iCropTop +
pFrameCrop->iCropBottom) << 1)) : pCurPicture->iHeightInPixel;
const int32_t kiChromaWidth = kiLumaWidth >> 1;
const int32_t kiChromaHeight = kiLumaHeight >> 1;
uint8_t* pSrc = NULL;
pSrc = bFrameCroppingFlag ? (pCurPicture->pData[0] + kiStrideY * ( pFrameCrop->iCropTop << 1 ) + ( pFrameCrop->iCropLeft << 1 )) : pCurPicture->pData[0];
pSrc = bFrameCroppingFlag ? (pCurPicture->pData[0] + kiStrideY * (pFrameCrop->iCropTop << 1) +
(pFrameCrop->iCropLeft << 1)) : pCurPicture->pData[0];
for (j = 0; j < kiLumaHeight; ++ j) {
iWrittenSize = WelsFwrite (pSrc + j * kiStrideY, 1, kiLumaWidth, pDumpRecFile);
assert (iWrittenSize == kiLumaWidth);
@@ -407,7 +412,8 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName
}
for (i = 1; i < I420_PLANES; ++ i) {
const int32_t kiStrideUV = pCurPicture->iLineSize[i];
pSrc = bFrameCroppingFlag ? (pCurPicture->pData[i] + kiStrideUV * pFrameCrop->iCropTop + pFrameCrop->iCropLeft) : pCurPicture->pData[i];
pSrc = bFrameCroppingFlag ? (pCurPicture->pData[i] + kiStrideUV * pFrameCrop->iCropTop + pFrameCrop->iCropLeft) :
pCurPicture->pData[i];
for (j = 0; j < kiChromaHeight; ++ j) {
iWrittenSize = WelsFwrite (pSrc + j * kiStrideUV, 1, kiChromaWidth, pDumpRecFile);
assert (iWrittenSize == kiChromaWidth);
@@ -427,9 +433,11 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName
* \brief Dump the reconstruction pictures
*/
void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend, SDqLayer* pDqLayer) {
void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend,
SDqLayer* pDqLayer) {
WelsFileHandle* pDumpRecFile = NULL;
SWelsSPS* pSpsTmp = (kiDid> BASE_DEPENDENCY_ID)? &(pDqLayer->sLayerInfo.pSubsetSpsP->pSps) : pDqLayer->sLayerInfo.pSpsP;
SWelsSPS* pSpsTmp = (kiDid > BASE_DEPENDENCY_ID) ? & (pDqLayer->sLayerInfo.pSubsetSpsP->pSps) :
pDqLayer->sLayerInfo.pSpsP;
bool bFrameCroppingFlag = pSpsTmp->bFrameCroppingFlag;
SCropOffset* pFrameCrop = &pSpsTmp->sFrameCrop;
@@ -451,12 +459,15 @@ void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t k
int32_t i = 0;
int32_t j = 0;
const int32_t kiStrideY = pCurPicture->iLineSize[0];
const int32_t kiLumaWidth = bFrameCroppingFlag ? (pCurPicture->iWidthInPixel-(( pFrameCrop->iCropLeft + pFrameCrop->iCropRight ) << 1 )) : pCurPicture->iWidthInPixel;
const int32_t kiLumaHeight = bFrameCroppingFlag ? (pCurPicture->iHeightInPixel-(( pFrameCrop->iCropTop + pFrameCrop->iCropBottom ) << 1 )) : pCurPicture->iHeightInPixel;
const int32_t kiLumaWidth = bFrameCroppingFlag ? (pCurPicture->iWidthInPixel - ((pFrameCrop->iCropLeft +
pFrameCrop->iCropRight) << 1)) : pCurPicture->iWidthInPixel;
const int32_t kiLumaHeight = bFrameCroppingFlag ? (pCurPicture->iHeightInPixel - ((pFrameCrop->iCropTop +
pFrameCrop->iCropBottom) << 1)) : pCurPicture->iHeightInPixel;
const int32_t kiChromaWidth = kiLumaWidth >> 1;
const int32_t kiChromaHeight = kiLumaHeight >> 1;
uint8_t* pSrc = NULL;
pSrc = bFrameCroppingFlag ? (pCurPicture->pData[0] + kiStrideY * ( pFrameCrop->iCropTop << 1 ) + ( pFrameCrop->iCropLeft << 1 )) : pCurPicture->pData[0];
pSrc = bFrameCroppingFlag ? (pCurPicture->pData[0] + kiStrideY * (pFrameCrop->iCropTop << 1) +
(pFrameCrop->iCropLeft << 1)) : pCurPicture->pData[0];
for (j = 0; j < kiLumaHeight; ++ j) {
iWrittenSize = WelsFwrite (pSrc + j * kiStrideY, 1, kiLumaWidth, pDumpRecFile);
assert (iWrittenSize == kiLumaWidth);
@@ -468,7 +479,8 @@ void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t k
}
for (i = 1; i < I420_PLANES; ++ i) {
const int32_t kiStrideUV = pCurPicture->iLineSize[i];
pSrc = bFrameCroppingFlag ? (pCurPicture->pData[i] + kiStrideUV * pFrameCrop->iCropTop + pFrameCrop->iCropLeft) : pCurPicture->pData[i];
pSrc = bFrameCroppingFlag ? (pCurPicture->pData[i] + kiStrideUV * pFrameCrop->iCropTop + pFrameCrop->iCropLeft) :
pCurPicture->pData[i];
for (j = 0; j < kiChromaHeight; ++ j) {
iWrittenSize = WelsFwrite (pSrc + j * kiStrideUV, 1, kiChromaWidth, pDumpRecFile);
assert (iWrittenSize == kiChromaWidth);

View File

@@ -156,9 +156,9 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) {
}
if (pSpatialLayer->iMaxSpatialBitrate < pSpatialLayer->iSpatialBitrate * 1.1f) {
WelsLog (pLogCtx, WELS_LOG_WARNING,
"MaxSpatialBitrate (%d) should set be larger than 1.1 times of SpatialBitrate (%d)",
pSpatialLayer->iMaxSpatialBitrate, pSpatialLayer->iSpatialBitrate);
// pSpatialLayer->iSpatialBitrate = (int32_t) (pSpatialLayer->iMaxSpatialBitrate/1.1f);
"MaxSpatialBitrate (%d) should set be larger than 1.1 times of SpatialBitrate (%d)",
pSpatialLayer->iMaxSpatialBitrate, pSpatialLayer->iSpatialBitrate);
// pSpatialLayer->iSpatialBitrate = (int32_t) (pSpatialLayer->iMaxSpatialBitrate/1.1f);
}
}
if (iTotalBitrate > pCfg->iTargetBitrate) {
@@ -1357,7 +1357,9 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) {
iTargetSpatialBsSize = iLayerBsSize;
iCountBsLen = iNonVclLayersBsSizeCount + iVclLayersBsSizeCount;
pParam->iNumRefFrame = WELS_CLIP3 (pParam->iNumRefFrame, MIN_REF_PIC_COUNT, (pParam->iUsageType==CAMERA_VIDEO_REAL_TIME?MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA:MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));
pParam->iNumRefFrame = WELS_CLIP3 (pParam->iNumRefFrame, MIN_REF_PIC_COUNT,
(pParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));
// Output
(*ppCtx)->pOut = (SWelsEncoderOutput*)pMa->WelsMalloc (sizeof (SWelsEncoderOutput), "SWelsEncoderOutput");
@@ -2015,7 +2017,9 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar
}
iRet = pCodingParam->DetermineTemporalSettings();
if (iRet != ENC_RETURN_SUCCESS) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), DetermineTemporalSettings failed return %d (check in/out frame rate and temporal layer setting!)", iRet);
WelsLog (pLogCtx, WELS_LOG_ERROR,
"WelsInitEncoderExt(), DetermineTemporalSettings failed return %d (check in/out frame rate and temporal layer setting!)",
iRet);
return iRet;
}
iRet = GetMultipleThreadIdc (pLogCtx, pCodingParam, iSliceNum, iCacheLineSize, uiCpuFeatureFlags);
@@ -3031,21 +3035,24 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate)
++ pCtx->iCodingIndex;
pFbi->eFrameType = videoFrameTypeSkip;
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8" PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp);
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %8" PRId64", skip one frame",
(int64_t)pSrcPic->uiTimeStamp);
return ENC_RETURN_SUCCESS;
}
eFrameType = DecideFrameType (pCtx, iSpatialNum);
if (eFrameType == videoFrameTypeSkip) {
pFbi->eFrameType = eFrameType;
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8" PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp);
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %8" PRId64", skip one frame",
(int64_t)pSrcPic->uiTimeStamp);
return ENC_RETURN_SUCCESS;
}
//loop each layer to check if have skip frame when RC and frame skip enable
if (CheckFrameSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, (uint32_t)pSrcPic->uiTimeStamp)) {
pFbi->eFrameType = videoFrameTypeSkip;
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8" PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp);
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %8" PRId64", skip one frame",
(int64_t)pSrcPic->uiTimeStamp);
return ENC_RETURN_SUCCESS;
}
@@ -3429,7 +3436,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
}
pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize);
RcTraceFrameBits (pCtx,pSrcPic->uiTimeStamp);
RcTraceFrameBits (pCtx, pSrcPic->uiTimeStamp);
pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc->iAverageFrameQp;
//update scc related
@@ -3760,7 +3767,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa
} else {
/* maybe adjustment introduced in bitrate or little settings adjustment and so on.. */
pNewParam->iNumRefFrame = WELS_CLIP3 (pNewParam->iNumRefFrame, MIN_REF_PIC_COUNT,
(pNewParam->iUsageType==CAMERA_VIDEO_REAL_TIME?MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA:MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));
(pNewParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));
pNewParam->iLoopFilterDisableIdc = WELS_CLIP3 (pNewParam->iLoopFilterDisableIdc, 0, 6);
pNewParam->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pNewParam->iLoopFilterAlphaC0Offset, -6, 6);
pNewParam->iLoopFilterBetaOffset = WELS_CLIP3 (pNewParam->iLoopFilterBetaOffset, -6, 6);

File diff suppressed because it is too large Load Diff

View File

@@ -71,7 +71,7 @@ void WelsResetRefList (sWelsEncCtx* pCtx) {
for (i = 0; i < pCtx->pSvcParam->iLTRRefNum + 1; i++)
pRefList->pLongRefList[i] = NULL;
for (i = 0; i < pCtx->pSvcParam->iNumRefFrame + 1; i++)
pRefList->pRef[i]->SetUnref ();
pRefList->pRef[i]->SetUnref();
pRefList->uiLongRefCount = 0;
pRefList->uiShortRefCount = 0;
@@ -106,7 +106,7 @@ static void DeleteNonSceneLTR (sWelsEncCtx* pCtx) {
SPicture* pRef = pRefList->pLongRefList[i];
if (pRef != NULL && pRef->bUsedAsRef && pRef->bIsLongRef && (!pRef->bIsSceneLTR) &&
(pCtx->uiTemporalId < pRef->uiTemporalId || pCtx->bCurFrameMarkedAsSceneLtr)) {
pRef->SetUnref ();
pRef->SetUnref();
DeleteLTRFromLongList (pCtx, i);
i--;
}
@@ -162,7 +162,7 @@ static inline void DeleteInvalidLTR (sWelsEncCtx* pCtx) {
iMaxFrameNumPlus1) & (FRAME_NUM_EQUAL | FRAME_NUM_SMALLER))) {
WelsLog (pLogCtx, WELS_LOG_WARNING, "LTR ,invalid LTR delete ,long_term_idx = %d , iFrameNum =%d ",
pLongRefList[i]->iLongTermPicNum, pLongRefList[i]->iFrameNum);
pLongRefList[i]->SetUnref ();
pLongRefList[i]->SetUnref();
DeleteLTRFromLongList (pCtx, i);
pLtr->bLTRMarkEnable = true;
if (pRefList->uiLongRefCount == 0) {
@@ -175,7 +175,7 @@ static inline void DeleteInvalidLTR (sWelsEncCtx* pCtx) {
&& pLtr->iLTRMarkMode == LTR_DELAY_MARK) {
WelsLog (pLogCtx, WELS_LOG_WARNING, "LTR ,iMarkFrameNum invalid LTR delete ,long_term_idx = %d , iFrameNum =%d ",
pLongRefList[i]->iLongTermPicNum, pLongRefList[i]->iFrameNum);
pLongRefList[i]->SetUnref ();
pLongRefList[i]->SetUnref();
DeleteLTRFromLongList (pCtx, i);
pLtr->bLTRMarkEnable = true;
if (pRefList->uiLongRefCount == 0) {
@@ -211,7 +211,7 @@ static inline void HandleLTRMarkFeedback (sWelsEncCtx* pCtx) {
for (j = 0; j < pRefList->uiLongRefCount; j++) {
if (pLongRefList[j]->iLongTermPicNum != pLtr->iCurLtrIdx) {
pLongRefList[j]->SetUnref ();
pLongRefList[j]->SetUnref();
DeleteLTRFromLongList (pCtx, j);
}
}
@@ -228,7 +228,7 @@ static inline void HandleLTRMarkFeedback (sWelsEncCtx* pCtx) {
} else if (pLtr->uiLtrMarkState == LTR_MARKING_FAILED) {
for (i = 0; i < pRefList->uiLongRefCount; i++) {
if (pLongRefList[i]->iFrameNum == pLtr->iLtrMarkFbFrameNum) {
pLongRefList[i]->SetUnref ();
pLongRefList[i]->SetUnref();
DeleteLTRFromLongList (pCtx, i);
break;
}
@@ -297,7 +297,7 @@ static inline void LTRMarkProcess (sWelsEncCtx* pCtx) {
pLongRefList[0] = pShortRefList[i];
pRefList->uiLongRefCount++;
if (pRefList->uiLongRefCount > pCtx->pSvcParam->iLTRRefNum) {
pRefList->pLongRefList[pRefList->uiLongRefCount - 1]->SetUnref ();
pRefList->pLongRefList[pRefList->uiLongRefCount - 1]->SetUnref();
DeleteLTRFromLongList (pCtx, pRefList->uiLongRefCount - 1);
}
DeleteSTRFromShortList (pCtx, i);
@@ -311,7 +311,7 @@ static inline void LTRMarkProcessScreen (sWelsEncCtx* pCtx) {
pCtx->pVaa->uiMarkLongTermPicIdx = pCtx->pDecPic->iLongTermPicNum;
if (pLongRefList[iLtrIdx] != NULL) {
pLongRefList[iLtrIdx]->SetUnref ();
pLongRefList[iLtrIdx]->SetUnref();
DeleteLTRFromLongList (pCtx, iLtrIdx);
}
pLongRefList[iLtrIdx] = pCtx->pDecPic;
@@ -334,7 +334,7 @@ static void PrefetchNextBuffer (void* pEncCtx) {
if (pRefList->pNextBuffer == NULL && pRefList->uiShortRefCount > 0) {
pRefList->pNextBuffer = pRefList->pShortRefList[pRefList->uiShortRefCount - 1];
pRefList->pNextBuffer->SetUnref ();
pRefList->pNextBuffer->SetUnref();
}
pCtx->pDecPic = pRefList->pNextBuffer;
@@ -398,12 +398,12 @@ bool WelsUpdateRefList (void* pEncCtx) {
}
for (i = pRefList->uiShortRefCount - 1; i > 0; i--) {
pRefList->pShortRefList[i]->SetUnref ();
pRefList->pShortRefList[i]->SetUnref();
DeleteSTRFromShortList (pCtx, i);
}
if (pRefList->uiShortRefCount > 0 && (pRefList->pShortRefList[0]->uiTemporalId > 0
|| pRefList->pShortRefList[0]->iFrameNum != pCtx->iFrameNum)) {
pRefList->pShortRefList[0]->SetUnref ();
pRefList->pShortRefList[0]->SetUnref();
DeleteSTRFromShortList (pCtx, 0);
}
}
@@ -698,7 +698,8 @@ static void UpdateSrcPicListLosslessScreenRefSelectionWithLtr (void* pEncCtx) {
//update info in src list
UpdateOriginalPicInfo (pCtx->pEncPic, pCtx->pDecPic);
PrefetchNextBuffer (pCtx);
pCtx->pVpp->UpdateSrcListLosslessScreenRefSelectionWithLtr (pCtx->pEncPic, iDIdx, pCtx->pVaa->uiMarkLongTermPicIdx, pCtx->ppRefPicListExt[iDIdx]->pLongRefList);
pCtx->pVpp->UpdateSrcListLosslessScreenRefSelectionWithLtr (pCtx->pEncPic, iDIdx, pCtx->pVaa->uiMarkLongTermPicIdx,
pCtx->ppRefPicListExt[iDIdx]->pLongRefList);
}
static void UpdateSrcPicList (void* pEncCtx) {
@@ -707,7 +708,8 @@ static void UpdateSrcPicList (void* pEncCtx) {
//update info in src list
UpdateOriginalPicInfo (pCtx->pEncPic, pCtx->pDecPic);
PrefetchNextBuffer (pCtx);
pCtx->pVpp->UpdateSrcList (pCtx->pEncPic, iDIdx, pCtx->ppRefPicListExt[iDIdx]->pShortRefList, pCtx->ppRefPicListExt[iDIdx]->uiShortRefCount);
pCtx->pVpp->UpdateSrcList (pCtx->pEncPic, iDIdx, pCtx->ppRefPicListExt[iDIdx]->pShortRefList,
pCtx->ppRefPicListExt[iDIdx]->uiShortRefCount);
}
bool WelsUpdateRefListScreen (void* pEncCtx) {

View File

@@ -1195,43 +1195,45 @@ void CWelsPreProcess::WelsExchangeSpatialPictures (SPicture** ppPic1, SPicture**
*ppPic2 = tmp;
}
void CWelsPreProcess::UpdateSrcListLosslessScreenRefSelectionWithLtr (SPicture* pCurPicture, const int32_t kiCurDid, const int32_t kuiMarkLongTermPicIdx, SPicture** pLongRefList) {
void CWelsPreProcess::UpdateSrcListLosslessScreenRefSelectionWithLtr (SPicture* pCurPicture, const int32_t kiCurDid,
const int32_t kuiMarkLongTermPicIdx, SPicture** pLongRefList) {
SPicture** pLongRefSrcList = &m_pSpatialPic[kiCurDid][0];
for (int32_t i = 0; i < MAX_REF_PIC_COUNT; ++i) {
if (NULL == pLongRefSrcList[i + 1] || (NULL != pLongRefList[i] && pLongRefList[i]->bUsedAsRef
&& pLongRefList[i]->bIsLongRef)) {
continue;
} else {
pLongRefSrcList[i + 1]->SetUnref ();
pLongRefSrcList[i + 1]->SetUnref();
}
}
WelsExchangeSpatialPictures (&m_pSpatialPic[kiCurDid][0],
&m_pSpatialPic[kiCurDid][1 + kuiMarkLongTermPicIdx]);
m_iAvaliableRefInSpatialPicList = MAX_REF_PIC_COUNT;
(GetCurrentFrameFromOrigList(kiCurDid))->SetUnref ();
(GetCurrentFrameFromOrigList (kiCurDid))->SetUnref();
}
void CWelsPreProcess::UpdateSrcList (SPicture* pCurPicture, const int32_t kiCurDid, SPicture** pShortRefList, const uint32_t kuiShortRefCount) {
void CWelsPreProcess::UpdateSrcList (SPicture* pCurPicture, const int32_t kiCurDid, SPicture** pShortRefList,
const uint32_t kuiShortRefCount) {
SPicture** pRefSrcList = &m_pSpatialPic[kiCurDid][0];
//pRefSrcList[0] is for current frame
if (pCurPicture->bUsedAsRef || pCurPicture->bIsLongRef) {
if (pCurPicture->iPictureType == P_SLICE && pCurPicture->uiTemporalId != 0 ) {
if (pCurPicture->iPictureType == P_SLICE && pCurPicture->uiTemporalId != 0) {
for (int iRefIdx = kuiShortRefCount - 1; iRefIdx >= 0; --iRefIdx) {
WelsExchangeSpatialPictures (&pRefSrcList[iRefIdx + 1],
&pRefSrcList[iRefIdx]);
&pRefSrcList[iRefIdx]);
}
m_iAvaliableRefInSpatialPicList = kuiShortRefCount;
} else {
WelsExchangeSpatialPictures (&pRefSrcList[0], &pRefSrcList[1]);
for (int32_t i = MAX_SHORT_REF_COUNT - 1; i > 0 ; --i) {
if (pRefSrcList[i + 1] != NULL) {
pRefSrcList[i + 1]->SetUnref ();
pRefSrcList[i + 1]->SetUnref();
}
}
m_iAvaliableRefInSpatialPicList = 1;
}
}
(GetCurrentFrameFromOrigList(kiCurDid))->SetUnref ();
(GetCurrentFrameFromOrigList (kiCurDid))->SetUnref();
}
//TODO: may opti later

View File

@@ -70,7 +70,8 @@ void BaseEncoderTest::TearDown() {
void BaseEncoderTest::EncodeStream (InputStream* in, EUsageType usageType, int width, int height,
float frameRate, SliceModeEnum slices, bool denoise, int layers, bool losslessLink, bool enableLtr, Callback* cbk) {
int rv = InitWithParam (encoder_, usageType, width, height, frameRate, slices, denoise, layers, losslessLink, enableLtr);
int rv = InitWithParam (encoder_, usageType, width, height, frameRate, slices, denoise, layers, losslessLink,
enableLtr);
ASSERT_TRUE (rv == cmResultSuccess);
// I420: 1(Y) + 1/4(U) + 1/4(V)

View File

@@ -99,7 +99,8 @@ TEST_P (DecodeEncodeTest, CompareOutput) {
#else
ASSERT_TRUE (Open (p.fileName));
#endif
EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, false, false, this);
EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, false, false,
this);
unsigned char digest[SHA_DIGEST_LENGTH];
SHA1Result (&ctx_, digest);
if (!HasFatalFailure()) {

View File

@@ -61,9 +61,11 @@ TEST_P (EncoderOutputTest, CompareOutput) {
EncodeFileParam p = GetParam();
#if defined(ANDROID_NDK)
std::string filename = std::string ("/sdcard/") + p.fileName;
EncodeFile (filename.c_str(), p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, p.isLossless, p.enableLtr, this);
EncodeFile (filename.c_str(), p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, p.isLossless,
p.enableLtr, this);
#else
EncodeFile (p.fileName, p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, p.isLossless, p.enableLtr, this);
EncodeFile (p.fileName, p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, p.isLossless,
p.enableLtr, this);
#endif
//will remove this after screen content algorithms are ready,
//because the bitstream output will vary when the different algorithms are added.

View File

@@ -85,11 +85,11 @@ void EncoderInterfaceTest::PrepareOneSrcFrame() {
pSrcPic->iPicHeight = pParamExt->iPicHeight;
pYUV[0] = rand() % 256;
for (int i = 1; i < m_iPicResSize; i++){
if((i%256) == 0)
for (int i = 1; i < m_iPicResSize; i++) {
if ((i % 256) == 0)
pYUV[i] = rand() % 256;
else
pYUV[i] = WELS_CLIP3(pYUV[i-1]+(rand()%3)-1,0,255);
pYUV[i] = WELS_CLIP3 (pYUV[i - 1] + (rand() % 3) - 1, 0, 255);
}
pSrcPic->iStride[0] = m_iWidth;
pSrcPic->iStride[1] = pSrcPic->iStride[2] = pSrcPic->iStride[0] >> 1;
@@ -153,7 +153,7 @@ TEST_F (EncoderInterfaceTest, EncoderAdditionalOptionSetTest) {
iValue = rand() % 256;
iResult = pPtrEnc->SetOption (eOptionId, &iValue);
if (iValue ==0)
if (iValue == 0)
EXPECT_EQ (iResult, static_cast<int> (cmInitParaError));
else
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
@@ -186,9 +186,9 @@ TEST_F (EncoderInterfaceTest, EncoderAdditionalOptionSetTest) {
fValue = static_cast<int> (rand() % 60 - 5);
iResult = pPtrEnc->SetOption (eOptionId, &fValue);
if (fValue <=0)
if (fValue <= 0)
EXPECT_EQ (iResult, static_cast<int> (cmInitParaError));
else{
else {
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
iResult = pPtrEnc->GetOption (eOptionId, &fReturn);
@@ -201,15 +201,15 @@ TEST_F (EncoderInterfaceTest, EncoderAdditionalOptionSetTest) {
pSrcPic->uiTimeStamp += 30;
eOptionId = ENCODER_OPTION_BITRATE;
SBitrateInfo sInfo,sReturn;
SBitrateInfo sInfo, sReturn;
sInfo.iBitrate = rand() % 100000 - 100;
sInfo.iLayer = static_cast<LAYER_NUM>(pParamExt->iSpatialLayerNum);
sInfo.iLayer = static_cast<LAYER_NUM> (pParamExt->iSpatialLayerNum);
iResult = pPtrEnc->SetOption (eOptionId, &sInfo);
if (sInfo.iBitrate <=0)
if (sInfo.iBitrate <= 0)
EXPECT_EQ (iResult, static_cast<int> (cmInitParaError));
else{
else {
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
sReturn.iLayer = static_cast<LAYER_NUM>(pParamExt->iSpatialLayerNum);
sReturn.iLayer = static_cast<LAYER_NUM> (pParamExt->iSpatialLayerNum);
iResult = pPtrEnc->GetOption (eOptionId, &sReturn);
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
EXPECT_EQ (WELS_CLIP3 (sInfo.iBitrate, 1, 2147483647), sReturn.iBitrate);
@@ -221,13 +221,13 @@ TEST_F (EncoderInterfaceTest, EncoderAdditionalOptionSetTest) {
eOptionId = ENCODER_OPTION_MAX_BITRATE;
sInfo.iBitrate = rand() % 100000 - 100;
sInfo.iLayer = static_cast<LAYER_NUM>(pParamExt->iSpatialLayerNum);
sInfo.iLayer = static_cast<LAYER_NUM> (pParamExt->iSpatialLayerNum);
iResult = pPtrEnc->SetOption (eOptionId, &sInfo);
if (sInfo.iBitrate <=0)
if (sInfo.iBitrate <= 0)
EXPECT_EQ (iResult, static_cast<int> (cmInitParaError));
else{
else {
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
sReturn.iLayer = static_cast<LAYER_NUM>(pParamExt->iSpatialLayerNum);
sReturn.iLayer = static_cast<LAYER_NUM> (pParamExt->iSpatialLayerNum);
iResult = pPtrEnc->GetOption (eOptionId, &sReturn);
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
EXPECT_EQ (WELS_CLIP3 (sInfo.iBitrate, 1, 2147483647), sReturn.iBitrate);
@@ -261,8 +261,8 @@ TEST_F (EncoderInterfaceTest, TemporalLayerSettingTest) {
pParamExt->iTemporalLayerNum = 1;
pParamExt->iSpatialLayerNum = 1;
for(int i = 0; i < 2; i++){
pParamExt->iUsageType = (( i == 0 ) ? SCREEN_CONTENT_REAL_TIME : CAMERA_VIDEO_REAL_TIME);
for (int i = 0; i < 2; i++) {
pParamExt->iUsageType = ((i == 0) ? SCREEN_CONTENT_REAL_TIME : CAMERA_VIDEO_REAL_TIME);
int iResult = pPtrEnc->InitializeExt (pParamExt);
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
@@ -328,9 +328,9 @@ TEST_F (EncoderInterfaceTest, TemporalLayerSettingTest) {
ENCODER_OPTION eOptionId = ENCODER_OPTION_SVC_ENCODE_PARAM_EXT;
memcpy (pOption, pParamExt, sizeof (SEncParamExt));
for(int i = 0; i < kiFrameNumber; i ++){
if ((i%7) == 0){
if (pOption->iTemporalLayerNum<4){
for (int i = 0; i < kiFrameNumber; i ++) {
if ((i % 7) == 0) {
if (pOption->iTemporalLayerNum < 4) {
pOption->iTemporalLayerNum++;
} else {
pOption->iTemporalLayerNum--;
@@ -371,7 +371,7 @@ TEST_F (EncoderInterfaceTest, MemoryCheckTest) {
pYUV = new unsigned char [m_iPicResSize];
PrepareOneSrcFrame();
for(int i = 0; i < kiFrameNumber; i ++){
for (int i = 0; i < kiFrameNumber; i ++) {
int iStartX = rand() % (m_iPicResSize >> 1);
int iEndX = (iStartX + (rand() % MEM_VARY_SIZE)) % m_iPicResSize;
for (int j = iStartX; j < iEndX; j++)
@@ -400,7 +400,7 @@ TEST_F (EncoderInterfaceTest, MemoryCheckTest) {
iResult = pPtrEnc->SetOption (eOptionId, pOption);
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
for(int i = 0; i < kiFrameNumber; i ++){
for (int i = 0; i < kiFrameNumber; i ++) {
int iStartX = rand() % (m_iPicResSize >> 1);
int iEndX = (iStartX + (rand() % MEM_VARY_SIZE)) % m_iPicResSize;
for (int j = iStartX; j < iEndX; j++)
@@ -415,7 +415,7 @@ TEST_F (EncoderInterfaceTest, MemoryCheckTest) {
iResult = pPtrEnc->SetOption (eOptionId, pOption);
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
for(int i = 0; i < kiFrameNumber; i ++){
for (int i = 0; i < kiFrameNumber; i ++) {
int iStartX = rand() % (m_iPicResSize >> 1);
int iEndX = (iStartX + (rand() % MEM_VARY_SIZE)) % m_iPicResSize;
for (int j = iStartX; j < iEndX; j++)
@@ -434,8 +434,8 @@ void GetValidEncParamBase (SEncParamBase* pEncParamBase) {
pEncParamBase->iUsageType = CAMERA_VIDEO_REAL_TIME;
pEncParamBase->iPicWidth = 2 + ((rand() % ((MAX_WIDTH >> 1) - 1)) << 1);
pEncParamBase->iPicHeight = 2 + ((rand() % ((MAX_HEIGHT >> 1) - 1)) << 1);
pEncParamBase->iPicWidth = VALID_SIZE(pEncParamBase->iPicWidth);
pEncParamBase->iPicHeight = VALID_SIZE(pEncParamBase->iPicHeight);
pEncParamBase->iPicWidth = VALID_SIZE (pEncParamBase->iPicWidth);
pEncParamBase->iPicHeight = VALID_SIZE (pEncParamBase->iPicHeight);
pEncParamBase->iTargetBitrate = rand() + 1; //!=0
pEncParamBase->iRCMode = RC_BITRATE_MODE; //-1, 0, 1, 2
pEncParamBase->fMaxFrameRate = rand() + 0.5f; //!=0

View File

@@ -80,18 +80,18 @@ void SumOf16x16BlockOfFrame_ref (uint8_t* pRefPicture, const int32_t kiWidth, co
void InitializeHashforFeature_ref (uint32_t* pTimesOfFeatureValue, uint16_t* pBuf, const int32_t kiListSize,
uint16_t** pLocationOfFeature, uint16_t** pFeatureValuePointerList) {
//assign location pointer
uint16_t** pLocationOfFeature, uint16_t** pFeatureValuePointerList) {
//assign location pointer
uint16_t* pBufPos = pBuf;
for (int32_t i = 0 ; i < kiListSize; ++i) {
pLocationOfFeature[i] =
pFeatureValuePointerList[i] = pBufPos;
pFeatureValuePointerList[i] = pBufPos;
pBufPos += (pTimesOfFeatureValue[i] << 1);
}
}
void FillQpelLocationByFeatureValue_ref (uint16_t* pFeatureOfBlock, const int32_t kiWidth, const int32_t kiHeight,
uint16_t** pFeatureValuePointerList) {
//assign each pixel's position
uint16_t** pFeatureValuePointerList) {
//assign each pixel's position
uint16_t* pSrcPointer = pFeatureOfBlock;
int32_t iQpelY = 0;
for (int32_t y = 0; y < kiHeight; y++) {
@@ -246,9 +246,11 @@ GENERATE_InitializeHashforFeature (InitializeHashforFeature_ref, InitializeHashf
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_c, 640, 320)
#ifdef X86_ASM
GENERATE_InitializeHashforFeature (InitializeHashforFeature_ref, InitializeHashforFeature_sse2, 10, 10)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_sse2, 16, 16)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_sse2, 16,
16)
GENERATE_InitializeHashforFeature (InitializeHashforFeature_ref, InitializeHashforFeature_sse2, 640, 320)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_sse2, 640, 320)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_sse2, 640,
320)
#endif
GENERATE_SumOfFrame (SumOf8x8BlockOfFrame_ref, SumOf8x8BlockOfFrame_c, 1, 1)
@@ -282,9 +284,11 @@ GENERATE_SumOfFrame (SumOf16x16BlockOfFrame_ref, SumOf16x16BlockOfFrame_neon, 1,
GENERATE_SumOfFrame (SumOf8x8BlockOfFrame_ref, SumOf8x8BlockOfFrame_neon, 640, 320)
GENERATE_SumOfFrame (SumOf16x16BlockOfFrame_ref, SumOf16x16BlockOfFrame_neon, 640, 320)
GENERATE_InitializeHashforFeature (InitializeHashforFeature_ref, InitializeHashforFeature_neon, 10, 10)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_neon, 16, 16)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_neon, 16,
16)
GENERATE_InitializeHashforFeature (InitializeHashforFeature_ref, InitializeHashforFeature_neon, 640, 320)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_neon, 640, 320)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_neon, 640,
320)
#endif
#ifdef HAVE_NEON_AARCH64
@@ -295,7 +299,9 @@ GENERATE_SumOfFrame (SumOf16x16BlockOfFrame_ref, SumOf16x16BlockOfFrame_AArch64_
GENERATE_SumOfFrame (SumOf8x8BlockOfFrame_ref, SumOf8x8BlockOfFrame_AArch64_neon, 640, 320)
GENERATE_SumOfFrame (SumOf16x16BlockOfFrame_ref, SumOf16x16BlockOfFrame_AArch64_neon, 640, 320)
GENERATE_InitializeHashforFeature (InitializeHashforFeature_ref, InitializeHashforFeature_AArch64_neon, 10, 10)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_AArch64_neon, 16, 16)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref,
FillQpelLocationByFeatureValue_AArch64_neon, 16, 16)
GENERATE_InitializeHashforFeature (InitializeHashforFeature_ref, InitializeHashforFeature_AArch64_neon, 640, 320)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref, FillQpelLocationByFeatureValue_AArch64_neon, 640, 320)
GENERATE_FillQpelLocationByFeatureValue (FillQpelLocationByFeatureValue_ref,
FillQpelLocationByFeatureValue_AArch64_neon, 640, 320)
#endif

View File

@@ -103,26 +103,26 @@ TEST (IntraSadSatdFuncTest, func) { \
}
#ifdef X86_ASM
GENERATE_Intra16x16_UT(WelsIntra16x16Combined3Sad_ssse3, WelsSampleSadIntra16x16Combined3_c, 1, WELS_CPU_SSSE3)
GENERATE_Intra16x16_UT(WelsIntra16x16Combined3Satd_sse41, WelsSampleSatdIntra16x16Combined3_c, 1, WELS_CPU_SSE41)
GENERATE_Intra8x8_UT(WelsIntraChroma8x8Combined3Satd_sse41, WelsSampleSatdIntra8x8Combined3_c, 1, WELS_CPU_SSE41)
GENERATE_Intra4x4_UT(WelsSampleSatdThree4x4_sse2, 1, WELS_CPU_SSE2)
GENERATE_Intra16x16_UT (WelsIntra16x16Combined3Sad_ssse3, WelsSampleSadIntra16x16Combined3_c, 1, WELS_CPU_SSSE3)
GENERATE_Intra16x16_UT (WelsIntra16x16Combined3Satd_sse41, WelsSampleSatdIntra16x16Combined3_c, 1, WELS_CPU_SSE41)
GENERATE_Intra8x8_UT (WelsIntraChroma8x8Combined3Satd_sse41, WelsSampleSatdIntra8x8Combined3_c, 1, WELS_CPU_SSE41)
GENERATE_Intra4x4_UT (WelsSampleSatdThree4x4_sse2, 1, WELS_CPU_SSE2)
#endif
#ifdef HAVE_NEON
GENERATE_Intra16x16_UT(WelsIntra16x16Combined3Sad_neon, WelsSampleSadIntra16x16Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra16x16_UT(WelsIntra16x16Combined3Satd_neon, WelsSampleSatdIntra16x16Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra8x8_UT(WelsIntra8x8Combined3Satd_neon, WelsSampleSatdIntra8x8Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra8x8_UT(WelsIntra8x8Combined3Sad_neon, WelsSampleSadIntra8x8Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra4x4_UT(WelsIntra4x4Combined3Satd_neon, 1, WELS_CPU_NEON)
GENERATE_Intra16x16_UT (WelsIntra16x16Combined3Sad_neon, WelsSampleSadIntra16x16Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra16x16_UT (WelsIntra16x16Combined3Satd_neon, WelsSampleSatdIntra16x16Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra8x8_UT (WelsIntra8x8Combined3Satd_neon, WelsSampleSatdIntra8x8Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra8x8_UT (WelsIntra8x8Combined3Sad_neon, WelsSampleSadIntra8x8Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra4x4_UT (WelsIntra4x4Combined3Satd_neon, 1, WELS_CPU_NEON)
#endif
#ifdef HAVE_NEON_AARCH64
GENERATE_Intra16x16_UT(WelsIntra16x16Combined3Sad_AArch64_neon, WelsSampleSadIntra16x16Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra16x16_UT(WelsIntra16x16Combined3Satd_AArch64_neon, WelsSampleSatdIntra16x16Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra8x8_UT(WelsIntra8x8Combined3Satd_AArch64_neon, WelsSampleSatdIntra8x8Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra8x8_UT(WelsIntra8x8Combined3Sad_AArch64_neon, WelsSampleSadIntra8x8Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra4x4_UT(WelsIntra4x4Combined3Satd_AArch64_neon, 1, WELS_CPU_NEON)
GENERATE_Intra16x16_UT (WelsIntra16x16Combined3Sad_AArch64_neon, WelsSampleSadIntra16x16Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra16x16_UT (WelsIntra16x16Combined3Satd_AArch64_neon, WelsSampleSatdIntra16x16Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra8x8_UT (WelsIntra8x8Combined3Satd_AArch64_neon, WelsSampleSatdIntra8x8Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra8x8_UT (WelsIntra8x8Combined3Sad_AArch64_neon, WelsSampleSadIntra8x8Combined3_c, 1, WELS_CPU_NEON)
GENERATE_Intra4x4_UT (WelsIntra4x4Combined3Satd_AArch64_neon, 1, WELS_CPU_NEON)
#endif
#define ASSERT_MEMORY_FAIL2X(A, B) \
@@ -537,51 +537,51 @@ TEST_F (SadSatdAssemblyFuncTest, func) { \
}
#ifdef X86_ASM
GENERATE_Sad4x4_UT(WelsSampleSad4x4_mmx, WelsSampleSad4x4_c, WELS_CPU_MMXEXT)
GENERATE_Sad8x8_UT(WelsSampleSad8x8_sse21, WelsSampleSad8x8_c, WELS_CPU_SSE2)
GENERATE_Sad8x16_UT(WelsSampleSad8x16_sse2, WelsSampleSad8x16_c, WELS_CPU_SSE2)
GENERATE_Sad16x8_UT(WelsSampleSad16x8_sse2, WelsSampleSad16x8_c, WELS_CPU_SSE2)
GENERATE_Sad16x16_UT(WelsSampleSad16x16_sse2, WelsSampleSad16x16_c, WELS_CPU_SSE2)
GENERATE_Sad4x4_UT (WelsSampleSad4x4_mmx, WelsSampleSad4x4_c, WELS_CPU_MMXEXT)
GENERATE_Sad8x8_UT (WelsSampleSad8x8_sse21, WelsSampleSad8x8_c, WELS_CPU_SSE2)
GENERATE_Sad8x16_UT (WelsSampleSad8x16_sse2, WelsSampleSad8x16_c, WELS_CPU_SSE2)
GENERATE_Sad16x8_UT (WelsSampleSad16x8_sse2, WelsSampleSad16x8_c, WELS_CPU_SSE2)
GENERATE_Sad16x16_UT (WelsSampleSad16x16_sse2, WelsSampleSad16x16_c, WELS_CPU_SSE2)
GENERATE_Sad4x4_UT(WelsSampleSatd4x4_sse2, WelsSampleSatd4x4_c, WELS_CPU_SSE2)
GENERATE_Sad8x8_UT(WelsSampleSatd8x8_sse2, WelsSampleSatd8x8_c, WELS_CPU_SSE2)
GENERATE_Sad8x16_UT(WelsSampleSatd8x16_sse2, WelsSampleSatd8x16_c, WELS_CPU_SSE2)
GENERATE_Sad16x8_UT(WelsSampleSatd16x8_sse2, WelsSampleSatd16x8_c, WELS_CPU_SSE2)
GENERATE_Sad16x16_UT(WelsSampleSatd16x16_sse2, WelsSampleSatd16x16_c, WELS_CPU_SSE2)
GENERATE_Sad4x4_UT (WelsSampleSatd4x4_sse2, WelsSampleSatd4x4_c, WELS_CPU_SSE2)
GENERATE_Sad8x8_UT (WelsSampleSatd8x8_sse2, WelsSampleSatd8x8_c, WELS_CPU_SSE2)
GENERATE_Sad8x16_UT (WelsSampleSatd8x16_sse2, WelsSampleSatd8x16_c, WELS_CPU_SSE2)
GENERATE_Sad16x8_UT (WelsSampleSatd16x8_sse2, WelsSampleSatd16x8_c, WELS_CPU_SSE2)
GENERATE_Sad16x16_UT (WelsSampleSatd16x16_sse2, WelsSampleSatd16x16_c, WELS_CPU_SSE2)
GENERATE_Sad4x4_UT(WelsSampleSatd4x4_sse41, WelsSampleSatd4x4_c, WELS_CPU_SSE41)
GENERATE_Sad8x8_UT(WelsSampleSatd8x8_sse41, WelsSampleSatd8x8_c, WELS_CPU_SSE41)
GENERATE_Sad8x16_UT(WelsSampleSatd8x16_sse41, WelsSampleSatd8x16_c, WELS_CPU_SSE41)
GENERATE_Sad16x8_UT(WelsSampleSatd16x8_sse41, WelsSampleSatd16x8_c, WELS_CPU_SSE41)
GENERATE_Sad16x16_UT(WelsSampleSatd16x16_sse41, WelsSampleSatd16x16_c, WELS_CPU_SSE41)
GENERATE_Sad4x4_UT (WelsSampleSatd4x4_sse41, WelsSampleSatd4x4_c, WELS_CPU_SSE41)
GENERATE_Sad8x8_UT (WelsSampleSatd8x8_sse41, WelsSampleSatd8x8_c, WELS_CPU_SSE41)
GENERATE_Sad8x16_UT (WelsSampleSatd8x16_sse41, WelsSampleSatd8x16_c, WELS_CPU_SSE41)
GENERATE_Sad16x8_UT (WelsSampleSatd16x8_sse41, WelsSampleSatd16x8_c, WELS_CPU_SSE41)
GENERATE_Sad16x16_UT (WelsSampleSatd16x16_sse41, WelsSampleSatd16x16_c, WELS_CPU_SSE41)
#endif
#ifdef HAVE_NEON
GENERATE_Sad4x4_UT(WelsSampleSad4x4_neon, WelsSampleSad4x4_c, WELS_CPU_NEON)
GENERATE_Sad8x8_UT(WelsSampleSad8x8_neon, WelsSampleSad8x8_c, WELS_CPU_NEON)
GENERATE_Sad8x16_UT(WelsSampleSad8x16_neon, WelsSampleSad8x16_c, WELS_CPU_NEON)
GENERATE_Sad16x8_UT(WelsSampleSad16x8_neon, WelsSampleSad16x8_c, WELS_CPU_NEON)
GENERATE_Sad16x16_UT(WelsSampleSad16x16_neon, WelsSampleSad16x16_c, WELS_CPU_NEON)
GENERATE_Sad4x4_UT (WelsSampleSad4x4_neon, WelsSampleSad4x4_c, WELS_CPU_NEON)
GENERATE_Sad8x8_UT (WelsSampleSad8x8_neon, WelsSampleSad8x8_c, WELS_CPU_NEON)
GENERATE_Sad8x16_UT (WelsSampleSad8x16_neon, WelsSampleSad8x16_c, WELS_CPU_NEON)
GENERATE_Sad16x8_UT (WelsSampleSad16x8_neon, WelsSampleSad16x8_c, WELS_CPU_NEON)
GENERATE_Sad16x16_UT (WelsSampleSad16x16_neon, WelsSampleSad16x16_c, WELS_CPU_NEON)
GENERATE_Sad4x4_UT(WelsSampleSatd4x4_neon, WelsSampleSatd4x4_c, WELS_CPU_NEON)
GENERATE_Sad8x8_UT(WelsSampleSatd8x8_neon, WelsSampleSatd8x8_c, WELS_CPU_NEON)
GENERATE_Sad8x16_UT(WelsSampleSatd8x16_neon, WelsSampleSatd8x16_c, WELS_CPU_NEON)
GENERATE_Sad16x8_UT(WelsSampleSatd16x8_neon, WelsSampleSatd16x8_c, WELS_CPU_NEON)
GENERATE_Sad16x16_UT(WelsSampleSatd16x16_neon, WelsSampleSatd16x16_c, WELS_CPU_NEON)
GENERATE_Sad4x4_UT (WelsSampleSatd4x4_neon, WelsSampleSatd4x4_c, WELS_CPU_NEON)
GENERATE_Sad8x8_UT (WelsSampleSatd8x8_neon, WelsSampleSatd8x8_c, WELS_CPU_NEON)
GENERATE_Sad8x16_UT (WelsSampleSatd8x16_neon, WelsSampleSatd8x16_c, WELS_CPU_NEON)
GENERATE_Sad16x8_UT (WelsSampleSatd16x8_neon, WelsSampleSatd16x8_c, WELS_CPU_NEON)
GENERATE_Sad16x16_UT (WelsSampleSatd16x16_neon, WelsSampleSatd16x16_c, WELS_CPU_NEON)
#endif
#ifdef HAVE_NEON_AARCH64
GENERATE_Sad4x4_UT(WelsSampleSad4x4_AArch64_neon, WelsSampleSad4x4_c, WELS_CPU_NEON)
GENERATE_Sad8x8_UT(WelsSampleSad8x8_AArch64_neon, WelsSampleSad8x8_c, WELS_CPU_NEON)
GENERATE_Sad8x16_UT(WelsSampleSad8x16_AArch64_neon, WelsSampleSad8x16_c, WELS_CPU_NEON)
GENERATE_Sad16x8_UT(WelsSampleSad16x8_AArch64_neon, WelsSampleSad16x8_c, WELS_CPU_NEON)
GENERATE_Sad16x16_UT(WelsSampleSad16x16_AArch64_neon, WelsSampleSad16x16_c, WELS_CPU_NEON)
GENERATE_Sad4x4_UT (WelsSampleSad4x4_AArch64_neon, WelsSampleSad4x4_c, WELS_CPU_NEON)
GENERATE_Sad8x8_UT (WelsSampleSad8x8_AArch64_neon, WelsSampleSad8x8_c, WELS_CPU_NEON)
GENERATE_Sad8x16_UT (WelsSampleSad8x16_AArch64_neon, WelsSampleSad8x16_c, WELS_CPU_NEON)
GENERATE_Sad16x8_UT (WelsSampleSad16x8_AArch64_neon, WelsSampleSad16x8_c, WELS_CPU_NEON)
GENERATE_Sad16x16_UT (WelsSampleSad16x16_AArch64_neon, WelsSampleSad16x16_c, WELS_CPU_NEON)
GENERATE_Sad4x4_UT(WelsSampleSatd4x4_AArch64_neon, WelsSampleSatd4x4_c, WELS_CPU_NEON)
GENERATE_Sad8x8_UT(WelsSampleSatd8x8_AArch64_neon, WelsSampleSatd8x8_c, WELS_CPU_NEON)
GENERATE_Sad8x16_UT(WelsSampleSatd8x16_AArch64_neon, WelsSampleSatd8x16_c, WELS_CPU_NEON)
GENERATE_Sad16x8_UT(WelsSampleSatd16x8_AArch64_neon, WelsSampleSatd16x8_c, WELS_CPU_NEON)
GENERATE_Sad16x16_UT(WelsSampleSatd16x16_AArch64_neon, WelsSampleSatd16x16_c, WELS_CPU_NEON)
GENERATE_Sad4x4_UT (WelsSampleSatd4x4_AArch64_neon, WelsSampleSatd4x4_c, WELS_CPU_NEON)
GENERATE_Sad8x8_UT (WelsSampleSatd8x8_AArch64_neon, WelsSampleSatd8x8_c, WELS_CPU_NEON)
GENERATE_Sad8x16_UT (WelsSampleSatd8x16_AArch64_neon, WelsSampleSatd8x16_c, WELS_CPU_NEON)
GENERATE_Sad16x8_UT (WelsSampleSatd16x8_AArch64_neon, WelsSampleSatd16x8_c, WELS_CPU_NEON)
GENERATE_Sad16x16_UT (WelsSampleSatd16x16_AArch64_neon, WelsSampleSatd16x16_c, WELS_CPU_NEON)
#endif
#define GENERATE_SadFour_UT(func, CPUFLAGS, width, height) \
@@ -610,25 +610,25 @@ TEST_F (SadSatdAssemblyFuncTest, func) { \
}
#ifdef X86_ASM
GENERATE_SadFour_UT(WelsSampleSadFour4x4_sse2, WELS_CPU_SSE2, 4, 4)
GENERATE_SadFour_UT(WelsSampleSadFour8x8_sse2, WELS_CPU_SSE2, 8, 8)
GENERATE_SadFour_UT(WelsSampleSadFour8x16_sse2, WELS_CPU_SSE2, 8, 16)
GENERATE_SadFour_UT(WelsSampleSadFour16x8_sse2, WELS_CPU_SSE2, 16, 8)
GENERATE_SadFour_UT(WelsSampleSadFour16x16_sse2, WELS_CPU_SSE2, 16, 16)
GENERATE_SadFour_UT (WelsSampleSadFour4x4_sse2, WELS_CPU_SSE2, 4, 4)
GENERATE_SadFour_UT (WelsSampleSadFour8x8_sse2, WELS_CPU_SSE2, 8, 8)
GENERATE_SadFour_UT (WelsSampleSadFour8x16_sse2, WELS_CPU_SSE2, 8, 16)
GENERATE_SadFour_UT (WelsSampleSadFour16x8_sse2, WELS_CPU_SSE2, 16, 8)
GENERATE_SadFour_UT (WelsSampleSadFour16x16_sse2, WELS_CPU_SSE2, 16, 16)
#endif
#ifdef HAVE_NEON
GENERATE_SadFour_UT(WelsSampleSadFour4x4_neon, WELS_CPU_NEON, 4, 4)
GENERATE_SadFour_UT(WelsSampleSadFour8x8_neon, WELS_CPU_NEON, 8, 8)
GENERATE_SadFour_UT(WelsSampleSadFour8x16_neon, WELS_CPU_NEON, 8, 16)
GENERATE_SadFour_UT(WelsSampleSadFour16x8_neon, WELS_CPU_NEON, 16, 8)
GENERATE_SadFour_UT(WelsSampleSadFour16x16_neon, WELS_CPU_NEON, 16, 16)
GENERATE_SadFour_UT (WelsSampleSadFour4x4_neon, WELS_CPU_NEON, 4, 4)
GENERATE_SadFour_UT (WelsSampleSadFour8x8_neon, WELS_CPU_NEON, 8, 8)
GENERATE_SadFour_UT (WelsSampleSadFour8x16_neon, WELS_CPU_NEON, 8, 16)
GENERATE_SadFour_UT (WelsSampleSadFour16x8_neon, WELS_CPU_NEON, 16, 8)
GENERATE_SadFour_UT (WelsSampleSadFour16x16_neon, WELS_CPU_NEON, 16, 16)
#endif
#ifdef HAVE_NEON_AARCH64
GENERATE_SadFour_UT(WelsSampleSadFour4x4_AArch64_neon, WELS_CPU_NEON, 4, 4)
GENERATE_SadFour_UT(WelsSampleSadFour8x8_AArch64_neon, WELS_CPU_NEON, 8, 8)
GENERATE_SadFour_UT(WelsSampleSadFour8x16_AArch64_neon, WELS_CPU_NEON, 8, 16)
GENERATE_SadFour_UT(WelsSampleSadFour16x8_AArch64_neon, WELS_CPU_NEON, 16, 8)
GENERATE_SadFour_UT(WelsSampleSadFour16x16_AArch64_neon, WELS_CPU_NEON, 16, 16)
GENERATE_SadFour_UT (WelsSampleSadFour4x4_AArch64_neon, WELS_CPU_NEON, 4, 4)
GENERATE_SadFour_UT (WelsSampleSadFour8x8_AArch64_neon, WELS_CPU_NEON, 8, 8)
GENERATE_SadFour_UT (WelsSampleSadFour8x16_AArch64_neon, WELS_CPU_NEON, 8, 16)
GENERATE_SadFour_UT (WelsSampleSadFour16x8_AArch64_neon, WELS_CPU_NEON, 16, 8)
GENERATE_SadFour_UT (WelsSampleSadFour16x16_AArch64_neon, WELS_CPU_NEON, 16, 16)
#endif

View File

@@ -9,8 +9,8 @@
using namespace WelsVP;
void DyadicBilinearDownsampler_ref (uint8_t* pDst, const int32_t kiDstStride,
uint8_t* pSrc, const int32_t kiSrcStride,
const int32_t kiSrcWidth, const int32_t kiSrcHeight) {
uint8_t* pSrc, const int32_t kiSrcStride,
const int32_t kiSrcWidth, const int32_t kiSrcHeight) {
uint8_t* pDstLine = pDst;
uint8_t* pSrcLine = pSrc;
const int32_t kiSrcStridex2 = kiSrcStride << 1;
@@ -30,8 +30,9 @@ void DyadicBilinearDownsampler_ref (uint8_t* pDst, const int32_t kiDstStride,
}
}
void GeneralBilinearFastDownsampler_ref (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, const int32_t kiDstHeight,
uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) {
void GeneralBilinearFastDownsampler_ref (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth,
const int32_t kiDstHeight,
uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) {
const uint32_t kuiScaleBitWidth = 16, kuiScaleBitHeight = 15;
const uint32_t kuiScaleWidth = (1 << kuiScaleBitWidth), kuiScaleHeight = (1 << kuiScaleBitHeight);
int32_t fScalex = WELS_ROUND ((float)kiSrcWidth / (float)kiDstWidth * kuiScaleWidth);
@@ -98,7 +99,8 @@ void GeneralBilinearFastDownsampler_ref (uint8_t* pDst, const int32_t kiDstStrid
}
}
void GeneralBilinearAccurateDownsampler_ref (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, const int32_t kiDstHeight,
void GeneralBilinearAccurateDownsampler_ref (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth,
const int32_t kiDstHeight,
uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) {
const int32_t kiScaleBit = 15;
const int32_t kiScale = (1 << kiScaleBit);
@@ -243,7 +245,8 @@ TEST (DownSampleTest, func) { \
GENERATE_DyadicBilinearDownsampler_UT (DyadicBilinearDownsampler_c, 0, 0)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearFastDownsampler_c, GeneralBilinearFastDownsampler_ref, 0, 0)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearAccurateDownsampler_c, GeneralBilinearAccurateDownsampler_ref, 0, 0)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearAccurateDownsampler_c, GeneralBilinearAccurateDownsampler_ref, 0,
0)
#if defined(X86_ASM)
GENERATE_DyadicBilinearDownsampler_UT (DyadicBilinearDownsamplerWidthx32_sse, 1, WELS_CPU_SSE)
@@ -256,20 +259,24 @@ GENERATE_DyadicBilinearDownsampler_UT (DyadicBilinearDownsamplerWidthx16_ssse3,
GENERATE_DyadicBilinearDownsampler_UT (DyadicBilinearDownsamplerWidthx32_sse4, 1, WELS_CPU_SSE41)
GENERATE_DyadicBilinearDownsampler_UT (DyadicBilinearDownsamplerWidthx16_sse4, 1, WELS_CPU_SSE41)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearFastDownsamplerWrap_sse2, GeneralBilinearFastDownsampler_ref, 1, WELS_CPU_SSE2)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearAccurateDownsamplerWrap_sse2, GeneralBilinearAccurateDownsampler_ref, 1, WELS_CPU_SSE2)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearFastDownsamplerWrap_sse2, GeneralBilinearFastDownsampler_ref, 1,
WELS_CPU_SSE2)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearAccurateDownsamplerWrap_sse2,
GeneralBilinearAccurateDownsampler_ref, 1, WELS_CPU_SSE2)
#endif
#if defined(HAVE_NEON)
GENERATE_DyadicBilinearDownsampler_UT (DyadicBilinearDownsamplerWidthx32_neon, 1, WELS_CPU_NEON)
GENERATE_DyadicBilinearDownsampler_UT (DyadicBilinearDownsampler_neon, 1, WELS_CPU_NEON)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearAccurateDownsamplerWrap_neon, GeneralBilinearAccurateDownsampler_ref, 1, WELS_CPU_NEON)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearAccurateDownsamplerWrap_neon,
GeneralBilinearAccurateDownsampler_ref, 1, WELS_CPU_NEON)
#endif
#if defined(HAVE_NEON_AARCH64)
GENERATE_DyadicBilinearDownsampler_UT (DyadicBilinearDownsamplerWidthx32_AArch64_neon, 1, WELS_CPU_NEON)
GENERATE_DyadicBilinearDownsampler_UT (DyadicBilinearDownsampler_AArch64_neon, 1, WELS_CPU_NEON)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearAccurateDownsamplerWrap_AArch64_neon, GeneralBilinearAccurateDownsampler_ref, 1, WELS_CPU_NEON)
GENERATE_GeneralBilinearDownsampler_UT (GeneralBilinearAccurateDownsamplerWrap_AArch64_neon,
GeneralBilinearAccurateDownsampler_ref, 1, WELS_CPU_NEON)
#endif