ref: 51efa57a3d29f0e513bd7714a4bff9b755ae383d
parent: 723044837ab8702c2163334653652c5dea2df41e
author: Martin Storsjö <[email protected]>
date: Fri May 15 07:45:20 EDT 2015
Convert tabs to spaces in vertically aligned code
--- a/codec/common/inc/golomb_common.h
+++ b/codec/common/inc/golomb_common.h
@@ -67,11 +67,11 @@
static inline int32_t InitBits (SBitStringAux* pBs, const uint8_t* kpBuf, const int32_t kiSize) {
uint8_t* ptr = (uint8_t*)kpBuf;
- pBs->pStartBuf = ptr;
- pBs->pCurBuf = ptr;
- pBs->pEndBuf = ptr + kiSize;
- pBs->iLeftBits = 32;
- pBs->uiCurBits = 0;
+ pBs->pStartBuf = ptr;
+ pBs->pCurBuf = ptr;
+ pBs->pEndBuf = ptr + kiSize;
+ pBs->iLeftBits = 32;
+ pBs->uiCurBits = 0;
return kiSize;
}
--- a/codec/common/src/expand_pic.cpp
+++ b/codec/common/src/expand_pic.cpp
@@ -36,19 +36,19 @@
// rewrite it (split into luma & chroma) that is helpful for mmx/sse2 optimization perform, 9/27/2009
static inline void ExpandPictureLuma_c (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW,
const int32_t kiPicH) {
- uint8_t* pTmp = pDst;
- uint8_t* pDstLastLine = pTmp + (kiPicH - 1) * kiStride;
- const int32_t kiPaddingLen = PADDING_LENGTH;
- const uint8_t kuiTL = pTmp[0];
- const uint8_t kuiTR = pTmp[kiPicW - 1];
- const uint8_t kuiBL = pDstLastLine[0];
- const uint8_t kuiBR = pDstLastLine[kiPicW - 1];
- int32_t i = 0;
+ uint8_t* pTmp = pDst;
+ uint8_t* pDstLastLine = pTmp + (kiPicH - 1) * kiStride;
+ const int32_t kiPaddingLen = PADDING_LENGTH;
+ const uint8_t kuiTL = pTmp[0];
+ const uint8_t kuiTR = pTmp[kiPicW - 1];
+ const uint8_t kuiBL = pDstLastLine[0];
+ const uint8_t kuiBR = pDstLastLine[kiPicW - 1];
+ int32_t i = 0;
do {
- const int32_t kiStrides = (1 + i) * kiStride;
- uint8_t* pTop = pTmp - kiStrides;
- uint8_t* pBottom = pDstLastLine + kiStrides;
+ const int32_t kiStrides = (1 + i) * kiStride;
+ uint8_t* pTop = pTmp - kiStrides;
+ uint8_t* pBottom = pDstLastLine + kiStrides;
// pad pTop and pBottom
memcpy (pTop, pTmp, kiPicW); // confirmed_safe_unsafe_usage
@@ -76,19 +76,19 @@
static inline void ExpandPictureChroma_c (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW,
const int32_t kiPicH) {
- uint8_t* pTmp = pDst;
- uint8_t* pDstLastLine = pTmp + (kiPicH - 1) * kiStride;
- const int32_t kiPaddingLen = (PADDING_LENGTH >> 1);
- const uint8_t kuiTL = pTmp[0];
- const uint8_t kuiTR = pTmp[kiPicW - 1];
- const uint8_t kuiBL = pDstLastLine[0];
- const uint8_t kuiBR = pDstLastLine[kiPicW - 1];
- int32_t i = 0;
+ uint8_t* pTmp = pDst;
+ uint8_t* pDstLastLine = pTmp + (kiPicH - 1) * kiStride;
+ const int32_t kiPaddingLen = (PADDING_LENGTH >> 1);
+ const uint8_t kuiTL = pTmp[0];
+ const uint8_t kuiTR = pTmp[kiPicW - 1];
+ const uint8_t kuiBL = pDstLastLine[0];
+ const uint8_t kuiBR = pDstLastLine[kiPicW - 1];
+ int32_t i = 0;
do {
- const int32_t kiStrides = (1 + i) * kiStride;
- uint8_t* pTop = pTmp - kiStrides;
- uint8_t* pBottom = pDstLastLine + kiStrides;
+ const int32_t kiStrides = (1 + i) * kiStride;
+ uint8_t* pTop = pTmp - kiStrides;
+ uint8_t* pBottom = pDstLastLine + kiStrides;
// pad pTop and pBottom
memcpy (pTop, pTmp, kiPicW); // confirmed_safe_unsafe_usage
@@ -147,13 +147,13 @@
void ExpandReferencingPicture (uint8_t* pData[3], int32_t iWidth, int32_t iHeight, int32_t iStride[3],
PExpandPictureFunc pExpLuma, PExpandPictureFunc pExpChrom[2]) {
/*local variable*/
- uint8_t* pPicY = pData[0];
+ uint8_t* pPicY = pData[0];
uint8_t* pPicCb = pData[1];
uint8_t* pPicCr = pData[2];
- const int32_t kiWidthY = iWidth;
- const int32_t kiHeightY = iHeight;
- const int32_t kiWidthUV = kiWidthY >> 1;
- const int32_t kiHeightUV = kiHeightY >> 1;
+ const int32_t kiWidthY = iWidth;
+ const int32_t kiHeightY = iHeight;
+ const int32_t kiWidthUV = kiWidthY >> 1;
+ const int32_t kiHeightUV = kiHeightY >> 1;
--- a/codec/common/src/intra_pred_common.cpp
+++ b/codec/common/src/intra_pred_common.cpp
@@ -65,8 +65,8 @@
uint8_t i = 15;
do {
- const uint8_t kuiSrc8 = pRef[iStridex15 - 1];
- const uint64_t kuiV64 = (uint64_t) (0x0101010101010101ULL * kuiSrc8);
+ const uint8_t kuiSrc8 = pRef[iStridex15 - 1];
+ const uint64_t kuiV64 = (uint64_t) (0x0101010101010101ULL * kuiSrc8);
ST64 (&pPred[iPredStridex15], kuiV64);
ST64 (&pPred[iPredStridex15 + 8], kuiV64);
--- a/codec/common/src/memory_align.cpp
+++ b/codec/common/src/memory_align.cpp
@@ -61,14 +61,14 @@
}
void* WelsMalloc (const uint32_t kuiSize, const char* kpTag, const uint32_t kiAlign) {
- const int32_t kiSizeOfVoidPointer = sizeof (void**);
- const int32_t kiSizeOfInt = sizeof (int32_t);
- const int32_t kiAlignedBytes = kiAlign - 1;
- const int32_t kiTrialRequestedSize = kuiSize + kiAlignedBytes + kiSizeOfVoidPointer + kiSizeOfInt;
- const int32_t kiActualRequestedSize = kiTrialRequestedSize;
- const uint32_t kiPayloadSize = kuiSize;
+ const int32_t kiSizeOfVoidPointer = sizeof (void**);
+ const int32_t kiSizeOfInt = sizeof (int32_t);
+ const int32_t kiAlignedBytes = kiAlign - 1;
+ const int32_t kiTrialRequestedSize = kuiSize + kiAlignedBytes + kiSizeOfVoidPointer + kiSizeOfInt;
+ const int32_t kiActualRequestedSize = kiTrialRequestedSize;
+ const uint32_t kiPayloadSize = kuiSize;
- uint8_t* pBuf = (uint8_t*) malloc (kiActualRequestedSize);
+ uint8_t* pBuf = (uint8_t*) malloc (kiActualRequestedSize);
#ifdef MEMORY_CHECK
if (fpMemChkPoint == NULL) {
m_fpMemChkPoint = fopen ("./enc_mem_check_point.txt", "at+");
--- a/codec/console/dec/src/d3d9_utils.cpp
+++ b/codec/console/dec/src/d3d9_utils.cpp
@@ -465,18 +465,18 @@
const TCHAR kszWindowClass[] = TEXT ("Wels Decoder Class");
WNDCLASSEX sWndClassEx = {0};
- sWndClassEx.cbSize = sizeof (WNDCLASSEX);
- sWndClassEx.style = CS_HREDRAW | CS_VREDRAW;
- sWndClassEx.lpfnWndProc = (WNDPROC)WndProc;
- sWndClassEx.cbClsExtra = 0;
- sWndClassEx.cbWndExtra = 0;
- sWndClassEx.hInstance = GetModuleHandle (NULL);
- sWndClassEx.hIcon = LoadIcon (sWndClassEx.hInstance, (LPCTSTR)IDI_TESTSHARESURFACE);
- sWndClassEx.hCursor = LoadCursor (NULL, IDC_ARROW);
- sWndClassEx.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
- sWndClassEx.lpszMenuName = (LPCSTR)IDC_TESTSHARESURFACE;
- sWndClassEx.lpszClassName = kszWindowClass;
- sWndClassEx.hIconSm = LoadIcon (sWndClassEx.hInstance, (LPCTSTR)IDI_SMALL);
+ sWndClassEx.cbSize = sizeof (WNDCLASSEX);
+ sWndClassEx.style = CS_HREDRAW | CS_VREDRAW;
+ sWndClassEx.lpfnWndProc = (WNDPROC)WndProc;
+ sWndClassEx.cbClsExtra = 0;
+ sWndClassEx.cbWndExtra = 0;
+ sWndClassEx.hInstance = GetModuleHandle (NULL);
+ sWndClassEx.hIcon = LoadIcon (sWndClassEx.hInstance, (LPCTSTR)IDI_TESTSHARESURFACE);
+ sWndClassEx.hCursor = LoadCursor (NULL, IDC_ARROW);
+ sWndClassEx.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
+ sWndClassEx.lpszMenuName = (LPCSTR)IDC_TESTSHARESURFACE;
+ sWndClassEx.lpszClassName = kszWindowClass;
+ sWndClassEx.hIconSm = LoadIcon (sWndClassEx.hInstance, (LPCTSTR)IDI_SMALL);
if (!RegisterClassEx (&sWndClassEx))
return E_FAIL;
--- a/codec/console/dec/src/h264dec.cpp
+++ b/codec/console/dec/src/h264dec.cpp
@@ -73,8 +73,8 @@
void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, const char* kpOuputFileName,
int32_t& iWidth, int32_t& iHeight, const char* pOptionFileName, const char* pLengthFileName) {
- FILE* pH264File = NULL;
- FILE* pYuvFile = NULL;
+ FILE* pH264File = NULL;
+ FILE* pYuvFile = NULL;
FILE* pOptionFile = NULL;
// Lenght input mode support
FILE* fpTrack = NULL;
@@ -237,8 +237,8 @@
pDst[1] = pData[1];
pDst[2] = pData[2];
}
- iEnd = WelsTime();
- iTotal += iEnd - iStart;
+ iEnd = WelsTime();
+ iTotal += iEnd - iStart;
if (sDstBufInfo.iBufferStatus == 1) {
cOutputModule.Process ((void**)pDst, &sDstBufInfo, pYuvFile);
iWidth = sDstBufInfo.UsrData.sSystemBuffer.iWidth;
@@ -269,8 +269,8 @@
pDst[1] = pData[1];
pDst[2] = pData[2];
}
- iEnd = WelsTime();
- iTotal += iEnd - iStart;
+ iEnd = WelsTime();
+ iTotal += iEnd - iStart;
if (sDstBufInfo.iBufferStatus == 1) {
cOutputModule.Process ((void**)pDst, &sDstBufInfo, pYuvFile);
iWidth = sDstBufInfo.UsrData.sSystemBuffer.iWidth;
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -197,8 +197,8 @@
}
}
}
- pDLayer->iDLayerQp = sLayerCtx.iDLayerQp;
- pDLayer->sSliceCfg.uiSliceMode = sLayerCtx.sSliceCfg.uiSliceMode;
+ pDLayer->iDLayerQp = sLayerCtx.iDLayerQp;
+ pDLayer->sSliceCfg.uiSliceMode = sLayerCtx.sSliceCfg.uiSliceMode;
memcpy (&pDLayer->sSliceCfg, &sLayerCtx.sSliceCfg, sizeof (SSliceConfig)); // confirmed_safe_unsafe_usage
memcpy (&pDLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0], &sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum[0],
@@ -626,59 +626,59 @@
int FillSpecificParameters (SEncParamExt& sParam) {
/* Test for temporal, spatial, SNR scalability */
sParam.iUsageType = CAMERA_VIDEO_REAL_TIME;
- sParam.fMaxFrameRate = 60.0f; // input frame rate
- sParam.iPicWidth = 1280; // width of picture in samples
- sParam.iPicHeight = 720; // height of picture in samples
- sParam.iTargetBitrate = 2500000; // target bitrate desired
+ sParam.fMaxFrameRate = 60.0f; // input frame rate
+ sParam.iPicWidth = 1280; // width of picture in samples
+ sParam.iPicHeight = 720; // height of picture in samples
+ sParam.iTargetBitrate = 2500000; // target bitrate desired
sParam.iMaxBitrate = UNSPECIFIED_BIT_RATE;
- sParam.iRCMode = RC_QUALITY_MODE; // rc mode control
- sParam.iTemporalLayerNum = 3; // layer number at temporal level
- sParam.iSpatialLayerNum = 4; // layer number at spatial level
+ sParam.iRCMode = RC_QUALITY_MODE; // rc mode control
+ sParam.iTemporalLayerNum = 3; // layer number at temporal level
+ sParam.iSpatialLayerNum = 4; // layer number at spatial level
sParam.bEnableDenoise = 0; // denoise control
sParam.bEnableBackgroundDetection = 1; // background detection control
sParam.bEnableAdaptiveQuant = 1; // adaptive quantization control
sParam.bEnableFrameSkip = 1; // frame skipping
- sParam.bEnableLongTermReference = 0; // long term reference control
+ sParam.bEnableLongTermReference = 0; // long term reference control
sParam.iLtrMarkPeriod = 30;
- sParam.uiIntraPeriod = 320; // period of Intra frame
+ sParam.uiIntraPeriod = 320; // period of Intra frame
sParam.eSpsPpsIdStrategy = INCREASING_ID;
sParam.bPrefixNalAddingCtrl = 0;
sParam.iComplexityMode = MEDIUM_COMPLEXITY;
int iIndexLayer = 0;
- sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_BASELINE;
- sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 160;
- sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 90;
- sParam.sSpatialLayers[iIndexLayer].fFrameRate = 7.5f;
- sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 64000;
- sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
+ sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_BASELINE;
+ sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 160;
+ sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 90;
+ sParam.sSpatialLayers[iIndexLayer].fFrameRate = 7.5f;
+ sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 64000;
+ sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
++ iIndexLayer;
- sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
- sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 320;
- sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 180;
- sParam.sSpatialLayers[iIndexLayer].fFrameRate = 15.0f;
- sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 160000;
- sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
+ sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
+ sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 320;
+ sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 180;
+ sParam.sSpatialLayers[iIndexLayer].fFrameRate = 15.0f;
+ sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 160000;
+ sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
++ iIndexLayer;
- sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
- sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 640;
- sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 360;
- sParam.sSpatialLayers[iIndexLayer].fFrameRate = 30.0f;
- sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 512000;
- sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
+ sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
+ sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 640;
+ sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 360;
+ sParam.sSpatialLayers[iIndexLayer].fFrameRate = 30.0f;
+ sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 512000;
+ sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.sSliceArgument.uiSliceNum = 1;
++ iIndexLayer;
- sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
- sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 1280;
- sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 720;
- sParam.sSpatialLayers[iIndexLayer].fFrameRate = 30.0f;
- sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 1500000;
- sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
+ sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
+ sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 1280;
+ sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 720;
+ sParam.sSpatialLayers[iIndexLayer].fFrameRate = 30.0f;
+ sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 1500000;
+ sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.sSliceArgument.uiSliceNum = 1;
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -138,8 +138,8 @@
return NULL; //uiForbiddenZeroBit should always equal to 0
}
- pNalUnitHeader->uiNalRefIdc = (uint8_t) (pNal[0] >> 5); // uiNalRefIdc
- pNalUnitHeader->eNalUnitType = (EWelsNalUnitType) (pNal[0] & 0x1f); // eNalUnitType
+ pNalUnitHeader->uiNalRefIdc = (uint8_t) (pNal[0] >> 5); // uiNalRefIdc
+ pNalUnitHeader->eNalUnitType = (EWelsNalUnitType) (pNal[0] & 0x1f); // eNalUnitType
++pNal;
--iNalSize;
@@ -241,8 +241,8 @@
*pConsumedBytes += NAL_UNIT_HEADER_EXT_SIZE;
pCurNal->sNalHeaderExt.sNalUnitHeader.uiForbiddenZeroBit = pNalUnitHeader->uiForbiddenZeroBit;
- pCurNal->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc = pNalUnitHeader->uiNalRefIdc;
- pCurNal->sNalHeaderExt.sNalUnitHeader.eNalUnitType = pNalUnitHeader->eNalUnitType;
+ pCurNal->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc = pNalUnitHeader->uiNalRefIdc;
+ pCurNal->sNalHeaderExt.sNalUnitHeader.eNalUnitType = pNalUnitHeader->eNalUnitType;
if (pNalUnitHeader->uiNalRefIdc != 0) {
pBs = &pCtx->sBs;
iBitSize = (iNalSize << 3) - BsGetTrailingBits (pNal + iNalSize - 1); // convert into bit
@@ -272,9 +272,9 @@
}
pCurNal->uiTimeStamp = pCtx->uiTimeStamp;
pCurNal->sNalHeaderExt.sNalUnitHeader.uiForbiddenZeroBit = pNalUnitHeader->uiForbiddenZeroBit;
- pCurNal->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc = pNalUnitHeader->uiNalRefIdc;
- pCurNal->sNalHeaderExt.sNalUnitHeader.eNalUnitType = pNalUnitHeader->eNalUnitType;
- pCurAu = pCtx->pAccessUnitList;
+ pCurNal->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc = pNalUnitHeader->uiNalRefIdc;
+ pCurNal->sNalHeaderExt.sNalUnitHeader.eNalUnitType = pNalUnitHeader->eNalUnitType;
+ pCurAu = pCtx->pAccessUnitList;
uiAvailNalNum = pCurAu->uiAvailUnitsNum;
@@ -576,12 +576,12 @@
*/
int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t kiSrcLen, uint8_t* pSrcNal,
const int32_t kSrcNalLen) {
- PBitStringAux pBs = NULL;
- EWelsNalUnitType eNalType = NAL_UNIT_UNSPEC_0; // make initial value as unspecified
- int32_t iPicWidth = 0;
- int32_t iPicHeight = 0;
- int32_t iBitSize = 0;
- int32_t iErr = ERR_NONE;
+ PBitStringAux pBs = NULL;
+ EWelsNalUnitType eNalType = NAL_UNIT_UNSPEC_0; // make initial value as unspecified
+ int32_t iPicWidth = 0;
+ int32_t iPicHeight = 0;
+ int32_t iBitSize = 0;
+ int32_t iErr = ERR_NONE;
if (kiSrcLen <= 0)
return iErr;
@@ -674,8 +674,8 @@
if (kuiMmco == MMCO_SHORT2UNUSED) {
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //difference_of_base_pic_nums_minus1
- pRefBasePicMarking->mmco_base[iIdx].uiDiffOfPicNums = 1 + uiCode;
- pRefBasePicMarking->mmco_base[iIdx].iShortFrameNum = 0;
+ pRefBasePicMarking->mmco_base[iIdx].uiDiffOfPicNums = 1 + uiCode;
+ pRefBasePicMarking->mmco_base[iIdx].iShortFrameNum = 0;
} else if (kuiMmco == MMCO_LONG2UNUSED) {
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //long_term_base_pic_num
pRefBasePicMarking->mmco_base[iIdx].uiLongTermPicNum = uiCode;
@@ -747,8 +747,8 @@
WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); //chroma_phase_y_plus1
pExt->uiChromaPhaseYPlus1 = uiCode;
- pExt->uiSeqRefLayerChromaPhaseXPlus1Flag = pExt->uiChromaPhaseXPlus1Flag;
- pExt->uiSeqRefLayerChromaPhaseYPlus1 = pExt->uiChromaPhaseYPlus1;
+ pExt->uiSeqRefLayerChromaPhaseXPlus1Flag = pExt->uiChromaPhaseXPlus1Flag;
+ pExt->uiSeqRefLayerChromaPhaseYPlus1 = pExt->uiChromaPhaseYPlus1;
memset (&pExt->sSeqScaledRefLayer, 0, sizeof (SPosOffset));
if (pExt->uiExtendedSpatialScalability == 1) {
@@ -948,11 +948,11 @@
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);
} else pSps->pSLevelLimits = pSLevelLimits;
// syntax elements in default
- pSps->uiChromaFormatIdc = 1;
+ pSps->uiChromaFormatIdc = 1;
- pSps->uiProfileIdc = uiProfileIdc;
- pSps->uiLevelIdc = uiLevelIdc;
- pSps->iSpsId = iSpsId;
+ pSps->uiProfileIdc = uiProfileIdc;
+ pSps->uiLevelIdc = uiLevelIdc;
+ pSps->iSpsId = iSpsId;
if (PRO_SCALABLE_BASELINE == uiProfileIdc || PRO_SCALABLE_HIGH == uiProfileIdc ||
PRO_HIGH == uiProfileIdc || PRO_HIGH10 == uiProfileIdc ||
@@ -1100,10 +1100,10 @@
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_CROPPING_DATA);
}
} else {
- pSps->sFrameCrop.iLeftOffset = 0; // frame_crop_left_offset
- pSps->sFrameCrop.iRightOffset = 0; // frame_crop_right_offset
- pSps->sFrameCrop.iTopOffset = 0; // frame_crop_top_offset
- pSps->sFrameCrop.iBottomOffset = 0; // frame_crop_bottom_offset
+ pSps->sFrameCrop.iLeftOffset = 0; // frame_crop_left_offset
+ pSps->sFrameCrop.iRightOffset = 0; // frame_crop_right_offset
+ pSps->sFrameCrop.iTopOffset = 0; // frame_crop_top_offset
+ pSps->sFrameCrop.iBottomOffset = 0; // frame_crop_bottom_offset
}
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //vui_parameters_present_flag
pSps->bVuiParamPresentFlag = !!uiCode;
@@ -1208,8 +1208,8 @@
if (PRO_SCALABLE_BASELINE == uiProfileIdc || PRO_SCALABLE_HIGH == uiProfileIdc)
pCtx->bAvcBasedFlag = false;
- *pPicWidth = pSps->iMbWidth << 4;
- *pPicHeight = pSps->iMbHeight << 4;
+ *pPicWidth = pSps->iMbWidth << 4;
+ *pPicHeight = pSps->iMbHeight << 4;
PSps pTmpSps = NULL;
if (kbUseSubsetFlag) {
pTmpSps = &pCtx->sSubsetSpsBuffer[iSpsId].sSps;
--- a/codec/decoder/core/src/bit_stream.cpp
+++ b/codec/decoder/core/src/bit_stream.cpp
@@ -74,9 +74,9 @@
if (NULL == pTmp)
return ERR_INFO_INVALID_ACCESS;
- pBitString->pStartBuf = pTmp; // buffer to start position
- pBitString->pEndBuf = pTmp + kiSizeBuf; // buffer + length
- pBitString->iBits = kiSize; // count bits of overall bitstreaming inputindex;
+ pBitString->pStartBuf = pTmp; // buffer to start position
+ pBitString->pEndBuf = pTmp + kiSizeBuf; // buffer + length
+ pBitString->iBits = kiSize; // count bits of overall bitstreaming inputindex;
pBitString->pCurBuf = pBitString->pStartBuf;
int32_t iErr = InitReadBits (pBitString, 0);
if (iErr) {
--- a/codec/decoder/core/src/deblocking.cpp
+++ b/codec/decoder/core/src/deblocking.cpp
@@ -815,7 +815,7 @@
void WelsDeblockingMb (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_t iBoundryFlag) {
uint8_t nBS[2][4][4] = {{{ 0 }}};
- int32_t iMbXyIndex = pCurDqLayer->iMbXyIndex;
+ int32_t iMbXyIndex = pCurDqLayer->iMbXyIndex;
int32_t iCurMbType = pCurDqLayer->pMbType[iMbXyIndex];
int32_t iMbNb;
--- a/codec/decoder/core/src/decode_mb_aux.cpp
+++ b/codec/decoder/core/src/decode_mb_aux.cpp
@@ -42,9 +42,9 @@
void IdctResAddPred_c (uint8_t* pPred, const int32_t kiStride, int16_t* pRs) {
int16_t iSrc[16];
- uint8_t* pDst = pPred;
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
+ uint8_t* pDst = pPred;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
int32_t i;
for (i = 0; i < 4; i++) {
@@ -61,16 +61,16 @@
}
for (i = 0; i < 4; i++) {
- int32_t kT1 = iSrc[i] + iSrc[i + 8];
- int32_t kT2 = iSrc[i + 4] + (iSrc[i + 12] >> 1);
- int32_t kT3 = (32 + kT1 + kT2) >> 6;
- int32_t kT4 = (32 + kT1 - kT2) >> 6;
+ int32_t kT1 = iSrc[i] + iSrc[i + 8];
+ int32_t kT2 = iSrc[i + 4] + (iSrc[i + 12] >> 1);
+ int32_t kT3 = (32 + kT1 + kT2) >> 6;
+ int32_t kT4 = (32 + kT1 - kT2) >> 6;
pDst[i] = WelsClip1 (kT3 + pPred[i]);
pDst[i + kiStride3] = WelsClip1 (kT4 + pPred[i + kiStride3]);
- kT1 = iSrc[i] - iSrc[i + 8];
- kT2 = (iSrc[i + 4] >> 1) - iSrc[i + 12];
+ kT1 = iSrc[i] - iSrc[i + 8];
+ kT2 = (iSrc[i + 4] >> 1) - iSrc[i + 12];
pDst[i + kiStride] = WelsClip1 (((32 + kT1 + kT2) >> 6) + pDst[i + kiStride]);
pDst[i + kiStride2] = WelsClip1 (((32 + kT1 - kT2) >> 6) + pDst[i + kiStride2]);
}
--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -601,10 +601,10 @@
}
int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& uiEosFlag) {
- PDqLayer pCurLayer = pCtx->pCurDqLayer;
- PBitStringAux pBsAux = pCurLayer->pBitStringAux;
- PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
- PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
+ PDqLayer pCurLayer = pCtx->pCurDqLayer;
+ PBitStringAux pBsAux = pCurLayer->pBitStringAux;
+ PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
+ PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
SWelsNeighAvail sNeighAvail;
int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;
int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;
@@ -812,10 +812,10 @@
}
int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail, uint32_t& uiEosFlag) {
- PDqLayer pCurLayer = pCtx->pCurDqLayer;
- PBitStringAux pBsAux = pCurLayer->pBitStringAux;
- PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
- PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
+ PDqLayer pCurLayer = pCtx->pCurDqLayer;
+ PBitStringAux pBsAux = pCurLayer->pBitStringAux;
+ PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
+ PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;
int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;
@@ -1048,9 +1048,9 @@
}
int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) {
- PDqLayer pCurLayer = pCtx->pCurDqLayer;
- PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
- PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
+ PDqLayer pCurLayer = pCtx->pCurDqLayer;
+ PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
+ PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
PPicture* ppRefPic = pCtx->sRefPic.pRefList[LIST_0];
uint32_t uiCode;
int32_t iMbXy = pCurLayer->iMbXyIndex;
@@ -1260,10 +1260,10 @@
int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
SVlcTable* pVlcTable = &pCtx->sVlcTable;
- PDqLayer pCurLayer = pCtx->pCurDqLayer;
- PBitStringAux pBs = pCurLayer->pBitStringAux;
- PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
- PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
+ PDqLayer pCurLayer = pCtx->pCurDqLayer;
+ PBitStringAux pBs = pCurLayer->pBitStringAux;
+ PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
+ PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
SWelsNeighAvail sNeighAvail;
int32_t iMbResProperty;
@@ -1579,10 +1579,10 @@
int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
SVlcTable* pVlcTable = &pCtx->sVlcTable;
- PDqLayer pCurLayer = pCtx->pCurDqLayer;
- PBitStringAux pBs = pCurLayer->pBitStringAux;
- PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
- PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
+ PDqLayer pCurLayer = pCtx->pCurDqLayer;
+ PBitStringAux pBs = pCurLayer->pBitStringAux;
+ PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
+ PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;
int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;
@@ -1909,10 +1909,10 @@
}
int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) {
- PDqLayer pCurLayer = pCtx->pCurDqLayer;
- PBitStringAux pBs = pCurLayer->pBitStringAux;
- PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
- PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
+ PDqLayer pCurLayer = pCtx->pCurDqLayer;
+ PBitStringAux pBs = pCurLayer->pBitStringAux;
+ PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
+ PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
PPicture* ppRefPic = pCtx->sRefPic.pRefList[LIST_0];
intX_t iUsedBits;
const int32_t iMbXy = pCurLayer->iMbXyIndex;
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -93,9 +93,9 @@
}
// initialize context in queue
- pPicBuf->iCapacity = kiSize;
+ pPicBuf->iCapacity = kiSize;
pPicBuf->iCurrentIdx = 0;
- * ppPicBuf = pPicBuf;
+ * ppPicBuf = pPicBuf;
return 0;
}
@@ -139,9 +139,9 @@
memcpy (pPicNewBuf->ppPic, pPicOldBuf->ppPic, kiOldSize * sizeof (PPicture));
// initialize context in queue
- pPicNewBuf->iCapacity = kiNewSize;
+ pPicNewBuf->iCapacity = kiNewSize;
pPicNewBuf->iCurrentIdx = pPicOldBuf->iCurrentIdx;
- * ppPicBuf = pPicNewBuf;
+ * ppPicBuf = pPicNewBuf;
for (int32_t i = 0; i < pPicNewBuf->iCapacity; i++) {
pPicNewBuf->ppPic[i]->bUsedAsRef = false;
@@ -214,8 +214,8 @@
}
// initialize context in queue
- pPicNewBuf->iCapacity = kiNewSize;
- *ppPicBuf = pPicNewBuf;
+ pPicNewBuf->iCapacity = kiNewSize;
+ *ppPicBuf = pPicNewBuf;
for (int32_t i = 0; i < pPicNewBuf->iCapacity; i++) {
pPicNewBuf->ppPic[i]->bUsedAsRef = false;
@@ -277,35 +277,35 @@
pCtx->pArgDec = NULL;
- pCtx->eOutputColorFormat = videoFormatI420; // yuv in default
- pCtx->bHaveGotMemory = false; // not ever request memory blocks for decoder context related
- pCtx->uiCpuFlag = 0;
+ pCtx->eOutputColorFormat = videoFormatI420; // yuv in default
+ pCtx->bHaveGotMemory = false; // not ever request memory blocks for decoder context related
+ pCtx->uiCpuFlag = 0;
- pCtx->bAuReadyFlag = 0; // au data is not ready
+ pCtx->bAuReadyFlag = 0; // au data is not ready
pCtx->bCabacInited = false;
pCtx->uiCpuFlag = WelsCPUFeatureDetect (&iCpuCores);
- pCtx->iImgWidthInPixel = 0;
- pCtx->iImgHeightInPixel = 0; // alloc picture data when picture size is available
- pCtx->iLastImgWidthInPixel = 0;
- pCtx->iLastImgHeightInPixel = 0;
+ pCtx->iImgWidthInPixel = 0;
+ pCtx->iImgHeightInPixel = 0; // alloc picture data when picture size is available
+ pCtx->iLastImgWidthInPixel = 0;
+ pCtx->iLastImgHeightInPixel = 0;
pCtx->bFreezeOutput = true;
- pCtx->iFrameNum = -1;
- pCtx->iPrevFrameNum = -1;
- pCtx->iErrorCode = ERR_NONE;
+ pCtx->iFrameNum = -1;
+ pCtx->iPrevFrameNum = -1;
+ pCtx->iErrorCode = ERR_NONE;
- pCtx->pDec = NULL;
+ pCtx->pDec = NULL;
WelsResetRefPic (pCtx);
- pCtx->iActiveFmoNum = 0;
+ pCtx->iActiveFmoNum = 0;
- pCtx->pPicBuff[LIST_0] = NULL;
- pCtx->pPicBuff[LIST_1] = NULL;
+ pCtx->pPicBuff[LIST_0] = NULL;
+ pCtx->pPicBuff[LIST_1] = NULL;
- pCtx->bAvcBasedFlag = true;
+ pCtx->bAvcBasedFlag = true;
pCtx->eErrorConMethod = ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE;
pCtx->pPreviousDecodedPictureInDpb = NULL;
pCtx->sDecoderStatistics.iAvgLumaQp = -1;
@@ -353,13 +353,13 @@
* request memory blocks for decoder avc part
*/
int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight) {
- const int32_t kiPicWidth = kiMbWidth << 4;
- const int32_t kiPicHeight = kiMbHeight << 4;
+ const int32_t kiPicWidth = kiMbWidth << 4;
+ const int32_t kiPicHeight = kiMbHeight << 4;
int32_t iErr = ERR_NONE;
- int32_t iListIdx = 0; //, mb_blocks = 0;
- int32_t iPicQueueSize = 0; // adaptive size of picture queue, = (pSps->iNumRefFrames x 2)
- bool bNeedChangePicQueue = true;
+ int32_t iListIdx = 0; //, mb_blocks = 0;
+ int32_t iPicQueueSize = 0; // adaptive size of picture queue, = (pSps->iNumRefFrames x 2)
+ bool bNeedChangePicQueue = true;
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pCtx || kiPicWidth <= 0 || kiPicHeight <= 0))
@@ -418,11 +418,11 @@
return iErr;
- pCtx->iImgWidthInPixel = kiPicWidth; // target width of image to be reconstruted while decoding
- pCtx->iImgHeightInPixel = kiPicHeight; // target height of image to be reconstruted while decoding
+ pCtx->iImgWidthInPixel = kiPicWidth; // target width of image to be reconstruted while decoding
+ pCtx->iImgHeightInPixel = kiPicHeight; // target height of image to be reconstruted while decoding
- pCtx->bHaveGotMemory = true; // global memory for decoder context related is requested
- pCtx->pDec = NULL; // need prefetch a new pic due to spatial size changed
+ pCtx->bHaveGotMemory = true; // global memory for decoder context related is requested
+ pCtx->pDec = NULL; // need prefetch a new pic due to spatial size changed
if (pCtx->pCabacDecEngine == NULL)
pCtx->pCabacDecEngine = (SWelsCabacDecEngine*) WelsMallocz (sizeof (SWelsCabacDecEngine), "pCtx->pCabacDecEngine");
@@ -450,12 +450,12 @@
}
// added for safe memory
- pCtx->iImgWidthInPixel = 0;
+ pCtx->iImgWidthInPixel = 0;
pCtx->iImgHeightInPixel = 0;
- pCtx->iLastImgWidthInPixel = 0;
+ pCtx->iLastImgWidthInPixel = 0;
pCtx->iLastImgHeightInPixel = 0;
pCtx->bFreezeOutput = true;
- pCtx->bHaveGotMemory = false;
+ pCtx->bHaveGotMemory = false;
WelsFree (pCtx->pCabacDecEngine, "pCtx->pCabacDecEngine");
}
@@ -660,8 +660,8 @@
((pSrcNal[2 + iSrcIdx] == 0x03) || (pSrcNal[2 + iSrcIdx] == 0x01))) {
if (pSrcNal[2 + iSrcIdx] == 0x03) {
ST16 (pDstNal + iDstIdx, 0);
- iDstIdx += 2;
- iSrcIdx += 3;
+ iDstIdx += 2;
+ iSrcIdx += 3;
iSrcConsumed += 3;
} else {
@@ -817,7 +817,7 @@
*/
int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight) {
int32_t iErr = ERR_NONE;
- const int32_t kiPicWidth = kiMbWidth << 4;
+ const int32_t kiPicWidth = kiMbWidth << 4;
const int32_t kiPicHeight = kiMbHeight << 4;
iErr = WelsRequestMem (pCtx, kiMbWidth, kiMbHeight); // common memory used
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -427,27 +427,27 @@
else
pShExt->bBasePredWeightTableFlag = true;
pShExt->uiRefLayerDqId = (uint8_t) - 1;
- pShExt->uiDisableInterLayerDeblockingFilterIdc = 0;
- pShExt->iInterLayerSliceAlphaC0Offset = 0;
- pShExt->iInterLayerSliceBetaOffset = 0;
- pShExt->bConstrainedIntraResamplingFlag = false;
- pShExt->uiRefLayerChromaPhaseXPlus1Flag = 0;
- pShExt->uiRefLayerChromaPhaseYPlus1 = 1;
+ pShExt->uiDisableInterLayerDeblockingFilterIdc = 0;
+ pShExt->iInterLayerSliceAlphaC0Offset = 0;
+ pShExt->iInterLayerSliceBetaOffset = 0;
+ pShExt->bConstrainedIntraResamplingFlag = false;
+ pShExt->uiRefLayerChromaPhaseXPlus1Flag = 0;
+ pShExt->uiRefLayerChromaPhaseYPlus1 = 1;
//memset(&pShExt->sScaledRefLayer, 0, sizeof(SPosOffset));
- pShExt->iScaledRefLayerPicWidthInSampleLuma = pShExt->sSliceHeader.iMbWidth << 4;
- pShExt->iScaledRefLayerPicHeightInSampleLuma = pShExt->sSliceHeader.iMbHeight << 4;
+ pShExt->iScaledRefLayerPicWidthInSampleLuma = pShExt->sSliceHeader.iMbWidth << 4;
+ pShExt->iScaledRefLayerPicHeightInSampleLuma = pShExt->sSliceHeader.iMbHeight << 4;
- pShExt->bSliceSkipFlag = false;
- pShExt->bAdaptiveBaseModeFlag = false;
- pShExt->bDefaultBaseModeFlag = false;
- pShExt->bAdaptiveMotionPredFlag = false;
- pShExt->bDefaultMotionPredFlag = false;
- pShExt->bAdaptiveResidualPredFlag = false;
- pShExt->bDefaultResidualPredFlag = false;
- pShExt->bTCoeffLevelPredFlag = false;
- pShExt->uiScanIdxStart = 0;
- pShExt->uiScanIdxEnd = 15;
+ pShExt->bSliceSkipFlag = false;
+ pShExt->bAdaptiveBaseModeFlag = false;
+ pShExt->bDefaultBaseModeFlag = false;
+ pShExt->bAdaptiveMotionPredFlag = false;
+ pShExt->bDefaultMotionPredFlag = false;
+ pShExt->bAdaptiveResidualPredFlag = false;
+ pShExt->bDefaultResidualPredFlag = false;
+ pShExt->bTCoeffLevelPredFlag = false;
+ pShExt->uiScanIdxStart = 0;
+ pShExt->uiScanIdxEnd = 15;
return true;
}
@@ -551,8 +551,8 @@
if (InitBsBuffer (pCtx) != 0)
return ERR_INFO_OUT_OF_MEMORY;
- pCtx->uiTargetDqId = (uint8_t) - 1;
- pCtx->bEndOfStreamFlag = false;
+ pCtx->uiTargetDqId = (uint8_t) - 1;
+ pCtx->bEndOfStreamFlag = false;
return ERR_NONE;
}
@@ -579,8 +579,8 @@
}
pCtx->sRawData.pHead = NULL;
pCtx->sRawData.pEnd = NULL;
- pCtx->sRawData.pStartPos = NULL;
- pCtx->sRawData.pCurPos = NULL;
+ pCtx->sRawData.pStartPos = NULL;
+ pCtx->sRawData.pCurPos = NULL;
if (pCtx->bParseOnly) {
if (pCtx->sSavedData.pHead) {
WelsFree (pCtx->sSavedData.pHead, "pCtx->sSavedData->pHead");
@@ -587,7 +587,7 @@
}
pCtx->sSavedData.pHead = NULL;
pCtx->sSavedData.pEnd = NULL;
- pCtx->sSavedData.pStartPos = NULL;
+ pCtx->sSavedData.pStartPos = NULL;
pCtx->sSavedData.pCurPos = NULL;
if (pCtx->pParserBsInfo) {
if (pCtx->pParserBsInfo->pDstBuff) {
@@ -610,20 +610,20 @@
PNalUnitHeaderExt pHeaderExt = &pNal->sNalHeaderExt;
uint8_t uiCurByte = *pSrc;
- pHeaderExt->bIdrFlag = !! (uiCurByte & 0x40);
- pHeaderExt->uiPriorityId = uiCurByte & 0x3F;
+ pHeaderExt->bIdrFlag = !! (uiCurByte & 0x40);
+ pHeaderExt->uiPriorityId = uiCurByte & 0x3F;
uiCurByte = * (++pSrc);
pHeaderExt->iNoInterLayerPredFlag = uiCurByte >> 7;
- pHeaderExt->uiDependencyId = (uiCurByte & 0x70) >> 4;
- pHeaderExt->uiQualityId = uiCurByte & 0x0F;
+ pHeaderExt->uiDependencyId = (uiCurByte & 0x70) >> 4;
+ pHeaderExt->uiQualityId = uiCurByte & 0x0F;
uiCurByte = * (++pSrc);
- pHeaderExt->uiTemporalId = uiCurByte >> 5;
- pHeaderExt->bUseRefBasePicFlag = !! (uiCurByte & 0x10);
- pHeaderExt->bDiscardableFlag = !! (uiCurByte & 0x08);
- pHeaderExt->bOutputFlag = !! (uiCurByte & 0x04);
- pHeaderExt->uiReservedThree2Bits = uiCurByte & 0x03;
- pHeaderExt->uiLayerDqId = (pHeaderExt->uiDependencyId << 4) | pHeaderExt->uiQualityId;
+ pHeaderExt->uiTemporalId = uiCurByte >> 5;
+ pHeaderExt->bUseRefBasePicFlag = !! (uiCurByte & 0x10);
+ pHeaderExt->bDiscardableFlag = !! (uiCurByte & 0x08);
+ pHeaderExt->bOutputFlag = !! (uiCurByte & 0x04);
+ pHeaderExt->uiReservedThree2Bits = uiCurByte & 0x03;
+ pHeaderExt->uiLayerDqId = (pHeaderExt->uiDependencyId << 4) | pHeaderExt->uiQualityId;
}
@@ -640,21 +640,21 @@
* Parse slice header of bitstream in avc for storing data structure
*/
int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, const bool kbExtensionFlag) {
- PNalUnit const kpCurNal = pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum - 1];
+ PNalUnit const kpCurNal = pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum - 1];
- PNalUnitHeaderExt pNalHeaderExt = NULL;
- PSliceHeader pSliceHead = NULL;
- PSliceHeaderExt pSliceHeadExt = NULL;
- PSubsetSps pSubsetSps = NULL;
- PSps pSps = NULL;
- PPps pPps = NULL;
- EWelsNalUnitType eNalType = static_cast<EWelsNalUnitType> (0);
- int32_t iPpsId = 0;
- int32_t iRet = ERR_NONE;
- uint8_t uiSliceType = 0;
- uint8_t uiQualityId = BASE_QUALITY_ID;
- bool bIdrFlag = false;
- bool bSgChangeCycleInvolved = false; // involved slice group change cycle ?
+ PNalUnitHeaderExt pNalHeaderExt = NULL;
+ PSliceHeader pSliceHead = NULL;
+ PSliceHeaderExt pSliceHeadExt = NULL;
+ PSubsetSps pSubsetSps = NULL;
+ PSps pSps = NULL;
+ PPps pPps = NULL;
+ EWelsNalUnitType eNalType = static_cast<EWelsNalUnitType> (0);
+ int32_t iPpsId = 0;
+ int32_t iRet = ERR_NONE;
+ uint8_t uiSliceType = 0;
+ uint8_t uiQualityId = BASE_QUALITY_ID;
+ bool bIdrFlag = false;
+ bool bSgChangeCycleInvolved = false; // involved slice group change cycle ?
uint32_t uiCode;
int32_t iCode;
SLogContext* pLogCtx = & (pCtx->sLogCtx);
@@ -663,11 +663,11 @@
return ERR_INFO_OUT_OF_MEMORY;
}
- pNalHeaderExt = &kpCurNal->sNalHeaderExt;
- pSliceHead = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader;
- eNalType = pNalHeaderExt->sNalUnitHeader.eNalUnitType;
+ pNalHeaderExt = &kpCurNal->sNalHeaderExt;
+ pSliceHead = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader;
+ eNalType = pNalHeaderExt->sNalUnitHeader.eNalUnitType;
- pSliceHeadExt = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt;
+ pSliceHeadExt = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt;
if (pSliceHeadExt) {
SRefBasePicMarking sBaseMarking;
@@ -746,7 +746,7 @@
if (kbExtensionFlag) {
pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId];
- pSps = &pSubsetSps->sSps;
+ pSps = &pSubsetSps->sSps;
if (pCtx->bSubspsAvailFlags[pPps->iSpsId] == false) {
pCtx->sDecoderStatistics.iSubSpsReportErrorNum++;
if (pCtx->iSubSPSLastInvalidId != pPps->iSpsId) {
@@ -798,15 +798,15 @@
WELS_READ_VERIFY (BsGetBits (pBs, pSps->uiLog2MaxFrameNum, &uiCode)); //frame_num
pSliceHead->iFrameNum = uiCode;
- pSliceHead->bFieldPicFlag = false;
- pSliceHead->bBottomFiledFlag = false;
+ pSliceHead->bFieldPicFlag = false;
+ pSliceHead->bBottomFiledFlag = false;
if (!pSps->bFrameMbsOnlyFlag) {
WelsLog (pLogCtx, WELS_LOG_WARNING, "ParseSliceHeaderSyntaxs(): frame_mbs_only_flag = %d not supported. ",
pSps->bFrameMbsOnlyFlag);
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_UNSUPPORTED_MBAFF);
}
- pSliceHead->iMbWidth = pSps->iMbWidth;
- pSliceHead->iMbHeight = pSps->iMbHeight / (1 + pSliceHead->bFieldPicFlag);
+ pSliceHead->iMbWidth = pSps->iMbWidth;
+ pSliceHead->iMbHeight = pSps->iMbHeight / (1 + pSliceHead->bFieldPicFlag);
if (bIdrFlag) {
if (pSliceHead->iFrameNum != 0) {
@@ -825,9 +825,9 @@
#endif
}
- pSliceHead->iDeltaPicOrderCntBottom = 0;
- pSliceHead->iDeltaPicOrderCnt[0] =
- pSliceHead->iDeltaPicOrderCnt[1] = 0;
+ pSliceHead->iDeltaPicOrderCntBottom = 0;
+ pSliceHead->iDeltaPicOrderCnt[0] =
+ pSliceHead->iDeltaPicOrderCnt[1] = 0;
if (pSps->uiPocType == 0) {
WELS_READ_VERIFY (BsGetBits (pBs, pSps->iLog2MaxPocLsb, &uiCode)); //pic_order_cnt_lsb
pSliceHead->iPicOrderCntLsb = uiCode;
@@ -854,8 +854,8 @@
}
//set defaults, might be overriden a few line later
- pSliceHead->uiRefCount[0] = pPps->uiNumRefIdxL0Active;
- pSliceHead->uiRefCount[1] = pPps->uiNumRefIdxL1Active;
+ pSliceHead->uiRefCount[0] = pPps->uiNumRefIdxL0Active;
+ pSliceHead->uiRefCount[1] = pPps->uiNumRefIdxL1Active;
bool bReadNumRefFlag = (P_SLICE == uiSliceType);
if (kbExtensionFlag) {
@@ -928,8 +928,8 @@
}
WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //slice_qp_delta
- pSliceHead->iSliceQpDelta = iCode;
- pSliceHead->iSliceQp = pPps->iPicInitQp + pSliceHead->iSliceQpDelta;
+ pSliceHead->iSliceQpDelta = iCode;
+ pSliceHead->iSliceQp = pPps->iPicInitQp + pSliceHead->iSliceQpDelta;
if (pSliceHead->iSliceQp < 0 || pSliceHead->iSliceQp > 51) {
WelsLog (pLogCtx, WELS_LOG_WARNING, "QP %d out of range", pSliceHead->iSliceQp);
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_QP);
@@ -943,9 +943,9 @@
}
}
- pSliceHead->uiDisableDeblockingFilterIdc = 0;
- pSliceHead->iSliceAlphaC0Offset = 0;
- pSliceHead->iSliceBetaOffset = 0;
+ pSliceHead->uiDisableDeblockingFilterIdc = 0;
+ pSliceHead->iSliceAlphaC0Offset = 0;
+ pSliceHead->iSliceBetaOffset = 0;
if (pPps->bDeblockingFilterControlPresentFlag) {
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //disable_deblocking_filter_idc
pSliceHead->uiDisableDeblockingFilterIdc = uiCode;
@@ -1017,8 +1017,8 @@
}
}
- pSliceHeadExt->uiRefLayerChromaPhaseXPlus1Flag = pSubsetSps->sSpsSvcExt.uiSeqRefLayerChromaPhaseXPlus1Flag;
- pSliceHeadExt->uiRefLayerChromaPhaseYPlus1 = pSubsetSps->sSpsSvcExt.uiSeqRefLayerChromaPhaseYPlus1;
+ pSliceHeadExt->uiRefLayerChromaPhaseXPlus1Flag = pSubsetSps->sSpsSvcExt.uiSeqRefLayerChromaPhaseXPlus1Flag;
+ pSliceHeadExt->uiRefLayerChromaPhaseYPlus1 = pSubsetSps->sSpsSvcExt.uiSeqRefLayerChromaPhaseYPlus1;
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constrained_intra_resampling_flag
pSliceHeadExt->bConstrainedIntraResamplingFlag = !!uiCode;
@@ -1025,13 +1025,13 @@
{
SPosOffset pos;
- pos.iLeftOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iLeftOffset;
- pos.iTopOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iTopOffset * (2 - pSps->bFrameMbsOnlyFlag);
- pos.iRightOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iRightOffset;
+ pos.iLeftOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iLeftOffset;
+ pos.iTopOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iTopOffset * (2 - pSps->bFrameMbsOnlyFlag);
+ pos.iRightOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iRightOffset;
pos.iBottomOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iBottomOffset * (2 - pSps->bFrameMbsOnlyFlag);
//memcpy(&pSliceHeadExt->sScaledRefLayer, &pos, sizeof(SPosOffset));//confirmed_safe_unsafe_usage
- pSliceHeadExt->iScaledRefLayerPicWidthInSampleLuma = (pSliceHead->iMbWidth << 4) - (pos.iLeftOffset + pos.iRightOffset);
- pSliceHeadExt->iScaledRefLayerPicHeightInSampleLuma = (pSliceHead->iMbHeight << 4) -
+ pSliceHeadExt->iScaledRefLayerPicWidthInSampleLuma = (pSliceHead->iMbWidth << 4) - (pos.iLeftOffset + pos.iRightOffset);
+ pSliceHeadExt->iScaledRefLayerPicHeightInSampleLuma = (pSliceHead->iMbHeight << 4) -
(pos.iTopOffset + pos.iBottomOffset) / (1 + pSliceHead->bFieldPicFlag);
}
} else if (uiQualityId > BASE_QUALITY_ID) {
@@ -1041,17 +1041,17 @@
pSliceHeadExt->uiRefLayerDqId = (uint8_t) - 1;
}
- pSliceHeadExt->bSliceSkipFlag = false;
- pSliceHeadExt->bAdaptiveBaseModeFlag = false;
- pSliceHeadExt->bDefaultBaseModeFlag = false;
- pSliceHeadExt->bAdaptiveMotionPredFlag = false;
- pSliceHeadExt->bDefaultMotionPredFlag = false;
- pSliceHeadExt->bAdaptiveResidualPredFlag = false;
- pSliceHeadExt->bDefaultResidualPredFlag = false;
+ pSliceHeadExt->bSliceSkipFlag = false;
+ pSliceHeadExt->bAdaptiveBaseModeFlag = false;
+ pSliceHeadExt->bDefaultBaseModeFlag = false;
+ pSliceHeadExt->bAdaptiveMotionPredFlag = false;
+ pSliceHeadExt->bDefaultMotionPredFlag = false;
+ pSliceHeadExt->bAdaptiveResidualPredFlag = false;
+ pSliceHeadExt->bDefaultResidualPredFlag = false;
if (pNalHeaderExt->iNoInterLayerPredFlag)
- pSliceHeadExt->bTCoeffLevelPredFlag = false;
+ pSliceHeadExt->bTCoeffLevelPredFlag = false;
else
- pSliceHeadExt->bTCoeffLevelPredFlag = pSubsetSps->sSpsSvcExt.bSeqTCoeffLevelPredFlag;
+ pSliceHeadExt->bTCoeffLevelPredFlag = pSubsetSps->sSpsSvcExt.bSeqTCoeffLevelPredFlag;
if (!pNalHeaderExt->iNoInterLayerPredFlag) {
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //slice_skip_flag
@@ -1099,8 +1099,8 @@
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_UNSUPPORTED_MGS);
}
} else {
- pSliceHeadExt->uiScanIdxStart = 0;
- pSliceHeadExt->uiScanIdxEnd = 15;
+ pSliceHeadExt->uiScanIdxStart = 0;
+ pSliceHeadExt->uiScanIdxEnd = 15;
}
}
@@ -1122,24 +1122,24 @@
if (kppDst == NULL || kpSrc == NULL)
return false;
- pNalHdrExtD = &kppDst->sNalHeaderExt;
- pNalHdrExtS = &kpSrc->sNalHeaderExt;
- pShExtD = &kppDst->sNalData.sVclNal.sSliceHeaderExt;
- pPrefixS = &kpSrc->sNalData.sPrefixNal;
- pSps = &pCtx->sSpsBuffer[pCtx->sPpsBuffer[pShExtD->sSliceHeader.iPpsId].iSpsId];
+ pNalHdrExtD = &kppDst->sNalHeaderExt;
+ pNalHdrExtS = &kpSrc->sNalHeaderExt;
+ pShExtD = &kppDst->sNalData.sVclNal.sSliceHeaderExt;
+ pPrefixS = &kpSrc->sNalData.sPrefixNal;
+ pSps = &pCtx->sSpsBuffer[pCtx->sPpsBuffer[pShExtD->sSliceHeader.iPpsId].iSpsId];
- pNalHdrExtD->uiDependencyId = pNalHdrExtS->uiDependencyId;
- pNalHdrExtD->uiQualityId = pNalHdrExtS->uiQualityId;
- pNalHdrExtD->uiTemporalId = pNalHdrExtS->uiTemporalId;
- pNalHdrExtD->uiPriorityId = pNalHdrExtS->uiPriorityId;
- pNalHdrExtD->bIdrFlag = pNalHdrExtS->bIdrFlag;
- pNalHdrExtD->iNoInterLayerPredFlag = pNalHdrExtS->iNoInterLayerPredFlag;
- pNalHdrExtD->bDiscardableFlag = pNalHdrExtS->bDiscardableFlag;
- pNalHdrExtD->bOutputFlag = pNalHdrExtS->bOutputFlag;
- pNalHdrExtD->bUseRefBasePicFlag = pNalHdrExtS->bUseRefBasePicFlag;
- pNalHdrExtD->uiLayerDqId = pNalHdrExtS->uiLayerDqId;
+ pNalHdrExtD->uiDependencyId = pNalHdrExtS->uiDependencyId;
+ pNalHdrExtD->uiQualityId = pNalHdrExtS->uiQualityId;
+ pNalHdrExtD->uiTemporalId = pNalHdrExtS->uiTemporalId;
+ pNalHdrExtD->uiPriorityId = pNalHdrExtS->uiPriorityId;
+ pNalHdrExtD->bIdrFlag = pNalHdrExtS->bIdrFlag;
+ pNalHdrExtD->iNoInterLayerPredFlag = pNalHdrExtS->iNoInterLayerPredFlag;
+ pNalHdrExtD->bDiscardableFlag = pNalHdrExtS->bDiscardableFlag;
+ pNalHdrExtD->bOutputFlag = pNalHdrExtS->bOutputFlag;
+ pNalHdrExtD->bUseRefBasePicFlag = pNalHdrExtS->bUseRefBasePicFlag;
+ pNalHdrExtD->uiLayerDqId = pNalHdrExtS->uiLayerDqId;
- pShExtD->bStoreRefBasePicFlag = pPrefixS->bStoreRefBasePicFlag;
+ pShExtD->bStoreRefBasePicFlag = pPrefixS->bStoreRefBasePicFlag;
memcpy (&pShExtD->sRefBasePicMarking, &pPrefixS->sRefPicBaseMarking,
sizeof (SRefBasePicMarking)); //confirmed_safe_unsafe_usage
if (pShExtD->sRefBasePicMarking.bAdaptiveRefBasePicMarkingModeFlag) {
@@ -1161,7 +1161,7 @@
int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) {
- PAccessUnit pCurAu = pCtx->pAccessUnitList;
+ PAccessUnit pCurAu = pCtx->pAccessUnitList;
int32_t iIdx = pCurAu->uiEndPos;
// Conversed iterator
@@ -1211,8 +1211,8 @@
int32_t i = 0;
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pCtx || kiMaxWidth <= 0 || kiMaxHeight <= 0))
- pCtx->sMb.iMbWidth = (kiMaxWidth + 15) >> 4;
- pCtx->sMb.iMbHeight = (kiMaxHeight + 15) >> 4;
+ pCtx->sMb.iMbWidth = (kiMaxWidth + 15) >> 4;
+ pCtx->sMb.iMbHeight = (kiMaxHeight + 15) >> 4;
if (pCtx->bInitialDqLayersMem && kiMaxWidth <= pCtx->iPicWidthReq
&& kiMaxHeight <= pCtx->iPicHeightReq) // have same dimension memory, skipped
@@ -1313,9 +1313,9 @@
++ i;
} while (i < LAYER_NUM_EXCHANGEABLE);
- pCtx->bInitialDqLayersMem = true;
- pCtx->iPicWidthReq = kiMaxWidth;
- pCtx->iPicHeightReq = kiMaxHeight;
+ pCtx->bInitialDqLayersMem = true;
+ pCtx->iPicWidthReq = kiMaxWidth;
+ pCtx->iPicHeightReq = kiMaxHeight;
return ERR_NONE;
}
@@ -1478,22 +1478,22 @@
++ i;
} while (i < LAYER_NUM_EXCHANGEABLE);
- pCtx->iPicWidthReq = 0;
- pCtx->iPicHeightReq = 0;
- pCtx->bInitialDqLayersMem = false;
+ pCtx->iPicWidthReq = 0;
+ pCtx->iPicHeightReq = 0;
+ pCtx->bInitialDqLayersMem = false;
}
void ResetCurrentAccessUnit (PWelsDecoderContext pCtx) {
PAccessUnit pCurAu = pCtx->pAccessUnitList;
pCurAu->uiStartPos = 0;
- pCurAu->uiEndPos = 0;
- pCurAu->bCompletedAuFlag = false;
+ pCurAu->uiEndPos = 0;
+ pCurAu->bCompletedAuFlag = false;
if (pCurAu->uiActualUnitsNum > 0) {
uint32_t iIdx = 0;
const uint32_t kuiActualNum = pCurAu->uiActualUnitsNum;
// a more simpler method to do nal units list management prefered here
- const uint32_t kuiAvailNum = pCurAu->uiAvailUnitsNum;
- const uint32_t kuiLeftNum = kuiAvailNum - kuiActualNum;
+ const uint32_t kuiAvailNum = pCurAu->uiAvailUnitsNum;
+ const uint32_t kuiLeftNum = kuiAvailNum - kuiActualNum;
// Swapping active nal unit nodes of succeeding AU with leading of list
while (iIdx < kuiLeftNum) {
@@ -1512,14 +1512,14 @@
* \history 11/16/2009
*/
void ForceResetCurrentAccessUnit (PAccessUnit pAu) {
- uint32_t uiSucAuIdx = pAu->uiEndPos + 1;
- uint32_t uiCurAuIdx = 0;
+ uint32_t uiSucAuIdx = pAu->uiEndPos + 1;
+ uint32_t uiCurAuIdx = 0;
// swap the succeeding AU's nal units to the front
while (uiSucAuIdx < pAu->uiAvailUnitsNum) {
PNalUnit t = pAu->pNalUnitsList[uiSucAuIdx];
- pAu->pNalUnitsList[uiSucAuIdx] = pAu->pNalUnitsList[uiCurAuIdx];
- pAu->pNalUnitsList[uiCurAuIdx] = t;
+ pAu->pNalUnitsList[uiSucAuIdx] = pAu->pNalUnitsList[uiCurAuIdx];
+ pAu->pNalUnitsList[uiCurAuIdx] = t;
++ uiSucAuIdx;
++ uiCurAuIdx;
}
@@ -1526,13 +1526,13 @@
// Update avail/actual units num accordingly for next AU parsing
if (pAu->uiAvailUnitsNum > pAu->uiEndPos)
- pAu->uiAvailUnitsNum -= (pAu->uiEndPos + 1);
+ pAu->uiAvailUnitsNum -= (pAu->uiEndPos + 1);
else
- pAu->uiAvailUnitsNum = 0;
- pAu->uiActualUnitsNum = 0;
+ pAu->uiAvailUnitsNum = 0;
+ pAu->uiActualUnitsNum = 0;
pAu->uiStartPos = 0;
- pAu->uiEndPos = 0;
- pAu->bCompletedAuFlag = false;
+ pAu->uiEndPos = 0;
+ pAu->bCompletedAuFlag = false;
}
//clear current corrupted NAL from pNalUnitsList
@@ -1547,11 +1547,11 @@
pCtx->bPpsExistAheadFlag = false;
// Force clear the AU list
- pCtx->pAccessUnitList->uiAvailUnitsNum = 0;
- pCtx->pAccessUnitList->uiActualUnitsNum = 0;
- pCtx->pAccessUnitList->uiStartPos = 0;
- pCtx->pAccessUnitList->uiEndPos = 0;
- pCtx->pAccessUnitList->bCompletedAuFlag = false;
+ pCtx->pAccessUnitList->uiAvailUnitsNum = 0;
+ pCtx->pAccessUnitList->uiActualUnitsNum = 0;
+ pCtx->pAccessUnitList->uiStartPos = 0;
+ pCtx->pAccessUnitList->uiEndPos = 0;
+ pCtx->pAccessUnitList->bCompletedAuFlag = false;
}
void CheckAvailNalUnitsListContinuity (PWelsDecoderContext pCtx, int32_t iStartIdx, int32_t iEndIdx) {
@@ -1985,35 +1985,35 @@
static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PNalUnit pNalUnit, PPicture pPicDec) {
PNalUnitHeaderExt pNalHdrExt = &pNalUnit->sNalHeaderExt;
- PSliceHeaderExt pShExt = &pNalUnit->sNalData.sVclNal.sSliceHeaderExt;
- PSliceHeader pSh = &pShExt->sSliceHeader;
- const uint8_t kuiQualityId = pNalHdrExt->uiQualityId;
+ PSliceHeaderExt pShExt = &pNalUnit->sNalData.sVclNal.sSliceHeaderExt;
+ PSliceHeader pSh = &pShExt->sSliceHeader;
+ const uint8_t kuiQualityId = pNalHdrExt->uiQualityId;
memcpy (&pDqLayer->sLayerInfo, pLayerInfo, sizeof (SLayerInfo)); //confirmed_safe_unsafe_usage
- pDqLayer->pDec = pPicDec;
- pDqLayer->iMbWidth = pSh->iMbWidth; // MB width of this picture
- pDqLayer->iMbHeight = pSh->iMbHeight;// MB height of this picture
+ pDqLayer->pDec = pPicDec;
+ pDqLayer->iMbWidth = pSh->iMbWidth; // MB width of this picture
+ pDqLayer->iMbHeight = pSh->iMbHeight;// MB height of this picture
pDqLayer->iSliceIdcBackup = (pSh->iFirstMbInSlice << 7) | (pNalHdrExt->uiDependencyId << 4) | (pNalHdrExt->uiQualityId);
/* Common syntax elements across all slices of a DQLayer */
- pDqLayer->uiPpsId = pLayerInfo->pPps->iPpsId;
- pDqLayer->uiDisableInterLayerDeblockingFilterIdc = pShExt->uiDisableInterLayerDeblockingFilterIdc;
- pDqLayer->iInterLayerSliceAlphaC0Offset = pShExt->iInterLayerSliceAlphaC0Offset;
- pDqLayer->iInterLayerSliceBetaOffset = pShExt->iInterLayerSliceBetaOffset;
- pDqLayer->iSliceGroupChangeCycle = pSh->iSliceGroupChangeCycle;
- pDqLayer->bStoreRefBasePicFlag = pShExt->bStoreRefBasePicFlag;
- pDqLayer->bTCoeffLevelPredFlag = pShExt->bTCoeffLevelPredFlag;
- pDqLayer->bConstrainedIntraResamplingFlag = pShExt->bConstrainedIntraResamplingFlag;
- pDqLayer->uiRefLayerDqId = pShExt->uiRefLayerDqId;
- pDqLayer->uiRefLayerChromaPhaseXPlus1Flag = pShExt->uiRefLayerChromaPhaseXPlus1Flag;
- pDqLayer->uiRefLayerChromaPhaseYPlus1 = pShExt->uiRefLayerChromaPhaseYPlus1;
+ pDqLayer->uiPpsId = pLayerInfo->pPps->iPpsId;
+ pDqLayer->uiDisableInterLayerDeblockingFilterIdc = pShExt->uiDisableInterLayerDeblockingFilterIdc;
+ pDqLayer->iInterLayerSliceAlphaC0Offset = pShExt->iInterLayerSliceAlphaC0Offset;
+ pDqLayer->iInterLayerSliceBetaOffset = pShExt->iInterLayerSliceBetaOffset;
+ pDqLayer->iSliceGroupChangeCycle = pSh->iSliceGroupChangeCycle;
+ pDqLayer->bStoreRefBasePicFlag = pShExt->bStoreRefBasePicFlag;
+ pDqLayer->bTCoeffLevelPredFlag = pShExt->bTCoeffLevelPredFlag;
+ pDqLayer->bConstrainedIntraResamplingFlag = pShExt->bConstrainedIntraResamplingFlag;
+ pDqLayer->uiRefLayerDqId = pShExt->uiRefLayerDqId;
+ pDqLayer->uiRefLayerChromaPhaseXPlus1Flag = pShExt->uiRefLayerChromaPhaseXPlus1Flag;
+ pDqLayer->uiRefLayerChromaPhaseYPlus1 = pShExt->uiRefLayerChromaPhaseYPlus1;
//memcpy(&pDqLayer->sScaledRefLayer, &pShExt->sScaledRefLayer, sizeof(SPosOffset));//confirmed_safe_unsafe_usage
if (kuiQualityId == BASE_QUALITY_ID) {
- pDqLayer->pRefPicListReordering = &pSh->pRefPicListReordering;
- pDqLayer->pRefPicMarking = &pSh->sRefMarking;
+ pDqLayer->pRefPicListReordering = &pSh->pRefPicListReordering;
+ pDqLayer->pRefPicMarking = &pSh->sRefMarking;
if (pSh->pPps->bWeightedPredFlag) {
pDqLayer->bUseWeightPredictionFlag = true;
@@ -2022,20 +2022,20 @@
} else
pDqLayer->bUseWeightPredictionFlag = false;
- pDqLayer->pRefPicBaseMarking = &pShExt->sRefBasePicMarking;
+ pDqLayer->pRefPicBaseMarking = &pShExt->sRefBasePicMarking;
}
- pDqLayer->uiLayerDqId = pNalHdrExt->uiLayerDqId; // dq_id of current layer
- pDqLayer->bUseRefBasePicFlag = pNalHdrExt->bUseRefBasePicFlag;
+ pDqLayer->uiLayerDqId = pNalHdrExt->uiLayerDqId; // dq_id of current layer
+ pDqLayer->bUseRefBasePicFlag = pNalHdrExt->bUseRefBasePicFlag;
}
void WelsDqLayerDecodeStart (PWelsDecoderContext pCtx, PNalUnit pCurNal, PSps pSps, PPps pPps) {
PSliceHeader pSh = &pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader;
- pCtx->eSliceType = pSh->eSliceType;
- pCtx->pSliceHeader = pSh;
+ pCtx->eSliceType = pSh->eSliceType;
+ pCtx->pSliceHeader = pSh;
- pCtx->iFrameNum = pSh->iFrameNum;
+ pCtx->iFrameNum = pSh->iFrameNum;
}
int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, int32_t iPoc) {
@@ -2050,18 +2050,18 @@
void InitCurDqLayerData (PWelsDecoderContext pCtx, PDqLayer pCurDq) {
if (NULL != pCtx && NULL != pCurDq) {
- pCurDq->pMbType = pCtx->sMb.pMbType[0];
- pCurDq->pSliceIdc = pCtx->sMb.pSliceIdc[0];
- pCurDq->pMv[0] = pCtx->sMb.pMv[0][0];
+ pCurDq->pMbType = pCtx->sMb.pMbType[0];
+ pCurDq->pSliceIdc = pCtx->sMb.pSliceIdc[0];
+ pCurDq->pMv[0] = pCtx->sMb.pMv[0][0];
pCurDq->pRefIndex[0] = pCtx->sMb.pRefIndex[0][0];
pCurDq->pNoSubMbPartSizeLessThan8x8Flag = pCtx->sMb.pNoSubMbPartSizeLessThan8x8Flag[0];
pCurDq->pTransformSize8x8Flag = pCtx->sMb.pTransformSize8x8Flag[0];
pCurDq->pLumaQp = pCtx->sMb.pLumaQp[0];
pCurDq->pChromaQp = pCtx->sMb.pChromaQp[0];
- pCurDq->pMvd[0] = pCtx->sMb.pMvd[0][0];
- pCurDq->pCbfDc = pCtx->sMb.pCbfDc[0];
- pCurDq->pNzc = pCtx->sMb.pNzc[0];
- pCurDq->pNzcRs = pCtx->sMb.pNzcRs[0];
+ pCurDq->pMvd[0] = pCtx->sMb.pMvd[0][0];
+ pCurDq->pCbfDc = pCtx->sMb.pCbfDc[0];
+ pCurDq->pNzc = pCtx->sMb.pNzc[0];
+ pCurDq->pNzcRs = pCtx->sMb.pNzcRs[0];
pCurDq->pScaledTCoeff = pCtx->sMb.pScaledTCoeff[0];
pCurDq->pIntraPredMode = pCtx->sMb.pIntraPredMode[0];
pCurDq->pIntra4x4FinalMode = pCtx->sMb.pIntra4x4FinalMode[0];
@@ -2156,10 +2156,10 @@
*/
while (iIdx <= iEndIdx) {
bool bReconstructSlice;
- iCurrIdQ = pNalCur->sNalHeaderExt.uiQualityId;
- iCurrIdD = pNalCur->sNalHeaderExt.uiDependencyId;
- pSh = &pNalCur->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader;
- pShExt = &pNalCur->sNalData.sVclNal.sSliceHeaderExt;
+ iCurrIdQ = pNalCur->sNalHeaderExt.uiQualityId;
+ iCurrIdD = pNalCur->sNalHeaderExt.uiDependencyId;
+ pSh = &pNalCur->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader;
+ pShExt = &pNalCur->sNalData.sVclNal.sSliceHeaderExt;
pCtx->bRPLRError = false;
bReconstructSlice = CheckSliceNeedReconstruct (pNalCur->sNalHeaderExt.uiLayerDqId, kuiTargetLayerDqId);
@@ -2170,14 +2170,14 @@
pCtx->pDec->bIdrFlag = pNalCur->sNalHeaderExt.bIdrFlag;
memcpy (&pLayerInfo.sSliceInLayer.sSliceHeaderExt, pShExt, sizeof (SSliceHeaderExt)); //confirmed_safe_unsafe_usage
- pLayerInfo.sSliceInLayer.bSliceHeaderExtFlag = pNalCur->sNalData.sVclNal.bSliceHeaderExtFlag;
- pLayerInfo.sSliceInLayer.eSliceType = pSh->eSliceType;
- pLayerInfo.sSliceInLayer.iLastMbQp = pSh->iSliceQp;
- dq_cur->pBitStringAux = &pNalCur->sNalData.sVclNal.sSliceBitsRead;
+ pLayerInfo.sSliceInLayer.bSliceHeaderExtFlag = pNalCur->sNalData.sVclNal.bSliceHeaderExtFlag;
+ pLayerInfo.sSliceInLayer.eSliceType = pSh->eSliceType;
+ pLayerInfo.sSliceInLayer.iLastMbQp = pSh->iSliceQp;
+ dq_cur->pBitStringAux = &pNalCur->sNalData.sVclNal.sSliceBitsRead;
- uiNalRefIdc = pNalCur->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc;
+ uiNalRefIdc = pNalCur->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc;
- iPpsId = pSh->iPpsId;
+ iPpsId = pSh->iPpsId;
pLayerInfo.pPps = pSh->pPps;
pLayerInfo.pSps = pSh->pSps;
--- a/codec/decoder/core/src/fmo.cpp
+++ b/codec/decoder/core/src/fmo.cpp
@@ -117,9 +117,9 @@
*/
static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const int32_t kiMbWidth,
const int32_t kiMbHeight) {
- int32_t iNumMb = 0;
- int32_t iErr = 0;
- bool bResolutionChanged = false;
+ int32_t iNumMb = 0;
+ int32_t iErr = 0;
+ bool bResolutionChanged = false;
// the cases we would not like
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == kpPps))
@@ -168,9 +168,9 @@
}
}
- if (0 == iErr) { // well now
- pFmo->iSliceGroupCount = kpPps->uiNumSliceGroups;
- pFmo->iSliceGroupType = kpPps->uiSliceGroupMapType;
+ if (0 == iErr) { // well now
+ pFmo->iSliceGroupCount = kpPps->uiNumSliceGroups;
+ pFmo->iSliceGroupType = kpPps->uiSliceGroupMapType;
}
return iErr;
@@ -215,10 +215,10 @@
pIter->pMbAllocMap = NULL;
}
- pIter->iSliceGroupCount = 0;
- pIter->iSliceGroupType = -1;
- pIter->iCountMbNum = 0;
- pIter->bActiveFlag = false;
+ pIter->iSliceGroupCount = 0;
+ pIter->iSliceGroupType = -1;
+ pIter->iCountMbNum = 0;
+ pIter->bActiveFlag = false;
++ iFreeNodes;
if (iFreeNodes >= kiAvail)
break;
@@ -289,8 +289,8 @@
* \return slice group idc - successful; -1 - failed;
*/
int32_t FmoMbToSliceGroup (PFmo pFmo, const MB_XY_T kiMbXy) {
- const int32_t kiMbNum = pFmo->iCountMbNum;
- const uint8_t* kpMbMap = pFmo->pMbAllocMap;
+ const int32_t kiMbNum = pFmo->iCountMbNum;
+ const uint8_t* kpMbMap = pFmo->pMbAllocMap;
if (kiMbXy < 0 || kiMbXy >= kiMbNum || kpMbMap == NULL)
return -1;
@@ -307,10 +307,10 @@
* \return iNextMb - successful; -1 - failed;
*/
MB_XY_T FmoNextMb (PFmo pFmo, const MB_XY_T kiMbXy) {
- const int32_t kiTotalMb = pFmo->iCountMbNum;
- const uint8_t* kpMbMap = pFmo->pMbAllocMap;
- MB_XY_T iNextMb = kiMbXy;
- const uint8_t kuiSliceGroupIdc = (uint8_t)FmoMbToSliceGroup (pFmo, kiMbXy);
+ const int32_t kiTotalMb = pFmo->iCountMbNum;
+ const uint8_t* kpMbMap = pFmo->pMbAllocMap;
+ MB_XY_T iNextMb = kiMbXy;
+ const uint8_t kuiSliceGroupIdc = (uint8_t)FmoMbToSliceGroup (pFmo, kiMbXy);
if (kuiSliceGroupIdc == (uint8_t) (-1))
return -1;
--- a/codec/decoder/core/src/get_intra_predictor.cpp
+++ b/codec/decoder/core/src/get_intra_predictor.cpp
@@ -75,10 +75,10 @@
}
void WelsI4x4LumaPredDc_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride2 + kiStride;
- const uint8_t kuiMean = (pPred[-1] + pPred[-1 + kiStride] + pPred[-1 + kiStride2] + pPred[-1 + kiStride3] +
- pPred[-kiStride] + pPred[-kiStride + 1] + pPred[-kiStride + 2] + pPred[-kiStride + 3] + 4) >> 3;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride2 + kiStride;
+ const uint8_t kuiMean = (pPred[-1] + pPred[-1 + kiStride] + pPred[-1 + kiStride2] + pPred[-1 + kiStride3] +
+ pPred[-kiStride] + pPred[-kiStride + 1] + pPred[-kiStride + 2] + pPred[-kiStride + 3] + 4) >> 3;
const uint32_t kuiMean32 = 0x01010101U * kuiMean;
ST32A4 (pPred , kuiMean32);
@@ -88,9 +88,9 @@
}
void WelsI4x4LumaPredDcLeft_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride2 + kiStride;
- const uint8_t kuiMean = (pPred[-1] + pPred[-1 + kiStride] + pPred[-1 + kiStride2] + pPred[-1 + kiStride3] + 2) >> 2;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride2 + kiStride;
+ const uint8_t kuiMean = (pPred[-1] + pPred[-1 + kiStride] + pPred[-1 + kiStride2] + pPred[-1 + kiStride3] + 2) >> 2;
const uint32_t kuiMean32 = 0x01010101U * kuiMean;
ST32A4 (pPred , kuiMean32);
@@ -100,10 +100,9 @@
}
void WelsI4x4LumaPredDcTop_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride2 + kiStride;
- const uint8_t kuiMean = (pPred[-kiStride] + pPred[-kiStride + 1] + pPred[-kiStride + 2] + pPred[-kiStride + 3] + 2) >>
- 2;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride2 + kiStride;
+ const uint8_t kuiMean = (pPred[-kiStride] + pPred[-kiStride + 1] + pPred[-kiStride + 2] + pPred[-kiStride + 3] + 2) >> 2;
const uint32_t kuiMean32 = 0x01010101U * kuiMean;
ST32A4 (pPred , kuiMean32);
@@ -123,25 +122,25 @@
/*down pLeft*/
void WelsI4x4LumaPredDDL_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
/*get pTop*/
- uint8_t* ptop = &pPred[-kiStride];
- const uint8_t kuiT0 = *ptop;
- const uint8_t kuiT1 = * (ptop + 1);
- const uint8_t kuiT2 = * (ptop + 2);
- const uint8_t kuiT3 = * (ptop + 3);
- const uint8_t kuiT4 = * (ptop + 4);
- const uint8_t kuiT5 = * (ptop + 5);
- const uint8_t kuiT6 = * (ptop + 6);
- const uint8_t kuiT7 = * (ptop + 7);
- const uint8_t kuiDDL0 = (2 + kuiT0 + kuiT2 + (kuiT1 << 1)) >> 2; // kDDL0
- const uint8_t kuiDDL1 = (2 + kuiT1 + kuiT3 + (kuiT2 << 1)) >> 2; // kDDL1
- const uint8_t kuiDDL2 = (2 + kuiT2 + kuiT4 + (kuiT3 << 1)) >> 2; // kDDL2
- const uint8_t kuiDDL3 = (2 + kuiT3 + kuiT5 + (kuiT4 << 1)) >> 2; // kDDL3
- const uint8_t kuiDDL4 = (2 + kuiT4 + kuiT6 + (kuiT5 << 1)) >> 2; // kDDL4
- const uint8_t kuiDDL5 = (2 + kuiT5 + kuiT7 + (kuiT6 << 1)) >> 2; // kDDL5
- const uint8_t kuiDDL6 = (2 + kuiT6 + kuiT7 + (kuiT7 << 1)) >> 2; // kDDL6
+ uint8_t* ptop = &pPred[-kiStride];
+ const uint8_t kuiT0 = *ptop;
+ const uint8_t kuiT1 = * (ptop + 1);
+ const uint8_t kuiT2 = * (ptop + 2);
+ const uint8_t kuiT3 = * (ptop + 3);
+ const uint8_t kuiT4 = * (ptop + 4);
+ const uint8_t kuiT5 = * (ptop + 5);
+ const uint8_t kuiT6 = * (ptop + 6);
+ const uint8_t kuiT7 = * (ptop + 7);
+ const uint8_t kuiDDL0 = (2 + kuiT0 + kuiT2 + (kuiT1 << 1)) >> 2; // kDDL0
+ const uint8_t kuiDDL1 = (2 + kuiT1 + kuiT3 + (kuiT2 << 1)) >> 2; // kDDL1
+ const uint8_t kuiDDL2 = (2 + kuiT2 + kuiT4 + (kuiT3 << 1)) >> 2; // kDDL2
+ const uint8_t kuiDDL3 = (2 + kuiT3 + kuiT5 + (kuiT4 << 1)) >> 2; // kDDL3
+ const uint8_t kuiDDL4 = (2 + kuiT4 + kuiT6 + (kuiT5 << 1)) >> 2; // kDDL4
+ const uint8_t kuiDDL5 = (2 + kuiT5 + kuiT7 + (kuiT6 << 1)) >> 2; // kDDL5
+ const uint8_t kuiDDL6 = (2 + kuiT6 + kuiT7 + (kuiT7 << 1)) >> 2; // kDDL6
const uint8_t kuiList[8] = { kuiDDL0, kuiDDL1, kuiDDL2, kuiDDL3, kuiDDL4, kuiDDL5, kuiDDL6, 0 };
ST32A4 (pPred , LD32 (kuiList));
@@ -152,22 +151,22 @@
/*down pLeft*/
void WelsI4x4LumaPredDDLTop_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
/*get pTop*/
- uint8_t* ptop = &pPred[-kiStride];
- const uint8_t kuiT0 = *ptop;
- const uint8_t kuiT1 = * (ptop + 1);
- const uint8_t kuiT2 = * (ptop + 2);
- const uint8_t kuiT3 = * (ptop + 3);
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
- const uint16_t kuiT33 = 1 + (kuiT3 << 1);
- const uint8_t kuiDLT0 = (kuiT01 + kuiT12) >> 2; // kDLT0
- const uint8_t kuiDLT1 = (kuiT12 + kuiT23) >> 2; // kDLT1
- const uint8_t kuiDLT2 = (kuiT23 + kuiT33) >> 2; // kDLT2
- const uint8_t kuiDLT3 = kuiT33 >> 1; // kDLT3
+ uint8_t* ptop = &pPred[-kiStride];
+ const uint8_t kuiT0 = *ptop;
+ const uint8_t kuiT1 = * (ptop + 1);
+ const uint8_t kuiT2 = * (ptop + 2);
+ const uint8_t kuiT3 = * (ptop + 3);
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
+ const uint16_t kuiT33 = 1 + (kuiT3 << 1);
+ const uint8_t kuiDLT0 = (kuiT01 + kuiT12) >> 2; // kDLT0
+ const uint8_t kuiDLT1 = (kuiT12 + kuiT23) >> 2; // kDLT1
+ const uint8_t kuiDLT2 = (kuiT23 + kuiT33) >> 2; // kDLT2
+ const uint8_t kuiDLT3 = kuiT33 >> 1; // kDLT3
const uint8_t kuiList[8] = { kuiDLT0, kuiDLT1, kuiDLT2, kuiDLT3, kuiDLT3, kuiDLT3, kuiDLT3 , kuiDLT3 };
ST32A4 (pPred, LD32 (kuiList));
@@ -179,36 +178,36 @@
/*down right*/
void WelsI4x4LumaPredDDR_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
- uint8_t* ptopleft = &pPred[- (kiStride + 1)];
- uint8_t* pleft = &pPred[-1];
- const uint8_t kuiLT = *ptopleft;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
+ uint8_t* ptopleft = &pPred[- (kiStride + 1)];
+ uint8_t* pleft = &pPred[-1];
+ const uint8_t kuiLT = *ptopleft;
/*get pLeft and pTop*/
- const uint8_t kuiL0 = *pleft;
- const uint8_t kuiL1 = * (pleft + kiStride);
- const uint8_t kuiL2 = * (pleft + kiStride2);
- const uint8_t kuiL3 = * (pleft + kiStride3);
- const uint8_t kuiT0 = * (ptopleft + 1);
- const uint8_t kuiT1 = * (ptopleft + 2);
- const uint8_t kuiT2 = * (ptopleft + 3);
- const uint8_t kuiT3 = * (ptopleft + 4);
- const uint16_t kuiTL0 = 1 + kuiLT + kuiL0;
- const uint16_t kuiLT0 = 1 + kuiLT + kuiT0;
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
- const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
- const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
- const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
- const uint8_t kuiDDR0 = (kuiTL0 + kuiLT0) >> 2; // kuiDDR0
- const uint8_t kuiDDR1 = (kuiLT0 + kuiT01) >> 2; // kuiDDR1
- const uint8_t kuiDDR2 = (kuiT01 + kuiT12) >> 2; // kuiDDR2
- const uint8_t kuiDDR3 = (kuiT12 + kuiT23) >> 2; // kuiDDR3
- const uint8_t kuiDDR4 = (kuiTL0 + kuiL01) >> 2; // kuiDDR4
- const uint8_t kuiDDR5 = (kuiL01 + kuiL12) >> 2; // kuiDDR5
- const uint8_t kuiDDR6 = (kuiL12 + kuiL23) >> 2; // kuiDDR6
- const uint8_t kuiList[8] = { kuiDDR6, kuiDDR5, kuiDDR4, kuiDDR0, kuiDDR1, kuiDDR2, kuiDDR3, 0 };
+ const uint8_t kuiL0 = *pleft;
+ const uint8_t kuiL1 = * (pleft + kiStride);
+ const uint8_t kuiL2 = * (pleft + kiStride2);
+ const uint8_t kuiL3 = * (pleft + kiStride3);
+ const uint8_t kuiT0 = * (ptopleft + 1);
+ const uint8_t kuiT1 = * (ptopleft + 2);
+ const uint8_t kuiT2 = * (ptopleft + 3);
+ const uint8_t kuiT3 = * (ptopleft + 4);
+ const uint16_t kuiTL0 = 1 + kuiLT + kuiL0;
+ const uint16_t kuiLT0 = 1 + kuiLT + kuiT0;
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
+ const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
+ const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
+ const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
+ const uint8_t kuiDDR0 = (kuiTL0 + kuiLT0) >> 2; // kuiDDR0
+ const uint8_t kuiDDR1 = (kuiLT0 + kuiT01) >> 2; // kuiDDR1
+ const uint8_t kuiDDR2 = (kuiT01 + kuiT12) >> 2; // kuiDDR2
+ const uint8_t kuiDDR3 = (kuiT12 + kuiT23) >> 2; // kuiDDR3
+ const uint8_t kuiDDR4 = (kuiTL0 + kuiL01) >> 2; // kuiDDR4
+ const uint8_t kuiDDR5 = (kuiL01 + kuiL12) >> 2; // kuiDDR5
+ const uint8_t kuiDDR6 = (kuiL12 + kuiL23) >> 2; // kuiDDR6
+ const uint8_t kuiList[8] = { kuiDDR6, kuiDDR5, kuiDDR4, kuiDDR0, kuiDDR1, kuiDDR2, kuiDDR3, 0 };
ST32A4 (pPred , LD32 (kuiList + 3));
ST32A4 (pPred + kiStride , LD32 (kuiList + 2));
@@ -219,34 +218,34 @@
/*vertical pLeft*/
void WelsI4x4LumaPredVL_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
- uint8_t* ptopleft = &pPred[- (kiStride + 1)];
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
+ uint8_t* ptopleft = &pPred[- (kiStride + 1)];
/*get pTop*/
- const uint8_t kuiT0 = * (ptopleft + 1);
- const uint8_t kuiT1 = * (ptopleft + 2);
- const uint8_t kuiT2 = * (ptopleft + 3);
- const uint8_t kuiT3 = * (ptopleft + 4);
- const uint8_t kuiT4 = * (ptopleft + 5);
- const uint8_t kuiT5 = * (ptopleft + 6);
- const uint8_t kuiT6 = * (ptopleft + 7);
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
- const uint16_t kuiT34 = 1 + kuiT3 + kuiT4;
- const uint16_t kuiT45 = 1 + kuiT4 + kuiT5;
- const uint16_t kuiT56 = 1 + kuiT5 + kuiT6;
- const uint8_t kuiVL0 = kuiT01 >> 1; // kuiVL0
- const uint8_t kuiVL1 = kuiT12 >> 1; // kuiVL1
- const uint8_t kuiVL2 = kuiT23 >> 1; // kuiVL2
- const uint8_t kuiVL3 = kuiT34 >> 1; // kuiVL3
- const uint8_t kuiVL4 = kuiT45 >> 1; // kuiVL4
- const uint8_t kuiVL5 = (kuiT01 + kuiT12) >> 2; // kuiVL5
- const uint8_t kuiVL6 = (kuiT12 + kuiT23) >> 2; // kuiVL6
- const uint8_t kuiVL7 = (kuiT23 + kuiT34) >> 2; // kuiVL7
- const uint8_t kuiVL8 = (kuiT34 + kuiT45) >> 2; // kuiVL8
- const uint8_t kuiVL9 = (kuiT45 + kuiT56) >> 2; // kuiVL9
- const uint8_t kuiList[10] = { kuiVL0, kuiVL1, kuiVL2, kuiVL3, kuiVL4, kuiVL5, kuiVL6, kuiVL7, kuiVL8, kuiVL9 };
+ const uint8_t kuiT0 = * (ptopleft + 1);
+ const uint8_t kuiT1 = * (ptopleft + 2);
+ const uint8_t kuiT2 = * (ptopleft + 3);
+ const uint8_t kuiT3 = * (ptopleft + 4);
+ const uint8_t kuiT4 = * (ptopleft + 5);
+ const uint8_t kuiT5 = * (ptopleft + 6);
+ const uint8_t kuiT6 = * (ptopleft + 7);
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
+ const uint16_t kuiT34 = 1 + kuiT3 + kuiT4;
+ const uint16_t kuiT45 = 1 + kuiT4 + kuiT5;
+ const uint16_t kuiT56 = 1 + kuiT5 + kuiT6;
+ const uint8_t kuiVL0 = kuiT01 >> 1; // kuiVL0
+ const uint8_t kuiVL1 = kuiT12 >> 1; // kuiVL1
+ const uint8_t kuiVL2 = kuiT23 >> 1; // kuiVL2
+ const uint8_t kuiVL3 = kuiT34 >> 1; // kuiVL3
+ const uint8_t kuiVL4 = kuiT45 >> 1; // kuiVL4
+ const uint8_t kuiVL5 = (kuiT01 + kuiT12) >> 2; // kuiVL5
+ const uint8_t kuiVL6 = (kuiT12 + kuiT23) >> 2; // kuiVL6
+ const uint8_t kuiVL7 = (kuiT23 + kuiT34) >> 2; // kuiVL7
+ const uint8_t kuiVL8 = (kuiT34 + kuiT45) >> 2; // kuiVL8
+ const uint8_t kuiVL9 = (kuiT45 + kuiT56) >> 2; // kuiVL9
+ const uint8_t kuiList[10] = { kuiVL0, kuiVL1, kuiVL2, kuiVL3, kuiVL4, kuiVL5, kuiVL6, kuiVL7, kuiVL8, kuiVL9 };
ST32A4 (pPred, LD32 (kuiList));
ST32A4 (pPred + kiStride, LD32 (kuiList + 5));
@@ -256,27 +255,27 @@
/*vertical pLeft*/
void WelsI4x4LumaPredVLTop_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
- uint8_t* ptopleft = &pPred[- (kiStride + 1)];
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
+ uint8_t* ptopleft = &pPred[- (kiStride + 1)];
/*get pTop*/
- const uint8_t kuiT0 = * (ptopleft + 1);
- const uint8_t kuiT1 = * (ptopleft + 2);
- const uint8_t kuiT2 = * (ptopleft + 3);
- const uint8_t kuiT3 = * (ptopleft + 4);
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
- const uint16_t kuiT33 = 1 + (kuiT3 << 1);
- const uint8_t kuiVL0 = kuiT01 >> 1;
- const uint8_t kuiVL1 = kuiT12 >> 1;
- const uint8_t kuiVL2 = kuiT23 >> 1;
- const uint8_t kuiVL3 = kuiT33 >> 1;
- const uint8_t kuiVL4 = (kuiT01 + kuiT12) >> 2;
- const uint8_t kuiVL5 = (kuiT12 + kuiT23) >> 2;
- const uint8_t kuiVL6 = (kuiT23 + kuiT33) >> 2;
- const uint8_t kuiVL7 = kuiVL3;
- const uint8_t kuiList[10] = { kuiVL0, kuiVL1, kuiVL2, kuiVL3, kuiVL3, kuiVL4, kuiVL5, kuiVL6, kuiVL7, kuiVL7 };
+ const uint8_t kuiT0 = * (ptopleft + 1);
+ const uint8_t kuiT1 = * (ptopleft + 2);
+ const uint8_t kuiT2 = * (ptopleft + 3);
+ const uint8_t kuiT3 = * (ptopleft + 4);
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
+ const uint16_t kuiT33 = 1 + (kuiT3 << 1);
+ const uint8_t kuiVL0 = kuiT01 >> 1;
+ const uint8_t kuiVL1 = kuiT12 >> 1;
+ const uint8_t kuiVL2 = kuiT23 >> 1;
+ const uint8_t kuiVL3 = kuiT33 >> 1;
+ const uint8_t kuiVL4 = (kuiT01 + kuiT12) >> 2;
+ const uint8_t kuiVL5 = (kuiT12 + kuiT23) >> 2;
+ const uint8_t kuiVL6 = (kuiT23 + kuiT33) >> 2;
+ const uint8_t kuiVL7 = kuiVL3;
+ const uint8_t kuiList[10] = { kuiVL0, kuiVL1, kuiVL2, kuiVL3, kuiVL3, kuiVL4, kuiVL5, kuiVL6, kuiVL7, kuiVL7 };
ST32A4 (pPred , LD32 (kuiList));
ST32A4 (pPred + kiStride , LD32 (kuiList + 5));
@@ -287,28 +286,28 @@
/*vertical right*/
void WelsI4x4LumaPredVR_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
- const uint8_t kuiLT = pPred[-kiStride - 1];
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
+ const uint8_t kuiLT = pPred[-kiStride - 1];
/*get pLeft and pTop*/
- const uint8_t kuiL0 = pPred[ -1];
- const uint8_t kuiL1 = pPred[kiStride - 1];
- const uint8_t kuiL2 = pPred[kiStride2 - 1];
- const uint8_t kuiT0 = pPred[ -kiStride];
- const uint8_t kuiT1 = pPred[1 - kiStride];
- const uint8_t kuiT2 = pPred[2 - kiStride];
- const uint8_t kuiT3 = pPred[3 - kiStride];
- const uint8_t kuiVR0 = (1 + kuiLT + kuiT0) >> 1; // kuiVR0
- const uint8_t kuiVR1 = (1 + kuiT0 + kuiT1) >> 1; // kuiVR1
- const uint8_t kuiVR2 = (1 + kuiT1 + kuiT2) >> 1; // kuiVR2
- const uint8_t kuiVR3 = (1 + kuiT2 + kuiT3) >> 1; // kuiVR3
- const uint8_t kuiVR4 = (2 + kuiL0 + (kuiLT << 1) + kuiT0) >> 2; // kuiVR4
- const uint8_t kuiVR5 = (2 + kuiLT + (kuiT0 << 1) + kuiT1) >> 2; // kuiVR5
- const uint8_t kuiVR6 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2; // kuiVR6
- const uint8_t kuiVR7 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2; // kuiVR7
- const uint8_t kuiVR8 = (2 + kuiLT + (kuiL0 << 1) + kuiL1) >> 2; // kuiVR8
- const uint8_t kuiVR9 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2; // kuiVR9
- const uint8_t kuiList[10] = { kuiVR8, kuiVR0, kuiVR1, kuiVR2, kuiVR3, kuiVR9, kuiVR4, kuiVR5, kuiVR6, kuiVR7 };
+ const uint8_t kuiL0 = pPred[ - 1];
+ const uint8_t kuiL1 = pPred[kiStride - 1];
+ const uint8_t kuiL2 = pPred[kiStride2 - 1];
+ const uint8_t kuiT0 = pPred[ -kiStride];
+ const uint8_t kuiT1 = pPred[1 - kiStride];
+ const uint8_t kuiT2 = pPred[2 - kiStride];
+ const uint8_t kuiT3 = pPred[3 - kiStride];
+ const uint8_t kuiVR0 = (1 + kuiLT + kuiT0) >> 1; // kuiVR0
+ const uint8_t kuiVR1 = (1 + kuiT0 + kuiT1) >> 1; // kuiVR1
+ const uint8_t kuiVR2 = (1 + kuiT1 + kuiT2) >> 1; // kuiVR2
+ const uint8_t kuiVR3 = (1 + kuiT2 + kuiT3) >> 1; // kuiVR3
+ const uint8_t kuiVR4 = (2 + kuiL0 + (kuiLT << 1) + kuiT0) >> 2; // kuiVR4
+ const uint8_t kuiVR5 = (2 + kuiLT + (kuiT0 << 1) + kuiT1) >> 2; // kuiVR5
+ const uint8_t kuiVR6 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2; // kuiVR6
+ const uint8_t kuiVR7 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2; // kuiVR7
+ const uint8_t kuiVR8 = (2 + kuiLT + (kuiL0 << 1) + kuiL1) >> 2; // kuiVR8
+ const uint8_t kuiVR9 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2; // kuiVR9
+ const uint8_t kuiList[10] = { kuiVR8, kuiVR0, kuiVR1, kuiVR2, kuiVR3, kuiVR9, kuiVR4, kuiVR5, kuiVR6, kuiVR7 };
ST32A4 (pPred , LD32 (kuiList + 1));
ST32A4 (pPred + kiStride , LD32 (kuiList + 6));
@@ -318,23 +317,23 @@
/*horizontal up*/
void WelsI4x4LumaPredHU_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
/*get pLeft*/
- const uint8_t kuiL0 = pPred[ -1];
- const uint8_t kuiL1 = pPred[kiStride - 1];
- const uint8_t kuiL2 = pPred[kiStride2 - 1];
- const uint8_t kuiL3 = pPred[kiStride3 - 1];
- const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
- const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
- const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
- const uint8_t kuiHU0 = kuiL01 >> 1;
- const uint8_t kuiHU1 = (kuiL01 + kuiL12) >> 2;
- const uint8_t kuiHU2 = kuiL12 >> 1;
- const uint8_t kuiHU3 = (kuiL12 + kuiL23) >> 2;
- const uint8_t kuiHU4 = kuiL23 >> 1;
- const uint8_t kuiHU5 = (1 + kuiL23 + (kuiL3 << 1)) >> 2;
- const uint8_t kuiList[10] = { kuiHU0, kuiHU1, kuiHU2, kuiHU3, kuiHU4, kuiHU5, kuiL3, kuiL3, kuiL3, kuiL3 };
+ const uint8_t kuiL0 = pPred[ - 1];
+ const uint8_t kuiL1 = pPred[kiStride - 1];
+ const uint8_t kuiL2 = pPred[kiStride2 - 1];
+ const uint8_t kuiL3 = pPred[kiStride3 - 1];
+ const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
+ const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
+ const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
+ const uint8_t kuiHU0 = kuiL01 >> 1;
+ const uint8_t kuiHU1 = (kuiL01 + kuiL12) >> 2;
+ const uint8_t kuiHU2 = kuiL12 >> 1;
+ const uint8_t kuiHU3 = (kuiL12 + kuiL23) >> 2;
+ const uint8_t kuiHU4 = kuiL23 >> 1;
+ const uint8_t kuiHU5 = (1 + kuiL23 + (kuiL3 << 1)) >> 2;
+ const uint8_t kuiList[10] = { kuiHU0, kuiHU1, kuiHU2, kuiHU3, kuiHU4, kuiHU5, kuiL3, kuiL3, kuiL3, kuiL3 };
ST32A4 (pPred , LD32 (kuiList));
ST32A4 (pPred + kiStride , LD32 (kuiList + 2));
@@ -344,35 +343,35 @@
/*horizontal down*/
void WelsI4x4LumaPredHD_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
- const uint8_t kuiLT = pPred[- (kiStride + 1)];
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
+ const uint8_t kuiLT = pPred[- (kiStride + 1)];
/*get pLeft and pTop*/
- const uint8_t kuiL0 = pPred[-1 ];
- const uint8_t kuiL1 = pPred[-1 + kiStride ];
- const uint8_t kuiL2 = pPred[-1 + kiStride2];
- const uint8_t kuiL3 = pPred[-1 + kiStride3];
- const uint8_t kuiT0 = pPred[-kiStride ];
- const uint8_t kuiT1 = pPred[-kiStride + 1 ];
- const uint8_t kuiT2 = pPred[-kiStride + 2 ];
- const uint16_t kuiTL0 = 1 + kuiLT + kuiL0;
- const uint16_t kuiLT0 = 1 + kuiLT + kuiT0;
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
- const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
- const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
- const uint8_t kuiHD0 = kuiTL0 >> 1;
- const uint8_t kuiHD1 = (kuiTL0 + kuiLT0) >> 2;
- const uint8_t kuiHD2 = (kuiLT0 + kuiT01) >> 2;
- const uint8_t kuiHD3 = (kuiT01 + kuiT12) >> 2;
- const uint8_t kuiHD4 = kuiL01 >> 1;
- const uint8_t kuiHD5 = (kuiTL0 + kuiL01) >> 2;
- const uint8_t kuiHD6 = kuiL12 >> 1;
- const uint8_t kuiHD7 = (kuiL01 + kuiL12) >> 2;
- const uint8_t kuiHD8 = kuiL23 >> 1;
- const uint8_t kuiHD9 = (kuiL12 + kuiL23) >> 2;
- const uint8_t kuiList[10] = { kuiHD8, kuiHD9, kuiHD6, kuiHD7, kuiHD4, kuiHD5, kuiHD0, kuiHD1, kuiHD2, kuiHD3 };
+ const uint8_t kuiL0 = pPred[-1 ];
+ const uint8_t kuiL1 = pPred[-1 + kiStride ];
+ const uint8_t kuiL2 = pPred[-1 + kiStride2];
+ const uint8_t kuiL3 = pPred[-1 + kiStride3];
+ const uint8_t kuiT0 = pPred[-kiStride ];
+ const uint8_t kuiT1 = pPred[-kiStride + 1 ];
+ const uint8_t kuiT2 = pPred[-kiStride + 2 ];
+ const uint16_t kuiTL0 = 1 + kuiLT + kuiL0;
+ const uint16_t kuiLT0 = 1 + kuiLT + kuiT0;
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
+ const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
+ const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
+ const uint8_t kuiHD0 = kuiTL0 >> 1;
+ const uint8_t kuiHD1 = (kuiTL0 + kuiLT0) >> 2;
+ const uint8_t kuiHD2 = (kuiLT0 + kuiT01) >> 2;
+ const uint8_t kuiHD3 = (kuiT01 + kuiT12) >> 2;
+ const uint8_t kuiHD4 = kuiL01 >> 1;
+ const uint8_t kuiHD5 = (kuiTL0 + kuiL01) >> 2;
+ const uint8_t kuiHD6 = kuiL12 >> 1;
+ const uint8_t kuiHD7 = (kuiL01 + kuiL12) >> 2;
+ const uint8_t kuiHD8 = kuiL23 >> 1;
+ const uint8_t kuiHD9 = (kuiL12 + kuiL23) >> 2;
+ const uint8_t kuiList[10] = { kuiHD8, kuiHD9, kuiHD6, kuiHD7, kuiHD4, kuiHD5, kuiHD0, kuiHD1, kuiHD2, kuiHD3 };
ST32A4 (pPred , LD32 (kuiList + 6));
ST32A4 (pPred + kiStride , LD32 (kuiList + 4));
@@ -882,8 +881,8 @@
void WelsIChromaPredV_c (uint8_t* pPred, const int32_t kiStride) {
- const uint64_t kuiVal64 = LD64A8 (&pPred[-kiStride]);
- const int32_t kiStride2 = kiStride << 1;
+ const uint64_t kuiVal64 = LD64A8 (&pPred[-kiStride]);
+ const int32_t kiStride2 = kiStride << 1;
const int32_t kiStride4 = kiStride2 << 1;
ST64A8 (pPred , kuiVal64);
@@ -901,8 +900,8 @@
uint8_t i = 7;
do {
- const uint8_t kuiVal8 = pPred[iTmp - 1];
- const uint64_t kuiVal64 = 0x0101010101010101ULL * kuiVal8;
+ const uint8_t kuiVal8 = pPred[iTmp - 1];
+ const uint64_t kuiVal64 = 0x0101010101010101ULL * kuiVal8;
ST64A8 (pPred + iTmp, kuiVal64);
@@ -938,25 +937,25 @@
void WelsIChromaPredDc_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiL1 = kiStride - 1;
- const int32_t kiL2 = kiL1 + kiStride;
- const int32_t kiL3 = kiL2 + kiStride;
- const int32_t kiL4 = kiL3 + kiStride;
- const int32_t kiL5 = kiL4 + kiStride;
- const int32_t kiL6 = kiL5 + kiStride;
- const int32_t kiL7 = kiL6 + kiStride;
+ const int32_t kiL1 = kiStride - 1;
+ const int32_t kiL2 = kiL1 + kiStride;
+ const int32_t kiL3 = kiL2 + kiStride;
+ const int32_t kiL4 = kiL3 + kiStride;
+ const int32_t kiL5 = kiL4 + kiStride;
+ const int32_t kiL6 = kiL5 + kiStride;
+ const int32_t kiL7 = kiL6 + kiStride;
/*caculate the kMean value*/
- const uint8_t kuiM1 = (pPred[-kiStride] + pPred[1 - kiStride] + pPred[2 - kiStride] + pPred[3 - kiStride] +
- pPred[-1] + pPred[kiL1] + pPred[kiL2] + pPred[kiL3] + 4) >> 3 ;
- const uint32_t kuiSum2 = pPred[4 - kiStride] + pPred[5 - kiStride] + pPred[6 - kiStride] + pPred[7 - kiStride];
- const uint32_t kuiSum3 = pPred[kiL4] + pPred[kiL5] + pPred[kiL6] + pPred[kiL7];
- const uint8_t kuiM2 = (kuiSum2 + 2) >> 2;
- const uint8_t kuiM3 = (kuiSum3 + 2) >> 2;
- const uint8_t kuiM4 = (kuiSum2 + kuiSum3 + 4) >> 3;
- const uint8_t kuiMUP[8] = {kuiM1, kuiM1, kuiM1, kuiM1, kuiM2, kuiM2, kuiM2, kuiM2};
- const uint8_t kuiMDown[8] = {kuiM3, kuiM3, kuiM3, kuiM3, kuiM4, kuiM4, kuiM4, kuiM4};
- const uint64_t kuiUP64 = LD64 (kuiMUP);
- const uint64_t kuiDN64 = LD64 (kuiMDown);
+ const uint8_t kuiM1 = (pPred[-kiStride] + pPred[1 - kiStride] + pPred[2 - kiStride] + pPred[3 - kiStride] +
+ pPred[-1] + pPred[kiL1] + pPred[kiL2] + pPred[kiL3] + 4) >> 3 ;
+ const uint32_t kuiSum2 = pPred[4 - kiStride] + pPred[5 - kiStride] + pPred[6 - kiStride] + pPred[7 - kiStride];
+ const uint32_t kuiSum3 = pPred[kiL4] + pPred[kiL5] + pPred[kiL6] + pPred[kiL7];
+ const uint8_t kuiM2 = (kuiSum2 + 2) >> 2;
+ const uint8_t kuiM3 = (kuiSum3 + 2) >> 2;
+ const uint8_t kuiM4 = (kuiSum2 + kuiSum3 + 4) >> 3;
+ const uint8_t kuiMUP[8] = {kuiM1, kuiM1, kuiM1, kuiM1, kuiM2, kuiM2, kuiM2, kuiM2};
+ const uint8_t kuiMDown[8] = {kuiM3, kuiM3, kuiM3, kuiM3, kuiM4, kuiM4, kuiM4, kuiM4};
+ const uint64_t kuiUP64 = LD64 (kuiMUP);
+ const uint64_t kuiDN64 = LD64 (kuiMDown);
ST64A8 (pPred , kuiUP64);
ST64A8 (pPred + kiL1 + 1, kuiUP64);
@@ -969,13 +968,13 @@
}
void WelsIChromaPredDcLeft_c (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiL1 = -1 + kiStride;
- const int32_t kiL2 = kiL1 + kiStride;
- const int32_t kiL3 = kiL2 + kiStride;
- const int32_t kiL4 = kiL3 + kiStride;
- const int32_t kiL5 = kiL4 + kiStride;
- const int32_t kiL6 = kiL5 + kiStride;
- const int32_t kiL7 = kiL6 + kiStride;
+ const int32_t kiL1 = -1 + kiStride;
+ const int32_t kiL2 = kiL1 + kiStride;
+ const int32_t kiL3 = kiL2 + kiStride;
+ const int32_t kiL4 = kiL3 + kiStride;
+ const int32_t kiL5 = kiL4 + kiStride;
+ const int32_t kiL6 = kiL5 + kiStride;
+ const int32_t kiL7 = kiL6 + kiStride;
/*caculate the kMean value*/
const uint8_t kuiMUP = (pPred[-1] + pPred[kiL1] + pPred[kiL2] + pPred[kiL3] + 2) >> 2 ;
const uint8_t kuiMDown = (pPred[kiL4] + pPred[kiL5] + pPred[kiL6] + pPred[kiL7] + 2) >> 2;
@@ -993,12 +992,11 @@
}
void WelsIChromaPredDcTop_c (uint8_t* pPred, const int32_t kiStride) {
- int32_t iTmp = (kiStride << 3) - kiStride;
+ int32_t iTmp = (kiStride << 3) - kiStride;
/*caculate the kMean value*/
- const uint8_t kuiM1 = (pPred[-kiStride] + pPred[1 - kiStride] + pPred[2 - kiStride] + pPred[3 - kiStride] + 2) >> 2;
- const uint8_t kuiM2 = (pPred[4 - kiStride] + pPred[5 - kiStride] + pPred[6 - kiStride] + pPred[7 - kiStride] + 2) >>
- 2;
- const uint8_t kuiM[8] = {kuiM1, kuiM1, kuiM1, kuiM1, kuiM2, kuiM2, kuiM2, kuiM2};
+ const uint8_t kuiM1 = (pPred[-kiStride] + pPred[1 - kiStride] + pPred[2 - kiStride] + pPred[3 - kiStride] + 2) >> 2;
+ const uint8_t kuiM2 = (pPred[4 - kiStride] + pPred[5 - kiStride] + pPred[6 - kiStride] + pPred[7 - kiStride] + 2) >> 2;
+ const uint8_t kuiM[8] = {kuiM1, kuiM1, kuiM1, kuiM1, kuiM2, kuiM2, kuiM2, kuiM2};
uint8_t i = 7;
@@ -1022,13 +1020,13 @@
}
void WelsI16x16LumaPredV_c (uint8_t* pPred, const int32_t kiStride) {
- int32_t iTmp = (kiStride << 4) - kiStride;
- const uint64_t kuiTop1 = LD64A8 (pPred - kiStride);
+ int32_t iTmp = (kiStride << 4) - kiStride;
+ const uint64_t kuiTop1 = LD64A8 (pPred - kiStride);
const uint64_t kuiTop2 = LD64A8 (pPred - kiStride + 8);
uint8_t i = 15;
do {
- ST64A8 (pPred + iTmp , kuiTop1);
+ ST64A8 (pPred + iTmp , kuiTop1);
ST64A8 (pPred + iTmp + 8, kuiTop2);
iTmp -= kiStride;
@@ -1040,10 +1038,10 @@
uint8_t i = 15;
do {
- const uint8_t kuiVal8 = pPred[iTmp - 1];
- const uint64_t kuiVal64 = 0x0101010101010101ULL * kuiVal8;
+ const uint8_t kuiVal8 = pPred[iTmp - 1];
+ const uint64_t kuiVal64 = 0x0101010101010101ULL * kuiVal8;
- ST64A8 (pPred + iTmp , kuiVal64);
+ ST64A8 (pPred + iTmp , kuiVal64);
ST64A8 (pPred + iTmp + 8, kuiVal64);
iTmp -= kiStride;
@@ -1128,8 +1126,8 @@
iSum += pPred[-1 + iTmp];
iTmp -= kiStride;
} while (i-- > 0);
- uiMean = (8 + iSum) >> 4;
- uiMean64 = 0x0101010101010101ULL * uiMean;
+ uiMean = (8 + iSum) >> 4;
+ uiMean64 = 0x0101010101010101ULL * uiMean;
iTmp = (kiStride << 4) - kiStride;
i = 15;
--- a/codec/decoder/core/src/memmgr_nal_unit.cpp
+++ b/codec/decoder/core/src/memmgr_nal_unit.cpp
@@ -72,12 +72,12 @@
++ uiIdx;
} while (uiIdx < kuiSize);
- (*ppAu)->uiCountUnitsNum = kuiSize;
- (*ppAu)->uiAvailUnitsNum = 0;
- (*ppAu)->uiActualUnitsNum = 0;
+ (*ppAu)->uiCountUnitsNum = kuiSize;
+ (*ppAu)->uiAvailUnitsNum = 0;
+ (*ppAu)->uiActualUnitsNum = 0;
(*ppAu)->uiStartPos = 0;
- (*ppAu)->uiEndPos = 0;
- (*ppAu)->bCompletedAuFlag = false;
+ (*ppAu)->uiEndPos = 0;
+ (*ppAu)->bCompletedAuFlag = false;
return 0;
}
@@ -109,11 +109,11 @@
++ iIdx;
} while (iIdx < kiOrgSize);
- pTmp->uiCountUnitsNum = kiExpSize;
- pTmp->uiAvailUnitsNum = (*ppAu)->uiAvailUnitsNum;
- pTmp->uiActualUnitsNum = (*ppAu)->uiActualUnitsNum;
- pTmp->uiEndPos = (*ppAu)->uiEndPos;
- pTmp->bCompletedAuFlag = (*ppAu)->bCompletedAuFlag;
+ pTmp->uiCountUnitsNum = kiExpSize;
+ pTmp->uiAvailUnitsNum = (*ppAu)->uiAvailUnitsNum;
+ pTmp->uiActualUnitsNum = (*ppAu)->uiActualUnitsNum;
+ pTmp->uiEndPos = (*ppAu)->uiEndPos;
+ pTmp->bCompletedAuFlag = (*ppAu)->bCompletedAuFlag;
MemFreeNalList (ppAu); // free old list
*ppAu = pTmp;
--- a/codec/decoder/core/src/mv_pred.cpp
+++ b/codec/decoder/core/src/mv_pred.cpp
@@ -196,15 +196,15 @@
//basic iMVs prediction unit for iMVs partition width (4, 2, 1)
void PredMv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],
int32_t iPartIdx, int32_t iPartWidth, int8_t iRef, int16_t iMVP[2]) {
- const uint8_t kuiLeftIdx = g_kuiCache30ScanIdx[iPartIdx] - 1;
- const uint8_t kuiTopIdx = g_kuiCache30ScanIdx[iPartIdx] - 6;
- const uint8_t kuiRightTopIdx = kuiTopIdx + iPartWidth;
- const uint8_t kuiLeftTopIdx = kuiTopIdx - 1;
+ const uint8_t kuiLeftIdx = g_kuiCache30ScanIdx[iPartIdx] - 1;
+ const uint8_t kuiTopIdx = g_kuiCache30ScanIdx[iPartIdx] - 6;
+ const uint8_t kuiRightTopIdx = kuiTopIdx + iPartWidth;
+ const uint8_t kuiLeftTopIdx = kuiTopIdx - 1;
const int8_t kiLeftRef = iRefIndex[0][kuiLeftIdx];
const int8_t kiTopRef = iRefIndex[0][ kuiTopIdx];
- const int8_t kiRightTopRef = iRefIndex[0][kuiRightTopIdx];
- const int8_t kiLeftTopRef = iRefIndex[0][ kuiLeftTopIdx];
+ const int8_t kiRightTopRef = iRefIndex[0][kuiRightTopIdx];
+ const int8_t kiLeftTopRef = iRefIndex[0][ kuiLeftTopIdx];
int8_t iDiagonalRef = kiRightTopRef;
int8_t iMatchRef = 0;
@@ -286,8 +286,8 @@
//update iMVs and iRefIndex cache for current MB, only for P_16*16 (SKIP inclusive)
/* can be further optimized */
void UpdateP16x16MotionInfo (PDqLayer pCurDqLayer, int8_t iRef, int16_t iMVs[2]) {
- const int16_t kiRef2 = (iRef << 8) | iRef;
- const int32_t kiMV32 = LD32 (iMVs);
+ const int16_t kiRef2 = (iRef << 8) | iRef;
+ const int32_t kiMV32 = LD32 (iMVs);
int32_t i;
int32_t iMbXy = pCurDqLayer->iMbXyIndex;
--- a/codec/decoder/core/src/parse_mb_syn_cabac.cpp
+++ b/codec/decoder/core/src/parse_mb_syn_cabac.cpp
@@ -374,8 +374,8 @@
int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroCount,
int16_t pMotionVector[LIST_A][30][MV_A], int16_t pMvdCache[LIST_A][30][MV_A], int8_t pRefIndex[LIST_A][30]) {
- PSlice pSlice = &pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer;
- PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
+ PSlice pSlice = &pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer;
+ PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
PDqLayer pCurDqLayer = pCtx->pCurDqLayer;
PPicture* ppRefPic = pCtx->sRefPic.pRefList[LIST_0];
int32_t pRefCount[2];
--- a/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
+++ b/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
@@ -990,8 +990,8 @@
int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][MV_A], int8_t iRefIdxArray[LIST_A][30],
PBitStringAux pBs) {
- PSlice pSlice = &pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer;
- PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
+ PSlice pSlice = &pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer;
+ PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
PPicture* ppRefPic = pCtx->sRefPic.pRefList[LIST_0];
int32_t iRefCount[2];
PDqLayer pCurDqLayer = pCtx->pCurDqLayer;
--- a/codec/decoder/core/src/pic_queue.cpp
+++ b/codec/decoder/core/src/pic_queue.cpp
@@ -64,10 +64,10 @@
int32_t iPicWidth = 0;
int32_t iPicHeight = 0;
- int32_t iPicChromaWidth = 0;
- int32_t iPicChromaHeight = 0;
- int32_t iLumaSize = 0;
- int32_t iChromaSize = 0;
+ int32_t iPicChromaWidth = 0;
+ int32_t iPicChromaHeight = 0;
+ int32_t iLumaSize = 0;
+ int32_t iChromaSize = 0;
pPic = (PPicture) WelsMallocz (sizeof (SPicture), "PPicture");
WELS_VERIFY_RETURN_IF (NULL, NULL == pPic);
@@ -76,11 +76,11 @@
iPicWidth = WELS_ALIGN (kiPicWidth + (PADDING_LENGTH << 1), PICTURE_RESOLUTION_ALIGNMENT);
iPicHeight = WELS_ALIGN (kiPicHeight + (PADDING_LENGTH << 1), PICTURE_RESOLUTION_ALIGNMENT);
- iPicChromaWidth = iPicWidth >> 1;
- iPicChromaHeight = iPicHeight >> 1;
+ iPicChromaWidth = iPicWidth >> 1;
+ iPicChromaHeight = iPicHeight >> 1;
- iLumaSize = iPicWidth * iPicHeight;
- iChromaSize = iPicChromaWidth * iPicChromaHeight;
+ iLumaSize = iPicWidth * iPicHeight;
+ iChromaSize = iPicChromaWidth * iPicChromaHeight;
if (pCtx->bParseOnly) {
pPic->pBuffer[0] = pPic->pBuffer[1] = pPic->pBuffer[2] = NULL;
@@ -95,16 +95,16 @@
memset (pPic->pBuffer[0], 128, (iLumaSize + (iChromaSize << 1)));
pPic->iLinesize[0] = iPicWidth;
pPic->iLinesize[1] = pPic->iLinesize[2] = iPicChromaWidth;
- pPic->pBuffer[1] = pPic->pBuffer[0] + iLumaSize;
- pPic->pBuffer[2] = pPic->pBuffer[1] + iChromaSize;
- pPic->pData[0] = pPic->pBuffer[0] + (1 + pPic->iLinesize[0]) * PADDING_LENGTH;
- pPic->pData[1] = pPic->pBuffer[1] + /*WELS_ALIGN*/ (((1 + pPic->iLinesize[1]) * PADDING_LENGTH) >> 1);
- pPic->pData[2] = pPic->pBuffer[2] + /*WELS_ALIGN*/ (((1 + pPic->iLinesize[2]) * PADDING_LENGTH) >> 1);
+ pPic->pBuffer[1] = pPic->pBuffer[0] + iLumaSize;
+ pPic->pBuffer[2] = pPic->pBuffer[1] + iChromaSize;
+ pPic->pData[0] = pPic->pBuffer[0] + (1 + pPic->iLinesize[0]) * PADDING_LENGTH;
+ pPic->pData[1] = pPic->pBuffer[1] + /*WELS_ALIGN*/ (((1 + pPic->iLinesize[1]) * PADDING_LENGTH) >> 1);
+ pPic->pData[2] = pPic->pBuffer[2] + /*WELS_ALIGN*/ (((1 + pPic->iLinesize[2]) * PADDING_LENGTH) >> 1);
}
- pPic->iPlanes = 3; // yv12 in default
- pPic->iWidthInPixel = kiPicWidth;
+ pPic->iPlanes = 3; // yv12 in default
+ pPic->iWidthInPixel = kiPicWidth;
pPic->iHeightInPixel = kiPicHeight;
- pPic->iFrameNum = -1;
+ pPic->iFrameNum = -1;
pPic->bAvailableFlag = true;
return pPic;
--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -63,9 +63,9 @@
* \return 2 based scaling factor
*/
static inline uint32_t GetLogFactor (float base, float upper) {
- const double dLog2factor = log10 (1.0 * upper / base) / log10 (2.0);
- const double dEpsilon = 0.0001;
- const double dRound = floor (dLog2factor + 0.5);
+ const double dLog2factor = log10 (1.0 * upper / base) / log10 (2.0);
+ const double dEpsilon = 0.0001;
+ const double dRound = floor (dLog2factor + 0.5);
if (dLog2factor < dRound + dEpsilon && dRound < dLog2factor + dEpsilon) {
return (uint32_t) (dRound);
@@ -125,46 +125,46 @@
static void FillDefault (SEncParamExt& param) {
memset (¶m, 0, sizeof (param));
- param.uiIntraPeriod = 0; // intra period (multiple of GOP size as desired)
- param.iNumRefFrame = AUTO_REF_PIC_COUNT;// number of reference frame used
+ param.uiIntraPeriod = 0; // intra period (multiple of GOP size as desired)
+ param.iNumRefFrame = AUTO_REF_PIC_COUNT;// number of reference frame used
- param.iPicWidth = 0; // actual input picture width
- param.iPicHeight = 0; // actual input picture height
+ param.iPicWidth = 0; // actual input picture width
+ param.iPicHeight = 0; // actual input picture height
- param.fMaxFrameRate = MAX_FRAME_RATE; // maximal frame rate [Hz / fps]
+ param.fMaxFrameRate = MAX_FRAME_RATE; // maximal frame rate [Hz / fps]
- param.iComplexityMode = MEDIUM_COMPLEXITY;
- param.iTargetBitrate = UNSPECIFIED_BIT_RATE; // overall target bitrate introduced in RC module
- param.iMaxBitrate = UNSPECIFIED_BIT_RATE;
- param.iMultipleThreadIdc = 1;
+ param.iComplexityMode = MEDIUM_COMPLEXITY;
+ param.iTargetBitrate = UNSPECIFIED_BIT_RATE; // overall target bitrate introduced in RC module
+ param.iMaxBitrate = UNSPECIFIED_BIT_RATE;
+ param.iMultipleThreadIdc = 1;
- param.iLTRRefNum = 0;
- param.iLtrMarkPeriod = 30; //the min distance of two int32_t references
+ param.iLTRRefNum = 0;
+ param.iLtrMarkPeriod = 30; //the min distance of two int32_t references
- param.bEnableSSEI = false;
- param.bSimulcastAVC = false;
- param.bEnableFrameCroppingFlag = true; // enable frame cropping flag: true alwayse in application
+ param.bEnableSSEI = false;
+ param.bSimulcastAVC = false;
+ param.bEnableFrameCroppingFlag = true; // enable frame cropping flag: true alwayse in application
// false: Streaming Video Sharing; true: Video Conferencing Meeting;
/* Deblocking loop filter */
- param.iLoopFilterDisableIdc = 0; // 0: on, 1: off, 2: on except for slice boundaries
- param.iLoopFilterAlphaC0Offset = 0; // AlphaOffset: valid range [-6, 6], default 0
- param.iLoopFilterBetaOffset = 0; // BetaOffset: valid range [-6, 6], default 0
+ param.iLoopFilterDisableIdc = 0; // 0: on, 1: off, 2: on except for slice boundaries
+ param.iLoopFilterAlphaC0Offset = 0; // AlphaOffset: valid range [-6, 6], default 0
+ param.iLoopFilterBetaOffset = 0; // BetaOffset: valid range [-6, 6], default 0
/* Rate Control */
- param.iRCMode = RC_QUALITY_MODE;
- param.iPaddingFlag = 0;
- param.iEntropyCodingModeFlag = 0;
- param.bEnableDenoise = false; // denoise control
- param.bEnableSceneChangeDetect = true; // scene change detection control
- param.bEnableBackgroundDetection = true; // background detection control
- param.bEnableAdaptiveQuant = true; // adaptive quantization control
- param.bEnableFrameSkip = true; // frame skipping
- param.bEnableLongTermReference = false; // long term reference control
- param.eSpsPpsIdStrategy = INCREASING_ID; // pSps pPps id addition control
- param.bPrefixNalAddingCtrl = false; // prefix NAL adding control
- param.iSpatialLayerNum = 1; // number of dependency(Spatial/CGS) layers used to be encoded
- param.iTemporalLayerNum = 1; // number of temporal layer specified
+ param.iRCMode = RC_QUALITY_MODE;
+ param.iPaddingFlag = 0;
+ param.iEntropyCodingModeFlag = 0;
+ param.bEnableDenoise = false; // denoise control
+ param.bEnableSceneChangeDetect = true; // scene change detection control
+ param.bEnableBackgroundDetection = true; // background detection control
+ param.bEnableAdaptiveQuant = true; // adaptive quantization control
+ param.bEnableFrameSkip = true; // frame skipping
+ param.bEnableLongTermReference = false; // long term reference control
+ param.eSpsPpsIdStrategy = INCREASING_ID;// pSps pPps id addition control
+ param.bPrefixNalAddingCtrl = false; // prefix NAL adding control
+ param.iSpatialLayerNum = 1; // number of dependency(Spatial/CGS) layers used to be encoded
+ param.iTemporalLayerNum = 1; // number of temporal layer specified
param.iMaxQp = 51;
param.iMinQp = 0;
@@ -188,28 +188,28 @@
void FillDefault() {
FillDefault (*this);
- uiGopSize = 1; // GOP size (at maximal frame rate: 16)
+ uiGopSize = 1; // GOP size (at maximal frame rate: 16)
iMaxNumRefFrame = AUTO_REF_PIC_COUNT;
- SUsedPicRect.iLeft =
- SUsedPicRect.iTop =
- SUsedPicRect.iWidth =
- SUsedPicRect.iHeight = 0; // the rect in input picture that encoder actually used
+ SUsedPicRect.iLeft =
+ SUsedPicRect.iTop =
+ SUsedPicRect.iWidth =
+ SUsedPicRect.iHeight = 0; // the rect in input picture that encoder actually used
- pCurPath = NULL; // record current lib path such as:/pData/pData/com.wels.enc/lib/
+ pCurPath = NULL; // record current lib path such as:/pData/pData/com.wels.enc/lib/
- bDeblockingParallelFlag = false; // deblocking filter parallelization control flag
+ bDeblockingParallelFlag = false;// deblocking filter parallelization control flag
- iCountThreadsNum = 1; // # derived from disable_multiple_slice_idc (=0 or >1) means;
+ iCountThreadsNum = 1; // # derived from disable_multiple_slice_idc (=0 or >1) means;
- iDecompStages = 0; // GOP size dependency, unknown here and be revised later
+ iDecompStages = 0; // GOP size dependency, unknown here and be revised later
iBitsVaryPercentage = 0;
}
int32_t ParamBaseTranscode (const SEncParamBase& pCodingParam) {
- fMaxFrameRate = WELS_CLIP3 (pCodingParam.fMaxFrameRate, MIN_FRAME_RATE, MAX_FRAME_RATE);
- iTargetBitrate = pCodingParam.iTargetBitrate;
- iUsageType = pCodingParam.iUsageType;
+ fMaxFrameRate = WELS_CLIP3 (pCodingParam.fMaxFrameRate, MIN_FRAME_RATE, MAX_FRAME_RATE);
+ iTargetBitrate = pCodingParam.iTargetBitrate;
+ iUsageType = pCodingParam.iUsageType;
iPicWidth = pCodingParam.iPicWidth;
iPicHeight = pCodingParam.iPicHeight;
@@ -220,34 +220,34 @@
iRCMode = pCodingParam.iRCMode; // rc mode
- int8_t iIdxSpatial = 0;
- EProfileIdc uiProfileIdc = PRO_BASELINE;
+ int8_t iIdxSpatial = 0;
+ EProfileIdc uiProfileIdc = PRO_BASELINE;
if (iEntropyCodingModeFlag)
uiProfileIdc = PRO_MAIN;
- SSpatialLayerInternal* pDlp = &sDependencyLayers[0];
+ SSpatialLayerInternal* pDlp = &sDependencyLayers[0];
while (iIdxSpatial < iSpatialLayerNum) {
- sSpatialLayers->uiProfileIdc = uiProfileIdc;
- sSpatialLayers->uiLevelIdc = LEVEL_UNKNOWN;
- sSpatialLayers[iIdxSpatial].fFrameRate = WELS_CLIP3 (pCodingParam.fMaxFrameRate,
+ sSpatialLayers->uiProfileIdc = uiProfileIdc;
+ sSpatialLayers->uiLevelIdc = LEVEL_UNKNOWN;
+ sSpatialLayers[iIdxSpatial].fFrameRate = WELS_CLIP3 (pCodingParam.fMaxFrameRate,
MIN_FRAME_RATE, MAX_FRAME_RATE);
- pDlp->fInputFrameRate =
- pDlp->fOutputFrameRate = WELS_CLIP3 (sSpatialLayers[iIdxSpatial].fFrameRate, MIN_FRAME_RATE,
+ pDlp->fInputFrameRate =
+ pDlp->fOutputFrameRate = WELS_CLIP3 (sSpatialLayers[iIdxSpatial].fFrameRate, MIN_FRAME_RATE,
MAX_FRAME_RATE);
#ifdef ENABLE_FRAME_DUMP
- pDlp->sRecFileName[0] = '\0'; // file to be constructed
+ pDlp->sRecFileName[0] = '\0'; // file to be constructed
#endif//ENABLE_FRAME_DUMP
pDlp->iActualWidth = sSpatialLayers[iIdxSpatial].iVideoWidth = iPicWidth;
pDlp->iActualHeight = sSpatialLayers[iIdxSpatial].iVideoHeight = iPicHeight;
- sSpatialLayers->iSpatialBitrate =
- sSpatialLayers[iIdxSpatial].iSpatialBitrate = pCodingParam.iTargetBitrate; // target bitrate for current spatial layer
+ sSpatialLayers->iSpatialBitrate =
+ sSpatialLayers[iIdxSpatial].iSpatialBitrate = pCodingParam.iTargetBitrate; // target bitrate for current spatial layer
- sSpatialLayers->iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
+ sSpatialLayers->iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
sSpatialLayers->iDLayerQp = SVC_QUALITY_BASE_QP;
- uiProfileIdc = (!bSimulcastAVC) ? PRO_SCALABLE_BASELINE : PRO_BASELINE;
+ uiProfileIdc = (!bSimulcastAVC) ? PRO_SCALABLE_BASELINE : PRO_BASELINE;
++ pDlp;
++ iIdxSpatial;
}
@@ -280,11 +280,11 @@
iMultipleThreadIdc = pCodingParam.iMultipleThreadIdc;
/* Deblocking loop filter */
- iLoopFilterDisableIdc = pCodingParam.iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries,
- iLoopFilterAlphaC0Offset = pCodingParam.iLoopFilterAlphaC0Offset; // AlphaOffset: valid range [-6, 6], default 0
- iLoopFilterBetaOffset = pCodingParam.iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
- iEntropyCodingModeFlag = pCodingParam.iEntropyCodingModeFlag;
- bEnableFrameCroppingFlag = pCodingParam.bEnableFrameCroppingFlag;
+ iLoopFilterDisableIdc = pCodingParam.iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries,
+ iLoopFilterAlphaC0Offset = pCodingParam.iLoopFilterAlphaC0Offset; // AlphaOffset: valid range [-6, 6], default 0
+ iLoopFilterBetaOffset = pCodingParam.iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
+ iEntropyCodingModeFlag = pCodingParam.iEntropyCodingModeFlag;
+ bEnableFrameCroppingFlag = pCodingParam.bEnableFrameCroppingFlag;
/* Rate Control */
iRCMode = pCodingParam.iRCMode; // rc mode
@@ -291,7 +291,7 @@
bSimulcastAVC = pCodingParam.bSimulcastAVC;
iPaddingFlag = pCodingParam.iPaddingFlag;
- iTargetBitrate = pCodingParam.iTargetBitrate; // target bitrate
+ iTargetBitrate = pCodingParam.iTargetBitrate; // target bitrate
iMaxBitrate = pCodingParam.iMaxBitrate;
if (iMaxBitrate < iTargetBitrate) {
iMaxBitrate = iTargetBitrate;
@@ -302,19 +302,19 @@
bEnableDenoise = pCodingParam.bEnableDenoise ? true : false; // Denoise Control // only support 0 or 1 now
/* Scene change detection control */
- bEnableSceneChangeDetect = pCodingParam.bEnableSceneChangeDetect;
+ bEnableSceneChangeDetect = pCodingParam.bEnableSceneChangeDetect;
/* Background detection Control */
bEnableBackgroundDetection = pCodingParam.bEnableBackgroundDetection ? true : false;
/* Adaptive quantization control */
- bEnableAdaptiveQuant = pCodingParam.bEnableAdaptiveQuant ? true : false;
+ bEnableAdaptiveQuant = pCodingParam.bEnableAdaptiveQuant ? true : false;
/* Frame skipping */
- bEnableFrameSkip = pCodingParam.bEnableFrameSkip ? true : false;
+ bEnableFrameSkip = pCodingParam.bEnableFrameSkip ? true : false;
/* Enable int32_t term reference */
- bEnableLongTermReference = pCodingParam.bEnableLongTermReference ? true : false;
+ bEnableLongTermReference = pCodingParam.bEnableLongTermReference ? true : false;
iLtrMarkPeriod = pCodingParam.iLtrMarkPeriod;
bIsLosslessLink = pCodingParam.bIsLosslessLink;
if (iUsageType == SCREEN_CONTENT_REAL_TIME && !bIsLosslessLink && bEnableLongTermReference) {
@@ -322,8 +322,8 @@
}
/* For ssei information */
- bEnableSSEI = pCodingParam.bEnableSSEI;
- bSimulcastAVC = pCodingParam.bSimulcastAVC;
+ bEnableSSEI = pCodingParam.bEnableSSEI;
+ bSimulcastAVC = pCodingParam.bSimulcastAVC;
/* Layer definition */
iSpatialLayerNum = (int8_t)WELS_CLIP3 (pCodingParam.iSpatialLayerNum, 1,
@@ -331,9 +331,9 @@
iTemporalLayerNum = (int8_t)WELS_CLIP3 (pCodingParam.iTemporalLayerNum, 1,
MAX_TEMPORAL_LEVEL); // number of temporal layer specified
- uiGopSize = 1 << (iTemporalLayerNum - 1); // Override GOP size based temporal layer
- iDecompStages = iTemporalLayerNum - 1; // WELS_LOG2( uiGopSize );// GOP size dependency
- uiIntraPeriod = pCodingParam.uiIntraPeriod;// intra period (multiple of GOP size as desired)
+ uiGopSize = 1 << (iTemporalLayerNum - 1); // Override GOP size based temporal layer
+ iDecompStages = iTemporalLayerNum - 1; // WELS_LOG2( uiGopSize );// GOP size dependency
+ uiIntraPeriod = pCodingParam.uiIntraPeriod;// intra period (multiple of GOP size as desired)
if (uiIntraPeriod == (uint32_t) (-1))
uiIntraPeriod = 0;
else if (uiIntraPeriod & (uiGopSize - 1)) // none multiple of GOP size
@@ -364,32 +364,32 @@
// keep the default value
}
- SSpatialLayerInternal* pDlp = &sDependencyLayers[0];
+ SSpatialLayerInternal* pDlp = &sDependencyLayers[0];
SSpatialLayerConfig* pSpatialLayer = &sSpatialLayers[0];
- EProfileIdc uiProfileIdc = PRO_BASELINE;
- int8_t iIdxSpatial = 0;
+ EProfileIdc uiProfileIdc = PRO_BASELINE;
+ int8_t iIdxSpatial = 0;
while (iIdxSpatial < iSpatialLayerNum) {
- pSpatialLayer->uiProfileIdc = (pCodingParam.sSpatialLayers[iIdxSpatial].uiProfileIdc == PRO_UNKNOWN) ? uiProfileIdc :
+ pSpatialLayer->uiProfileIdc = (pCodingParam.sSpatialLayers[iIdxSpatial].uiProfileIdc == PRO_UNKNOWN) ? uiProfileIdc :
pCodingParam.sSpatialLayers[iIdxSpatial].uiProfileIdc;
pSpatialLayer->uiLevelIdc = pCodingParam.sSpatialLayers[iIdxSpatial].uiLevelIdc;
- float fLayerFrameRate = WELS_CLIP3 (pCodingParam.sSpatialLayers[iIdxSpatial].fFrameRate,
+ float fLayerFrameRate = WELS_CLIP3 (pCodingParam.sSpatialLayers[iIdxSpatial].fFrameRate,
MIN_FRAME_RATE, fParamMaxFrameRate);
- pDlp->fInputFrameRate = fParamMaxFrameRate;
+ pDlp->fInputFrameRate = fParamMaxFrameRate;
pSpatialLayer->fFrameRate =
- pDlp->fOutputFrameRate = WELS_CLIP3 (fLayerFrameRate, MIN_FRAME_RATE, fParamMaxFrameRate);
+ pDlp->fOutputFrameRate = WELS_CLIP3 (fLayerFrameRate, MIN_FRAME_RATE, fParamMaxFrameRate);
#ifdef ENABLE_FRAME_DUMP
- pDlp->sRecFileName[0] = '\0'; // file to be constructed
+ pDlp->sRecFileName[0] = '\0'; // file to be constructed
#endif//ENABLE_FRAME_DUMP
pSpatialLayer->iVideoWidth = WELS_CLIP3 (pCodingParam.sSpatialLayers[iIdxSpatial].iVideoWidth, 0,
- iPicWidth); // frame width
+ iPicWidth); // frame width
pSpatialLayer->iVideoHeight = WELS_CLIP3 (pCodingParam.sSpatialLayers[iIdxSpatial].iVideoHeight, 0,
iPicHeight);// frame height
- pSpatialLayer->iSpatialBitrate =
- pCodingParam.sSpatialLayers[iIdxSpatial].iSpatialBitrate; // target bitrate for current spatial layer
- pSpatialLayer->iMaxSpatialBitrate =
+ pSpatialLayer->iSpatialBitrate =
+ pCodingParam.sSpatialLayers[iIdxSpatial].iSpatialBitrate; // target bitrate for current spatial layer
+ pSpatialLayer->iMaxSpatialBitrate =
pCodingParam.sSpatialLayers[iIdxSpatial].iMaxSpatialBitrate;
//multi slice
@@ -437,17 +437,16 @@
* \return NONE (should ensure valid parameter before this procedure)
*/
int32_t DetermineTemporalSettings() {
- const int32_t iDecStages = WELS_LOG2 (
- uiGopSize); // (int8_t)GetLogFactor(1.0f, 1.0f * pcfg->uiGopSize); //log2(uiGopSize)
- const uint8_t* pTemporalIdList = &g_kuiTemporalIdListTable[iDecStages][0];
- SSpatialLayerInternal* pDlp = &sDependencyLayers[0];
+ const int32_t iDecStages = WELS_LOG2 (uiGopSize); // (int8_t)GetLogFactor(1.0f, 1.0f * pcfg->uiGopSize); //log2(uiGopSize)
+ const uint8_t* pTemporalIdList = &g_kuiTemporalIdListTable[iDecStages][0];
+ SSpatialLayerInternal* pDlp = &sDependencyLayers[0];
SSpatialLayerConfig* pSpatialLayer = &sSpatialLayers[0];
EProfileIdc uiProfileIdc = iEntropyCodingModeFlag ? PRO_MAIN : PRO_BASELINE;
- int8_t i = 0;
+ int8_t i = 0;
while (i < iSpatialLayerNum) {
- const uint32_t kuiLogFactorInOutRate = GetLogFactor (pDlp->fOutputFrameRate, pDlp->fInputFrameRate);
- const uint32_t kuiLogFactorMaxInRate = GetLogFactor (pDlp->fInputFrameRate, fMaxFrameRate);
+ const uint32_t kuiLogFactorInOutRate = GetLogFactor (pDlp->fOutputFrameRate, pDlp->fInputFrameRate);
+ const uint32_t kuiLogFactorMaxInRate = GetLogFactor (pDlp->fInputFrameRate, fMaxFrameRate);
if (UINT_MAX == kuiLogFactorInOutRate || UINT_MAX == kuiLogFactorMaxInRate) {
return ENC_RETURN_INVALIDINPUT;
}
@@ -468,9 +467,9 @@
}
}
- pDlp->iHighestTemporalId = iMaxTemporalId;
- pDlp->iTemporalResolution = kuiLogFactorMaxInRate + kuiLogFactorInOutRate;
- pDlp->iDecompositionStages = iDecStages - kuiLogFactorMaxInRate - kuiLogFactorInOutRate;
+ pDlp->iHighestTemporalId = iMaxTemporalId;
+ pDlp->iTemporalResolution = kuiLogFactorMaxInRate + kuiLogFactorInOutRate;
+ pDlp->iDecompositionStages = iDecStages - kuiLogFactorMaxInRate - kuiLogFactorInOutRate;
if (pDlp->iDecompositionStages < 0) {
return ENC_RETURN_INVALIDINPUT;
}
--- a/codec/encoder/core/inc/picture.h
+++ b/codec/encoder/core/inc/picture.h
@@ -104,18 +104,18 @@
* set picture as unreferenced
*/
void SetUnref () {
- iFramePoc = -1;
- iFrameNum = -1;
- uiTemporalId =
- uiSpatialId =
- iLongTermPicNum = -1;
- bIsLongRef = false;
+ iFramePoc = -1;
+ iFrameNum = -1;
+ uiTemporalId =
+ uiSpatialId =
+ iLongTermPicNum = -1;
+ bIsLongRef = false;
uiRecieveConfirmed = RECIEVE_FAILED;
- iMarkFrameNum = -1;
- bUsedAsRef = false;
+ iMarkFrameNum = -1;
+ bUsedAsRef = false;
if (NULL != pScreenBlockFeatureStorage)
- pScreenBlockFeatureStorage->bRefBlockFeatureCalculated = false;
+ pScreenBlockFeatureStorage->bRefBlockFeatureCalculated = false;
}
} SPicture;
--- a/codec/encoder/core/inc/vlc_encoder.h
+++ b/codec/encoder/core/inc/vlc_encoder.h
@@ -57,8 +57,8 @@
static inline int32_t WriteTotalCoeffTrailingones (SBitStringAux* pBs, uint8_t uiNc, uint8_t uiTotalCoeff,
uint8_t uiTrailingOnes) {
-const uint8_t kuiNcIdx = g_kuiEncNcMapTable[uiNc];
-const uint8_t* kpCoeffToken = &g_kuiVlcCoeffToken[kuiNcIdx][uiTotalCoeff][uiTrailingOnes][0];
+const uint8_t kuiNcIdx = g_kuiEncNcMapTable[uiNc];
+const uint8_t* kpCoeffToken = &g_kuiVlcCoeffToken[kuiNcIdx][uiTotalCoeff][uiTrailingOnes][0];
return BsWriteBits (pBs, kpCoeffToken[1], kpCoeffToken[0]);
}
--- a/codec/encoder/core/src/au_set.cpp
+++ b/codec/encoder/core/src/au_set.cpp
@@ -468,9 +468,9 @@
const uint32_t kuiSpsId, const bool kbEnableFrameCropping, bool bEnableRc,
const int32_t kiDlayerCount, bool bSVCBaselayer) {
memset (pSps, 0, sizeof (SWelsSPS));
- pSps->uiSpsId = kuiSpsId;
- pSps->iMbWidth = (pLayerParam->iVideoWidth + 15) >> 4;
- pSps->iMbHeight = (pLayerParam->iVideoHeight + 15) >> 4;
+ pSps->uiSpsId = kuiSpsId;
+ pSps->iMbWidth = (pLayerParam->iVideoWidth + 15) >> 4;
+ pSps->iMbHeight = (pLayerParam->iVideoHeight + 15) >> 4;
//max value of both iFrameNum and POC are 2^16-1, in our encoder, iPOC=2*iFrameNum, so max of iFrameNum should be 2^15-1.--
pSps->uiLog2MaxFrameNum = 15;//16;
@@ -536,9 +536,9 @@
pSps->uiProfileIdc = (pLayerParam->uiProfileIdc >= PRO_SCALABLE_BASELINE) ? pLayerParam->uiProfileIdc :
PRO_SCALABLE_BASELINE;
- pSubsetSps->sSpsSvcExt.iExtendedSpatialScalability = 0; /* ESS is 0 in default */
- pSubsetSps->sSpsSvcExt.bAdaptiveTcoeffLevelPredFlag = false;
- pSubsetSps->sSpsSvcExt.bSeqTcoeffLevelPredFlag = false;
+ pSubsetSps->sSpsSvcExt.iExtendedSpatialScalability = 0; /* ESS is 0 in default */
+ pSubsetSps->sSpsSvcExt.bAdaptiveTcoeffLevelPredFlag = false;
+ pSubsetSps->sSpsSvcExt.bSeqTcoeffLevelPredFlag = false;
pSubsetSps->sSpsSvcExt.bSliceHeaderRestrictionFlag = true;
return 0;
@@ -594,11 +594,11 @@
}
#endif//!DISABLE_FMO_FEATURE
- pPps->iPicInitQp = 26;
- pPps->iPicInitQs = 26;
+ pPps->iPicInitQp = 26;
+ pPps->iPicInitQs = 26;
- pPps->uiChromaQpIndexOffset = 0;
- pPps->bDeblockingFilterControlPresentFlag = kbDeblockingFilterPresentFlag;
+ pPps->uiChromaQpIndexOffset = 0;
+ pPps->bDeblockingFilterControlPresentFlag = kbDeblockingFilterPresentFlag;
return 0;
}
--- a/codec/encoder/core/src/deblocking.cpp
+++ b/codec/encoder/core/src/deblocking.cpp
@@ -655,9 +655,9 @@
void DeblockingFilterFrameAvcbase (SDqLayer* pCurDq, SWelsFuncPtrList* pFunc) {
int32_t i, j;
- const int32_t kiMbWidth = pCurDq->iMbWidth;
- const int32_t kiMbHeight = pCurDq->iMbHeight;
- SMB* pCurrentMbBlock = pCurDq->sMbDataP;
+ const int32_t kiMbWidth = pCurDq->iMbWidth;
+ const int32_t kiMbHeight = pCurDq->iMbHeight;
+ SMB* pCurrentMbBlock = pCurDq->sMbDataP;
SSliceHeaderExt* sSliceHeaderExt = &pCurDq->sLayerInfo.pSliceInLayer[0].sSliceHeaderExt;
SDeblockingFilter pFilter;
@@ -691,14 +691,14 @@
}
void DeblockingFilterSliceAvcbase (SDqLayer* pCurDq, SWelsFuncPtrList* pFunc, const int32_t kiSliceIdx) {
- SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;
- SMB* pMbList = pCurDq->sMbDataP;
- SSliceHeaderExt* sSliceHeaderExt = &pCurDq->sLayerInfo.pSliceInLayer[kiSliceIdx].sSliceHeaderExt;
+ SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;
+ SMB* pMbList = pCurDq->sMbDataP;
+ SSliceHeaderExt* sSliceHeaderExt = &pCurDq->sLayerInfo.pSliceInLayer[kiSliceIdx].sSliceHeaderExt;
SMB* pCurrentMbBlock;
- const int32_t kiMbWidth = pCurDq->iMbWidth;
- const int32_t kiMbHeight = pCurDq->iMbHeight;
- const int32_t kiTotalNumMb = kiMbWidth * kiMbHeight;
+ const int32_t kiMbWidth = pCurDq->iMbWidth;
+ const int32_t kiMbHeight = pCurDq->iMbHeight;
+ const int32_t kiTotalNumMb = kiMbWidth * kiMbHeight;
int32_t iCurMbIdx = 0, iNextMbIdx = 0, iNumMbFiltered = 0;
/* Step1: parameters set */
@@ -712,13 +712,13 @@
pFilter.iCsStride[1] = pCurDq->pDecPic->iLineSize[1];
pFilter.iCsStride[2] = pCurDq->pDecPic->iLineSize[2];
pFilter.iSliceAlphaC0Offset = sSliceHeaderExt->sSliceHeader.iSliceAlphaC0Offset;
- pFilter.iSliceBetaOffset = sSliceHeaderExt->sSliceHeader.iSliceBetaOffset;
- pFilter.iMbStride = kiMbWidth;
+ pFilter.iSliceBetaOffset = sSliceHeaderExt->sSliceHeader.iSliceBetaOffset;
+ pFilter.iMbStride = kiMbWidth;
iNextMbIdx = sSliceHeaderExt->sSliceHeader.iFirstMbInSlice;
for (; ;) {
- iCurMbIdx = iNextMbIdx;
+ iCurMbIdx = iNextMbIdx;
pCurrentMbBlock = &pMbList[ iCurMbIdx ];
pFilter.pCsData[0] = pCurDq->pDecPic->pData[0] + ((pCurrentMbBlock->iMbX + pCurrentMbBlock->iMbY * pFilter.iCsStride[0])
@@ -740,30 +740,30 @@
}
void PerformDeblockingFilter (sWelsEncCtx* pEnc) {
- const int32_t kiCurDid = pEnc->uiDependencyId;
- SWelsSvcCodingParam* pSvcParam = pEnc->pSvcParam;
- SSpatialLayerConfig* pSpatialLayer = &pSvcParam->sSpatialLayers[kiCurDid];
- SDqLayer* pCurLayer = pEnc->pCurDqLayer;
+ const int32_t kiCurDid = pEnc->uiDependencyId;
+ SWelsSvcCodingParam* pSvcParam = pEnc->pSvcParam;
+ SSpatialLayerConfig* pSpatialLayer = &pSvcParam->sSpatialLayers[kiCurDid];
+ SDqLayer* pCurLayer = pEnc->pCurDqLayer;
if (pCurLayer->iLoopFilterDisableIdc == 0) {
DeblockingFilterFrameAvcbase (pCurLayer, pEnc->pFuncList);
} else if (pCurLayer->iLoopFilterDisableIdc == 2) {
- int32_t iSliceCount = 0;
- int32_t iSliceIdx = 0;
+ int32_t iSliceCount = 0;
+ int32_t iSliceIdx = 0;
if (SM_DYN_SLICE != pSpatialLayer->sSliceCfg.uiSliceMode) {
- iSliceCount = GetCurrentSliceNum (pCurLayer->pSliceEncCtx);
+ iSliceCount = GetCurrentSliceNum (pCurLayer->pSliceEncCtx);
do {
DeblockingFilterSliceAvcbase (pCurLayer, pEnc->pFuncList, iSliceIdx);
++ iSliceIdx;
} while (iSliceIdx < iSliceCount);
- } else { // for dynamic slicing mode
- const int32_t kiNumPicPartition = pEnc->iActiveThreadsNum; //pSvcParam->iCountThreadsNum;
- int32_t iPartitionIdx = 0;
+ } else { // for dynamic slicing mode
+ const int32_t kiNumPicPartition = pEnc->iActiveThreadsNum; //pSvcParam->iCountThreadsNum;
+ int32_t iPartitionIdx = 0;
while (iPartitionIdx < kiNumPicPartition) {
- iSliceCount = pCurLayer->pNumSliceCodedOfPartition[iPartitionIdx];
- iSliceIdx = iPartitionIdx;
+ iSliceCount = pCurLayer->pNumSliceCodedOfPartition[iPartitionIdx];
+ iSliceIdx = iPartitionIdx;
do {
DeblockingFilterSliceAvcbase (pCurLayer, pEnc->pFuncList, iSliceIdx);
iSliceIdx += kiNumPicPartition;
--- a/codec/encoder/core/src/decode_mb_aux.cpp
+++ b/codec/encoder/core/src/decode_mb_aux.cpp
@@ -42,10 +42,10 @@
int32_t i = 4;
while (--i >= 0) {
- const int32_t kiIdx = i << 2;
- const int32_t kiIdx1 = 1 + kiIdx;
- const int32_t kiIdx2 = 1 + kiIdx1;
- const int32_t kiIdx3 = 1 + kiIdx2;
+ const int32_t kiIdx = i << 2;
+ const int32_t kiIdx1 = 1 + kiIdx;
+ const int32_t kiIdx2 = 1 + kiIdx1;
+ const int32_t kiIdx3 = 1 + kiIdx2;
iTemp[0] = pRes[kiIdx ] + pRes[kiIdx2];
iTemp[1] = pRes[kiIdx ] - pRes[kiIdx2];
@@ -60,9 +60,9 @@
i = 4;
while (--i >= 0) {
- const int32_t kiI4 = 4 + i;
- const int32_t kiI8 = 4 + kiI4;
- const int32_t kiI12 = 4 + kiI8;
+ const int32_t kiI4 = 4 + i;
+ const int32_t kiI8 = 4 + kiI4;
+ const int32_t kiI12 = 4 + kiI8;
iTemp[0] = pRes[i ] + pRes[kiI8 ];
iTemp[1] = pRes[i ] - pRes[kiI8 ];
@@ -78,14 +78,14 @@
/* for qp < 12 */
void WelsDequantLumaDc4x4 (int16_t* pRes, const int32_t kiQp) {
- int32_t i = 15;
- const uint16_t kuiDequantValue = g_kuiDequantCoeff[kiQp % 6][0];
- const int16_t kiQF0 = kiQp / 6;
- const int16_t kiQF1 = 2 - kiQF0;
- const int16_t kiQF0S = 1 << (1 - kiQF0);
+ int32_t i = 15;
+ const uint16_t kuiDequantValue = g_kuiDequantCoeff[kiQp % 6][0];
+ const int16_t kiQF0 = kiQp / 6;
+ const int16_t kiQF1 = 2 - kiQF0;
+ const int16_t kiQF0S = 1 << (1 - kiQF0);
while (i >= 0) {
- pRes[i ] = (pRes[i ] * kuiDequantValue + kiQF0S) >> kiQF1;
+ pRes[i ] = (pRes[i ] * kuiDequantValue + kiQF0S) >> kiQF1;
pRes[i - 1] = (pRes[i - 1] * kuiDequantValue + kiQF0S) >> kiQF1;
pRes[i - 2] = (pRes[i - 2] * kuiDequantValue + kiQF0S) >> kiQF1;
pRes[i - 3] = (pRes[i - 3] * kuiDequantValue + kiQF0S) >> kiQF1;
@@ -100,12 +100,12 @@
int32_t i;
for (i = 0; i < 16; i += 4) {
- iTemp[0] = pRes[i ] + pRes[i + 2];
- iTemp[1] = pRes[i ] - pRes[i + 2];
+ iTemp[0] = pRes[i ] + pRes[i + 2];
+ iTemp[1] = pRes[i ] - pRes[i + 2];
iTemp[2] = pRes[i + 1] - pRes[i + 3];
iTemp[3] = pRes[i + 1] + pRes[i + 3];
- pRes[i ] = iTemp[0] + iTemp[3];
+ pRes[i ] = iTemp[0] + iTemp[3];
pRes[i + 1] = iTemp[1] + iTemp[2];
pRes[i + 2] = iTemp[1] - iTemp[2];
pRes[i + 3] = iTemp[0] - iTemp[3];
@@ -112,12 +112,12 @@
}
for (i = 0; i < 4; i++) {
- iTemp[0] = pRes[i ] + pRes[i + 8 ];
- iTemp[1] = pRes[i ] - pRes[i + 8 ];
+ iTemp[0] = pRes[i ] + pRes[i + 8 ];
+ iTemp[1] = pRes[i ] - pRes[i + 8 ];
iTemp[2] = pRes[i + 4 ] - pRes[i + 12];
iTemp[3] = pRes[i + 4 ] + pRes[i + 12];
- pRes[i ] = (iTemp[0] + iTemp[3]) * kuiMF;
+ pRes[i ] = (iTemp[0] + iTemp[3]) * kuiMF;
pRes[i + 4 ] = (iTemp[1] + iTemp[2]) * kuiMF;
pRes[i + 8 ] = (iTemp[1] - iTemp[2]) * kuiMF;
pRes[i + 12] = (iTemp[0] - iTemp[3]) * kuiMF;
@@ -126,9 +126,9 @@
void WelsDequantIHadamard2x2Dc (int16_t* pDct, const uint16_t kuiMF) {
const int16_t kiSumU = pDct[0] + pDct[2];
- const int16_t kiDelU = pDct[0] - pDct[2];
+ const int16_t kiDelU = pDct[0] - pDct[2];
const int16_t kiSumD = pDct[1] + pDct[3];
- const int16_t kiDelD = pDct[1] - pDct[3];
+ const int16_t kiDelD = pDct[1] - pDct[3];
pDct[0] = ((kiSumU + kiSumD) * kuiMF) >> 1;
pDct[1] = ((kiSumU - kiSumD) * kuiMF) >> 1;
@@ -139,8 +139,8 @@
void WelsDequant4x4_c (int16_t* pRes, const uint16_t* kpMF) {
int32_t i;
for (i = 0; i < 8; i++) {
- pRes[i] *= kpMF[i];
- pRes[i + 8] *= kpMF[i];
+ pRes[i] *= kpMF[i];
+ pRes[i + 8] *= kpMF[i];
}
}
@@ -147,14 +147,14 @@
void WelsDequantFour4x4_c (int16_t* pRes, const uint16_t* kpMF) {
int32_t i;
for (i = 0; i < 8; i++) {
- pRes[i] *= kpMF[i];
- pRes[i + 8] *= kpMF[i];
- pRes[i + 16] *= kpMF[i];
- pRes[i + 24] *= kpMF[i];
- pRes[i + 32] *= kpMF[i];
- pRes[i + 40] *= kpMF[i];
- pRes[i + 48] *= kpMF[i];
- pRes[i + 56] *= kpMF[i];
+ pRes[i] *= kpMF[i];
+ pRes[i + 8] *= kpMF[i];
+ pRes[i + 16] *= kpMF[i];
+ pRes[i + 24] *= kpMF[i];
+ pRes[i + 32] *= kpMF[i];
+ pRes[i + 40] *= kpMF[i];
+ pRes[i + 48] *= kpMF[i];
+ pRes[i + 56] *= kpMF[i];
}
}
@@ -238,13 +238,13 @@
i = j << 2;
k = (j & 0x01) << 1;
r = j & 0x02;
- pBlock[i] = (0 + k + (0 + r) * kiStrideY) << 2;
- pBlock[i + 1] = (1 + k + (0 + r) * kiStrideY) << 2;
- pBlock[i + 2] = (0 + k + (1 + r) * kiStrideY) << 2;
- pBlock[i + 3] = (1 + k + (1 + r) * kiStrideY) << 2;
+ pBlock[i] = (0 + k + (0 + r) * kiStrideY) << 2;
+ pBlock[i + 1] = (1 + k + (0 + r) * kiStrideY) << 2;
+ pBlock[i + 2] = (0 + k + (1 + r) * kiStrideY) << 2;
+ pBlock[i + 3] = (1 + k + (1 + r) * kiStrideY) << 2;
- pBlock[16 + j] =
- pBlock[20 + j] = ((j & 0x01) + r * kiStrideUV) << 2;
+ pBlock[16 + j] =
+ pBlock[20 + j] = ((j & 0x01) + r * kiStrideUV) << 2;
}
}
--- a/codec/encoder/core/src/encode_mb_aux.cpp
+++ b/codec/encoder/core/src/encode_mb_aux.cpp
@@ -283,12 +283,12 @@
for (i = 0 ; i < 16 ; i += 4) {
iIdx = ((i & 0x08) << 4) + ((i & 0x04) << 3);
- s[0] = pDct[iIdx ] + pDct[iIdx + 80];
- s[3] = pDct[iIdx ] - pDct[iIdx + 80];
- s[1] = pDct[iIdx + 16] + pDct[iIdx + 64];
- s[2] = pDct[iIdx + 16] - pDct[iIdx + 64];
+ s[0] = pDct[iIdx ] + pDct[iIdx + 80];
+ s[3] = pDct[iIdx ] - pDct[iIdx + 80];
+ s[1] = pDct[iIdx + 16] + pDct[iIdx + 64];
+ s[2] = pDct[iIdx + 16] - pDct[iIdx + 64];
- p[i ] = s[0] + s[1];
+ p[i ] = s[0] + s[1];
p[i + 2] = s[0] - s[1];
p[i + 1] = s[3] + s[2];
p[i + 3] = s[3] - s[2];
@@ -295,12 +295,12 @@
}
for (i = 0 ; i < 4 ; i ++) {
- s[0] = p[i ] + p[i + 12];
- s[3] = p[i ] - p[i + 12];
- s[1] = p[i + 4] + p[i + 8];
- s[2] = p[i + 4] - p[i + 8];
+ s[0] = p[i ] + p[i + 12];
+ s[3] = p[i ] - p[i + 12];
+ s[1] = p[i + 4] + p[i + 8];
+ s[2] = p[i + 4] - p[i + 8];
- pLumaDc[i ] = WELS_CLIP3 ((s[0] + s[1] + 1) >> 1, -32768, 32767);
+ pLumaDc[i ] = WELS_CLIP3 ((s[0] + s[1] + 1) >> 1, -32768, 32767);
pLumaDc[i + 8 ] = WELS_CLIP3 ((s[0] - s[1] + 1) >> 1, -32768, 32767);
pLumaDc[i + 4 ] = WELS_CLIP3 ((s[3] + s[2] + 1) >> 1, -32768, 32767);
pLumaDc[i + 12] = WELS_CLIP3 ((s[3] - s[2] + 1) >> 1, -32768, 32767);
@@ -331,7 +331,7 @@
s[1] = pData[kiI1] + pData[kiI2];
s[2] = pData[kiI1] - pData[kiI2];
- pDct[i ] = s[0] + s[1];
+ pDct[i ] = s[0] + s[1];
pDct[kiI2] = s[0] - s[1];
pDct[kiI1] = (s[3] << 1) + s[2];
pDct[kiI3] = s[3] - (s[2] << 1);
@@ -339,9 +339,9 @@
/* vertical transform */
for (i = 0 ; i < 4 ; i ++) {
- const int32_t kiI4 = 4 + i;
- const int32_t kiI8 = 8 + i;
- const int32_t kiI12 = 12 + i;
+ const int32_t kiI4 = 4 + i;
+ const int32_t kiI8 = 8 + i;
+ const int32_t kiI12 = 12 + i;
s[0] = pDct[i ] + pDct[kiI12];
s[3] = pDct[i ] - pDct[kiI12];
@@ -348,7 +348,7 @@
s[1] = pDct[kiI4] + pDct[kiI8 ];
s[2] = pDct[kiI4] - pDct[kiI8 ];
- pDct[i ] = s[0] + s[1];
+ pDct[i ] = s[0] + s[1];
pDct[kiI8 ] = s[0] - s[1];
pDct[kiI4 ] = (s[3] << 1) + s[2];
pDct[kiI12] = s[3] - (s[2] << 1);
@@ -359,9 +359,9 @@
int32_t stride_1 = iStride1 << 2;
int32_t stride_2 = iStride2 << 2;
- WelsDctT4_c (pDct, &pPixel1[0], iStride1, &pPixel2[0], iStride2);
- WelsDctT4_c (pDct + 16, &pPixel1[4], iStride1, &pPixel2[4], iStride2);
- WelsDctT4_c (pDct + 32, &pPixel1[stride_1 ], iStride1, &pPixel2[stride_2 ], iStride2);
+ WelsDctT4_c (pDct, &pPixel1[0], iStride1, &pPixel2[0], iStride2);
+ WelsDctT4_c (pDct + 16, &pPixel1[4], iStride1, &pPixel2[4], iStride2);
+ WelsDctT4_c (pDct + 32, &pPixel1[stride_1 ], iStride1, &pPixel2[stride_2 ], iStride2);
WelsDctT4_c (pDct + 48, &pPixel1[stride_1 + 4], iStride1, &pPixel2[stride_2 + 4], iStride2);
}
--- a/codec/encoder/core/src/encoder.cpp
+++ b/codec/encoder/core/src/encoder.cpp
@@ -74,9 +74,9 @@
if (NULL == pSrcPic || kiWidth == 0 || kiHeight == 0)
return 1;
- pSrcPic->iColorFormat = kiColorspace;
- pSrcPic->iPicWidth = kiWidth;
- pSrcPic->iPicHeight = kiHeight;
+ pSrcPic->iColorFormat = kiColorspace;
+ pSrcPic->iPicWidth = kiWidth;
+ pSrcPic->iPicHeight = kiHeight;
//currently encoder only supports videoFormatI420.
if ((kiColorspace & (~videoFormatVFlip)) != videoFormatI420)
@@ -84,32 +84,32 @@
switch (kiColorspace & (~videoFormatVFlip)) {
case videoFormatI420:
case videoFormatYV12:
- pSrcPic->pData[0] = NULL;
- pSrcPic->pData[1] = NULL;
- pSrcPic->pData[2] = NULL;
- pSrcPic->pData[3] = NULL;
- pSrcPic->iStride[0] = kiWidth;
- pSrcPic->iStride[2] = pSrcPic->iStride[1] = kiWidth >> 1;
- pSrcPic->iStride[3] = 0;
+ pSrcPic->pData[0] = NULL;
+ pSrcPic->pData[1] = NULL;
+ pSrcPic->pData[2] = NULL;
+ pSrcPic->pData[3] = NULL;
+ pSrcPic->iStride[0] = kiWidth;
+ pSrcPic->iStride[2] = pSrcPic->iStride[1] = kiWidth >> 1;
+ pSrcPic->iStride[3] = 0;
break;
case videoFormatYUY2:
case videoFormatYVYU:
case videoFormatUYVY:
- pSrcPic->pData[0] = NULL;
- pSrcPic->pData[1] = NULL;
- pSrcPic->pData[2] = NULL;
- pSrcPic->pData[3] = NULL;
- pSrcPic->iStride[0] = CALC_BI_STRIDE (kiWidth, 16);
- pSrcPic->iStride[3] = pSrcPic->iStride[2] = pSrcPic->iStride[1] = 0;
+ pSrcPic->pData[0] = NULL;
+ pSrcPic->pData[1] = NULL;
+ pSrcPic->pData[2] = NULL;
+ pSrcPic->pData[3] = NULL;
+ pSrcPic->iStride[0] = CALC_BI_STRIDE (kiWidth, 16);
+ pSrcPic->iStride[3] = pSrcPic->iStride[2] = pSrcPic->iStride[1] = 0;
break;
case videoFormatRGB:
case videoFormatBGR:
- pSrcPic->pData[0] = NULL;
- pSrcPic->pData[1] = NULL;
- pSrcPic->pData[2] = NULL;
- pSrcPic->pData[3] = NULL;
- pSrcPic->iStride[0] = CALC_BI_STRIDE (kiWidth, 24);
- pSrcPic->iStride[3] = pSrcPic->iStride[2] = pSrcPic->iStride[1] = 0;
+ pSrcPic->pData[0] = NULL;
+ pSrcPic->pData[1] = NULL;
+ pSrcPic->pData[2] = NULL;
+ pSrcPic->pData[3] = NULL;
+ pSrcPic->iStride[0] = CALC_BI_STRIDE (kiWidth, 24);
+ pSrcPic->iStride[3] = pSrcPic->iStride[2] = pSrcPic->iStride[1] = 0;
if (kiColorspace & videoFormatVFlip)
pSrcPic->iColorFormat = kiColorspace & (~videoFormatVFlip);
else
@@ -119,12 +119,12 @@
case videoFormatRGBA:
case videoFormatARGB:
case videoFormatABGR:
- pSrcPic->pData[0] = NULL;
- pSrcPic->pData[1] = NULL;
- pSrcPic->pData[2] = NULL;
- pSrcPic->pData[3] = NULL;
- pSrcPic->iStride[0] = kiWidth << 2;
- pSrcPic->iStride[3] = pSrcPic->iStride[2] = pSrcPic->iStride[1] = 0;
+ pSrcPic->pData[0] = NULL;
+ pSrcPic->pData[1] = NULL;
+ pSrcPic->pData[2] = NULL;
+ pSrcPic->pData[3] = NULL;
+ pSrcPic->iStride[0] = kiWidth << 2;
+ pSrcPic->iStride[3] = pSrcPic->iStride[2] = pSrcPic->iStride[1] = 0;
if (kiColorspace & videoFormatVFlip)
pSrcPic->iColorFormat = kiColorspace & (~videoFormatVFlip);
else
@@ -231,8 +231,8 @@
*/
void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) {
// for bitstream writing
- pEncCtx->iPosBsBuffer = 0; // reset bs pBuffer position
- pEncCtx->pOut->iNalIndex = 0; // reset NAL index
+ pEncCtx->iPosBsBuffer = 0; // reset bs pBuffer position
+ pEncCtx->pOut->iNalIndex = 0; // reset NAL index
InitBits (&pEncCtx->pOut->sBsWrite, pEncCtx->pOut->pBsBuffer, pEncCtx->pOut->uiSize);
@@ -250,20 +250,20 @@
else
pEncCtx->iFrameNum = 0; // if iFrameNum overflow
}
- pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;
- pEncCtx->eSliceType = P_SLICE;
- pEncCtx->eNalPriority = NRI_PRI_HIGH;
+ pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;
+ pEncCtx->eSliceType = P_SLICE;
+ pEncCtx->eNalPriority = NRI_PRI_HIGH;
} else if (keFrameType == videoFrameTypeIDR) {
- pEncCtx->iFrameNum = 0;
- pEncCtx->iPOC = 0;
+ pEncCtx->iFrameNum = 0;
+ pEncCtx->iPOC = 0;
pEncCtx->bEncCurFrmAsIdrFlag = false;
pEncCtx->iFrameIndex = 0;
- pEncCtx->eNalType = NAL_UNIT_CODED_SLICE_IDR;
- pEncCtx->eSliceType = I_SLICE;
- pEncCtx->eNalPriority = NRI_PRI_HIGHEST;
+ pEncCtx->eNalType = NAL_UNIT_CODED_SLICE_IDR;
+ pEncCtx->eSliceType = I_SLICE;
+ pEncCtx->eNalPriority = NRI_PRI_HIGHEST;
- pEncCtx->iCodingIndex = 0;
+ pEncCtx->iCodingIndex = 0;
// reset_ref_list
@@ -281,9 +281,9 @@
pEncCtx->iFrameNum = 0; // if iFrameNum overflow
}
- pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;
- pEncCtx->eSliceType = I_SLICE;
- pEncCtx->eNalPriority = NRI_PRI_HIGHEST;
+ pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;
+ pEncCtx->eSliceType = I_SLICE;
+ pEncCtx->eNalPriority = NRI_PRI_HIGHEST;
// rc_init_gop
} else { // B pictures are not supported now, any else?
@@ -393,13 +393,13 @@
if (NULL != pDumpRecFile) {
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 kiChromaWidth = kiLumaWidth >> 1;
- const int32_t kiChromaHeight = kiLumaHeight >> 1;
+ 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 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];
@@ -460,13 +460,13 @@
if (NULL != pDumpRecFile) {
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 kiChromaWidth = kiLumaWidth >> 1;
- const int32_t kiChromaHeight = kiLumaHeight >> 1;
+ 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 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];
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -391,10 +391,10 @@
SSpatialLayerConfig* pSpatialLayer = &pCodingParam->sSpatialLayers[i];
const int32_t kiPicWidth = pSpatialLayer->iVideoWidth;
const int32_t kiPicHeight = pSpatialLayer->iVideoHeight;
- uint32_t iMbWidth = 0;
- uint32_t iMbHeight = 0;
- int32_t iMbNumInFrame = 0;
- uint32_t iMaxSliceNum = MAX_SLICES_NUM;
+ uint32_t iMbWidth = 0;
+ uint32_t iMbHeight = 0;
+ int32_t iMbNumInFrame = 0;
+ uint32_t iMaxSliceNum = MAX_SLICES_NUM;
if ((kiPicWidth <= 0) || (kiPicHeight <= 0) || (kiPicWidth > MAX_WIDTH) || (kiPicHeight > MAX_HEIGHT)) {
WelsLog (pLogCtx, WELS_LOG_ERROR,
"ParamValidationExt(),width(1-%d),height(1-%d)invalid %d x %d in dependency layer settings!", MAX_WIDTH, MAX_HEIGHT,
@@ -436,8 +436,8 @@
case SM_FIXEDSLCNUM_SLICE: {
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
- iMbWidth = (kiPicWidth + 15) >> 4;
- iMbHeight = (kiPicHeight + 15) >> 4;
+ iMbWidth = (kiPicWidth + 15) >> 4;
+ iMbHeight = (kiPicHeight + 15) >> 4;
iMbNumInFrame = iMbWidth * iMbHeight;
iMaxSliceNum = MAX_SLICES_NUM;
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0
@@ -490,8 +490,8 @@
case SM_RASTER_SLICE: {
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
- iMbWidth = (kiPicWidth + 15) >> 4;
- iMbHeight = (kiPicHeight + 15) >> 4;
+ iMbWidth = (kiPicWidth + 15) >> 4;
+ iMbHeight = (kiPicHeight + 15) >> 4;
iMbNumInFrame = iMbWidth * iMbHeight;
iMaxSliceNum = MAX_SLICES_NUM;
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0] <= 0) {
@@ -532,8 +532,8 @@
case SM_ROWMB_SLICE: {
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
- iMbWidth = (kiPicWidth + 15) >> 4;
- iMbHeight = (kiPicHeight + 15) >> 4;
+ iMbWidth = (kiPicWidth + 15) >> 4;
+ iMbHeight = (kiPicHeight + 15) >> 4;
iMaxSliceNum = MAX_SLICES_NUM;
if (iMbHeight > iMaxSliceNum) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings more than MAX(%d)!",
@@ -556,8 +556,8 @@
}
break;
case SM_DYN_SLICE: {
- iMbWidth = (kiPicWidth + 15) >> 4;
- iMbHeight = (kiPicHeight + 15) >> 4;
+ iMbWidth = (kiPicWidth + 15) >> 4;
+ iMbHeight = (kiPicHeight + 15) >> 4;
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint <= 0) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid iSliceSize (%d) settings!",
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint);
@@ -674,10 +674,10 @@
*/
static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam, int32_t* pCountLayers,
int32_t* pCountNals) {
- int32_t iCountNumLayers = 0;
- int32_t iCountNumNals = 0;
- int32_t iNumDependencyLayers = 0;
- int32_t iDIndex = 0;
+ int32_t iCountNumLayers = 0;
+ int32_t iCountNumNals = 0;
+ int32_t iNumDependencyLayers = 0;
+ int32_t iDIndex = 0;
if (NULL == pParam || NULL == ppCtx || NULL == *ppCtx)
return 1;
@@ -754,16 +754,16 @@
static void InitMbInfo (sWelsEncCtx* pEnc, SMB* pList, SDqLayer* pLayer, const int32_t kiDlayerId,
const int32_t kiMaxMbNum) {
- int32_t iMbWidth = pLayer->iMbWidth;
- int32_t iMbHeight = pLayer->iMbHeight;
+ int32_t iMbWidth = pLayer->iMbWidth;
+ int32_t iMbHeight = pLayer->iMbHeight;
int32_t iIdx;
- int32_t iMbNum = iMbWidth * iMbHeight;
+ int32_t iMbNum = iMbWidth * iMbHeight;
SSliceCtx* pSliceCtx = pLayer->pSliceEncCtx;
uint32_t uiNeighborAvail;
- const int32_t kiOffset = (kiDlayerId & 0x01) * kiMaxMbNum;
- SMVUnitXY (*pLayerMvUnitBlock4x4)[MB_BLOCK4x4_NUM] = (SMVUnitXY (*)[MB_BLOCK4x4_NUM]) (
+ const int32_t kiOffset = (kiDlayerId & 0x01) * kiMaxMbNum;
+ SMVUnitXY (*pLayerMvUnitBlock4x4)[MB_BLOCK4x4_NUM] = (SMVUnitXY (*)[MB_BLOCK4x4_NUM]) (
&pEnc->pMvUnitBlock4x4[MB_BLOCK4x4_NUM * kiOffset]);
- int8_t (*pLayerRefIndexBlock8x8)[MB_BLOCK8x8_NUM] = (int8_t (*)[MB_BLOCK8x8_NUM]) (
+ int8_t (*pLayerRefIndexBlock8x8)[MB_BLOCK8x8_NUM] = (int8_t (*)[MB_BLOCK8x8_NUM]) (
&pEnc->pRefIndexBlock4x4[MB_BLOCK8x8_NUM * kiOffset]);
for (iIdx = 0; iIdx < iMbNum; iIdx++) {
@@ -804,8 +804,8 @@
if (bRightTop) {
uiNeighborAvail |= TOPRIGHT_MB_POS;
}
- pList[iIdx].uiSliceIdc = uiSliceIdc; // merge from svc_hd_opt_b for multiple slices coding
- pList[iIdx].uiNeighborAvail = uiNeighborAvail;
+ pList[iIdx].uiSliceIdc = uiSliceIdc; // merge from svc_hd_opt_b for multiple slices coding
+ pList[iIdx].uiNeighborAvail = uiNeighborAvail;
uiNeighborAvail = 0;
if (pList[iIdx].iMbX >= BASE_MV_MB_NMB)
uiNeighborAvail |= LEFT_MB_POS;
@@ -816,22 +816,22 @@
if (pList[iIdx].iMbY <= (iMbHeight - 1 - BASE_MV_MB_NMB))
uiNeighborAvail |= BOTTOM_MB_POS;
- pList[iIdx].sMv = pLayerMvUnitBlock4x4[iIdx];
- pList[iIdx].pRefIndex = pLayerRefIndexBlock8x8[iIdx];
- pList[iIdx].pSadCost = &pEnc->pSadCostMb[iIdx];
- pList[iIdx].pIntra4x4PredMode = &pEnc->pIntra4x4PredModeBlocks[iIdx * INTRA_4x4_MODE_NUM];
- pList[iIdx].pNonZeroCount = &pEnc->pNonZeroCountBlocks[iIdx * MB_LUMA_CHROMA_BLOCK4x4_NUM];
+ pList[iIdx].sMv = pLayerMvUnitBlock4x4[iIdx];
+ pList[iIdx].pRefIndex = pLayerRefIndexBlock8x8[iIdx];
+ pList[iIdx].pSadCost = &pEnc->pSadCostMb[iIdx];
+ pList[iIdx].pIntra4x4PredMode = &pEnc->pIntra4x4PredModeBlocks[iIdx * INTRA_4x4_MODE_NUM];
+ pList[iIdx].pNonZeroCount = &pEnc->pNonZeroCountBlocks[iIdx * MB_LUMA_CHROMA_BLOCK4x4_NUM];
}
}
int32_t InitMbListD (sWelsEncCtx** ppCtx) {
- int32_t iNumDlayer = (*ppCtx)->pSvcParam->iSpatialLayerNum;
- int32_t iMbSize[MAX_DEPENDENCY_LAYER] = { 0 };
- int32_t iOverallMbNum = 0;
- int32_t iMbWidth = 0;
- int32_t iMbHeight = 0;
- int32_t i;
+ int32_t iNumDlayer = (*ppCtx)->pSvcParam->iSpatialLayerNum;
+ int32_t iMbSize[MAX_DEPENDENCY_LAYER] = { 0 };
+ int32_t iOverallMbNum = 0;
+ int32_t iMbWidth = 0;
+ int32_t iMbHeight = 0;
+ int32_t i;
if (iNumDlayer > MAX_DEPENDENCY_LAYER)
return 1;
@@ -923,14 +923,14 @@
int32_t iRet = 0;
if (!kbUseSubsetSps) {
- pSps = & (pCtx->pSpsArray[kiSpsId]);
+ pSps = & (pCtx->pSpsArray[kiSpsId]);
} else {
- pSubsetSps = & (pCtx->pSubsetArray[kiSpsId]);
- pSps = &pSubsetSps->pSps;
+ pSubsetSps = & (pCtx->pSubsetArray[kiSpsId]);
+ pSps = &pSubsetSps->pSps;
}
- SWelsSvcCodingParam* pParam = pCtx->pSvcParam;
- SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex];
+ SWelsSvcCodingParam* pParam = pCtx->pSvcParam;
+ SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex];
// Need port pSps/pPps initialization due to spatial scalability changed
if (!kbUseSubsetSps) {
iRet = WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
@@ -1070,25 +1070,25 @@
* \return 0 - successful; otherwise failed
*/
static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingParasetList) {
- SWelsSvcCodingParam* pParam = NULL;
- SWelsSPS* pSps = NULL;
- SSubsetSps* pSubsetSps = NULL;
- SWelsPPS* pPps = NULL;
- CMemoryAlign* pMa = NULL;
- int32_t iDlayerCount = 0;
- int32_t iDlayerIndex = 0;
- uint32_t iSpsId = 0;
- uint32_t iPpsId = 0;
- uint32_t iNumRef = 0;
- int32_t iResult = 0;
+ SWelsSvcCodingParam* pParam = NULL;
+ SWelsSPS* pSps = NULL;
+ SSubsetSps* pSubsetSps = NULL;
+ SWelsPPS* pPps = NULL;
+ CMemoryAlign* pMa = NULL;
+ int32_t iDlayerCount = 0;
+ int32_t iDlayerIndex = 0;
+ uint32_t iSpsId = 0;
+ uint32_t iPpsId = 0;
+ uint32_t iNumRef = 0;
+ int32_t iResult = 0;
if (NULL == ppCtx || NULL == *ppCtx)
return 1;
- pMa = (*ppCtx)->pMemAlign;
- pParam = (*ppCtx)->pSvcParam;
- iDlayerCount = pParam->iSpatialLayerNum;
- iNumRef = pParam->iMaxNumRefFrame;
+ pMa = (*ppCtx)->pMemAlign;
+ pParam = (*ppCtx)->pSvcParam;
+ iDlayerCount = pParam->iSpatialLayerNum;
+ iNumRef = pParam->iMaxNumRefFrame;
const int32_t kiFeatureStrategyIndex = FME_DEFAULT_FEATURE_INDEX;
const int32_t kiMe16x16 = ME_DIA_CROSS;
@@ -1098,16 +1098,15 @@
iDlayerIndex = 0;
while (iDlayerIndex < iDlayerCount) {
- SRefList* pRefList = NULL;
- uint32_t i = 0;
- const int32_t kiWidth = pParam->sSpatialLayers[iDlayerIndex].iVideoWidth;
- const int32_t kiHeight = pParam->sSpatialLayers[iDlayerIndex].iVideoHeight;
- int32_t iPicWidth = WELS_ALIGN (kiWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with iWidth of horizon
- int32_t iPicChromaWidth = iPicWidth >> 1;
+ SRefList* pRefList = NULL;
+ uint32_t i = 0;
+ const int32_t kiWidth = pParam->sSpatialLayers[iDlayerIndex].iVideoWidth;
+ const int32_t kiHeight = pParam->sSpatialLayers[iDlayerIndex].iVideoHeight;
+ int32_t iPicWidth = WELS_ALIGN (kiWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with iWidth of horizon
+ int32_t iPicChromaWidth = iPicWidth >> 1;
- iPicWidth = WELS_ALIGN (iPicWidth,
- 32); // 32(or 16 for chroma below) to match original imp. here instead of iCacheLineSize
- iPicChromaWidth = WELS_ALIGN (iPicChromaWidth, 16);
+ iPicWidth = WELS_ALIGN (iPicWidth, 32); // 32(or 16 for chroma below) to match original imp. here instead of iCacheLineSize
+ iPicChromaWidth = WELS_ALIGN (iPicChromaWidth, 16);
WelsGetEncBlockStrideOffset ((*ppCtx)->pStrideTab->pStrideEncBlockOffset[iDlayerIndex], iPicWidth, iPicChromaWidth);
@@ -1128,11 +1127,11 @@
iDlayerIndex = 0;
while (iDlayerIndex < iDlayerCount) {
- SDqLayer* pDqLayer = NULL;
- SSpatialLayerConfig* pDlayer = &pParam->sSpatialLayers[iDlayerIndex];
- const int32_t kiMbW = (pDlayer->iVideoWidth + 0x0f) >> 4;
- const int32_t kiMbH = (pDlayer->iVideoHeight + 0x0f) >> 4;
- int32_t iMaxSliceNum = 1;
+ SDqLayer* pDqLayer = NULL;
+ SSpatialLayerConfig* pDlayer = &pParam->sSpatialLayers[iDlayerIndex];
+ const int32_t kiMbW = (pDlayer->iVideoWidth + 0x0f) >> 4;
+ const int32_t kiMbH = (pDlayer->iVideoHeight + 0x0f) >> 4;
+ int32_t iMaxSliceNum = 1;
const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sSliceCfg);
if (iMaxSliceNum < kiSliceNum)
iMaxSliceNum = kiSliceNum;
@@ -1143,11 +1142,11 @@
// for dynamic slicing mode
if (SM_DYN_SLICE == pDlayer->sSliceCfg.uiSliceMode) {
- const int32_t iSize = pParam->iCountThreadsNum * sizeof (int32_t);
+ const int32_t iSize = pParam->iCountThreadsNum * sizeof (int32_t);
- pDqLayer->pNumSliceCodedOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pNumSliceCodedOfPartition");
- pDqLayer->pLastCodedMbIdxOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pLastCodedMbIdxOfPartition");
- pDqLayer->pLastMbIdxOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pLastMbIdxOfPartition");
+ pDqLayer->pNumSliceCodedOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pNumSliceCodedOfPartition");
+ pDqLayer->pLastCodedMbIdxOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pLastCodedMbIdxOfPartition");
+ pDqLayer->pLastMbIdxOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pLastMbIdxOfPartition");
WELS_VERIFY_RETURN_PROC_IF (1,
(NULL == pDqLayer->pNumSliceCodedOfPartition ||
@@ -1156,8 +1155,8 @@
FreeMemorySvc (ppCtx))
}
- pDqLayer->iMbWidth = kiMbW;
- pDqLayer->iMbHeight = kiMbH;
+ pDqLayer->iMbWidth = kiMbW;
+ pDqLayer->iMbHeight = kiMbH;
{
int32_t iSliceIdx = 0;
pDqLayer->sLayerInfo.pSliceInLayer = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "pSliceInLayer");
@@ -1181,8 +1180,8 @@
// fix issue in case single pSlice coding might be inclusive exist in variant spatial layer setting, also introducing multi-pSlice modes
else { // only one pSlice
SSlice* pSlice = &pDqLayer->sLayerInfo.pSliceInLayer[0];
- pSlice->uiSliceIdx = 0;
- pSlice->pSliceBsa = & (*ppCtx)->pOut->sBsWrite;
+ pSlice->uiSliceIdx = 0;
+ pSlice->pSliceBsa = & (*ppCtx)->pOut->sBsWrite;
if (AllocMbCacheAligned (&pSlice->sMbCacheInfo, pMa)) {
FreeMemorySvc (ppCtx);
return 1;
@@ -1192,11 +1191,11 @@
//deblocking parameters initialization
//target-layer deblocking
- pDqLayer->iLoopFilterDisableIdc = pParam->iLoopFilterDisableIdc;
- pDqLayer->iLoopFilterAlphaC0Offset = (pParam->iLoopFilterAlphaC0Offset) << 1;
- pDqLayer->iLoopFilterBetaOffset = (pParam->iLoopFilterBetaOffset) << 1;
+ pDqLayer->iLoopFilterDisableIdc = pParam->iLoopFilterDisableIdc;
+ pDqLayer->iLoopFilterAlphaC0Offset = (pParam->iLoopFilterAlphaC0Offset) << 1;
+ pDqLayer->iLoopFilterBetaOffset = (pParam->iLoopFilterBetaOffset) << 1;
//parallel deblocking
- pDqLayer->bDeblockingParallelFlag = pParam->bDeblockingParallelFlag;
+ pDqLayer->bDeblockingParallelFlag = pParam->bDeblockingParallelFlag;
//deblocking parameter adjustment
if (SM_SINGLE_SLICE == pDlayer->sSliceCfg.uiSliceMode) {
@@ -1278,9 +1277,9 @@
iDlayerIndex = 0;
while (iDlayerIndex < iDlayerCount) {
- SDqIdc* pDqIdc = & (*ppCtx)->pDqIdcMap[iDlayerIndex];
- const bool bUseSubsetSps = (!pParam->bSimulcastAVC) && (iDlayerIndex > BASE_DEPENDENCY_ID);
- SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex];
+ SDqIdc* pDqIdc = & (*ppCtx)->pDqIdcMap[iDlayerIndex];
+ const bool bUseSubsetSps = (!pParam->bSimulcastAVC) && (iDlayerIndex > BASE_DEPENDENCY_ID);
+ SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex];
bool bSvcBaselayer = (!pParam->bSimulcastAVC) && (iDlayerCount > BASE_DEPENDENCY_ID)
&& (iDlayerIndex == BASE_DEPENDENCY_ID);
pDqIdc->uiSpatialId = iDlayerIndex;
@@ -1403,11 +1402,11 @@
}
int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers) {
- CMemoryAlign* pMa = (*ppCtx)->pMemAlign;
- SWelsSvcCodingParam* pParam = (*ppCtx)->pSvcParam;
- SStrideTables* pPtr = NULL;
- int16_t* pTmpRow = NULL, *pRowX = NULL, *pRowY = NULL, *p = NULL;
- uint8_t* pBase = NULL;
+ CMemoryAlign* pMa = (*ppCtx)->pMemAlign;
+ SWelsSvcCodingParam* pParam = (*ppCtx)->pSvcParam;
+ SStrideTables* pPtr = NULL;
+ int16_t* pTmpRow = NULL, *pRowX = NULL, *pRowY = NULL, *p = NULL;
+ uint8_t* pBase = NULL;
uint8_t* pBaseDec = NULL, *pBaseEnc = NULL, *pBaseMbX = NULL, *pBaseMbY = NULL;
struct {
int32_t iMbWidth;
@@ -1417,19 +1416,19 @@
int32_t iLineSizeY[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
int32_t iLineSizeUV[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
int32_t iMapSpatialIdx[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
- int32_t iSizeDec = 0;
- int32_t iSizeEnc = 0;
- int32_t iCountLayersNeedCs[2] = {0};
+ int32_t iSizeDec = 0;
+ int32_t iSizeEnc = 0;
+ int32_t iCountLayersNeedCs[2] = {0};
const int32_t kiUnit1Size = 24 * sizeof (int32_t);
- int32_t iUnit2Size = 0;
- int32_t iNeedAllocSize = 0;
- int32_t iRowSize = 0;
- int16_t iMaxMbWidth = 0;
- int16_t iMaxMbHeight = 0;
- int32_t i = 0;
- int32_t iSpatialIdx = 0;
- int32_t iTemporalIdx = 0;
- int32_t iCntTid = 0;
+ int32_t iUnit2Size = 0;
+ int32_t iNeedAllocSize = 0;
+ int32_t iRowSize = 0;
+ int16_t iMaxMbWidth = 0;
+ int16_t iMaxMbHeight = 0;
+ int32_t i = 0;
+ int32_t iSpatialIdx = 0;
+ int32_t iTemporalIdx = 0;
+ int32_t iCntTid = 0;
if (kiNumSpatialLayers <= 0 || kiNumSpatialLayers > MAX_DEPENDENCY_LAYER)
return 1;
@@ -1447,8 +1446,8 @@
const int32_t kiTmpHeight = (pParam->sSpatialLayers[iSpatialIdx].iVideoHeight + 15) >> 4;
int32_t iNumMb = kiTmpWidth * kiTmpHeight;
- sMbSizeMap[iSpatialIdx].iMbWidth = kiTmpWidth;
- sMbSizeMap[iSpatialIdx].iCountMbNum = iNumMb;
+ sMbSizeMap[iSpatialIdx].iMbWidth = kiTmpWidth;
+ sMbSizeMap[iSpatialIdx].iCountMbNum = iNumMb;
iNumMb *= sizeof (int16_t);
sMbSizeMap[iSpatialIdx].iSizeAllMbAlignCache = iNumMb;
@@ -1467,7 +1466,7 @@
SSpatialLayerConfig* fDlp = &pParam->sSpatialLayers[iSpatialIdx];
const int32_t kiWidthPad = WELS_ALIGN (fDlp->iVideoWidth, 16) + (PADDING_LENGTH << 1);
- iLineSizeY[iSpatialIdx][kbBaseTemporalFlag] = WELS_ALIGN (kiWidthPad, 32);
+ iLineSizeY[iSpatialIdx][kbBaseTemporalFlag] = WELS_ALIGN (kiWidthPad, 32);
iLineSizeUV[iSpatialIdx][kbBaseTemporalFlag] = WELS_ALIGN ((kiWidthPad >> 1), 16);
iMapSpatialIdx[iCountLayersNeedCs[kbBaseTemporalFlag]][kbBaseTemporalFlag] = iSpatialIdx;
@@ -1486,10 +1485,10 @@
return 1;
}
- pBaseDec = pBase; // iCountLayersNeedCs
- pBaseEnc = pBaseDec + iSizeDec; // iNumSpatialLayers
- pBaseMbX = pBaseEnc + iSizeEnc; // iNumSpatialLayers
- pBaseMbY = pBaseMbX + iUnit2Size; // iNumSpatialLayers
+ pBaseDec = pBase; // iCountLayersNeedCs
+ pBaseEnc = pBaseDec + iSizeDec; // iNumSpatialLayers
+ pBaseMbX = pBaseEnc + iSizeEnc; // iNumSpatialLayers
+ pBaseMbY = pBaseMbX + iUnit2Size; // iNumSpatialLayers
iTemporalIdx = 0;
while (iTemporalIdx < iCntTid) {
@@ -1498,8 +1497,8 @@
iSpatialIdx = 0;
while (iSpatialIdx < iCountLayersNeedCs[kbBaseTemporalFlag]) {
const int32_t kiActualSpatialIdx = iMapSpatialIdx[iSpatialIdx][kbBaseTemporalFlag];
- const int32_t kiLumaWidth = iLineSizeY[kiActualSpatialIdx][kbBaseTemporalFlag];
- const int32_t kiChromaWidth = iLineSizeUV[kiActualSpatialIdx][kbBaseTemporalFlag];
+ const int32_t kiLumaWidth = iLineSizeY[kiActualSpatialIdx][kbBaseTemporalFlag];
+ const int32_t kiChromaWidth = iLineSizeUV[kiActualSpatialIdx][kbBaseTemporalFlag];
WelsGetEncBlockStrideOffset ((int32_t*)pBaseDec, kiLumaWidth, kiChromaWidth);
@@ -1552,10 +1551,10 @@
while (iSpatialIdx < kiNumSpatialLayers) {
const int32_t kiAllocMbSize = sMbSizeMap[iSpatialIdx].iSizeAllMbAlignCache;
- pPtr->pStrideEncBlockOffset[iSpatialIdx] = (int32_t*)pBaseEnc;
+ pPtr->pStrideEncBlockOffset[iSpatialIdx] = (int32_t*)pBaseEnc;
- pPtr->pMbIndexX[iSpatialIdx] = (int16_t*)pBaseMbX;
- pPtr->pMbIndexY[iSpatialIdx] = (int16_t*)pBaseMbY;
+ pPtr->pMbIndexX[iSpatialIdx] = (int16_t*)pBaseMbX;
+ pPtr->pMbIndexY[iSpatialIdx] = (int16_t*)pBaseMbY;
pBaseEnc += kiUnit1Size;
pBaseMbX += kiAllocMbSize;
@@ -1565,11 +1564,11 @@
}
while (iSpatialIdx < MAX_DEPENDENCY_LAYER) {
- pPtr->pStrideDecBlockOffset[iSpatialIdx][0] = NULL;
- pPtr->pStrideDecBlockOffset[iSpatialIdx][1] = NULL;
- pPtr->pStrideEncBlockOffset[iSpatialIdx] = NULL;
- pPtr->pMbIndexX[iSpatialIdx] = NULL;
- pPtr->pMbIndexY[iSpatialIdx] = NULL;
+ pPtr->pStrideDecBlockOffset[iSpatialIdx][0] = NULL;
+ pPtr->pStrideDecBlockOffset[iSpatialIdx][1] = NULL;
+ pPtr->pStrideEncBlockOffset[iSpatialIdx] = NULL;
+ pPtr->pMbIndexX[iSpatialIdx] = NULL;
+ pPtr->pMbIndexY[iSpatialIdx] = NULL;
++ iSpatialIdx;
}
@@ -1576,9 +1575,9 @@
// initialize pMbIndexX and pMbIndexY tables as below
- iMaxMbWidth = sMbSizeMap[kiNumSpatialLayers - 1].iMbWidth;
- iMaxMbWidth = WELS_ALIGN (iMaxMbWidth, 4); // 4 loops for int16_t required introduced as below
- iRowSize = iMaxMbWidth * sizeof (int16_t);
+ iMaxMbWidth = sMbSizeMap[kiNumSpatialLayers - 1].iMbWidth;
+ iMaxMbWidth = WELS_ALIGN (iMaxMbWidth, 4); // 4 loops for int16_t required introduced as below
+ iRowSize = iMaxMbWidth * sizeof (int16_t);
pTmpRow = (int16_t*)pMa->WelsMalloc (iRowSize, "pTmpRow");
if (NULL == pTmpRow) {
@@ -1590,10 +1589,10 @@
i = 0;
p = pRowX;
while (i < iMaxMbWidth) {
- *p = i;
- * (p + 1) = 1 + i;
- * (p + 2) = 2 + i;
- * (p + 3) = 3 + i;
+ *p = i;
+ * (p + 1) = 1 + i;
+ * (p + 2) = 2 + i;
+ * (p + 3) = 3 + i;
p += 4;
i += 4;
@@ -1602,9 +1601,9 @@
iSpatialIdx = kiNumSpatialLayers;
while (--iSpatialIdx >= 0) {
int16_t* pMbIndexX = pPtr->pMbIndexX[iSpatialIdx];
- const int32_t kiMbWidth = sMbSizeMap[iSpatialIdx].iMbWidth;
- const int32_t kiMbHeight = sMbSizeMap[iSpatialIdx].iCountMbNum / kiMbWidth;
- const int32_t kiLineSize = kiMbWidth * sizeof (int16_t);
+ const int32_t kiMbWidth = sMbSizeMap[iSpatialIdx].iMbWidth;
+ const int32_t kiMbHeight = sMbSizeMap[iSpatialIdx].iCountMbNum / kiMbWidth;
+ const int32_t kiLineSize = kiMbWidth * sizeof (int16_t);
i = 0;
while (i < kiMbHeight) {
@@ -1625,9 +1624,9 @@
int16_t j = 0;
for (iSpatialIdx = kiNumSpatialLayers - 1; iSpatialIdx >= 0; -- iSpatialIdx) {
- const int32_t kiMbWidth = sMbSizeMap[iSpatialIdx].iMbWidth;
+ const int32_t kiMbWidth = sMbSizeMap[iSpatialIdx].iMbWidth;
const int32_t kiMbHeight = sMbSizeMap[iSpatialIdx].iCountMbNum / kiMbWidth;
- const int32_t kiLineSize = kiMbWidth * sizeof (int16_t);
+ const int32_t kiLineSize = kiMbWidth * sizeof (int16_t);
int16_t* pMbIndexY = pPtr->pMbIndexY[iSpatialIdx] + i * kiMbWidth;
if (i < kiMbHeight) {
@@ -1709,22 +1708,22 @@
iMvdRange = WELS_MIN (iMvdRange, iFixMvdRange);
}
int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingParasetList) {
- SWelsSvcCodingParam* pParam = (*ppCtx)->pSvcParam;
- CMemoryAlign* pMa = (*ppCtx)->pMemAlign;
- SSpatialLayerConfig* pFinalSpatial = NULL;
- int32_t iCountBsLen = 0;
- int32_t iCountNals = 0;
- int32_t iMaxPicWidth = 0;
- int32_t iMaxPicHeight = 0;
- int32_t iCountMaxMbNum = 0;
- int32_t iIndex = 0;
- int32_t iCountLayers = 0;
- int32_t iResult = 0;
- float fCompressRatioThr = .5f;
- const int32_t kiNumDependencyLayers = pParam->iSpatialLayerNum;
- int32_t iVclLayersBsSizeCount = 0;
- int32_t iNonVclLayersBsSizeCount = 0;
- int32_t iTargetSpatialBsSize = 0;
+ SWelsSvcCodingParam* pParam = (*ppCtx)->pSvcParam;
+ CMemoryAlign* pMa = (*ppCtx)->pMemAlign;
+ SSpatialLayerConfig* pFinalSpatial = NULL;
+ int32_t iCountBsLen = 0;
+ int32_t iCountNals = 0;
+ int32_t iMaxPicWidth = 0;
+ int32_t iMaxPicHeight = 0;
+ int32_t iCountMaxMbNum = 0;
+ int32_t iIndex = 0;
+ int32_t iCountLayers = 0;
+ int32_t iResult = 0;
+ float fCompressRatioThr = .5f;
+ const int32_t kiNumDependencyLayers = pParam->iSpatialLayerNum;
+ int32_t iVclLayersBsSizeCount = 0;
+ int32_t iNonVclLayersBsSizeCount = 0;
+ int32_t iTargetSpatialBsSize = 0;
if (kiNumDependencyLayers < 1 || kiNumDependencyLayers > MAX_DEPENDENCY_LAYER) {
WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc() failed due to invalid iNumDependencyLayers(%d)!",
@@ -1741,9 +1740,9 @@
return 1;
}
- pFinalSpatial = &pParam->sSpatialLayers[kiNumDependencyLayers - 1];
- iMaxPicWidth = pFinalSpatial->iVideoWidth;
- iMaxPicHeight = pFinalSpatial->iVideoHeight;
+ pFinalSpatial = &pParam->sSpatialLayers[kiNumDependencyLayers - 1];
+ iMaxPicWidth = pFinalSpatial->iVideoWidth;
+ iMaxPicHeight = pFinalSpatial->iVideoHeight;
iCountMaxMbNum = ((15 + iMaxPicWidth) >> 4) * ((15 + iMaxPicHeight) >> 4);
iResult = AcquireLayersNals (ppCtx, pParam, &iCountLayers, &iCountNals);
@@ -1780,15 +1779,15 @@
// Output
(*ppCtx)->pOut = (SWelsEncoderOutput*)pMa->WelsMalloc (sizeof (SWelsEncoderOutput), "SWelsEncoderOutput");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut), FreeMemorySvc (ppCtx))
- (*ppCtx)->pOut->pBsBuffer = (uint8_t*)pMa->WelsMalloc (iCountBsLen, "pOut->pBsBuffer");
+ (*ppCtx)->pOut->pBsBuffer = (uint8_t*)pMa->WelsMalloc (iCountBsLen, "pOut->pBsBuffer");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pBsBuffer), FreeMemorySvc (ppCtx))
- (*ppCtx)->pOut->uiSize = iCountBsLen;
- (*ppCtx)->pOut->sNalList = (SWelsNalRaw*)pMa->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList");
+ (*ppCtx)->pOut->uiSize = iCountBsLen;
+ (*ppCtx)->pOut->sNalList = (SWelsNalRaw*)pMa->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->sNalList), FreeMemorySvc (ppCtx))
- (*ppCtx)->pOut->pNalLen = (int32_t*)pMa->WelsMallocz (iCountNals * sizeof (int32_t), "pOut->pNalLen");
+ (*ppCtx)->pOut->pNalLen = (int32_t*)pMa->WelsMallocz (iCountNals * sizeof (int32_t), "pOut->pNalLen");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pNalLen), FreeMemorySvc (ppCtx))
- (*ppCtx)->pOut->iCountNals = iCountNals;
- (*ppCtx)->pOut->iNalIndex = 0;
+ (*ppCtx)->pOut->iCountNals = iCountNals;
+ (*ppCtx)->pOut->iNalIndex = 0;
if (pParam->iMultipleThreadIdc > 1) {
const int32_t iTotalLength = iCountBsLen + (iTargetSpatialBsSize * ((*ppCtx)->iMaxSliceCount - 1));
@@ -1929,9 +1928,9 @@
int32_t iMvdRange = 0;
GetMvMvdRange (pParam, (*ppCtx)->iMvRange, iMvdRange);
- const uint32_t kuiMvdInterTableSize = (iMvdRange << 2); //intepel*4=qpel
- const uint32_t kuiMvdInterTableStride = 1 + (kuiMvdInterTableSize << 1);//qpel_mv_range*2=(+/-);
- const uint32_t kuiMvdCacheAlignedSize = kuiMvdInterTableStride * sizeof (uint16_t);
+ const uint32_t kuiMvdInterTableSize = (iMvdRange << 2); //intepel*4=qpel
+ const uint32_t kuiMvdInterTableStride = 1 + (kuiMvdInterTableSize << 1);//qpel_mv_range*2=(+/-);
+ const uint32_t kuiMvdCacheAlignedSize = kuiMvdInterTableStride * sizeof (uint16_t);
(*ppCtx)->iMvdCostTableSize = kuiMvdInterTableSize;
(*ppCtx)->iMvdCostTableStride = kuiMvdInterTableStride;
@@ -2227,13 +2226,13 @@
uint16_t iMaxSliceCount = 0;
do {
- SSpatialLayerConfig* pDlp = &pCodingParam->sSpatialLayers[iSpatialIdx];
- SSliceConfig* pMso = &pDlp->sSliceCfg;
- SSliceArgument* pSlcArg = &pMso->sSliceArgument;
- const int32_t kiMbWidth = (pDlp->iVideoWidth + 15) >> 4;
- const int32_t kiMbHeight = (pDlp->iVideoHeight + 15) >> 4;
- const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight;
- int32_t iSliceNum = (SM_AUTO_SLICE == pMso->uiSliceMode) ? kiCpuCores : pSlcArg->uiSliceNum;
+ SSpatialLayerConfig* pDlp = &pCodingParam->sSpatialLayers[iSpatialIdx];
+ SSliceConfig* pMso = &pDlp->sSliceCfg;
+ SSliceArgument* pSlcArg = &pMso->sSliceArgument;
+ const int32_t kiMbWidth = (pDlp->iVideoWidth + 15) >> 4;
+ const int32_t kiMbHeight = (pDlp->iVideoHeight + 15) >> 4;
+ const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight;
+ int32_t iSliceNum = (SM_AUTO_SLICE == pMso->uiSliceMode) ? kiCpuCores : pSlcArg->uiSliceNum;
// NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode,
// uiSliceNum of current spatial layer settings equals to uiCpuCores number; SM_DYN_SLICE mode,
// uiSliceNum intials as uiCpuCores also, stay tuned dynamically slicing in future
@@ -2430,10 +2429,10 @@
*/
int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingParam, SLogContext* pLogCtx,
SExistingParasetList* pExistingParasetList) {
- sWelsEncCtx* pCtx = NULL;
- int32_t iRet = 0;
- int16_t iSliceNum = 1; // number of slices used
- int32_t iCacheLineSize = 16; // on chip cache line size in byte
+ sWelsEncCtx* pCtx = NULL;
+ int32_t iRet = 0;
+ int16_t iSliceNum = 1; // number of slices used
+ int32_t iCacheLineSize = 16; // on chip cache line size in byte
uint32_t uiCpuFeatureFlags = 0;
if (NULL == ppCtx || NULL == pCodingParam) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), NULL == ppCtx(0x%p) or NULL == pCodingParam(0x%p).",
@@ -2554,7 +2553,7 @@
if (iCount > 0) {
int32_t iCountNumIMb = pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][Intra4x4] +
pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][Intra16x16] + pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][7];
- int32_t iCountNumPMb = pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra4x4] +
+ int32_t iCountNumPMb = pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra4x4] +
pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra16x16] +
pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][7] +
pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x16] +
@@ -2563,7 +2562,7 @@
pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x8] +
pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][10] +
pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][PSkip];
- int32_t count_p_mbL0 = pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x16] +
+ int32_t count_p_mbL0 = pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x16] +
pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x8] +
pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x16] +
pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x8] +
@@ -2670,16 +2669,16 @@
}
void DynslcUpdateMbNeighbourInfoListForAllSlices (SSliceCtx* pSliceCtx, SMB* pMbList) {
- const int32_t kiMbWidth = pSliceCtx->iMbWidth;
- const int32_t kiEndMbInSlice = pSliceCtx->iMbNumInFrame - 1;
- int32_t iIdx = 0;
+ const int32_t kiMbWidth = pSliceCtx->iMbWidth;
+ const int32_t kiEndMbInSlice = pSliceCtx->iMbNumInFrame - 1;
+ int32_t iIdx = 0;
do {
SMB* pMb = &pMbList[iIdx];
- uint32_t uiNeighborAvailFlag = 0;
- const int32_t kiMbXY = pMb->iMbXY;
- const int32_t kiMbX = pMb->iMbX;
- const int32_t kiMbY = pMb->iMbY;
+ uint32_t uiNeighborAvailFlag = 0;
+ const int32_t kiMbXY = pMb->iMbXY;
+ const int32_t kiMbX = pMb->iMbX;
+ const int32_t kiMbY = pMb->iMbY;
bool bLeft;
bool bTop;
bool bLeftTop;
@@ -2730,8 +2729,8 @@
void WelsInitCurrentQBLayerMltslc (sWelsEncCtx* pCtx) {
//pData init
- SDqLayer* pCurDq = pCtx->pCurDqLayer;
- SSliceCtx* pSliceCtx = (pCurDq->pSliceEncCtx);
+ SDqLayer* pCurDq = pCtx->pCurDqLayer;
+ SSliceCtx* pSliceCtx = (pCurDq->pSliceEncCtx);
//mb_neighbor
DynslcUpdateMbNeighbourInfoListForAllSlices (pSliceCtx, pCurDq->sMbDataP);
@@ -2738,10 +2737,10 @@
}
void UpdateSlicepEncCtxWithPartition (SSliceCtx* pSliceCtx, int32_t iPartitionNum) {
- const int32_t kiMbNumInFrame = pSliceCtx->iMbNumInFrame;
- int32_t iCountMbNumPerPartition = kiMbNumInFrame;
- int32_t iAssignableMbLeft = kiMbNumInFrame;
- int32_t iFirstMbIdx = 0;
+ const int32_t kiMbNumInFrame = pSliceCtx->iMbNumInFrame;
+ int32_t iCountMbNumPerPartition = kiMbNumInFrame;
+ int32_t iAssignableMbLeft = kiMbNumInFrame;
+ int32_t iFirstMbIdx = 0;
int32_t i/*, j*/;
if (iPartitionNum <= 0)
@@ -2770,15 +2769,15 @@
}
void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) {
- SDqLayer* pCurDq = pCtx->pCurDqLayer;
- SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;
+ SDqLayer* pCurDq = pCtx->pCurDqLayer;
+ SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;
UpdateSlicepEncCtxWithPartition (pSliceCtx, iPartitionNum);
if (I_SLICE == pCtx->eSliceType) { //check if uiSliceSizeConstraint too small
#define byte_complexIMBat26 (60)
- uint8_t iCurDid = pCtx->uiDependencyId;
- uint32_t uiFrmByte = 0;
+ uint8_t iCurDid = pCtx->uiDependencyId;
+ uint32_t uiFrmByte = 0;
if (pCtx->pSvcParam->iRCMode != RC_OFF_MODE) {
//RC case
@@ -2826,20 +2825,20 @@
void WelsInitCurrentLayer (sWelsEncCtx* pCtx,
const int32_t kiWidth,
const int32_t kiHeight) {
- SWelsSvcCodingParam* pParam = pCtx->pSvcParam;
- SPicture* pEncPic = pCtx->pEncPic;
- SPicture* pDecPic = pCtx->pDecPic;
- SDqLayer* pCurDq = pCtx->pCurDqLayer;
- SSlice* pBaseSlice = &pCurDq->sLayerInfo.pSliceInLayer[0];
- SSlice* pSlice = NULL;
- const uint8_t kiCurDid = pCtx->uiDependencyId;
+ SWelsSvcCodingParam* pParam = pCtx->pSvcParam;
+ SPicture* pEncPic = pCtx->pEncPic;
+ SPicture* pDecPic = pCtx->pDecPic;
+ SDqLayer* pCurDq = pCtx->pCurDqLayer;
+ SSlice* pBaseSlice = &pCurDq->sLayerInfo.pSliceInLayer[0];
+ SSlice* pSlice = NULL;
+ const uint8_t kiCurDid = pCtx->uiDependencyId;
const bool kbUseSubsetSpsFlag = (!pParam->bSimulcastAVC) && (kiCurDid > BASE_DEPENDENCY_ID);
- SSpatialLayerConfig* fDlp = &pParam->sSpatialLayers[kiCurDid];
- SNalUnitHeaderExt* pNalHdExt = &pCurDq->sLayerInfo.sNalHeaderExt;
- SNalUnitHeader* pNalHd = &pNalHdExt->sNalUnitHeader;
- SDqIdc* pDqIdc = &pCtx->pDqIdcMap[kiCurDid];
- int32_t iIdx = 0;
- int32_t iSliceCount = 0;
+ SSpatialLayerConfig* fDlp = &pParam->sSpatialLayers[kiCurDid];
+ SNalUnitHeaderExt* pNalHdExt = &pCurDq->sLayerInfo.sNalHeaderExt;
+ SNalUnitHeader* pNalHd = &pNalHdExt->sNalUnitHeader;
+ SDqIdc* pDqIdc = &pCtx->pDqIdcMap[kiCurDid];
+ int32_t iIdx = 0;
+ int32_t iSliceCount = 0;
if (NULL == pCurDq)
return;
@@ -2859,19 +2858,19 @@
iCurPpsId = pCtx->sPSOVector.iPpsIdList[pDqIdc->iPpsId][WELS_ABS (pCtx->uiIdrPicId - 1) % MAX_PPS_COUNT];
}
- pBaseSlice->sSliceHeaderExt.sSliceHeader.iPpsId = iCurPpsId;
- pCurDq->sLayerInfo.pPpsP =
- pBaseSlice->sSliceHeaderExt.sSliceHeader.pPps = &pCtx->pPPSArray[iCurPpsId];
+ pBaseSlice->sSliceHeaderExt.sSliceHeader.iPpsId = iCurPpsId;
+ pCurDq->sLayerInfo.pPpsP =
+ pBaseSlice->sSliceHeaderExt.sSliceHeader.pPps = &pCtx->pPPSArray[iCurPpsId];
- pBaseSlice->sSliceHeaderExt.sSliceHeader.iSpsId = iCurSpsId;
+ pBaseSlice->sSliceHeaderExt.sSliceHeader.iSpsId = iCurSpsId;
if (kbUseSubsetSpsFlag) {
- pCurDq->sLayerInfo.pSubsetSpsP = &pCtx->pSubsetArray[iCurSpsId];
- pCurDq->sLayerInfo.pSpsP =
- pBaseSlice->sSliceHeaderExt.sSliceHeader.pSps = &pCurDq->sLayerInfo.pSubsetSpsP->pSps;
+ pCurDq->sLayerInfo.pSubsetSpsP = &pCtx->pSubsetArray[iCurSpsId];
+ pCurDq->sLayerInfo.pSpsP =
+ pBaseSlice->sSliceHeaderExt.sSliceHeader.pSps = &pCurDq->sLayerInfo.pSubsetSpsP->pSps;
} else {
- pCurDq->sLayerInfo.pSubsetSpsP = NULL;
- pCurDq->sLayerInfo.pSpsP =
- pBaseSlice->sSliceHeaderExt.sSliceHeader.pSps = &pCtx->pSpsArray[iCurSpsId];
+ pCurDq->sLayerInfo.pSubsetSpsP = NULL;
+ pCurDq->sLayerInfo.pSpsP =
+ pBaseSlice->sSliceHeaderExt.sSliceHeader.pSps = &pCtx->pSpsArray[iCurSpsId];
}
pSlice = pBaseSlice;
@@ -2878,24 +2877,24 @@
iIdx = 1;
while (iIdx < iSliceCount) {
++ pSlice;
- pSlice->sSliceHeaderExt.sSliceHeader.iPpsId = pBaseSlice->sSliceHeaderExt.sSliceHeader.iPpsId;
- pSlice->sSliceHeaderExt.sSliceHeader.pPps = pBaseSlice->sSliceHeaderExt.sSliceHeader.pPps;
- pSlice->sSliceHeaderExt.sSliceHeader.iSpsId = pBaseSlice->sSliceHeaderExt.sSliceHeader.iSpsId;
- pSlice->sSliceHeaderExt.sSliceHeader.pSps = pBaseSlice->sSliceHeaderExt.sSliceHeader.pSps;
+ pSlice->sSliceHeaderExt.sSliceHeader.iPpsId = pBaseSlice->sSliceHeaderExt.sSliceHeader.iPpsId;
+ pSlice->sSliceHeaderExt.sSliceHeader.pPps = pBaseSlice->sSliceHeaderExt.sSliceHeader.pPps;
+ pSlice->sSliceHeaderExt.sSliceHeader.iSpsId = pBaseSlice->sSliceHeaderExt.sSliceHeader.iSpsId;
+ pSlice->sSliceHeaderExt.sSliceHeader.pSps = pBaseSlice->sSliceHeaderExt.sSliceHeader.pSps;
++ iIdx;
}
memset (pNalHdExt, 0, sizeof (SNalUnitHeaderExt));
- pNalHd->uiNalRefIdc = pCtx->eNalPriority;
- pNalHd->eNalUnitType = pCtx->eNalType;
+ pNalHd->uiNalRefIdc = pCtx->eNalPriority;
+ pNalHd->eNalUnitType = pCtx->eNalType;
- pNalHdExt->uiDependencyId = kiCurDid;
- pNalHdExt->bDiscardableFlag = (pCtx->bNeedPrefixNalFlag) ? (pNalHd->uiNalRefIdc == NRI_PRI_LOWEST) : false;
- pNalHdExt->bIdrFlag = (pCtx->iFrameNum == 0) && ((pCtx->eNalType == NAL_UNIT_CODED_SLICE_IDR)
- || (pCtx->eSliceType == I_SLICE));
- pNalHdExt->uiTemporalId = pCtx->uiTemporalId;
+ pNalHdExt->uiDependencyId = kiCurDid;
+ pNalHdExt->bDiscardableFlag = (pCtx->bNeedPrefixNalFlag) ? (pNalHd->uiNalRefIdc == NRI_PRI_LOWEST) : false;
+ pNalHdExt->bIdrFlag = (pCtx->iFrameNum == 0) && ((pCtx->eNalType == NAL_UNIT_CODED_SLICE_IDR)
+ || (pCtx->eSliceType == I_SLICE));
+ pNalHdExt->uiTemporalId = pCtx->uiTemporalId;
- pBaseSlice->bSliceHeaderExtFlag = (NAL_UNIT_CODED_SLICE_EXT == pNalHd->eNalUnitType);
+ pBaseSlice->bSliceHeaderExtFlag = (NAL_UNIT_CODED_SLICE_EXT == pNalHd->eNalUnitType);
pSlice = pBaseSlice;
iIdx = 1;
@@ -2906,19 +2905,19 @@
}
// pEncPic pData
- pCurDq->pEncData[0] = pEncPic->pData[0];
- pCurDq->pEncData[1] = pEncPic->pData[1];
- pCurDq->pEncData[2] = pEncPic->pData[2];
- pCurDq->iEncStride[0] = pEncPic->iLineSize[0];
- pCurDq->iEncStride[1] = pEncPic->iLineSize[1];
- pCurDq->iEncStride[2] = pEncPic->iLineSize[2];
+ pCurDq->pEncData[0] = pEncPic->pData[0];
+ pCurDq->pEncData[1] = pEncPic->pData[1];
+ pCurDq->pEncData[2] = pEncPic->pData[2];
+ pCurDq->iEncStride[0] = pEncPic->iLineSize[0];
+ pCurDq->iEncStride[1] = pEncPic->iLineSize[1];
+ pCurDq->iEncStride[2] = pEncPic->iLineSize[2];
// cs pData
- pCurDq->pCsData[0] = pDecPic->pData[0];
- pCurDq->pCsData[1] = pDecPic->pData[1];
- pCurDq->pCsData[2] = pDecPic->pData[2];
- pCurDq->iCsStride[0] = pDecPic->iLineSize[0];
- pCurDq->iCsStride[1] = pDecPic->iLineSize[1];
- pCurDq->iCsStride[2] = pDecPic->iLineSize[2];
+ pCurDq->pCsData[0] = pDecPic->pData[0];
+ pCurDq->pCsData[1] = pDecPic->pData[1];
+ pCurDq->pCsData[2] = pDecPic->pData[2];
+ pCurDq->iCsStride[0] = pDecPic->iLineSize[0];
+ pCurDq->iCsStride[1] = pDecPic->iLineSize[1];
+ pCurDq->iCsStride[2] = pDecPic->iLineSize[2];
if (pCurDq->pRefLayer != NULL) {
pCurDq->bBaseLayerAvailableFlag = true;
@@ -2970,9 +2969,9 @@
void PreprocessSliceCoding (sWelsEncCtx* pCtx) {
- SDqLayer* pCurLayer = pCtx->pCurDqLayer;
- //const bool kbBaseAvail = pCurLayer->bBaseLayerAvailableFlag;
- const bool kbHighestSpatialLayer =
+ SDqLayer* pCurLayer = pCtx->pCurDqLayer;
+ //const bool kbBaseAvail = pCurLayer->bBaseLayerAvailableFlag;
+ const bool kbHighestSpatialLayer =
(pCtx->pSvcParam->iSpatialLayerNum == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1));
SWelsFuncPtrList* pFuncList = pCtx->pFuncList;
SLogContext* pLogCtx = & (pCtx->sLogCtx);
@@ -3090,13 +3089,13 @@
static inline void WelsSwapDqLayers (sWelsEncCtx* pCtx) {
// swap and assign reference
- const int32_t kiDid = pCtx->uiDependencyId;
- const int32_t kiNextDqIdx = 1 + kiDid;
+ const int32_t kiDid = pCtx->uiDependencyId;
+ const int32_t kiNextDqIdx = 1 + kiDid;
- SDqLayer* pTmpLayer = pCtx->ppDqLayerList[kiNextDqIdx];
- SDqLayer* pRefLayer = pCtx->pCurDqLayer;
- pCtx->pCurDqLayer = pTmpLayer;
- pCtx->pCurDqLayer->pRefLayer = pRefLayer;
+ SDqLayer* pTmpLayer = pCtx->ppDqLayerList[kiNextDqIdx];
+ SDqLayer* pRefLayer = pCtx->pCurDqLayer;
+ pCtx->pCurDqLayer = pTmpLayer;
+ pCtx->pCurDqLayer->pRefLayer = pRefLayer;
}
/*!
@@ -3111,12 +3110,12 @@
assert (kiSliceCount > 0);
if (keFrameType != videoFrameTypeIDR) {
assert (pCtx->iNumRef0 > 0);
- pCtx->pRefPic = pCtx->pRefList0[0]; // always get item 0 due to reordering done
- pCtx->pCurDqLayer->pRefPic = pCtx->pRefPic;
- uiRefIdx = 0; // reordered reference iIndex
- } else { // safe for IDR coding
- pCtx->pRefPic = NULL;
- pCtx->pCurDqLayer->pRefPic = NULL;
+ pCtx->pRefPic = pCtx->pRefList0[0]; // always get item 0 due to reordering done
+ pCtx->pCurDqLayer->pRefPic = pCtx->pRefPic;
+ uiRefIdx = 0; // reordered reference iIndex
+ } else { // safe for IDR coding
+ pCtx->pRefPic = NULL;
+ pCtx->pCurDqLayer->pRefPic = NULL;
}
iIdx = 0;
@@ -3132,17 +3131,17 @@
const uint32_t kuiMaxIdInBs) { //paraset_type = 0: SPS; =1: PPS
//SPS_ID in avc_sps and pSubsetSps will be different using this
//SPS_ID case example:
- //1st enter: next_spsid_in_bs == 0; spsid == 0; delta==0; //actual spsid_in_bs == 0
- //1st finish: next_spsid_in_bs == 1;
- //2nd enter: next_spsid_in_bs == 1; spsid == 0; delta==1; //actual spsid_in_bs == 1
- //2nd finish: next_spsid_in_bs == 2;
- //31st enter: next_spsid_in_bs == 31; spsid == 0~2; delta==31~29; //actual spsid_in_bs == 31
- //31st finish: next_spsid_in_bs == 0;
- //31st enter: next_spsid_in_bs == 0; spsid == 0~2; delta==-2~0; //actual spsid_in_bs == 0
- //31st finish: next_spsid_in_bs == 1;
+ //1st enter: next_spsid_in_bs == 0; spsid == 0; delta==0; //actual spsid_in_bs == 0
+ //1st finish: next_spsid_in_bs == 1;
+ //2nd enter: next_spsid_in_bs == 1; spsid == 0; delta==1; //actual spsid_in_bs == 1
+ //2nd finish: next_spsid_in_bs == 2;
+ //31st enter: next_spsid_in_bs == 31; spsid == 0~2; delta==31~29; //actual spsid_in_bs == 31
+ //31st finish:next_spsid_in_bs == 0;
+ //31st enter: next_spsid_in_bs == 0; spsid == 0~2; delta==-2~0; //actual spsid_in_bs == 0
+ //31st finish:next_spsid_in_bs == 1;
- const int32_t kiEncId = kiCurEncoderParaSetId;
- uint32_t uiNextIdInBs = sParaSetOffsetVariable->uiNextParaSetIdToUseInBs;
+ const int32_t kiEncId = kiCurEncoderParaSetId;
+ uint32_t uiNextIdInBs = sParaSetOffsetVariable->uiNextParaSetIdToUseInBs;
//update current layer's pCodingParam
sParaSetOffsetVariable->iParaSetIdDelta[kiEncId] = uiNextIdInBs -
@@ -3225,12 +3224,12 @@
* \return writing results, success or error
*/
int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pNumNal, int32_t* pTotalLength) {
- int32_t iSize = 0;
- int32_t iNal = 0;
- int32_t iIdx = 0;
- int32_t iId = 0;
- int32_t iCountNal = 0;
- int32_t iNalLength = 0;
+ int32_t iSize = 0;
+ int32_t iNal = 0;
+ int32_t iIdx = 0;
+ int32_t iId = 0;
+ int32_t iCountNal = 0;
+ int32_t iNalLength = 0;
int32_t iReturn = ENC_RETURN_SUCCESS;
if (NULL == pCtx || NULL == pNalLen || NULL == pNumNal)
@@ -3298,8 +3297,8 @@
WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
pNalLen[iCountNal] = iNalLength;
- pCtx->iPosBsBuffer += iNalLength;
- iSize += iNalLength;
+ pCtx->iPosBsBuffer += iNalLength;
+ iSize += iNalLength;
++ iIdx;
++ iCountNal;
@@ -3384,13 +3383,13 @@
int32_t WritePadding (sWelsEncCtx* pCtx, int32_t iLen, int32_t& iSize) {
int32_t i = 0;
- int32_t iNal = 0;
- SBitStringAux* pBs = NULL;
+ int32_t iNal = 0;
+ SBitStringAux* pBs = NULL;
int32_t iNalLen;
iSize = 0;
- iNal = pCtx->pOut->iNalIndex;
- pBs = &pCtx->pOut->sBsWrite; // SBitStringAux instance for non VCL NALs decoding
+ iNal = pCtx->pOut->iNalIndex;
+ pBs = &pCtx->pOut->sBsWrite; // SBitStringAux instance for non VCL NALs decoding
if ((pBs->pEndBuf - pBs->pCurBuf) < iLen || iNal >= pCtx->pOut->iCountNals) {
#if GOM_TRACE_FLAG
@@ -3416,8 +3415,8 @@
&iNalLen);
WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
- pCtx->iPosBsBuffer += iNalLen;
- iSize += iNalLen;
+ pCtx->iPosBsBuffer += iNalLen;
+ iSize += iNalLen;
return ENC_RETURN_SUCCESS;
}
@@ -3487,15 +3486,15 @@
iReturn = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal, &iNonVclSize);
WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
- pLayerBsInfo->uiSpatialId = 0;
- pLayerBsInfo->uiTemporalId = 0;
- pLayerBsInfo->uiQualityId = 0;
- pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
- pLayerBsInfo->iNalCount = iCountNal;
+ pLayerBsInfo->uiSpatialId = 0;
+ pLayerBsInfo->uiTemporalId = 0;
+ pLayerBsInfo->uiQualityId = 0;
+ pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
+ pLayerBsInfo->iNalCount = iCountNal;
//point to next pLayerBsInfo
++ pLayerBsInfo;
- pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
+ pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
//update for external countings
++ iLayerNum;
@@ -3524,15 +3523,15 @@
iCountNal = 1;
//finish writing one NAL
- pLayerBsInfo->uiSpatialId = iIdx;
- pLayerBsInfo->uiTemporalId = 0;
- pLayerBsInfo->uiQualityId = 0;
- pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
- pLayerBsInfo->iNalCount = iCountNal;
+ pLayerBsInfo->uiSpatialId = iIdx;
+ pLayerBsInfo->uiTemporalId = 0;
+ pLayerBsInfo->uiQualityId = 0;
+ pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
+ pLayerBsInfo->iNalCount = iCountNal;
//point to next pLayerBsInfo
++ pLayerBsInfo;
- pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
+ pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
//update for external countings
iCountNal = 0;
@@ -3555,15 +3554,15 @@
iCountNal = 1;
//finish writing one NAL
- pLayerBsInfo->uiSpatialId = iIdx;
- pLayerBsInfo->uiTemporalId = 0;
- pLayerBsInfo->uiQualityId = 0;
- pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
- pLayerBsInfo->iNalCount = iCountNal;
+ pLayerBsInfo->uiSpatialId = iIdx;
+ pLayerBsInfo->uiTemporalId = 0;
+ pLayerBsInfo->uiQualityId = 0;
+ pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
+ pLayerBsInfo->iNalCount = iCountNal;
//point to next pLayerBsInfo
++ pLayerBsInfo;
- pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
+ pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
//update for external countings
iCountNal = 0;
@@ -3603,15 +3602,15 @@
//finish writing one NAL
}
- pLayerBsInfo->uiSpatialId = iSpatialId;
- pLayerBsInfo->uiTemporalId = 0;
- pLayerBsInfo->uiQualityId = 0;
- pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
- pLayerBsInfo->iNalCount = iCountNal;
+ pLayerBsInfo->uiSpatialId = iSpatialId;
+ pLayerBsInfo->uiTemporalId = 0;
+ pLayerBsInfo->uiQualityId = 0;
+ pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
+ pLayerBsInfo->iNalCount = iCountNal;
//point to next pLayerBsInfo
++ pLayerBsInfo;
- pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
+ pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
//update for external countings
iCountNal = 0;
@@ -3638,15 +3637,15 @@
//finish writing one NAL
}
- pLayerBsInfo->uiSpatialId = iSpatialId;
- pLayerBsInfo->uiTemporalId = 0;
- pLayerBsInfo->uiQualityId = 0;
- pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
- pLayerBsInfo->iNalCount = iCountNal;
+ pLayerBsInfo->uiSpatialId = iSpatialId;
+ pLayerBsInfo->uiTemporalId = 0;
+ pLayerBsInfo->uiQualityId = 0;
+ pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
+ pLayerBsInfo->iNalCount = iCountNal;
//point to next pLayerBsInfo
++ pLayerBsInfo;
- pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
+ pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
//update for external countings
iCountNal = 0;
@@ -3676,29 +3675,29 @@
if (pCtx == NULL) {
return ENC_RETURN_MEMALLOCERR;
}
- SLayerBSInfo* pLayerBsInfo = &pFbi->sLayerInfo[0];
- SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
+ SLayerBSInfo* pLayerBsInfo = &pFbi->sLayerInfo[0];
+ SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0];
#if defined(ENABLE_FRAME_DUMP) || defined(ENABLE_PSNR_CALC)
- SPicture* fsnr = NULL;
+ SPicture* fsnr = NULL;
#endif//ENABLE_FRAME_DUMP || ENABLE_PSNR_CALC
- SPicture* pEncPic = NULL; // to be decided later
- int32_t iDidList[MAX_DEPENDENCY_LAYER] = {0};
- int32_t iLayerNum = 0;
- int32_t iLayerSize = 0;
- int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame
- int32_t iSpatialIdx = 0; // iIndex of spatial layers due to frame size changed in this given frame
- int32_t iFrameSize = 0;
- int32_t iNalIdxInLayer = 0;
- int32_t iCountNal = 0;
- EVideoFrameType eFrameType = videoFrameTypeInvalid;
- int32_t iCurWidth = 0;
- int32_t iCurHeight = 0;
- EWelsNalUnitType eNalType = NAL_UNIT_UNSPEC_0;
- EWelsNalRefIdc eNalRefIdc = NRI_PRI_LOWEST;
- int8_t iCurDid = 0;
- int8_t iCurTid = 0;
- bool bAvcBased = false;
+ SPicture* pEncPic = NULL; // to be decided later
+ int32_t iDidList[MAX_DEPENDENCY_LAYER] = {0};
+ int32_t iLayerNum = 0;
+ int32_t iLayerSize = 0;
+ int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame
+ int32_t iSpatialIdx = 0; // iIndex of spatial layers due to frame size changed in this given frame
+ int32_t iFrameSize = 0;
+ int32_t iNalIdxInLayer = 0;
+ int32_t iCountNal = 0;
+ EVideoFrameType eFrameType = videoFrameTypeInvalid;
+ int32_t iCurWidth = 0;
+ int32_t iCurHeight = 0;
+ EWelsNalUnitType eNalType = NAL_UNIT_UNSPEC_0;
+ EWelsNalRefIdc eNalRefIdc = NRI_PRI_LOWEST;
+ int8_t iCurDid = 0;
+ int8_t iCurTid = 0;
+ bool bAvcBased = false;
SLogContext* pLogCtx = & (pCtx->sLogCtx);
#if defined(ENABLE_PSNR_CALC)
float fSnrY = .0f, fSnrU = .0f, fSnrV = .0f;
@@ -3775,24 +3774,24 @@
WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
}
- pCtx->pCurDqLayer = pCtx->ppDqLayerList[pSpatialIndexMap->iDid];
- pCtx->pCurDqLayer->pRefLayer = NULL;
+ pCtx->pCurDqLayer = pCtx->ppDqLayerList[pSpatialIndexMap->iDid];
+ pCtx->pCurDqLayer->pRefLayer = NULL;
while (iSpatialIdx < iSpatialNum) {
- const int32_t iDidIdx = (pSpatialIndexMap + iSpatialIdx)->iDid; // get iDid
- SSpatialLayerConfig* pParam = &pSvcParam->sSpatialLayers[iDidIdx];
+ const int32_t iDidIdx = (pSpatialIndexMap + iSpatialIdx)->iDid; // get iDid
+ SSpatialLayerConfig* pParam = &pSvcParam->sSpatialLayers[iDidIdx];
- pCtx->uiDependencyId = iCurDid = (int8_t)iDidIdx;
+ pCtx->uiDependencyId = iCurDid = (int8_t)iDidIdx;
pCtx->pVpp->AnalyzeSpatialPic (pCtx, iDidIdx);
- pCtx->pEncPic = pEncPic = (pSpatialIndexMap + iSpatialIdx)->pSrc;
- pCtx->pEncPic->iPictureType = pCtx->eSliceType;
- pCtx->pEncPic->iFramePoc = pCtx->iPOC;
+ pCtx->pEncPic = pEncPic = (pSpatialIndexMap + iSpatialIdx)->pSrc;
+ pCtx->pEncPic->iPictureType = pCtx->eSliceType;
+ pCtx->pEncPic->iFramePoc = pCtx->iPOC;
- iCurWidth = pParam->iVideoWidth;
- iCurHeight = pParam->iVideoHeight;
+ iCurWidth = pParam->iVideoWidth;
+ iCurHeight = pParam->iVideoHeight;
- iDidList[iSpatialIdx] = iCurDid;
+ iDidList[iSpatialIdx] = iCurDid;
// Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed
switch (pParam->sSliceCfg.uiSliceMode) {
@@ -3826,9 +3825,9 @@
return ENC_RETURN_UNSUPPORTED_PARA;
}
- iNalIdxInLayer = 0;
- bAvcBased = ((pSvcParam->bSimulcastAVC) || (iCurDid == BASE_DEPENDENCY_ID));
- pCtx->bNeedPrefixNalFlag = ((!pSvcParam->bSimulcastAVC) && (bAvcBased &&
+ iNalIdxInLayer = 0;
+ bAvcBased = ((pSvcParam->bSimulcastAVC) || (iCurDid == BASE_DEPENDENCY_ID));
+ pCtx->bNeedPrefixNalFlag = ((!pSvcParam->bSimulcastAVC) && (bAvcBased &&
(pSvcParam->bPrefixNalAddingCtrl ||
(pSvcParam->iSpatialLayerNum > 1))));
@@ -3848,12 +3847,12 @@
pCtx->eNalType = eNalType;
pCtx->eNalPriority = eNalRefIdc;
- pCtx->pDecPic = pCtx->ppRefPicListExt[iCurDid]->pNextBuffer;
+ pCtx->pDecPic = pCtx->ppRefPicListExt[iCurDid]->pNextBuffer;
#if defined(ENABLE_FRAME_DUMP) || defined(ENABLE_PSNR_CALC)
- fsnr = pCtx->pDecPic;
+ fsnr = pCtx->pDecPic;
#endif//#if defined(ENABLE_FRAME_DUMP) || defined(ENABLE_PSNR_CALC)
- pCtx->pDecPic->iPictureType = pCtx->eSliceType;
- pCtx->pDecPic->iFramePoc = pCtx->iPOC;
+ pCtx->pDecPic->iPictureType = pCtx->eSliceType;
+ pCtx->pDecPic->iFramePoc = pCtx->iPOC;
WelsInitCurrentLayer (pCtx, iCurWidth, iCurHeight);
@@ -3918,12 +3917,12 @@
iSliceSize = pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer];
iLayerSize += iSliceSize;
- pCtx->iPosBsBuffer += iSliceSize;
- pLayerBsInfo->uiLayerType = VIDEO_CODING_LAYER;
- pLayerBsInfo->uiSpatialId = iCurDid;
- pLayerBsInfo->uiTemporalId = iCurTid;
- pLayerBsInfo->uiQualityId = 0;
- pLayerBsInfo->iNalCount = ++ iNalIdxInLayer;
+ pCtx->iPosBsBuffer += iSliceSize;
+ pLayerBsInfo->uiLayerType = VIDEO_CODING_LAYER;
+ pLayerBsInfo->uiSpatialId = iCurDid;
+ pLayerBsInfo->uiTemporalId = iCurTid;
+ pLayerBsInfo->uiQualityId = 0;
+ pLayerBsInfo->iNalCount = ++ iNalIdxInLayer;
}
// for dynamic slicing single threading..
else if ((SM_DYN_SLICE == pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) {
@@ -3993,9 +3992,9 @@
int32_t iNumThreadsScheduled = 0;
int32_t iIndexOfSliceToBeCoded = 0;
- pCtx->iActiveThreadsNum = pSvcParam->iCountThreadsNum;
- iNumThreadsScheduled = pCtx->iActiveThreadsNum;
- iNumThreadsRunning = iNumThreadsScheduled;
+ pCtx->iActiveThreadsNum = pSvcParam->iCountThreadsNum;
+ iNumThreadsScheduled = pCtx->iActiveThreadsNum;
+ iNumThreadsRunning = iNumThreadsScheduled;
// to fire slice coding threads
iRet = FiredSliceThreads (pCtx, &pCtx->pSliceThreading->pThreadPEncCtx[0],
&pCtx->pSliceThreading->pReadySliceCodingEvent[0],
@@ -4066,8 +4065,8 @@
iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);
while (iSliceIdx < iSliceCount) {
- int32_t iSliceSize = 0;
- int32_t iPayloadSize = 0;
+ int32_t iSliceSize = 0;
+ int32_t iPayloadSize = 0;
if (bNeedPrefix) {
pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType,
eNalRefIdc,
@@ -4089,8 +4088,8 @@
WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
iSliceSize = pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer];
- pCtx->iPosBsBuffer += iSliceSize;
- iLayerSize += iSliceSize;
+ pCtx->iPosBsBuffer += iSliceSize;
+ iLayerSize += iSliceSize;
#if defined(SLICE_INFO_OUTPUT)
fprintf (stderr,
@@ -4104,11 +4103,11 @@
++ iSliceIdx;
}
- pLayerBsInfo->uiLayerType = VIDEO_CODING_LAYER;
- pLayerBsInfo->uiSpatialId = iCurDid;
- pLayerBsInfo->uiTemporalId = iCurTid;
- pLayerBsInfo->uiQualityId = 0;
- pLayerBsInfo->iNalCount = iNalIdxInLayer;
+ pLayerBsInfo->uiLayerType = VIDEO_CODING_LAYER;
+ pLayerBsInfo->uiSpatialId = iCurDid;
+ pLayerBsInfo->uiTemporalId = iCurTid;
+ pLayerBsInfo->uiQualityId = 0;
+ pLayerBsInfo->iNalCount = iNalIdxInLayer;
}
}
@@ -4202,9 +4201,9 @@
#if defined(ENABLE_PSNR_CALC)
{
- pCtx->sStatData[iCurDid][0].sQualityStat.rYPsnr[pCtx->eSliceType] += fSnrY;
- pCtx->sStatData[iCurDid][0].sQualityStat.rUPsnr[pCtx->eSliceType] += fSnrU;
- pCtx->sStatData[iCurDid][0].sQualityStat.rVPsnr[pCtx->eSliceType] += fSnrV;
+ pCtx->sStatData[iCurDid][0].sQualityStat.rYPsnr[pCtx->eSliceType] += fSnrY;
+ pCtx->sStatData[iCurDid][0].sQualityStat.rUPsnr[pCtx->eSliceType] += fSnrU;
+ pCtx->sStatData[iCurDid][0].sQualityStat.rVPsnr[pCtx->eSliceType] += fSnrV;
}
#endif//ENABLE_PSNR_CALC
@@ -4261,14 +4260,14 @@
pCtx->pWelsSvcRc[pCtx->uiDependencyId].iPaddingSize = 0;
- pLayerBsInfo->uiSpatialId = 0;
- pLayerBsInfo->uiTemporalId = 0;
- pLayerBsInfo->uiQualityId = 0;
- pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
- pLayerBsInfo->iNalCount = 1;
+ pLayerBsInfo->uiSpatialId = 0;
+ pLayerBsInfo->uiTemporalId = 0;
+ pLayerBsInfo->uiQualityId = 0;
+ pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
+ pLayerBsInfo->iNalCount = 1;
pLayerBsInfo->pNalLengthInByte[0] = iPaddingNalSize;
++ pLayerBsInfo;
- pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
+ pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + 1;
++ iLayerNum;
@@ -4416,7 +4415,7 @@
/* Decide whether need reset for IDR frame based on adjusting prarameters changed */
/* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */
- bNeedReset = (pOldParam == NULL) ||
+ bNeedReset = (pOldParam == NULL) ||
(pOldParam->bSimulcastAVC != pNewParam->bSimulcastAVC) ||
(pOldParam->iSpatialLayerNum != pNewParam->iSpatialLayerNum) ||
(pOldParam->iPicWidth != pNewParam->iPicWidth
@@ -4437,8 +4436,8 @@
iIndexD = 0;
assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum);
do {
- const SSpatialLayerInternal* kpOldDlp = &pOldParam->sDependencyLayers[iIndexD];
- const SSpatialLayerInternal* kpNewDlp = &pNewParam->sDependencyLayers[iIndexD];
+ const SSpatialLayerInternal* kpOldDlp = &pOldParam->sDependencyLayers[iIndexD];
+ const SSpatialLayerInternal* kpNewDlp = &pNewParam->sDependencyLayers[iIndexD];
float fT1 = .0f;
float fT2 = .0f;
@@ -4555,21 +4554,21 @@
}
} else {
/* maybe adjustment introduced in bitrate or little settings adjustment and so on.. */
- pNewParam->iNumRefFrame = WELS_CLIP3 (pNewParam->iNumRefFrame, MIN_REF_PIC_COUNT,
+ 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->iLoopFilterDisableIdc = WELS_CLIP3 (pNewParam->iLoopFilterDisableIdc, 0, 6);
- pNewParam->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pNewParam->iLoopFilterAlphaC0Offset, -6, 6);
- pNewParam->iLoopFilterBetaOffset = WELS_CLIP3 (pNewParam->iLoopFilterBetaOffset, -6, 6);
- pNewParam->fMaxFrameRate = WELS_CLIP3 (pNewParam->fMaxFrameRate, MIN_FRAME_RATE, MAX_FRAME_RATE);
+ pNewParam->iLoopFilterDisableIdc = WELS_CLIP3 (pNewParam->iLoopFilterDisableIdc, 0, 6);
+ pNewParam->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pNewParam->iLoopFilterAlphaC0Offset, -6, 6);
+ pNewParam->iLoopFilterBetaOffset = WELS_CLIP3 (pNewParam->iLoopFilterBetaOffset, -6, 6);
+ pNewParam->fMaxFrameRate = WELS_CLIP3 (pNewParam->fMaxFrameRate, MIN_FRAME_RATE, MAX_FRAME_RATE);
// we can not use direct struct based memcpy due some fields need keep unchanged as before
- pOldParam->fMaxFrameRate = pNewParam->fMaxFrameRate; // maximal frame rate [Hz / fps]
- pOldParam->iComplexityMode = pNewParam->iComplexityMode; // color space of input sequence
- pOldParam->uiIntraPeriod = pNewParam->uiIntraPeriod; // intra period (multiple of GOP size as desired)
+ pOldParam->fMaxFrameRate = pNewParam->fMaxFrameRate; // maximal frame rate [Hz / fps]
+ pOldParam->iComplexityMode = pNewParam->iComplexityMode; // color space of input sequence
+ pOldParam->uiIntraPeriod = pNewParam->uiIntraPeriod; // intra period (multiple of GOP size as desired)
pOldParam->eSpsPpsIdStrategy = pNewParam->eSpsPpsIdStrategy;
pOldParam->bPrefixNalAddingCtrl = pNewParam->bPrefixNalAddingCtrl;
- pOldParam->iNumRefFrame = pNewParam->iNumRefFrame; // number of reference frame used
+ pOldParam->iNumRefFrame = pNewParam->iNumRefFrame; // number of reference frame used
pOldParam->uiGopSize = pNewParam->uiGopSize;
if (pOldParam->iTemporalLayerNum != pNewParam->iTemporalLayerNum) {
pOldParam->iTemporalLayerNum = pNewParam->iTemporalLayerNum;
@@ -4590,21 +4589,21 @@
pOldParam->iLtrMarkPeriod = pNewParam->iLtrMarkPeriod;
// keep below values unchanged as before
- pOldParam->bEnableSSEI = pNewParam->bEnableSSEI;
- pOldParam->bSimulcastAVC = pNewParam->bSimulcastAVC;
- pOldParam->bEnableFrameCroppingFlag = pNewParam->bEnableFrameCroppingFlag; // enable frame cropping flag
+ pOldParam->bEnableSSEI = pNewParam->bEnableSSEI;
+ pOldParam->bSimulcastAVC = pNewParam->bSimulcastAVC;
+ pOldParam->bEnableFrameCroppingFlag = pNewParam->bEnableFrameCroppingFlag; // enable frame cropping flag
/* Motion search */
/* Deblocking loop filter */
- pOldParam->iLoopFilterDisableIdc = pNewParam->iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries
- pOldParam->iLoopFilterAlphaC0Offset = pNewParam->iLoopFilterAlphaC0Offset;// AlphaOffset: valid range [-6, 6], default 0
- pOldParam->iLoopFilterBetaOffset = pNewParam->iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
+ pOldParam->iLoopFilterDisableIdc = pNewParam->iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries
+ pOldParam->iLoopFilterAlphaC0Offset = pNewParam->iLoopFilterAlphaC0Offset;// AlphaOffset: valid range [-6, 6], default 0
+ pOldParam->iLoopFilterBetaOffset = pNewParam->iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
/* Rate Control */
- pOldParam->iRCMode = pNewParam->iRCMode;
- pOldParam->iTargetBitrate = pNewParam->iTargetBitrate; // overall target bitrate introduced in RC module
- pOldParam->iPaddingFlag = pNewParam->iPaddingFlag;
+ pOldParam->iRCMode = pNewParam->iRCMode;
+ pOldParam->iTargetBitrate = pNewParam->iTargetBitrate; // overall target bitrate introduced in RC module
+ pOldParam->iPaddingFlag = pNewParam->iPaddingFlag;
/* Layer definition */
pOldParam->bPrefixNalAddingCtrl = pNewParam->bPrefixNalAddingCtrl;
@@ -4612,22 +4611,22 @@
// d
iIndexD = 0;
do {
- SSpatialLayerInternal* pOldDlpInternal = &pOldParam->sDependencyLayers[iIndexD];
- SSpatialLayerInternal* pNewDlpInternal = &pNewParam->sDependencyLayers[iIndexD];
+ SSpatialLayerInternal* pOldDlpInternal = &pOldParam->sDependencyLayers[iIndexD];
+ SSpatialLayerInternal* pNewDlpInternal = &pNewParam->sDependencyLayers[iIndexD];
- SSpatialLayerConfig* pOldDlp = &pOldParam->sSpatialLayers[iIndexD];
- SSpatialLayerConfig* pNewDlp = &pNewParam->sSpatialLayers[iIndexD];
+ SSpatialLayerConfig* pOldDlp = &pOldParam->sSpatialLayers[iIndexD];
+ SSpatialLayerConfig* pNewDlp = &pNewParam->sSpatialLayers[iIndexD];
- pOldDlpInternal->fInputFrameRate = pNewDlpInternal->fInputFrameRate; // input frame rate
- pOldDlpInternal->fOutputFrameRate = pNewDlpInternal->fOutputFrameRate; // output frame rate
- pOldDlp->iSpatialBitrate = pNewDlp->iSpatialBitrate;
+ pOldDlpInternal->fInputFrameRate = pNewDlpInternal->fInputFrameRate; // input frame rate
+ pOldDlpInternal->fOutputFrameRate = pNewDlpInternal->fOutputFrameRate; // output frame rate
+ pOldDlp->iSpatialBitrate = pNewDlp->iSpatialBitrate;
- pOldDlp->uiProfileIdc = pNewDlp->uiProfileIdc; // value of profile IDC (0 for auto-detection)
- pOldDlp->iDLayerQp = pNewDlp->iDLayerQp;
+ pOldDlp->uiProfileIdc = pNewDlp->uiProfileIdc; // value of profile IDC (0 for auto-detection)
+ pOldDlp->iDLayerQp = pNewDlp->iDLayerQp;
/* Derived variants below */
- pOldDlpInternal->iTemporalResolution = pNewDlpInternal->iTemporalResolution;
- pOldDlpInternal->iDecompositionStages = pNewDlpInternal->iDecompositionStages;
+ pOldDlpInternal->iTemporalResolution = pNewDlpInternal->iTemporalResolution;
+ pOldDlpInternal->iDecompositionStages = pNewDlpInternal->iDecompositionStages;
memcpy (pOldDlpInternal->uiCodingIdx2TemporalId, pNewDlpInternal->uiCodingIdx2TemporalId,
sizeof (pOldDlpInternal->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage
@@ -4809,12 +4808,12 @@
while (uiSliceIdx < iMaxSliceNum) {
pSORC->iComplexityIndexSlice = 0;
pSORC->iCalculatedQpSlice = pCtx->iGlobalQp;
- pSORC->iTotalQpSlice = 0;
- pSORC->iTotalMbSlice = 0;
+ pSORC->iTotalQpSlice = 0;
+ pSORC->iTotalMbSlice = 0;
pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurLayer->pSliceEncCtx->pCountMbNumInSlice[uiSliceIdx],
INT_MULTIPLY);
- pSORC->iFrameBitsSlice = 0;
- pSORC->iGomBitsSlice = 0;
+ pSORC->iFrameBitsSlice = 0;
+ pSORC->iGomBitsSlice = 0;
pSORC ++;
uiSliceIdx ++;
}
@@ -4836,31 +4835,31 @@
int32_t iStartSliceIdx
) {
- SDqLayer* pCurLayer = pCtx->pCurDqLayer;
- SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
- int32_t iNalIdxInLayer = *pNalIdxInLayer;
- int32_t iSliceIdx = iStartSliceIdx;
- const int32_t kiSliceStep = pCtx->iActiveThreadsNum;
- const int32_t kiPartitionId = iStartSliceIdx % kiSliceStep;
- int32_t iPartitionBsSize = 0;
- int32_t iAnyMbLeftInPartition = iEndMbInPartition - iFirstMbInPartition;
- const EWelsNalUnitType keNalType = pCtx->eNalType;
- const EWelsNalRefIdc keNalRefIdc = pCtx->eNalPriority;
- const bool kbNeedPrefix = pCtx->bNeedPrefixNalFlag;
- const int32_t kiSliceIdxStep = pCtx->iActiveThreadsNum;
+ SDqLayer* pCurLayer = pCtx->pCurDqLayer;
+ SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
+ int32_t iNalIdxInLayer = *pNalIdxInLayer;
+ int32_t iSliceIdx = iStartSliceIdx;
+ const int32_t kiSliceStep = pCtx->iActiveThreadsNum;
+ const int32_t kiPartitionId = iStartSliceIdx % kiSliceStep;
+ int32_t iPartitionBsSize = 0;
+ int32_t iAnyMbLeftInPartition = iEndMbInPartition - iFirstMbInPartition;
+ const EWelsNalUnitType keNalType = pCtx->eNalType;
+ const EWelsNalRefIdc keNalRefIdc = pCtx->eNalPriority;
+ const bool kbNeedPrefix = pCtx->bNeedPrefixNalFlag;
+ const int32_t kiSliceIdxStep = pCtx->iActiveThreadsNum;
int32_t iReturn = ENC_RETURN_SUCCESS;
//init
{
- pSliceCtx->pFirstMbInSlice[iSliceIdx] = iFirstMbInPartition;
- pCurLayer->pNumSliceCodedOfPartition[kiPartitionId] = 1; // one slice per partition intialized, dynamic slicing inside
- pCurLayer->pLastMbIdxOfPartition[kiPartitionId] = iEndMbInPartition - 1;
+ pSliceCtx->pFirstMbInSlice[iSliceIdx] = iFirstMbInPartition;
+ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId] = 1; // one slice per partition intialized, dynamic slicing inside
+ pCurLayer->pLastMbIdxOfPartition[kiPartitionId] = iEndMbInPartition - 1;
}
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = 0;
while (iAnyMbLeftInPartition > 0) {
- int32_t iSliceSize = 0;
- int32_t iPayloadSize = 0;
+ int32_t iSliceSize = 0;
+ int32_t iPayloadSize = 0;
if (iSliceIdx >= (pSliceCtx->iMaxSliceNumConstraint - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
if (pCtx->iActiveThreadsNum == 1) {
@@ -4898,8 +4897,8 @@
WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
iSliceSize = pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer];
- pCtx->iPosBsBuffer += iSliceSize;
- iPartitionBsSize += iSliceSize;
+ pCtx->iPosBsBuffer += iSliceSize;
+ iPartitionBsSize += iSliceSize;
#if defined(SLICE_INFO_OUTPUT)
fprintf (stderr,
@@ -4915,15 +4914,15 @@
iAnyMbLeftInPartition = iEndMbInPartition - (1 + pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId]);
}
- *pLayerSize = iPartitionBsSize;
- *pNalIdxInLayer = iNalIdxInLayer;
+ *pLayerSize = iPartitionBsSize;
+ *pNalIdxInLayer = iNalIdxInLayer;
// slice based packing???
- pLayerBsInfo->uiLayerType = VIDEO_CODING_LAYER;
- pLayerBsInfo->uiSpatialId = pCtx->uiDependencyId;
- pLayerBsInfo->uiTemporalId = pCtx->uiTemporalId;
- pLayerBsInfo->uiQualityId = 0;
- pLayerBsInfo->iNalCount = iNalIdxInLayer;
+ pLayerBsInfo->uiLayerType = VIDEO_CODING_LAYER;
+ pLayerBsInfo->uiSpatialId = pCtx->uiDependencyId;
+ pLayerBsInfo->uiTemporalId = pCtx->uiTemporalId;
+ pLayerBsInfo->uiQualityId = 0;
+ pLayerBsInfo->iNalCount = iNalIdxInLayer;
return ENC_RETURN_SUCCESS;
}
--- a/codec/encoder/core/src/get_intra_predictor.cpp
+++ b/codec/encoder/core/src/get_intra_predictor.cpp
@@ -133,22 +133,22 @@
/*down pLeft*/
void WelsI4x4LumaPredDDL_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
/*get pTop*/
- const uint8_t kuiT0 = pRef[-kiStride];
- const uint8_t kuiT1 = pRef[1 - kiStride];
- const uint8_t kuiT2 = pRef[2 - kiStride];
- const uint8_t kuiT3 = pRef[3 - kiStride];
- const uint8_t kuiT4 = pRef[4 - kiStride];
- const uint8_t kuiT5 = pRef[5 - kiStride];
- const uint8_t kuiT6 = pRef[6 - kiStride];
- const uint8_t kuiT7 = pRef[7 - kiStride];
- const uint8_t kuiDDL0 = (2 + kuiT0 + kuiT2 + (kuiT1 << 1)) >> 2; // uiDDL0
- const uint8_t kuiDDL1 = (2 + kuiT1 + kuiT3 + (kuiT2 << 1)) >> 2; // uiDDL1
- const uint8_t kuiDDL2 = (2 + kuiT2 + kuiT4 + (kuiT3 << 1)) >> 2; // uiDDL2
- const uint8_t kuiDDL3 = (2 + kuiT3 + kuiT5 + (kuiT4 << 1)) >> 2; // uiDDL3
- const uint8_t kuiDDL4 = (2 + kuiT4 + kuiT6 + (kuiT5 << 1)) >> 2; // uiDDL4
- const uint8_t kuiDDL5 = (2 + kuiT5 + kuiT7 + (kuiT6 << 1)) >> 2; // uiDDL5
- const uint8_t kuiDDL6 = (2 + kuiT6 + kuiT7 + (kuiT7 << 1)) >> 2; // uiDDL6
- ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
+ const uint8_t kuiT0 = pRef[-kiStride];
+ const uint8_t kuiT1 = pRef[1 - kiStride];
+ const uint8_t kuiT2 = pRef[2 - kiStride];
+ const uint8_t kuiT3 = pRef[3 - kiStride];
+ const uint8_t kuiT4 = pRef[4 - kiStride];
+ const uint8_t kuiT5 = pRef[5 - kiStride];
+ const uint8_t kuiT6 = pRef[6 - kiStride];
+ const uint8_t kuiT7 = pRef[7 - kiStride];
+ const uint8_t kuiDDL0 = (2 + kuiT0 + kuiT2 + (kuiT1 << 1)) >> 2; // uiDDL0
+ const uint8_t kuiDDL1 = (2 + kuiT1 + kuiT3 + (kuiT2 << 1)) >> 2; // uiDDL1
+ const uint8_t kuiDDL2 = (2 + kuiT2 + kuiT4 + (kuiT3 << 1)) >> 2; // uiDDL2
+ const uint8_t kuiDDL3 = (2 + kuiT3 + kuiT5 + (kuiT4 << 1)) >> 2; // uiDDL3
+ const uint8_t kuiDDL4 = (2 + kuiT4 + kuiT6 + (kuiT5 << 1)) >> 2; // uiDDL4
+ const uint8_t kuiDDL5 = (2 + kuiT5 + kuiT7 + (kuiT6 << 1)) >> 2; // uiDDL5
+ const uint8_t kuiDDL6 = (2 + kuiT6 + kuiT7 + (kuiT7 << 1)) >> 2; // uiDDL6
+ ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
uiSrc[0] = kuiDDL0;
uiSrc[1] = uiSrc[4] = kuiDDL1;
uiSrc[2] = uiSrc[5] = uiSrc[8] = kuiDDL2;
@@ -163,15 +163,15 @@
/*down pLeft*/
void WelsI4x4LumaPredDDLTop_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
/*get pTop*/
- const uint8_t kuiT0 = pRef[-kiStride];
- const uint8_t kuiT1 = pRef[1 - kiStride];
- const uint8_t kuiT2 = pRef[2 - kiStride];
- const uint8_t kuiT3 = pRef[3 - kiStride];
- const uint8_t kuiDLT0 = (2 + kuiT0 + kuiT2 + (kuiT1 << 1)) >> 2; // uiDLT0
- const uint8_t kuiDLT1 = (2 + kuiT1 + kuiT3 + (kuiT2 << 1)) >> 2; // uiDLT1
- const uint8_t kuiDLT2 = (2 + kuiT2 + kuiT3 + (kuiT3 << 1)) >> 2; // uiDLT2
- const uint8_t kuiDLT3 = (2 + (kuiT3 << 2)) >> 2; // uiDLT3
- ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
+ const uint8_t kuiT0 = pRef[-kiStride];
+ const uint8_t kuiT1 = pRef[1 - kiStride];
+ const uint8_t kuiT2 = pRef[2 - kiStride];
+ const uint8_t kuiT3 = pRef[3 - kiStride];
+ const uint8_t kuiDLT0 = (2 + kuiT0 + kuiT2 + (kuiT1 << 1)) >> 2; // uiDLT0
+ const uint8_t kuiDLT1 = (2 + kuiT1 + kuiT3 + (kuiT2 << 1)) >> 2; // uiDLT1
+ const uint8_t kuiDLT2 = (2 + kuiT2 + kuiT3 + (kuiT3 << 1)) >> 2; // uiDLT2
+ const uint8_t kuiDLT3 = (2 + (kuiT3 << 2)) >> 2; // uiDLT3
+ ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
memset (&uiSrc[6], kuiDLT3, 10 * sizeof (uint8_t));
uiSrc[0] = kuiDLT0;
uiSrc[1] = uiSrc[4] = kuiDLT1;
@@ -184,34 +184,34 @@
/*down right*/
void WelsI4x4LumaPredDDR_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
- const int32_t kiStridex2 = kiStride << 1;
- const int32_t kiStridex3 = kiStride + kiStridex2;
- const uint8_t kuiLT = pRef[-kiStride - 1]; // pTop-pLeft
+ const int32_t kiStridex2 = kiStride << 1;
+ const int32_t kiStridex3 = kiStride + kiStridex2;
+ const uint8_t kuiLT = pRef[-kiStride - 1]; // pTop-pLeft
/*get pLeft and pTop*/
- const uint8_t kuiL0 = pRef[-1];
- const uint8_t kuiL1 = pRef[kiStride - 1];
- const uint8_t kuiL2 = pRef[kiStridex2 - 1];
- const uint8_t kuiL3 = pRef[kiStridex3 - 1];
- const uint8_t kuiT0 = pRef[-kiStride];
- const uint8_t kuiT1 = pRef[1 - kiStride];
- const uint8_t kuiT2 = pRef[2 - kiStride];
- const uint8_t kuiT3 = pRef[3 - kiStride];
- const uint16_t kuiTL0 = 1 + kuiLT + kuiL0;
- const uint16_t kuiLT0 = 1 + kuiLT + kuiT0;
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
- const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
- const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
- const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
- const uint8_t kuiDDR0 = (kuiTL0 + kuiLT0) >> 2;
- const uint8_t kuiDDR1 = (kuiLT0 + kuiT01) >> 2;
- const uint8_t kuiDDR2 = (kuiT01 + kuiT12) >> 2;
- const uint8_t kuiDDR3 = (kuiT12 + kuiT23) >> 2;
- const uint8_t kuiDDR4 = (kuiTL0 + kuiL01) >> 2;
- const uint8_t kuiDDR5 = (kuiL01 + kuiL12) >> 2;
- const uint8_t kuiDDR6 = (kuiL12 + kuiL23) >> 2;
- ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
+ const uint8_t kuiL0 = pRef[-1];
+ const uint8_t kuiL1 = pRef[kiStride - 1];
+ const uint8_t kuiL2 = pRef[kiStridex2 - 1];
+ const uint8_t kuiL3 = pRef[kiStridex3 - 1];
+ const uint8_t kuiT0 = pRef[-kiStride];
+ const uint8_t kuiT1 = pRef[1 - kiStride];
+ const uint8_t kuiT2 = pRef[2 - kiStride];
+ const uint8_t kuiT3 = pRef[3 - kiStride];
+ const uint16_t kuiTL0 = 1 + kuiLT + kuiL0;
+ const uint16_t kuiLT0 = 1 + kuiLT + kuiT0;
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
+ const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
+ const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
+ const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
+ const uint8_t kuiDDR0 = (kuiTL0 + kuiLT0) >> 2;
+ const uint8_t kuiDDR1 = (kuiLT0 + kuiT01) >> 2;
+ const uint8_t kuiDDR2 = (kuiT01 + kuiT12) >> 2;
+ const uint8_t kuiDDR3 = (kuiT12 + kuiT23) >> 2;
+ const uint8_t kuiDDR4 = (kuiTL0 + kuiL01) >> 2;
+ const uint8_t kuiDDR5 = (kuiL01 + kuiL12) >> 2;
+ const uint8_t kuiDDR6 = (kuiL12 + kuiL23) >> 2;
+ ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
uiSrc[0] = uiSrc[5] = uiSrc[10] = uiSrc[15] = kuiDDR0;
uiSrc[1] = uiSrc[6] = uiSrc[11] = kuiDDR1;
uiSrc[2] = uiSrc[7] = kuiDDR2;
@@ -227,24 +227,24 @@
/*vertical pLeft*/
void WelsI4x4LumaPredVL_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
/*get pTop*/
- const uint8_t kuiT0 = pRef[-kiStride];
- const uint8_t kuiT1 = pRef[1 - kiStride];
- const uint8_t kuiT2 = pRef[2 - kiStride];
- const uint8_t kuiT3 = pRef[3 - kiStride];
- const uint8_t kuiT4 = pRef[4 - kiStride];
- const uint8_t kuiT5 = pRef[5 - kiStride];
- const uint8_t kuiT6 = pRef[6 - kiStride];
- const uint8_t kuiVL0 = (1 + kuiT0 + kuiT1) >> 1; // uiVL0
- const uint8_t kuiVL1 = (1 + kuiT1 + kuiT2) >> 1; // uiVL1
- const uint8_t kuiVL2 = (1 + kuiT2 + kuiT3) >> 1; // uiVL2
- const uint8_t kuiVL3 = (1 + kuiT3 + kuiT4) >> 1; // uiVL3
- const uint8_t kuiVL4 = (1 + kuiT4 + kuiT5) >> 1; // uiVL4
- const uint8_t kuiVL5 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2; // uiVL5
- const uint8_t kuiVL6 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2; // uiVL6
- const uint8_t kuiVL7 = (2 + kuiT2 + (kuiT3 << 1) + kuiT4) >> 2; // uiVL7
- const uint8_t kuiVL8 = (2 + kuiT3 + (kuiT4 << 1) + kuiT5) >> 2; // uiVL8
- const uint8_t kuiVL9 = (2 + kuiT4 + (kuiT5 << 1) + kuiT6) >> 2; // uiVL9
- ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
+ const uint8_t kuiT0 = pRef[-kiStride];
+ const uint8_t kuiT1 = pRef[1 - kiStride];
+ const uint8_t kuiT2 = pRef[2 - kiStride];
+ const uint8_t kuiT3 = pRef[3 - kiStride];
+ const uint8_t kuiT4 = pRef[4 - kiStride];
+ const uint8_t kuiT5 = pRef[5 - kiStride];
+ const uint8_t kuiT6 = pRef[6 - kiStride];
+ const uint8_t kuiVL0 = (1 + kuiT0 + kuiT1) >> 1; // uiVL0
+ const uint8_t kuiVL1 = (1 + kuiT1 + kuiT2) >> 1; // uiVL1
+ const uint8_t kuiVL2 = (1 + kuiT2 + kuiT3) >> 1; // uiVL2
+ const uint8_t kuiVL3 = (1 + kuiT3 + kuiT4) >> 1; // uiVL3
+ const uint8_t kuiVL4 = (1 + kuiT4 + kuiT5) >> 1; // uiVL4
+ const uint8_t kuiVL5 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2; // uiVL5
+ const uint8_t kuiVL6 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2; // uiVL6
+ const uint8_t kuiVL7 = (2 + kuiT2 + (kuiT3 << 1) + kuiT4) >> 2; // uiVL7
+ const uint8_t kuiVL8 = (2 + kuiT3 + (kuiT4 << 1) + kuiT5) >> 2; // uiVL8
+ const uint8_t kuiVL9 = (2 + kuiT4 + (kuiT5 << 1) + kuiT6) >> 2; // uiVL9
+ ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
uiSrc[0] = kuiVL0;
uiSrc[1] = uiSrc[8] = kuiVL1;
uiSrc[2] = uiSrc[9] = kuiVL2;
@@ -263,21 +263,21 @@
/*vertical pLeft*/
void WelsI4x4LumaPredVLTop_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
- uint8_t* pTopLeft = &pRef[-kiStride - 1]; // pTop-pLeft
+ uint8_t* pTopLeft = &pRef[-kiStride - 1]; // pTop-pLeft
/*get pTop*/
- const uint8_t kuiT0 = * (pTopLeft + 1);
- const uint8_t kuiT1 = * (pTopLeft + 2);
- const uint8_t kuiT2 = * (pTopLeft + 3);
- const uint8_t kuiT3 = * (pTopLeft + 4);
- const uint8_t kuiVLT0 = (1 + kuiT0 + kuiT1) >> 1; // uiVLT0
- const uint8_t kuiVLT1 = (1 + kuiT1 + kuiT2) >> 1; // uiVLT1
- const uint8_t kuiVLT2 = (1 + kuiT2 + kuiT3) >> 1; // uiVLT2
- const uint8_t kuiVLT3 = (1 + (kuiT3 << 1)) >> 1; // uiVLT3
- const uint8_t kuiVLT4 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2; // uiVLT4
- const uint8_t kuiVLT5 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2; // uiVLT5
- const uint8_t kuiVLT6 = (2 + kuiT2 + (kuiT3 << 1) + kuiT3) >> 2; // uiVLT6
- const uint8_t kuiVLT7 = (2 + (kuiT3 << 2)) >> 2; // uiVLT7
- ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
+ const uint8_t kuiT0 = * (pTopLeft + 1);
+ const uint8_t kuiT1 = * (pTopLeft + 2);
+ const uint8_t kuiT2 = * (pTopLeft + 3);
+ const uint8_t kuiT3 = * (pTopLeft + 4);
+ const uint8_t kuiVLT0 = (1 + kuiT0 + kuiT1) >> 1; // uiVLT0
+ const uint8_t kuiVLT1 = (1 + kuiT1 + kuiT2) >> 1; // uiVLT1
+ const uint8_t kuiVLT2 = (1 + kuiT2 + kuiT3) >> 1; // uiVLT2
+ const uint8_t kuiVLT3 = (1 + (kuiT3 << 1)) >> 1; // uiVLT3
+ const uint8_t kuiVLT4 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2; // uiVLT4
+ const uint8_t kuiVLT5 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2; // uiVLT5
+ const uint8_t kuiVLT6 = (2 + kuiT2 + (kuiT3 << 1) + kuiT3) >> 2; // uiVLT6
+ const uint8_t kuiVLT7 = (2 + (kuiT3 << 2)) >> 2; // uiVLT7
+ ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
uiSrc[0] = kuiVLT0;
uiSrc[1] = uiSrc[8] = kuiVLT1;
uiSrc[2] = uiSrc[9] = kuiVLT2;
@@ -292,27 +292,27 @@
/*vertical right*/
void WelsI4x4LumaPredVR_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
- const int32_t kiStridex2 = kiStride << 1;
- const uint8_t kuiLT = pRef[-kiStride - 1]; // pTop-pLeft
+ const int32_t kiStridex2 = kiStride << 1;
+ const uint8_t kuiLT = pRef[-kiStride - 1]; // pTop-pLeft
/*get pLeft and pTop*/
- const uint8_t kuiL0 = pRef[-1];
- const uint8_t kuiL1 = pRef[kiStride - 1];
- const uint8_t kuiL2 = pRef[kiStridex2 - 1];
- const uint8_t kuiT0 = pRef[-kiStride];
- const uint8_t kuiT1 = pRef[1 - kiStride];
- const uint8_t kuiT2 = pRef[2 - kiStride];
- const uint8_t kuiT3 = pRef[3 - kiStride];
- const uint8_t kuiVR0 = (1 + kuiLT + kuiT0) >> 1;
- const uint8_t kuiVR1 = (1 + kuiT0 + kuiT1) >> 1;
- const uint8_t kuiVR2 = (1 + kuiT1 + kuiT2) >> 1;
- const uint8_t kuiVR3 = (1 + kuiT2 + kuiT3) >> 1;
- const uint8_t kuiVR4 = (2 + kuiL0 + (kuiLT << 1) + kuiT0) >> 2;
- const uint8_t kuiVR5 = (2 + kuiLT + (kuiT0 << 1) + kuiT1) >> 2;
- const uint8_t kuiVR6 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2;
- const uint8_t kuiVR7 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2;
- const uint8_t kuiVR8 = (2 + kuiLT + (kuiL0 << 1) + kuiL1) >> 2;
- const uint8_t kuiVR9 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2;
- ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
+ const uint8_t kuiL0 = pRef[-1];
+ const uint8_t kuiL1 = pRef[kiStride - 1];
+ const uint8_t kuiL2 = pRef[kiStridex2 - 1];
+ const uint8_t kuiT0 = pRef[-kiStride];
+ const uint8_t kuiT1 = pRef[1 - kiStride];
+ const uint8_t kuiT2 = pRef[2 - kiStride];
+ const uint8_t kuiT3 = pRef[3 - kiStride];
+ const uint8_t kuiVR0 = (1 + kuiLT + kuiT0) >> 1;
+ const uint8_t kuiVR1 = (1 + kuiT0 + kuiT1) >> 1;
+ const uint8_t kuiVR2 = (1 + kuiT1 + kuiT2) >> 1;
+ const uint8_t kuiVR3 = (1 + kuiT2 + kuiT3) >> 1;
+ const uint8_t kuiVR4 = (2 + kuiL0 + (kuiLT << 1) + kuiT0) >> 2;
+ const uint8_t kuiVR5 = (2 + kuiLT + (kuiT0 << 1) + kuiT1) >> 2;
+ const uint8_t kuiVR6 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2;
+ const uint8_t kuiVR7 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2;
+ const uint8_t kuiVR8 = (2 + kuiLT + (kuiL0 << 1) + kuiL1) >> 2;
+ const uint8_t kuiVR9 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2;
+ ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
uiSrc[0] = uiSrc[9] = kuiVR0;
uiSrc[1] = uiSrc[10] = kuiVR1;
uiSrc[2] = uiSrc[11] = kuiVR2;
@@ -330,23 +330,23 @@
/*horizontal up*/
void WelsI4x4LumaPredHU_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
- const int32_t kiStridex2 = kiStride << 1;
- const int32_t kiStridex3 = kiStride + kiStridex2;
+ const int32_t kiStridex2 = kiStride << 1;
+ const int32_t kiStridex3 = kiStride + kiStridex2;
/*get pLeft*/
- const uint8_t kuiL0 = pRef[-1];
- const uint8_t kuiL1 = pRef[kiStride - 1];
- const uint8_t kuiL2 = pRef[kiStridex2 - 1];
- const uint8_t kuiL3 = pRef[kiStridex3 - 1];
- const uint16_t kuiL01 = (1 + kuiL0 + kuiL1);
- const uint16_t kuiL12 = (1 + kuiL1 + kuiL2);
- const uint16_t kuiL23 = (1 + kuiL2 + kuiL3);
- const uint8_t kuiHU0 = kuiL01 >> 1;
- const uint8_t kuiHU1 = (kuiL01 + kuiL12) >> 2;
- const uint8_t kuiHU2 = kuiL12 >> 1;
- const uint8_t kuiHU3 = (kuiL12 + kuiL23) >> 2;
- const uint8_t kuiHU4 = kuiL23 >> 1;
- const uint8_t kuiHU5 = (1 + kuiL23 + (kuiL3 << 1)) >> 2;
- ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
+ const uint8_t kuiL0 = pRef[-1];
+ const uint8_t kuiL1 = pRef[kiStride - 1];
+ const uint8_t kuiL2 = pRef[kiStridex2 - 1];
+ const uint8_t kuiL3 = pRef[kiStridex3 - 1];
+ const uint16_t kuiL01 = (1 + kuiL0 + kuiL1);
+ const uint16_t kuiL12 = (1 + kuiL1 + kuiL2);
+ const uint16_t kuiL23 = (1 + kuiL2 + kuiL3);
+ const uint8_t kuiHU0 = kuiL01 >> 1;
+ const uint8_t kuiHU1 = (kuiL01 + kuiL12) >> 2;
+ const uint8_t kuiHU2 = kuiL12 >> 1;
+ const uint8_t kuiHU3 = (kuiL12 + kuiL23) >> 2;
+ const uint8_t kuiHU4 = kuiL23 >> 1;
+ const uint8_t kuiHU5 = (1 + kuiL23 + (kuiL3 << 1)) >> 2;
+ ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
uiSrc[0] = kuiHU0;
uiSrc[1] = kuiHU1;
uiSrc[2] = uiSrc[4] = kuiHU2;
@@ -361,28 +361,28 @@
/*horizontal down*/
void WelsI4x4LumaPredHD_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
- const int32_t kiStridex2 = kiStride << 1;
- const int32_t kiStridex3 = kiStride + kiStridex2;
- const uint8_t kuiLT = pRef[-kiStride - 1]; // pTop-pLeft
+ const int32_t kiStridex2 = kiStride << 1;
+ const int32_t kiStridex3 = kiStride + kiStridex2;
+ const uint8_t kuiLT = pRef[-kiStride - 1]; // pTop-pLeft
/*get pLeft and pTop*/
- const uint8_t kuiL0 = pRef[-1];
- const uint8_t kuiL1 = pRef[kiStride - 1];
- const uint8_t kuiL2 = pRef[kiStridex2 - 1];
- const uint8_t kuiL3 = pRef[kiStridex3 - 1];
- const uint8_t kuiT0 = pRef[-kiStride];
- const uint8_t kuiT1 = pRef[1 - kiStride];
- const uint8_t kuiT2 = pRef[2 - kiStride];
- const uint8_t kuiHD0 = (1 + kuiLT + kuiL0) >> 1; // uiHD0
- const uint8_t kuiHD1 = (2 + kuiL0 + (kuiLT << 1) + kuiT0) >> 2; // uiHD1
- const uint8_t kuiHD2 = (2 + kuiLT + (kuiT0 << 1) + kuiT1) >> 2; // uiHD2
- const uint8_t kuiHD3 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2; // uiHD3
- const uint8_t kuiHD4 = (1 + kuiL0 + kuiL1) >> 1; // uiHD4
- const uint8_t kuiHD5 = (2 + kuiLT + (kuiL0 << 1) + kuiL1) >> 2; // uiHD5
- const uint8_t kuiHD6 = (1 + kuiL1 + kuiL2) >> 1; // uiHD6
- const uint8_t kuiHD7 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2; // uiHD7
- const uint8_t kuiHD8 = (1 + kuiL2 + kuiL3) >> 1; // uiHD8
- const uint8_t kuiHD9 = (2 + kuiL1 + (kuiL2 << 1) + kuiL3) >> 2; // uiHD9
- ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
+ const uint8_t kuiL0 = pRef[-1];
+ const uint8_t kuiL1 = pRef[kiStride - 1];
+ const uint8_t kuiL2 = pRef[kiStridex2 - 1];
+ const uint8_t kuiL3 = pRef[kiStridex3 - 1];
+ const uint8_t kuiT0 = pRef[-kiStride];
+ const uint8_t kuiT1 = pRef[1 - kiStride];
+ const uint8_t kuiT2 = pRef[2 - kiStride];
+ const uint8_t kuiHD0 = (1 + kuiLT + kuiL0) >> 1; // uiHD0
+ const uint8_t kuiHD1 = (2 + kuiL0 + (kuiLT << 1) + kuiT0) >> 2; // uiHD1
+ const uint8_t kuiHD2 = (2 + kuiLT + (kuiT0 << 1) + kuiT1) >> 2; // uiHD2
+ const uint8_t kuiHD3 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2; // uiHD3
+ const uint8_t kuiHD4 = (1 + kuiL0 + kuiL1) >> 1; // uiHD4
+ const uint8_t kuiHD5 = (2 + kuiLT + (kuiL0 << 1) + kuiL1) >> 2; // uiHD5
+ const uint8_t kuiHD6 = (1 + kuiL1 + kuiL2) >> 1; // uiHD6
+ const uint8_t kuiHD7 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2; // uiHD7
+ const uint8_t kuiHD8 = (1 + kuiL2 + kuiL3) >> 1; // uiHD8
+ const uint8_t kuiHD9 = (2 + kuiL1 + (kuiL2 << 1) + kuiL3) >> 2; // uiHD9
+ ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
uiSrc[0] = uiSrc[6] = kuiHD0;
uiSrc[1] = uiSrc[7] = kuiHD1;
uiSrc[2] = kuiHD2;
@@ -404,7 +404,7 @@
void WelsIChromaPredV_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
const uint64_t kuiSrc64 = LD64 (&pRef[-kiStride]);
- ST64 (pPred , kuiSrc64);
+ ST64 (pPred , kuiSrc64);
ST64 (pPred + 8 , kuiSrc64);
ST64 (pPred + 16, kuiSrc64);
ST64 (pPred + 24, kuiSrc64);
@@ -476,7 +476,7 @@
const uint64_t kuiTopMean64 = LD64 (kuiTopMean);
const uint64_t kuiBottomMean64 = LD64 (kuiBottomMean);
- ST64 (pPred , kuiTopMean64);
+ ST64 (pPred , kuiTopMean64);
ST64 (pPred + 8 , kuiTopMean64);
ST64 (pPred + 16, kuiTopMean64);
ST64 (pPred + 24, kuiTopMean64);
@@ -487,19 +487,19 @@
}
void WelsIChromaPredDcLeft_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
- const int32_t kuiL1 = kiStride - 1;
- const int32_t kuiL2 = kuiL1 + kiStride;
- const int32_t kuiL3 = kuiL2 + kiStride;
- const int32_t kuiL4 = kuiL3 + kiStride;
- const int32_t kuiL5 = kuiL4 + kiStride;
- const int32_t kuiL6 = kuiL5 + kiStride;
- const int32_t kuiL7 = kuiL6 + kiStride;
+ const int32_t kuiL1 = kiStride - 1;
+ const int32_t kuiL2 = kuiL1 + kiStride;
+ const int32_t kuiL3 = kuiL2 + kiStride;
+ const int32_t kuiL4 = kuiL3 + kiStride;
+ const int32_t kuiL5 = kuiL4 + kiStride;
+ const int32_t kuiL6 = kuiL5 + kiStride;
+ const int32_t kuiL7 = kuiL6 + kiStride;
/*caculate the iMean value*/
- const uint8_t kuiTopMean = (pRef[-1] + pRef[kuiL1] + pRef[kuiL2] + pRef[kuiL3] + 2) >> 2 ;
- const uint8_t kuiBottomMean = (pRef[kuiL4] + pRef[kuiL5] + pRef[kuiL6] + pRef[kuiL7] + 2) >> 2;
- const uint64_t kuiTopMean64 = (uint64_t) (0x0101010101010101ULL * kuiTopMean);
- const uint64_t kuiBottomMean64 = (uint64_t) (0x0101010101010101ULL * kuiBottomMean);
- ST64 (pPred , kuiTopMean64);
+ const uint8_t kuiTopMean = (pRef[-1] + pRef[kuiL1] + pRef[kuiL2] + pRef[kuiL3] + 2) >> 2 ;
+ const uint8_t kuiBottomMean = (pRef[kuiL4] + pRef[kuiL5] + pRef[kuiL6] + pRef[kuiL7] + 2) >> 2;
+ const uint64_t kuiTopMean64 = (uint64_t) (0x0101010101010101ULL * kuiTopMean);
+ const uint64_t kuiBottomMean64 = (uint64_t) (0x0101010101010101ULL * kuiBottomMean);
+ ST64 (pPred , kuiTopMean64);
ST64 (pPred + 8 , kuiTopMean64);
ST64 (pPred + 16, kuiTopMean64);
ST64 (pPred + 24, kuiTopMean64);
@@ -516,7 +516,7 @@
const uint8_t kuiMean[8] = {kuiMean1, kuiMean1, kuiMean1, kuiMean1, kuiMean2, kuiMean2, kuiMean2, kuiMean2};
const uint64_t kuiMean64 = LD64 (kuiMean);
- ST64 (pPred , kuiMean64);
+ ST64 (pPred , kuiMean64);
ST64 (pPred + 8 , kuiMean64);
ST64 (pPred + 16, kuiMean64);
ST64 (pPred + 24, kuiMean64);
@@ -528,7 +528,7 @@
void WelsIChromaPredDcNA_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
const uint64_t kuiDcValue64 = (uint64_t)0x8080808080808080ULL;
- ST64 (pPred , kuiDcValue64);
+ ST64 (pPred , kuiDcValue64);
ST64 (pPred + 8 , kuiDcValue64);
ST64 (pPred + 16, kuiDcValue64);
ST64 (pPred + 24, kuiDcValue64);
--- a/codec/encoder/core/src/md.cpp
+++ b/codec/encoder/core/src/md.cpp
@@ -435,10 +435,10 @@
int32_t AnalysisVaaInfoIntra_c (uint8_t* pDataY, const int32_t kiLineSize) {
ENFORCE_STACK_ALIGN_1D (uint16_t, uiAvgBlock, 16, 16)
uint16_t* pBlock = &uiAvgBlock[0];
- uint8_t* pEncData = pDataY;
- const int32_t kiLineSize2 = kiLineSize << 1;
- const int32_t kiLineSize3 = kiLineSize + kiLineSize2;
- const int32_t kiLineSize4 = kiLineSize << 2;
+ uint8_t* pEncData = pDataY;
+ const int32_t kiLineSize2 = kiLineSize << 1;
+ const int32_t kiLineSize3 = kiLineSize + kiLineSize2;
+ const int32_t kiLineSize4 = kiLineSize << 2;
int32_t i = 0, j = 0, num = 0;
int32_t iSumAvg = 0, iSumSqr = 0;
@@ -492,9 +492,9 @@
bool MdIntraAnalysisVaaInfo (sWelsEncCtx* pEncCtx, uint8_t* pEncMb) {
- SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
+ SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
const int32_t kiLineSize = pCurDqLayer->iEncStride[0];
- const int32_t kiVariance = pEncCtx->pFuncList->pfGetVarianceFromIntraVaa (pEncMb, kiLineSize);
+ const int32_t kiVariance = pEncCtx->pFuncList->pfGetVarianceFromIntraVaa (pEncMb, kiLineSize);
return (kiVariance >= INTRA_VARIANCE_SAD_THRESHOLD);
}
@@ -527,11 +527,11 @@
inline void MeRefineQuarPixel (SWelsFuncPtrList* pFunc, SWelsME* pMe, SMeRefinePointer* pMeRefine,
const int32_t kiWidth, const int32_t kiHeight, SQuarRefineParams* pParams, int32_t iStrideEnc) {
- PWelsSampleAveragingFunc pSampleAvg = pFunc->sMcFuncs.pfSampleAveraging;
+ PWelsSampleAveragingFunc pSampleAvg = pFunc->sMcFuncs.pfSampleAveraging;
int32_t iCurCost;
- uint8_t* pEncMb = pMe->pEncMb;
- uint8_t* pTmp = NULL;
- const uint8_t kuiPixel = pMe->uiBlockSize;
+ uint8_t* pEncMb = pMe->pEncMb;
+ uint8_t* pTmp = NULL;
+ const uint8_t kuiPixel = pMe->uiBlockSize;
pSampleAvg (pMeRefine->pQuarPixTmp, ME_REFINE_BUF_STRIDE, pParams->pSrcA[0], ME_REFINE_BUF_STRIDE,
pParams->pSrcB[0], pParams->iStrideA, kiWidth, kiHeight);
@@ -791,9 +791,9 @@
* iMvdSz = (648*2+1) or (972*2+1);
*/
void MvdCostInit (uint16_t* pMvdCostInter, const int32_t kiMvdSz) {
- const int32_t kiSz = kiMvdSz >> 1;
- uint16_t* pNegMvd = pMvdCostInter;
- uint16_t* pPosMvd = pMvdCostInter + kiSz + 1;
+ const int32_t kiSz = kiMvdSz >> 1;
+ uint16_t* pNegMvd = pMvdCostInter;
+ uint16_t* pPosMvd = pMvdCostInter + kiSz + 1;
const int32_t* kpQpLambda = &g_kiQpCostTable[0];
int32_t i, j;
@@ -803,15 +803,15 @@
int32_t iPosSe = 1;
for (j = 0; j < kiSz; j += 4) {
- *pNegMvd++ = kiLambda * BsSizeSE (iNegSe++);
- *pNegMvd++ = kiLambda * BsSizeSE (iNegSe++);
- *pNegMvd++ = kiLambda * BsSizeSE (iNegSe++);
- *pNegMvd++ = kiLambda * BsSizeSE (iNegSe++);
+ *pNegMvd++ = kiLambda * BsSizeSE (iNegSe++);
+ *pNegMvd++ = kiLambda * BsSizeSE (iNegSe++);
+ *pNegMvd++ = kiLambda * BsSizeSE (iNegSe++);
+ *pNegMvd++ = kiLambda * BsSizeSE (iNegSe++);
- *pPosMvd++ = kiLambda * BsSizeSE (iPosSe++);
- *pPosMvd++ = kiLambda * BsSizeSE (iPosSe++);
- *pPosMvd++ = kiLambda * BsSizeSE (iPosSe++);
- *pPosMvd++ = kiLambda * BsSizeSE (iPosSe++);
+ *pPosMvd++ = kiLambda * BsSizeSE (iPosSe++);
+ *pPosMvd++ = kiLambda * BsSizeSE (iPosSe++);
+ *pPosMvd++ = kiLambda * BsSizeSE (iPosSe++);
+ *pPosMvd++ = kiLambda * BsSizeSE (iPosSe++);
}
*pNegMvd = kiLambda;
pNegMvd += kiSz + 1;
@@ -820,12 +820,12 @@
}
void PredictSad (int8_t* pRefIndexCache, int32_t* pSadCostCache, int32_t uiRef, int32_t* pSadPred) {
- const int32_t kiRefB = pRefIndexCache[1];//top g_uiCache12_8x8RefIdx[0] - 4
- int32_t iRefC = pRefIndexCache[5];//top-right g_uiCache12_8x8RefIdx[0] - 2
- const int32_t kiRefA = pRefIndexCache[6];//left g_uiCache12_8x8RefIdx[0] - 1
- const int32_t kiSadB = pSadCostCache[1];
- int32_t iSadC = pSadCostCache[2];
- const int32_t kiSadA = pSadCostCache[3];
+ const int32_t kiRefB = pRefIndexCache[1];//top g_uiCache12_8x8RefIdx[0] - 4
+ int32_t iRefC = pRefIndexCache[5];//top-right g_uiCache12_8x8RefIdx[0] - 2
+ const int32_t kiRefA = pRefIndexCache[6];//left g_uiCache12_8x8RefIdx[0] - 1
+ const int32_t kiSadB = pSadCostCache[1];
+ int32_t iSadC = pSadCostCache[2];
+ const int32_t kiSadA = pSadCostCache[3];
int32_t iCount;
@@ -865,13 +865,13 @@
void PredictSadSkip (int8_t* pRefIndexCache, bool* pMbSkipCache, int32_t* pSadCostCache, int32_t uiRef,
int32_t* iSadPredSkip) {
- const int32_t kiRefB = pRefIndexCache[1];//top g_uiCache12_8x8RefIdx[0] - 4
- int32_t iRefC = pRefIndexCache[5];//top-right g_uiCache12_8x8RefIdx[0] - 2
- const int32_t kiRefA = pRefIndexCache[6];//left g_uiCache12_8x8RefIdx[0] - 1
- const int32_t kiSadB = (pMbSkipCache[1] == 1 ? pSadCostCache[1] : 0);
- int32_t iSadC = (pMbSkipCache[2] == 1 ? pSadCostCache[2] : 0);
- const int32_t kiSadA = (pMbSkipCache[3] == 1 ? pSadCostCache[3] : 0);
- int32_t iRefSkip = pMbSkipCache[2];
+ const int32_t kiRefB = pRefIndexCache[1];//top g_uiCache12_8x8RefIdx[0] - 4
+ int32_t iRefC = pRefIndexCache[5];//top-right g_uiCache12_8x8RefIdx[0] - 2
+ const int32_t kiRefA = pRefIndexCache[6];//left g_uiCache12_8x8RefIdx[0] - 1
+ const int32_t kiSadB = (pMbSkipCache[1] == 1 ? pSadCostCache[1] : 0);
+ int32_t iSadC = (pMbSkipCache[2] == 1 ? pSadCostCache[2] : 0);
+ const int32_t kiSadA = (pMbSkipCache[3] == 1 ? pSadCostCache[3] : 0);
+ int32_t iRefSkip = pMbSkipCache[2];
int32_t iCount = 0;
--- a/codec/encoder/core/src/mv_pred.cpp
+++ b/codec/encoder/core/src/mv_pred.cpp
@@ -43,8 +43,8 @@
namespace WelsEnc {
//basic pMv prediction unit for pMv width (4, 2, 1)
void PredMv (const SMVComponentUnit* kpMvComp, int8_t iPartIdx, int8_t iPartW, int32_t iRef, SMVUnitXY* sMvp) {
- const uint8_t kuiLeftIdx = g_kuiCache30ScanIdx[iPartIdx] - 1;
- const uint8_t kuiTopIdx = g_kuiCache30ScanIdx[iPartIdx] - 6;
+ const uint8_t kuiLeftIdx = g_kuiCache30ScanIdx[iPartIdx] - 1;
+ const uint8_t kuiTopIdx = g_kuiCache30ScanIdx[iPartIdx] - 6;
int32_t iMatchRef;
int32_t iLeftRef = kpMvComp->iRefIndexCache[kuiLeftIdx];
@@ -69,8 +69,8 @@
}
// b2[diag] b1[top] b0[left] is available!
- iMatchRef = (iRef == iLeftRef) << MB_LEFT_BIT;
- iMatchRef |= (iRef == iTopRef) << MB_TOP_BIT;
+ iMatchRef = (iRef == iLeftRef) << MB_LEFT_BIT;
+ iMatchRef |= (iRef == iTopRef) << MB_TOP_BIT;
iMatchRef |= (iRef == iDiagonalRef) << MB_TOPRIGHT_BIT;
switch (iMatchRef) {
case LEFT_MB_POS:// A
@@ -147,12 +147,12 @@
//update pMv and uiRefIndex cache for current MB, only for P_16*16 (SKIP inclusive)
void UpdateP16x16MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int8_t kiRef, SMVUnitXY* pMv) {
// optimized 11/25/2011
- SMVComponentUnit* pMvComp = &pMbCache->sMvComponents;
- const uint32_t kuiMv32 = LD32 (pMv);
- const uint64_t kuiMv64 = BUTTERFLY4x8 (kuiMv32);
- uint64_t uiMvBuf[8] = { kuiMv64, kuiMv64, kuiMv64, kuiMv64, kuiMv64, kuiMv64, kuiMv64, kuiMv64 };
- const uint16_t kuiRef16 = BUTTERFLY1x2 (kiRef);
- const uint32_t kuiRef32 = BUTTERFLY2x4 (kuiRef16);
+ SMVComponentUnit* pMvComp = &pMbCache->sMvComponents;
+ const uint32_t kuiMv32 = LD32 (pMv);
+ const uint64_t kuiMv64 = BUTTERFLY4x8 (kuiMv32);
+ uint64_t uiMvBuf[8] = { kuiMv64, kuiMv64, kuiMv64, kuiMv64, kuiMv64, kuiMv64, kuiMv64, kuiMv64 };
+ const uint16_t kuiRef16 = BUTTERFLY1x2 (kiRef);
+ const uint32_t kuiRef32 = BUTTERFLY2x4 (kuiRef16);
ST32 (pCurMb->pRefIndex, kuiRef32);
// update pMv range from 0~15
@@ -161,23 +161,23 @@
/*
* blocks 0: 7~10, 1: 13~16, 2: 19~22, 3: 25~28
*/
- pMvComp->iRefIndexCache[7] = kiRef;
+ pMvComp->iRefIndexCache[7] = kiRef;
ST16 (&pMvComp->iRefIndexCache[8], kuiRef16);
- pMvComp->iRefIndexCache[10] = kiRef;
- pMvComp->iRefIndexCache[13] = kiRef;
+ pMvComp->iRefIndexCache[10] = kiRef;
+ pMvComp->iRefIndexCache[13] = kiRef;
ST16 (&pMvComp->iRefIndexCache[14], kuiRef16);
- pMvComp->iRefIndexCache[16] = kiRef;
- pMvComp->iRefIndexCache[19] = kiRef;
+ pMvComp->iRefIndexCache[16] = kiRef;
+ pMvComp->iRefIndexCache[19] = kiRef;
ST16 (&pMvComp->iRefIndexCache[20], kuiRef16);
- pMvComp->iRefIndexCache[22] = kiRef;
- pMvComp->iRefIndexCache[25] = kiRef;
+ pMvComp->iRefIndexCache[22] = kiRef;
+ pMvComp->iRefIndexCache[25] = kiRef;
ST16 (&pMvComp->iRefIndexCache[26], kuiRef16);
- pMvComp->iRefIndexCache[28] = kiRef;
+ pMvComp->iRefIndexCache[28] = kiRef;
/*
* blocks 0: 7~10, 1: 13~16, 2: 19~22, 3: 25~28
*/
- pMvComp->sMotionVectorCache[7] = *pMv;
+ pMvComp->sMotionVectorCache[7] = *pMv;
ST64 (&pMvComp->sMotionVectorCache[8], kuiMv64);
pMvComp->sMotionVectorCache[10] = *pMv;
pMvComp->sMotionVectorCache[13] = *pMv;
@@ -195,18 +195,18 @@
void UpdateP16x8MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPartIdx, const int8_t kiRef,
SMVUnitXY* pMv) {
// optimized 11/25/2011
- SMVComponentUnit* pMvComp = &pMbCache->sMvComponents;
- const uint32_t kuiMv32 = LD32 (pMv);
- const uint64_t kuiMv64 = BUTTERFLY4x8 (kuiMv32);
- uint64_t uiMvBuf[4] = { kuiMv64, kuiMv64, kuiMv64, kuiMv64 };
- const int16_t kiScan4Idx = g_kuiMbCountScan4Idx[kiPartIdx];
- const int16_t kiCacheIdx = g_kuiCache30ScanIdx[kiPartIdx];
- const int16_t kiCacheIdx1 = 1 + kiCacheIdx;
- const int16_t kiCacheIdx3 = 3 + kiCacheIdx;
- const int16_t kiCacheIdx6 = 6 + kiCacheIdx;
- const int16_t kiCacheIdx7 = 7 + kiCacheIdx;
- const int16_t kiCacheIdx9 = 9 + kiCacheIdx;
- const uint16_t kuiRef16 = BUTTERFLY1x2 (kiRef);
+ SMVComponentUnit* pMvComp = &pMbCache->sMvComponents;
+ const uint32_t kuiMv32 = LD32 (pMv);
+ const uint64_t kuiMv64 = BUTTERFLY4x8 (kuiMv32);
+ uint64_t uiMvBuf[4] = { kuiMv64, kuiMv64, kuiMv64, kuiMv64 };
+ const int16_t kiScan4Idx = g_kuiMbCountScan4Idx[kiPartIdx];
+ const int16_t kiCacheIdx = g_kuiCache30ScanIdx[kiPartIdx];
+ const int16_t kiCacheIdx1 = 1 + kiCacheIdx;
+ const int16_t kiCacheIdx3 = 3 + kiCacheIdx;
+ const int16_t kiCacheIdx6 = 6 + kiCacheIdx;
+ const int16_t kiCacheIdx7 = 7 + kiCacheIdx;
+ const int16_t kiCacheIdx9 = 9 + kiCacheIdx;
+ const uint16_t kuiRef16 = BUTTERFLY1x2 (kiRef);
ST16 (&pCurMb->pRefIndex[ (kiPartIdx >> 2)], kuiRef16);
memcpy (&pCurMb->sMv[kiScan4Idx], uiMvBuf, sizeof (uiMvBuf)); // confirmed_safe_unsafe_usage
@@ -214,17 +214,17 @@
/*
* blocks 0: g_kuiCache30ScanIdx[iPartIdx]~g_kuiCache30ScanIdx[iPartIdx]+3, 1: g_kuiCache30ScanIdx[iPartIdx]+6~g_kuiCache30ScanIdx[iPartIdx]+9
*/
- pMvComp->iRefIndexCache[kiCacheIdx] = kiRef;
+ pMvComp->iRefIndexCache[kiCacheIdx] = kiRef;
ST16 (&pMvComp->iRefIndexCache[kiCacheIdx1], kuiRef16);
- pMvComp->iRefIndexCache[kiCacheIdx3] = kiRef;
- pMvComp->iRefIndexCache[kiCacheIdx6] = kiRef;
+ pMvComp->iRefIndexCache[kiCacheIdx3] = kiRef;
+ pMvComp->iRefIndexCache[kiCacheIdx6] = kiRef;
ST16 (&pMvComp->iRefIndexCache[kiCacheIdx7], kuiRef16);
- pMvComp->iRefIndexCache[kiCacheIdx9] = kiRef;
+ pMvComp->iRefIndexCache[kiCacheIdx9] = kiRef;
/*
* blocks 0: g_kuiCache30ScanIdx[iPartIdx]~g_kuiCache30ScanIdx[iPartIdx]+3, 1: g_kuiCache30ScanIdx[iPartIdx]+6~g_kuiCache30ScanIdx[iPartIdx]+9
*/
- pMvComp->sMotionVectorCache[kiCacheIdx] = *pMv;
+ pMvComp->sMotionVectorCache[kiCacheIdx] = *pMv;
ST64 (&pMvComp->sMotionVectorCache[kiCacheIdx1], kuiMv64);
pMvComp->sMotionVectorCache[kiCacheIdx3] = *pMv;
pMvComp->sMotionVectorCache[kiCacheIdx6] = *pMv;
@@ -235,20 +235,20 @@
void update_P8x16_motion_info (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPartIdx, const int8_t kiRef,
SMVUnitXY* pMv) {
// optimized 11/25/2011
- SMVComponentUnit* pMvComp = &pMbCache->sMvComponents;
- const uint32_t kuiMv32 = LD32 (pMv);
- const uint64_t kuiMv64 = BUTTERFLY4x8 (kuiMv32);
- const int16_t kiScan4Idx = g_kuiMbCountScan4Idx[kiPartIdx];
- const int16_t kiCacheIdx = g_kuiCache30ScanIdx[kiPartIdx];
- const int16_t kiCacheIdx1 = 1 + kiCacheIdx;
- const int16_t kiCacheIdx3 = 3 + kiCacheIdx;
- const int16_t kiCacheIdx12 = 12 + kiCacheIdx;
- const int16_t kiCacheIdx13 = 13 + kiCacheIdx;
- const int16_t kiCacheIdx15 = 15 + kiCacheIdx;
- const int16_t kiBlkIdx = kiPartIdx >> 2;
- const uint16_t kuiRef16 = BUTTERFLY1x2 (kiRef);
+ SMVComponentUnit* pMvComp = &pMbCache->sMvComponents;
+ const uint32_t kuiMv32 = LD32 (pMv);
+ const uint64_t kuiMv64 = BUTTERFLY4x8 (kuiMv32);
+ const int16_t kiScan4Idx = g_kuiMbCountScan4Idx[kiPartIdx];
+ const int16_t kiCacheIdx = g_kuiCache30ScanIdx[kiPartIdx];
+ const int16_t kiCacheIdx1 = 1 + kiCacheIdx;
+ const int16_t kiCacheIdx3 = 3 + kiCacheIdx;
+ const int16_t kiCacheIdx12 = 12 + kiCacheIdx;
+ const int16_t kiCacheIdx13 = 13 + kiCacheIdx;
+ const int16_t kiCacheIdx15 = 15 + kiCacheIdx;
+ const int16_t kiBlkIdx = kiPartIdx >> 2;
+ const uint16_t kuiRef16 = BUTTERFLY1x2 (kiRef);
- pCurMb->pRefIndex[kiBlkIdx] = kiRef;
+ pCurMb->pRefIndex[kiBlkIdx] = kiRef;
pCurMb->pRefIndex[2 + kiBlkIdx] = kiRef;
ST64 (&pCurMb->sMv[kiScan4Idx], kuiMv64);
ST64 (&pCurMb->sMv[4 + kiScan4Idx], kuiMv64);
@@ -258,17 +258,17 @@
/*
* blocks 0: g_kuiCache30ScanIdx[iPartIdx]~g_kuiCache30ScanIdx[iPartIdx]+3, 1: g_kuiCache30ScanIdx[iPartIdx]+6~g_kuiCache30ScanIdx[iPartIdx]+9
*/
- pMvComp->iRefIndexCache[kiCacheIdx] = kiRef;
+ pMvComp->iRefIndexCache[kiCacheIdx] = kiRef;
ST16 (&pMvComp->iRefIndexCache[kiCacheIdx1], kuiRef16);
- pMvComp->iRefIndexCache[kiCacheIdx3] = kiRef;
- pMvComp->iRefIndexCache[kiCacheIdx12] = kiRef;
+ pMvComp->iRefIndexCache[kiCacheIdx3] = kiRef;
+ pMvComp->iRefIndexCache[kiCacheIdx12] = kiRef;
ST16 (&pMvComp->iRefIndexCache[kiCacheIdx13], kuiRef16);
- pMvComp->iRefIndexCache[kiCacheIdx15] = kiRef;
+ pMvComp->iRefIndexCache[kiCacheIdx15] = kiRef;
/*
* blocks 0: g_kuiCache30ScanIdx[iPartIdx]~g_kuiCache30ScanIdx[iPartIdx]+3, 1: g_kuiCache30ScanIdx[iPartIdx]+6~g_kuiCache30ScanIdx[iPartIdx]+9
*/
- pMvComp->sMotionVectorCache[kiCacheIdx] = *pMv;
+ pMvComp->sMotionVectorCache[kiCacheIdx] = *pMv;
ST64 (&pMvComp->sMotionVectorCache[kiCacheIdx1], kuiMv64);
pMvComp->sMotionVectorCache[kiCacheIdx3] = *pMv;
pMvComp->sMotionVectorCache[kiCacheIdx12] = *pMv;
@@ -279,13 +279,13 @@
void UpdateP8x8MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPartIdx, const int8_t kiRef,
SMVUnitXY* pMv) {
SMVComponentUnit* pMvComp = &pMbCache->sMvComponents;
- const uint32_t kuiMv32 = LD32 (pMv);
- const uint64_t kuiMv64 = BUTTERFLY4x8 (kuiMv32);
- const int16_t kiScan4Idx = g_kuiMbCountScan4Idx[kiPartIdx];
- const int16_t kiCacheIdx = g_kuiCache30ScanIdx[kiPartIdx];
- const int16_t kiCacheIdx1 = 1 + kiCacheIdx;
- const int16_t kiCacheIdx6 = 6 + kiCacheIdx;
- const int16_t kiCacheIdx7 = 7 + kiCacheIdx;
+ const uint32_t kuiMv32 = LD32 (pMv);
+ const uint64_t kuiMv64 = BUTTERFLY4x8 (kuiMv32);
+ const int16_t kiScan4Idx = g_kuiMbCountScan4Idx[kiPartIdx];
+ const int16_t kiCacheIdx = g_kuiCache30ScanIdx[kiPartIdx];
+ const int16_t kiCacheIdx1 = 1 + kiCacheIdx;
+ const int16_t kiCacheIdx6 = 6 + kiCacheIdx;
+ const int16_t kiCacheIdx7 = 7 + kiCacheIdx;
//mb
ST64 (&pCurMb->sMv[ kiScan4Idx], kuiMv64);
--- a/codec/encoder/core/src/nal_encap.cpp
+++ b/codec/encoder/core/src/nal_encap.cpp
@@ -45,18 +45,18 @@
*/
void WelsLoadNal (SWelsEncoderOutput* pEncoderOuput, const int32_t/*EWelsNalUnitType*/ kiType,
const int32_t/*EWelsNalRefIdc*/ kiNalRefIdc) {
- SWelsEncoderOutput* pWelsEncoderOuput = pEncoderOuput;
- SWelsNalRaw* pRawNal = &pWelsEncoderOuput->sNalList[ pWelsEncoderOuput->iNalIndex ];
- SNalUnitHeader* sNalUnitHeader = &pRawNal->sNalExt.sNalUnitHeader;
- const int32_t kiStartPos = (BsGetBitsPos (&pWelsEncoderOuput->sBsWrite) >> 3);
+ SWelsEncoderOutput* pWelsEncoderOuput = pEncoderOuput;
+ SWelsNalRaw* pRawNal = &pWelsEncoderOuput->sNalList[ pWelsEncoderOuput->iNalIndex ];
+ SNalUnitHeader* sNalUnitHeader = &pRawNal->sNalExt.sNalUnitHeader;
+ const int32_t kiStartPos = (BsGetBitsPos (&pWelsEncoderOuput->sBsWrite) >> 3);
- sNalUnitHeader->eNalUnitType = (EWelsNalUnitType)kiType;
- sNalUnitHeader->uiNalRefIdc = (EWelsNalRefIdc)kiNalRefIdc;
- sNalUnitHeader->uiForbiddenZeroBit = 0;
+ sNalUnitHeader->eNalUnitType = (EWelsNalUnitType)kiType;
+ sNalUnitHeader->uiNalRefIdc = (EWelsNalRefIdc)kiNalRefIdc;
+ sNalUnitHeader->uiForbiddenZeroBit = 0;
- pRawNal->pRawData = &pWelsEncoderOuput->pBsBuffer[kiStartPos];
- pRawNal->iStartPos = kiStartPos;
- pRawNal->iPayloadSize = 0;
+ pRawNal->pRawData = &pWelsEncoderOuput->pBsBuffer[kiStartPos];
+ pRawNal->iStartPos = kiStartPos;
+ pRawNal->iPayloadSize = 0;
}
/*!
@@ -63,13 +63,13 @@
* \brief unload pRawNal NAL
*/
void WelsUnloadNal (SWelsEncoderOutput* pEncoderOuput) {
- SWelsEncoderOutput* pWelsEncoderOuput = pEncoderOuput;
- int32_t* pIdx = &pWelsEncoderOuput->iNalIndex;
- SWelsNalRaw* pRawNal = &pWelsEncoderOuput->sNalList[ *pIdx ];
- const int32_t kiEndPos = (BsGetBitsPos (&pWelsEncoderOuput->sBsWrite) >> 3);
+ SWelsEncoderOutput* pWelsEncoderOuput = pEncoderOuput;
+ int32_t* pIdx = &pWelsEncoderOuput->iNalIndex;
+ SWelsNalRaw* pRawNal = &pWelsEncoderOuput->sNalList[ *pIdx ];
+ const int32_t kiEndPos = (BsGetBitsPos (&pWelsEncoderOuput->sBsWrite) >> 3);
/* count payload size of pRawNal NAL */
- pRawNal->iPayloadSize = kiEndPos - pRawNal->iStartPos;
+ pRawNal->iPayloadSize = kiEndPos - pRawNal->iStartPos;
++ (*pIdx);
}
@@ -79,19 +79,19 @@
*/
void WelsLoadNalForSlice (SWelsSliceBs* pSliceBsIn, const int32_t/*EWelsNalUnitType*/ kiType,
const int32_t/*EWelsNalRefIdc*/ kiNalRefIdc) {
- SWelsSliceBs* pSliceBs = pSliceBsIn;
- SWelsNalRaw* pRawNal = &pSliceBs->sNalList[ pSliceBs->iNalIndex ];
- SNalUnitHeader* sNalUnitHeader = &pRawNal->sNalExt.sNalUnitHeader;
- SBitStringAux* pBitStringAux = &pSliceBs->sBsWrite;
- const int32_t kiStartPos = (BsGetBitsPos (pBitStringAux) >> 3);
+ SWelsSliceBs* pSliceBs = pSliceBsIn;
+ SWelsNalRaw* pRawNal = &pSliceBs->sNalList[ pSliceBs->iNalIndex ];
+ SNalUnitHeader* sNalUnitHeader = &pRawNal->sNalExt.sNalUnitHeader;
+ SBitStringAux* pBitStringAux = &pSliceBs->sBsWrite;
+ const int32_t kiStartPos = (BsGetBitsPos (pBitStringAux) >> 3);
- sNalUnitHeader->eNalUnitType = (EWelsNalUnitType)kiType;
- sNalUnitHeader->uiNalRefIdc = (EWelsNalRefIdc)kiNalRefIdc;
- sNalUnitHeader->uiForbiddenZeroBit = 0;
+ sNalUnitHeader->eNalUnitType = (EWelsNalUnitType)kiType;
+ sNalUnitHeader->uiNalRefIdc = (EWelsNalRefIdc)kiNalRefIdc;
+ sNalUnitHeader->uiForbiddenZeroBit = 0;
- pRawNal->pRawData = &pSliceBs->pBsBuffer[kiStartPos];
- pRawNal->iStartPos = kiStartPos;
- pRawNal->iPayloadSize = 0;
+ pRawNal->pRawData = &pSliceBs->pBsBuffer[kiStartPos];
+ pRawNal->iStartPos = kiStartPos;
+ pRawNal->iPayloadSize = 0;
}
/*!
@@ -98,14 +98,14 @@
* \brief unload pRawNal NAL
*/
void WelsUnloadNalForSlice (SWelsSliceBs* pSliceBsIn) {
- SWelsSliceBs* pSliceBs = pSliceBsIn;
- int32_t* pIdx = &pSliceBs->iNalIndex;
- SWelsNalRaw* pRawNal = &pSliceBs->sNalList[ *pIdx ];
- SBitStringAux* pBitStringAux = &pSliceBs->sBsWrite;
- const int32_t kiEndPos = (BsGetBitsPos (pBitStringAux) >> 3);
+ SWelsSliceBs* pSliceBs = pSliceBsIn;
+ int32_t* pIdx = &pSliceBs->iNalIndex;
+ SWelsNalRaw* pRawNal = &pSliceBs->sNalList[ *pIdx ];
+ SBitStringAux* pBitStringAux = &pSliceBs->sBsWrite;
+ const int32_t kiEndPos = (BsGetBitsPos (pBitStringAux) >> 3);
/* count payload size of pRawNal NAL */
- pRawNal->iPayloadSize = kiEndPos - pRawNal->iStartPos;
+ pRawNal->iPayloadSize = kiEndPos - pRawNal->iStartPos;
++ (*pIdx);
}
@@ -132,12 +132,12 @@
return ENC_RETURN_MEMALLOCERR;
//TODO: call the realloc© instead
}
- uint8_t* pDstStart = (uint8_t*)pDst;
- uint8_t* pDstPointer = pDstStart;
- uint8_t* pSrcPointer = pRawNal->pRawData;
- uint8_t* pSrcEnd = pRawNal->pRawData + pRawNal->iPayloadSize;
- int32_t iZeroCount = 0;
- int32_t iNalLength = 0;
+ uint8_t* pDstStart = (uint8_t*)pDst;
+ uint8_t* pDstPointer = pDstStart;
+ uint8_t* pSrcPointer = pRawNal->pRawData;
+ uint8_t* pSrcEnd = pRawNal->pRawData + pRawNal->iPayloadSize;
+ int32_t iZeroCount = 0;
+ int32_t iNalLength = 0;
*pDstLen = 0;
static const uint8_t kuiStartCodePrefix[NAL_HEADER_SIZE] = { 0, 0, 0, 1 };
--- a/codec/encoder/core/src/picture_handle.cpp
+++ b/codec/encoder/core/src/picture_handle.cpp
@@ -54,43 +54,43 @@
int32_t iPicWidth = 0;
int32_t iPicHeight = 0;
- int32_t iPicChromaWidth = 0;
- int32_t iPicChromaHeight = 0;
- int32_t iLumaSize = 0;
- int32_t iChromaSize = 0;
+ int32_t iPicChromaWidth = 0;
+ int32_t iPicChromaHeight = 0;
+ int32_t iLumaSize = 0;
+ int32_t iChromaSize = 0;
pPic = static_cast<SPicture*> (pMa->WelsMallocz (sizeof (SPicture), "pPic"));
WELS_VERIFY_RETURN_IF (NULL, NULL == pPic);
- iPicWidth = WELS_ALIGN (kiWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with width of horizon
- iPicHeight = WELS_ALIGN (kiHeight, MB_HEIGHT_LUMA) + (PADDING_LENGTH << 1); // with height of vertical
- iPicChromaWidth = iPicWidth >> 1;
- iPicChromaHeight = iPicHeight >> 1;
- iPicWidth = WELS_ALIGN (iPicWidth,
- 32); // 32(or 16 for chroma below) to match original imp. here instead of cache_line_size
- iPicChromaWidth = WELS_ALIGN (iPicChromaWidth, 16);
- iLumaSize = iPicWidth * iPicHeight;
- iChromaSize = iPicChromaWidth * iPicChromaHeight;
+ iPicWidth = WELS_ALIGN (kiWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with width of horizon
+ iPicHeight = WELS_ALIGN (kiHeight, MB_HEIGHT_LUMA) + (PADDING_LENGTH << 1); // with height of vertical
+ iPicChromaWidth = iPicWidth >> 1;
+ iPicChromaHeight = iPicHeight >> 1;
+ iPicWidth = WELS_ALIGN (iPicWidth,
+ 32); // 32(or 16 for chroma below) to match original imp. here instead of cache_line_size
+ iPicChromaWidth = WELS_ALIGN (iPicChromaWidth, 16);
+ iLumaSize = iPicWidth * iPicHeight;
+ iChromaSize = iPicChromaWidth * iPicChromaHeight;
- pPic->pBuffer = (uint8_t*)pMa->WelsMalloc (iLumaSize /* luma */
+ pPic->pBuffer = (uint8_t*)pMa->WelsMalloc (iLumaSize /* luma */
+ (iChromaSize << 1) /* Cb,Cr */
, "pPic->pBuffer");
WELS_VERIFY_RETURN_PROC_IF (NULL, NULL == pPic->pBuffer, FreePicture (pMa, &pPic));
- pPic->iLineSize[0] = iPicWidth;
- pPic->iLineSize[1] = pPic->iLineSize[2] = iPicChromaWidth;
- pPic->pData[0] = pPic->pBuffer + (1 + pPic->iLineSize[0]) * PADDING_LENGTH;
- pPic->pData[1] = pPic->pBuffer + iLumaSize + (((1 + pPic->iLineSize[1]) * PADDING_LENGTH) >> 1);
- pPic->pData[2] = pPic->pBuffer + iLumaSize + iChromaSize + (((1 + pPic->iLineSize[2]) * PADDING_LENGTH) >> 1);
+ pPic->iLineSize[0] = iPicWidth;
+ pPic->iLineSize[1] = pPic->iLineSize[2] = iPicChromaWidth;
+ pPic->pData[0] = pPic->pBuffer + (1 + pPic->iLineSize[0]) * PADDING_LENGTH;
+ pPic->pData[1] = pPic->pBuffer + iLumaSize + (((1 + pPic->iLineSize[1]) * PADDING_LENGTH) >> 1);
+ pPic->pData[2] = pPic->pBuffer + iLumaSize + iChromaSize + (((1 + pPic->iLineSize[2]) * PADDING_LENGTH) >> 1);
- pPic->iWidthInPixel = kiWidth;
- pPic->iHeightInPixel = kiHeight;
- pPic->iFrameNum = -1;
+ pPic->iWidthInPixel = kiWidth;
+ pPic->iHeightInPixel = kiHeight;
+ pPic->iFrameNum = -1;
- pPic->bIsLongRef = false;
+ pPic->bIsLongRef = false;
pPic->iLongTermPicNum = -1;
pPic->uiRecieveConfirmed = 0;
- pPic->iMarkFrameNum = -1;
+ pPic->iMarkFrameNum = -1;
if (bNeedMbInfo) {
const uint32_t kuiCountMbNum = ((15 + kiWidth) >> 4) * ((15 + kiHeight) >> 4);
@@ -134,22 +134,22 @@
pMa->WelsFree (pPic->pBuffer, "pPic->pBuffer");
pPic->pBuffer = NULL;
}
- pPic->pBuffer = NULL;
- pPic->pData[0] =
- pPic->pData[1] =
- pPic->pData[2] = NULL;
- pPic->iLineSize[0] =
- pPic->iLineSize[1] =
+ pPic->pBuffer = NULL;
+ pPic->pData[0] =
+ pPic->pData[1] =
+ pPic->pData[2] = NULL;
+ pPic->iLineSize[0] =
+ pPic->iLineSize[1] =
pPic->iLineSize[2] = 0;
- pPic->iWidthInPixel = 0;
- pPic->iHeightInPixel = 0;
- pPic->iFrameNum = -1;
+ pPic->iWidthInPixel = 0;
+ pPic->iHeightInPixel = 0;
+ pPic->iFrameNum = -1;
- pPic->bIsLongRef = false;
- pPic->uiRecieveConfirmed = 0;
- pPic->iLongTermPicNum = -1;
- pPic->iMarkFrameNum = -1;
+ pPic->bIsLongRef = false;
+ pPic->uiRecieveConfirmed = 0;
+ pPic->iLongTermPicNum = -1;
+ pPic->iMarkFrameNum = -1;
if (pPic->uiRefMbType) {
pMa->WelsFree (pPic->uiRefMbType, "pPic->uiRefMbType");
--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -59,27 +59,27 @@
}; //WELS_ROUND(INT_MULTIPLY*pow (2.0, (iQP - 4.0) / 6.0))
void RcInitLayerMemory (SWelsSvcRc* pWelsSvcRc, CMemoryAlign* pMA, const int32_t kiMaxTl) {
- const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;
- const int32_t kiGomSize = pWelsSvcRc->iGomSize;
- const int32_t kiGomSizeD = kiGomSize * sizeof (double);
- const int32_t kiGomSizeI = kiGomSize * sizeof (int32_t);
- const int32_t kiLayerRcSize = kiGomSizeD + (kiGomSizeI * 3) + sizeof (SRCTemporal) * kiMaxTl;
- uint8_t* pBaseMem = (uint8_t*)pMA->WelsMalloc (kiLayerRcSize, "pWelsSvcRc->pTemporalOverRc");
+ const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;
+ const int32_t kiGomSize = pWelsSvcRc->iGomSize;
+ const int32_t kiGomSizeD = kiGomSize * sizeof (double);
+ const int32_t kiGomSizeI = kiGomSize * sizeof (int32_t);
+ const int32_t kiLayerRcSize = kiGomSizeD + (kiGomSizeI * 3) + sizeof (SRCTemporal) * kiMaxTl;
+ uint8_t* pBaseMem = (uint8_t*)pMA->WelsMalloc (kiLayerRcSize, "pWelsSvcRc->pTemporalOverRc");
if (NULL == pBaseMem)
return;
- pWelsSvcRc->pTemporalOverRc = (SRCTemporal*)pBaseMem;
+ pWelsSvcRc->pTemporalOverRc = (SRCTemporal*)pBaseMem;
pBaseMem += sizeof (SRCTemporal) * kiMaxTl;
- pWelsSvcRc->pGomComplexity = (double*)pBaseMem;
+ pWelsSvcRc->pGomComplexity = (double*)pBaseMem;
pBaseMem += kiGomSizeD;
- pWelsSvcRc->pGomForegroundBlockNum = (int32_t*)pBaseMem;
+ pWelsSvcRc->pGomForegroundBlockNum = (int32_t*)pBaseMem;
pBaseMem += kiGomSizeI;
- pWelsSvcRc->pCurrentFrameGomSad = (int32_t*)pBaseMem;
+ pWelsSvcRc->pCurrentFrameGomSad = (int32_t*)pBaseMem;
pBaseMem += kiGomSizeI;
- pWelsSvcRc->pGomCost = (int32_t*)pBaseMem;
+ pWelsSvcRc->pGomCost = (int32_t*)pBaseMem;
- pWelsSvcRc->pSlicingOverRc = (SRCSlicing*)pMA->WelsMalloc (sizeof (SRCSlicing) * kiSliceNum, "SlicingOverRC");
+ pWelsSvcRc->pSlicingOverRc = (SRCSlicing*)pMA->WelsMalloc (sizeof (SRCSlicing) * kiSliceNum, "SlicingOverRC");
}
void RcFreeLayerMemory (SWelsSvcRc* pWelsSvcRc, CMemoryAlign* pMA) {
@@ -90,10 +90,10 @@
if (pWelsSvcRc != NULL && pWelsSvcRc->pTemporalOverRc != NULL) {
pMA->WelsFree (pWelsSvcRc->pTemporalOverRc, "pWelsSvcRc->pTemporalOverRc");
pWelsSvcRc->pTemporalOverRc = NULL;
- pWelsSvcRc->pGomComplexity = NULL;
- pWelsSvcRc->pGomForegroundBlockNum = NULL;
- pWelsSvcRc->pCurrentFrameGomSad = NULL;
- pWelsSvcRc->pGomCost = NULL;
+ pWelsSvcRc->pGomComplexity = NULL;
+ pWelsSvcRc->pGomForegroundBlockNum = NULL;
+ pWelsSvcRc->pCurrentFrameGomSad = NULL;
+ pWelsSvcRc->pGomCost = NULL;
}
}
@@ -169,9 +169,9 @@
RcInitLayerMemory (pWelsSvcRc, pEncCtx->pMemAlign, 1 + pEncCtx->pSvcParam->sDependencyLayers[j].iHighestTemporalId);
- bMultiSliceMode = ((SM_RASTER_SLICE == pDLayerParam->sSliceCfg.uiSliceMode) ||
- (SM_ROWMB_SLICE == pDLayerParam->sSliceCfg.uiSliceMode) ||
- (SM_DYN_SLICE == pDLayerParam->sSliceCfg.uiSliceMode));
+ bMultiSliceMode = ((SM_RASTER_SLICE == pDLayerParam->sSliceCfg.uiSliceMode) ||
+ (SM_ROWMB_SLICE == pDLayerParam->sSliceCfg.uiSliceMode) ||
+ (SM_DYN_SLICE == pDLayerParam->sSliceCfg.uiSliceMode));
if (bMultiSliceMode)
pWelsSvcRc->iNumberMbGom = pWelsSvcRc->iNumberMbFrame;
}
@@ -210,16 +210,16 @@
}
void RcUpdateBitrateFps (sWelsEncCtx* pEncCtx) {
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc;
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc;
SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId];
SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
- const int32_t kiGopSize = (1 << pDLayerParamInternal->iDecompositionStages);
+ const int32_t kiGopSize = (1 << pDLayerParamInternal->iDecompositionStages);
const int32_t kiHighestTid = pDLayerParamInternal->iHighestTemporalId;
const int32_t input_iBitsPerFrame = WELS_DIV_ROUND (pDLayerParam->iSpatialBitrate,
pDLayerParamInternal->fOutputFrameRate);
- const int64_t kiGopBits = input_iBitsPerFrame * kiGopSize;
+ const int64_t kiGopBits = input_iBitsPerFrame * kiGopSize;
int32_t i;
pWelsSvcRc->iBitRate = pDLayerParam->iSpatialBitrate;
@@ -252,9 +252,9 @@
void RcInitVGop (sWelsEncCtx* pEncCtx) {
- const int32_t kiDid = pEncCtx->uiDependencyId;
+ const int32_t kiDid = pEncCtx->uiDependencyId;
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[kiDid];
- SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc;
+ SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc;
const int32_t kiHighestTid = pEncCtx->pSvcParam->sDependencyLayers[kiDid].iHighestTemporalId;
pWelsSvcRc->iRemainingBits = VGOP_SIZE * pWelsSvcRc->iBitsPerFrame;
@@ -269,11 +269,11 @@
}
void RcInitRefreshParameter (sWelsEncCtx* pEncCtx) {
- const int32_t kiDid = pEncCtx->uiDependencyId;
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[kiDid];
- SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc;
- SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[kiDid];
- SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[kiDid];
+ const int32_t kiDid = pEncCtx->uiDependencyId;
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[kiDid];
+ SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc;
+ SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[kiDid];
+ SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[kiDid];
const int32_t kiHighestTid = pDLayerParamInternal->iHighestTemporalId;
int32_t i;
@@ -327,14 +327,14 @@
#if GOM_TRACE_FLAG
void RcTraceVGopBitrate (sWelsEncCtx* pEncCtx) {
- const int32_t kiDid = pEncCtx->uiDependencyId;
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[kiDid];
+ const int32_t kiDid = pEncCtx->uiDependencyId;
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[kiDid];
if (pWelsSvcRc->iFrameCodedInVGop) {
- const int32_t kiHighestTid = pEncCtx->pSvcParam->sDependencyLayers[kiDid].iHighestTemporalId;
- SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc;
+ const int32_t kiHighestTid = pEncCtx->pSvcParam->sDependencyLayers[kiDid].iHighestTemporalId;
+ SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc;
int32_t iVGopBitrate = 0;
- int32_t iTotalBits = pWelsSvcRc->iPaddingBitrateStat;
+ int32_t iTotalBits = pWelsSvcRc->iPaddingBitrateStat;
int32_t iTid = 0;
while (iTid <= kiHighestTid) {
iTotalBits += pTOverRc[iTid].iGopBitsDq;
@@ -356,10 +356,10 @@
#endif
void RcUpdateTemporalZero (sWelsEncCtx* pEncCtx) {
- const int32_t kiDid = pEncCtx->uiDependencyId;
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[kiDid];
- SSpatialLayerInternal* pDLayerParam = &pEncCtx->pSvcParam->sDependencyLayers[kiDid];
- const int32_t kiGopSize = (1 << pDLayerParam->iDecompositionStages);
+ const int32_t kiDid = pEncCtx->uiDependencyId;
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[kiDid];
+ SSpatialLayerInternal* pDLayerParam = &pEncCtx->pSvcParam->sDependencyLayers[kiDid];
+ const int32_t kiGopSize = (1 << pDLayerParam->iDecompositionStages);
if (pWelsSvcRc->iPreviousGopSize != kiGopSize) {
#if GOM_TRACE_FLAG
@@ -389,8 +389,8 @@
int32_t dInitialQPArray[4][4] = {{28, 26, 24, 22}, {30, 28, 26, 24}, {32, 30, 28, 26}, {34, 32, 30, 28}};
int32_t iBppIndex = 0;
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId];
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId];
SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
if (pDLayerParamInternal->fOutputFrameRate > EPSN && pDLayerParam->iVideoWidth && pDLayerParam->iVideoHeight)
dBpp = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParamInternal->fOutputFrameRate *
@@ -438,9 +438,9 @@
void RcCalculatePictureQp (sWelsEncCtx* pEncCtx) {
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- int32_t iTl = pEncCtx->uiTemporalId;
- SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[iTl];
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ int32_t iTl = pEncCtx->uiTemporalId;
+ SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[iTl];
int32_t iLumaQp = 0;
if (0 == pTOverRc->iPFrameNum) {
@@ -515,29 +515,29 @@
}
void RcInitSliceInformation (sWelsEncCtx* pEncCtx) {
- SSliceCtx* pCurSliceCtx = pEncCtx->pCurDqLayer->pSliceEncCtx;
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[0];
- const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;
- const int32_t kiBitsPerMb = WELS_DIV_ROUND (static_cast<int64_t> (pWelsSvcRc->iTargetBits) * INT_MULTIPLY,
- pWelsSvcRc->iNumberMbFrame);
+ SSliceCtx* pCurSliceCtx = pEncCtx->pCurDqLayer->pSliceEncCtx;
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[0];
+ const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;
+ const int32_t kiBitsPerMb = WELS_DIV_ROUND (static_cast<int64_t> (pWelsSvcRc->iTargetBits) * INT_MULTIPLY,
+ pWelsSvcRc->iNumberMbFrame);
for (int32_t i = 0; i < kiSliceNum; i++) {
- pSOverRc->iStartMbSlice =
- pSOverRc->iEndMbSlice = pCurSliceCtx->pFirstMbInSlice[i];
- pSOverRc->iEndMbSlice += (pCurSliceCtx->pCountMbNumInSlice[i] - 1);
- pSOverRc->iTotalQpSlice = 0;
- pSOverRc->iTotalMbSlice = 0;
- pSOverRc->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurSliceCtx->pCountMbNumInSlice[i], INT_MULTIPLY);
- pSOverRc->iFrameBitsSlice = 0;
- pSOverRc->iGomBitsSlice = 0;
+ pSOverRc->iStartMbSlice =
+ pSOverRc->iEndMbSlice = pCurSliceCtx->pFirstMbInSlice[i];
+ pSOverRc->iEndMbSlice += (pCurSliceCtx->pCountMbNumInSlice[i] - 1);
+ pSOverRc->iTotalQpSlice = 0;
+ pSOverRc->iTotalMbSlice = 0;
+ pSOverRc->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurSliceCtx->pCountMbNumInSlice[i], INT_MULTIPLY);
+ pSOverRc->iFrameBitsSlice = 0;
+ pSOverRc->iGomBitsSlice = 0;
++ pSOverRc;
}
}
void RcDecideTargetBits (sWelsEncCtx* pEncCtx) {
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[pEncCtx->uiTemporalId];
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[pEncCtx->uiTemporalId];
pWelsSvcRc->iCurrentBitsLevel = BITS_NORMAL;
//allocate bits
@@ -560,17 +560,17 @@
void RcInitGomParameters (sWelsEncCtx* pEncCtx) {
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[0];
- const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;
- const int32_t kiGlobalQp = pEncCtx->iGlobalQp;
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[0];
+ const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;
+ const int32_t kiGlobalQp = pEncCtx->iGlobalQp;
pWelsSvcRc->iAverageFrameQp = 0;
pWelsSvcRc->iMinFrameQp = 51;
pWelsSvcRc->iMaxFrameQp = 0;
for (int32_t i = 0; i < kiSliceNum; ++i) {
- pSOverRc->iComplexityIndexSlice = 0;
- pSOverRc->iCalculatedQpSlice = kiGlobalQp;
+ pSOverRc->iComplexityIndexSlice = 0;
+ pSOverRc->iCalculatedQpSlice = kiGlobalQp;
++ pSOverRc;
}
memset (pWelsSvcRc->pGomComplexity, 0, pWelsSvcRc->iGomSize * sizeof (double));
@@ -579,16 +579,16 @@
void RcCalculateMbQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, const int32_t kiSliceId) {
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];
- int32_t iLumaQp = pSOverRc->iCalculatedQpSlice;
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];
+ int32_t iLumaQp = pSOverRc->iCalculatedQpSlice;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
if (pEncCtx->pSvcParam->bEnableAdaptiveQuant) {
iLumaQp = (int8_t)WELS_CLIP3 (iLumaQp +
pEncCtx->pVaa->sAdaptiveQuantParam.pMotionTextureIndexToDeltaQp[pCurMb->iMbXY], pWelsSvcRc->iMinQp, 51);
}
- pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (iLumaQp + kuiChromaQpIndexOffset)];
- pCurMb->uiLumaQp = iLumaQp;
+ pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (iLumaQp + kuiChromaQpIndexOffset)];
+ pCurMb->uiLumaQp = iLumaQp;
}
SWelsSvcRc* RcJudgeBaseUsability (sWelsEncCtx* pEncCtx) {
@@ -615,15 +615,15 @@
}
void RcGomTargetBits (sWelsEncCtx* pEncCtx, const int32_t kiSliceId) {
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- SWelsSvcRc* pWelsSvcRc_Base = NULL;
- SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ SWelsSvcRc* pWelsSvcRc_Base = NULL;
+ SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];
int32_t iAllocateBits = 0;
int32_t iSumSad = 0;
int32_t iLastGomIndex = 0;
int32_t iLeftBits = 0;
- const int32_t kiComplexityIndex = pSOverRc->iComplexityIndexSlice;
+ const int32_t kiComplexityIndex = pSOverRc->iComplexityIndexSlice;
int32_t i;
iLastGomIndex = pSOverRc->iEndMbSlice / pWelsSvcRc->iNumberMbGom;
@@ -653,8 +653,8 @@
void RcCalculateGomQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iSliceId) {
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[iSliceId];
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[iSliceId];
int64_t iBitsRatio = 1;
int64_t iLeftBits = pSOverRc->iTargetBitsSlice - pSOverRc->iFrameBitsSlice;
@@ -953,9 +953,9 @@
}
void RcUpdateFrameComplexity (sWelsEncCtx* pEncCtx) {
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- const int32_t kiTl = pEncCtx->uiTemporalId;
- SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[kiTl];
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ const int32_t kiTl = pEncCtx->uiTemporalId;
+ SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[kiTl];
if (0 == pTOverRc->iPFrameNum) {
pTOverRc->iLinearCmplx = ((int64_t)pWelsSvcRc->iFrameDqBits) * pWelsSvcRc->iQStep;
@@ -1046,11 +1046,11 @@
}
void WelsRcMbInitGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, SSlice* pSlice) {
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- const int32_t kiSliceId = pSlice->uiSliceIdx;
- SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];
- SBitStringAux* bs = pSlice->pSliceBsa;
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ const int32_t kiSliceId = pSlice->uiSliceIdx;
+ SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];
+ SBitStringAux* bs = pSlice->pSliceBsa;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
pSOverRc->iBsPosSlice = BsGetBitsPos (bs);
@@ -1073,11 +1073,11 @@
}
void WelsRcMbInfoUpdateGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iCostLuma, SSlice* pSlice) {
- SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- SBitStringAux* bs = pSlice->pSliceBsa;
- int32_t iSliceId = pSlice->uiSliceIdx;
- SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[iSliceId];
- const int32_t kiComplexityIndex = pSOverRc->iComplexityIndexSlice;
+ SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
+ SBitStringAux* bs = pSlice->pSliceBsa;
+ int32_t iSliceId = pSlice->uiSliceIdx;
+ SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[iSliceId];
+ const int32_t kiComplexityIndex = pSOverRc->iComplexityIndexSlice;
int32_t iCurMbBits = BsGetBitsPos (bs) - pSOverRc->iBsPosSlice;
pSOverRc->iFrameBitsSlice += iCurMbBits;
@@ -1344,15 +1344,15 @@
}
} else {
- int32_t iTl = pEncCtx->uiTemporalId;
- SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[iTl];
+ int32_t iTl = pEncCtx->uiTemporalId;
+ SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[iTl];
int32_t iMaxTh = static_cast<int32_t> (pWelsSvcRc->iBufferSizeSkip - pWelsSvcRc->iBufferFullnessSkip);
int32_t iMinTh = iMaxTh / (iTl + 2);
- SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
- const int32_t kiGopSize = (1 << pDLayerParamInternal->iDecompositionStages);
+ SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
+ const int32_t kiGopSize = (1 << pDLayerParamInternal->iDecompositionStages);
int32_t iAverageFrameSize = (int32_t) ((double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate));
- const int32_t kiGopBits = iAverageFrameSize * kiGopSize;
+ const int32_t kiGopBits = iAverageFrameSize * kiGopSize;
int64_t iCmplxRatio = WELS_DIV_ROUND64 (pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity * INT_MULTIPLY,
pTOverRc->iFrameCmplxMean);
iCmplxRatio = WELS_CLIP3 (iCmplxRatio, INT_MULTIPLY - FRAME_CMPLX_RATIO_RANGE, INT_MULTIPLY + FRAME_CMPLX_RATIO_RANGE);
--- a/codec/encoder/core/src/ref_list_mgr_svc.cpp
+++ b/codec/encoder/core/src/ref_list_mgr_svc.cpp
@@ -191,8 +191,8 @@
* handle LTR Mark feedback message
*/
static inline void HandleLTRMarkFeedback (sWelsEncCtx* pCtx) {
- SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
- SPicture** pLongRefList = pRefList->pLongRefList;
+ SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
+ SPicture** pLongRefList = pRefList->pLongRefList;
SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
int32_t i, j;
@@ -323,8 +323,8 @@
}
static void PrefetchNextBuffer (sWelsEncCtx* pCtx) {
- SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
- const int32_t kiNumRef = pCtx->pSvcParam->iNumRefFrame;
+ SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
+ const int32_t kiNumRef = pCtx->pSvcParam->iNumRefFrame;
int32_t i;
pRefList->pNextBuffer = NULL;
@@ -347,14 +347,14 @@
* update reference picture list
*/
bool WelsUpdateRefList (sWelsEncCtx* pCtx) {
- SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
- SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
- SSpatialLayerInternal* pParamD = &pCtx->pSvcParam->sDependencyLayers[pCtx->uiDependencyId];
+ SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
+ SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
+ SSpatialLayerInternal* pParamD = &pCtx->pSvcParam->sDependencyLayers[pCtx->uiDependencyId];
- int32_t iRefIdx = 0;
- const uint8_t kuiTid = pCtx->uiTemporalId;
- const uint8_t kuiDid = pCtx->uiDependencyId;
- const EWelsSliceType keSliceType = pCtx->eSliceType;
+ int32_t iRefIdx = 0;
+ const uint8_t kuiTid = pCtx->uiTemporalId;
+ const uint8_t kuiDid = pCtx->uiDependencyId;
+ const EWelsSliceType keSliceType = pCtx->eSliceType;
uint32_t i = 0;
// Need update pRef list in case store base layer or target dependency layer construction
if (NULL == pCtx->pCurDqLayer)
@@ -374,11 +374,11 @@
// move picture in list
pCtx->pDecPic->uiTemporalId = kuiTid;
- pCtx->pDecPic->uiSpatialId = kuiDid;
- pCtx->pDecPic->iFrameNum = pCtx->iFrameNum;
- pCtx->pDecPic->iFramePoc = pCtx->iPOC;
+ pCtx->pDecPic->uiSpatialId = kuiDid;
+ pCtx->pDecPic->iFrameNum = pCtx->iFrameNum;
+ pCtx->pDecPic->iFramePoc = pCtx->iPOC;
pCtx->pDecPic->uiRecieveConfirmed = RECIEVE_UNKOWN;
- pCtx->pDecPic->bUsedAsRef = true;
+ pCtx->pDecPic->bUsedAsRef = true;
for (iRefIdx = pRefList->uiShortRefCount - 1; iRefIdx >= 0; --iRefIdx) {
pRefList->pShortRefList[iRefIdx + 1] = pRefList->pShortRefList[iRefIdx];
@@ -467,9 +467,9 @@
}
for (iSliceIdx = 0; iSliceIdx < kiCountSliceNum; iSliceIdx++) {
- SSliceHeaderExt* pSliceHdrExt = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx].sSliceHeaderExt;
- SSliceHeader* pSliceHdr = &pSliceHdrExt->sSliceHeader;
- SRefPicMarking* pRefPicMark = &pSliceHdr->sRefMarking;
+ SSliceHeaderExt* pSliceHdrExt = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx].sSliceHeaderExt;
+ SSliceHeader* pSliceHdr = &pSliceHdrExt->sSliceHeader;
+ SRefPicMarking* pRefPicMark = &pSliceHdr->sRefMarking;
memset (pRefPicMark, 0, sizeof (SRefPicMarking));
@@ -555,11 +555,11 @@
* build reference picture list
*/
bool WelsBuildRefList (sWelsEncCtx* pCtx, const int32_t iPOC, int32_t iBestLtrRefIdx) {
- SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
- SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
- const int32_t kiNumRef = pCtx->pSvcParam->iNumRefFrame;
- const uint8_t kuiTid = pCtx->uiTemporalId;
- uint32_t i = 0;
+ SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
+ SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
+ const int32_t kiNumRef = pCtx->pSvcParam->iNumRefFrame;
+ const uint8_t kuiTid = pCtx->uiTemporalId;
+ uint32_t i = 0;
// to support any type of cur_dq->mgs_control
// [ 0: using current layer to do ME/MC;
@@ -627,9 +627,9 @@
*/
void WelsUpdateRefSyntax (sWelsEncCtx* pCtx, const int32_t iPOC, const int32_t uiFrameType) {
SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
- int32_t iIdx = 0;
- const int32_t kiCountSliceNum = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);
- int32_t iAbsDiffPicNumMinus1 = -1;
+ int32_t iIdx = 0;
+ const int32_t kiCountSliceNum = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);
+ int32_t iAbsDiffPicNumMinus1 = -1;
assert (kiCountSliceNum > 0);
@@ -638,10 +638,10 @@
iAbsDiffPicNumMinus1 = pCtx->iFrameNum - (pCtx->pRefList0[0]->iFrameNum) - 1;
for (iIdx = 0; iIdx < kiCountSliceNum; iIdx++) {
- SSliceHeaderExt* pSliceHdrExt = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iIdx].sSliceHeaderExt;
- SSliceHeader* pSliceHdr = &pSliceHdrExt->sSliceHeader;
- SRefPicListReorderSyntax* pRefReorder = &pSliceHdr->sRefReordering;
- SRefPicMarking* pRefPicMark = &pSliceHdr->sRefMarking;
+ SSliceHeaderExt* pSliceHdrExt = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iIdx].sSliceHeaderExt;
+ SSliceHeader* pSliceHdr = &pSliceHdrExt->sSliceHeader;
+ SRefPicListReorderSyntax* pRefReorder = &pSliceHdr->sRefReordering;
+ SRefPicMarking* pRefPicMark = &pSliceHdr->sRefMarking;
/*syntax for num_ref_idx_l0_active_minus1*/
pSliceHdr->uiRefCount = pCtx->iNumRef0;
@@ -713,10 +713,10 @@
}
bool WelsUpdateRefListScreen (sWelsEncCtx* pCtx) {
- SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
- SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
- SSpatialLayerInternal* pParamD = &pCtx->pSvcParam->sDependencyLayers[pCtx->uiDependencyId];
- const uint8_t kuiTid = pCtx->uiTemporalId;
+ SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
+ SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
+ SSpatialLayerInternal* pParamD = &pCtx->pSvcParam->sDependencyLayers[pCtx->uiDependencyId];
+ const uint8_t kuiTid = pCtx->uiTemporalId;
// Need update ref list in case store base layer or target dependency layer construction
if (NULL == pCtx->pCurDqLayer)
return false;
@@ -734,13 +734,13 @@
pCtx->pFuncList->sExpandPicFunc.pfExpandLumaPicture, pCtx->pFuncList->sExpandPicFunc.pfExpandChromaPicture);
// move picture in list
- pCtx->pDecPic->uiTemporalId = pCtx->uiTemporalId;
- pCtx->pDecPic->uiSpatialId = pCtx->uiDependencyId;
- pCtx->pDecPic->iFrameNum = pCtx->iFrameNum;
- pCtx->pDecPic->iFramePoc = pCtx->iPOC;
- pCtx->pDecPic->bUsedAsRef = true;
- pCtx->pDecPic->bIsLongRef = true;
- pCtx->pDecPic->bIsSceneLTR = pLtr->bLTRMarkingFlag || (pCtx->pSvcParam->bEnableLongTermReference
+ pCtx->pDecPic->uiTemporalId = pCtx->uiTemporalId;
+ pCtx->pDecPic->uiSpatialId = pCtx->uiDependencyId;
+ pCtx->pDecPic->iFrameNum = pCtx->iFrameNum;
+ pCtx->pDecPic->iFramePoc = pCtx->iPOC;
+ pCtx->pDecPic->bUsedAsRef = true;
+ pCtx->pDecPic->bIsLongRef = true;
+ pCtx->pDecPic->bIsSceneLTR = pLtr->bLTRMarkingFlag || (pCtx->pSvcParam->bEnableLongTermReference
&& pCtx->eSliceType == I_SLICE);
pCtx->pDecPic->iLongTermPicNum = pLtr->iCurLtrIdx;
}
@@ -919,9 +919,9 @@
const int32_t iMaxLtrIdx = pCtx->pSvcParam->iNumRefFrame - STR_ROOM - 1;
const int32_t iSliceNum = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);
for (int32_t iSliceIdx = 0; iSliceIdx < iSliceNum; iSliceIdx++) {
- SSliceHeaderExt* pSliceHdrExt = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx].sSliceHeaderExt;
- SSliceHeader* pSliceHdr = &pSliceHdrExt->sSliceHeader;
- SRefPicMarking* pRefPicMark = &pSliceHdr->sRefMarking;
+ SSliceHeaderExt* pSliceHdrExt = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx].sSliceHeaderExt;
+ SSliceHeader* pSliceHdr = &pSliceHdrExt->sSliceHeader;
+ SRefPicMarking* pRefPicMark = &pSliceHdr->sRefMarking;
memset (pRefPicMark, 0, sizeof (SRefPicMarking));
if (pCtx->pSvcParam->bEnableLongTermReference) {
--- a/codec/encoder/core/src/set_mb_syn_cavlc.cpp
+++ b/codec/encoder/core/src/set_mb_syn_cavlc.cpp
@@ -233,18 +233,18 @@
void StashMBStatusCavlc (SDynamicSlicingStack* pDss, SSlice* pSlice, int32_t iMbSkipRun) {
SBitStringAux* pBs = pSlice->pSliceBsa;
- pDss->pBsStackBufPtr = pBs->pCurBuf;
- pDss->uiBsStackCurBits = pBs->uiCurBits;
- pDss->iBsStackLeftBits = pBs->iLeftBits;
- pDss->uiLastMbQp = pSlice->uiLastMbQp;
+ pDss->pBsStackBufPtr = pBs->pCurBuf;
+ pDss->uiBsStackCurBits = pBs->uiCurBits;
+ pDss->iBsStackLeftBits = pBs->iLeftBits;
+ pDss->uiLastMbQp = pSlice->uiLastMbQp;
pDss->iMbSkipRunStack = iMbSkipRun;
}
int32_t StashPopMBStatusCavlc (SDynamicSlicingStack* pDss, SSlice* pSlice) {
SBitStringAux* pBs = pSlice->pSliceBsa;
- pBs->pCurBuf = pDss->pBsStackBufPtr;
- pBs->uiCurBits = pDss->uiBsStackCurBits;
- pBs->iLeftBits = pDss->iBsStackLeftBits;
- pSlice->uiLastMbQp = pDss->uiLastMbQp;
+ pBs->pCurBuf = pDss->pBsStackBufPtr;
+ pBs->uiCurBits = pDss->uiBsStackCurBits;
+ pBs->iLeftBits = pDss->iBsStackLeftBits;
+ pSlice->uiLastMbQp = pDss->uiLastMbQp;
return pDss->iMbSkipRunStack;
}
void StashMBStatusCabac (SDynamicSlicingStack* pDss, SSlice* pSlice, int32_t iMbSkipRun) {
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -73,17 +73,17 @@
void UpdateMbListNeighborParallel (SSliceCtx* pSliceCtx,
SMB* pMbList,
const int32_t uiSliceIdc) {
- const uint16_t* kpMbMap = pSliceCtx->pOverallMbMap;
- const int32_t kiMbWidth = pSliceCtx->iMbWidth;
- int32_t iIdx = pSliceCtx->pFirstMbInSlice[uiSliceIdc];
- const int32_t kiEndMbInSlice = iIdx + pSliceCtx->pCountMbNumInSlice[uiSliceIdc] - 1;
+ const uint16_t* kpMbMap = pSliceCtx->pOverallMbMap;
+ const int32_t kiMbWidth = pSliceCtx->iMbWidth;
+ int32_t iIdx = pSliceCtx->pFirstMbInSlice[uiSliceIdc];
+ const int32_t kiEndMbInSlice = iIdx + pSliceCtx->pCountMbNumInSlice[uiSliceIdc] - 1;
do {
- SMB* pMb = &pMbList[iIdx];
- uint32_t uiNeighborAvailFlag = 0;
- const int32_t kiMbXY = pMb->iMbXY;
- const int32_t kiMbX = pMb->iMbX;
- const int32_t kiMbY = pMb->iMbY;
+ SMB* pMb = &pMbList[iIdx];
+ uint32_t uiNeighborAvailFlag = 0;
+ const int32_t kiMbXY = pMb->iMbXY;
+ const int32_t kiMbX = pMb->iMbX;
+ const int32_t kiMbY = pMb->iMbY;
bool bLeft;
bool bTop;
bool bLeftTop;
@@ -112,8 +112,8 @@
if (bRightTop) {
uiNeighborAvailFlag |= TOPRIGHT_MB_POS;
}
- pMb->uiNeighborAvail = (uint8_t)uiNeighborAvailFlag;
- pMb->uiSliceIdc = uiSliceIdc;
+ pMb->uiNeighborAvail = (uint8_t)uiNeighborAvailFlag;
+ pMb->uiSliceIdc = uiSliceIdc;
++ iIdx;
} while (iIdx <= kiEndMbInSlice);
@@ -120,13 +120,13 @@
}
void CalcSliceComplexRatio (void* pRatio, SSliceCtx* pSliceCtx, uint32_t* pSliceConsume) {
- int32_t* pRatioList = (int32_t*)pRatio;
+ int32_t* pRatioList = (int32_t*)pRatio;
int32_t iAvI[MAX_SLICES_NUM];
- int32_t iSumAv = 0;
- uint32_t* pSliceTime = (uint32_t*)pSliceConsume;
- int32_t* pCountMbInSlice = (int32_t*)pSliceCtx->pCountMbNumInSlice;
- const int32_t kiSliceCount = pSliceCtx->iSliceNumInFrame;
- int32_t iSliceIdx = 0;
+ int32_t iSumAv = 0;
+ uint32_t* pSliceTime = (uint32_t*)pSliceConsume;
+ int32_t* pCountMbInSlice = (int32_t*)pSliceCtx->pCountMbNumInSlice;
+ const int32_t kiSliceCount = pSliceCtx->iSliceNumInFrame;
+ int32_t iSliceIdx = 0;
WelsEmms();
@@ -145,10 +145,10 @@
}
int32_t NeedDynamicAdjust (void* pConsumeTime, const int32_t iSliceNum) {
- uint32_t* pSliceConsume = (uint32_t*)pConsumeTime;
- uint32_t uiTotalConsume = 0;
- int32_t iSliceIdx = 0;
- int32_t iNeedAdj = false;
+ uint32_t* pSliceConsume = (uint32_t*)pConsumeTime;
+ uint32_t uiTotalConsume = 0;
+ int32_t iSliceIdx = 0;
+ int32_t iNeedAdj = false;
WelsEmms();
@@ -164,9 +164,9 @@
}
iSliceIdx = 0;
- float fThr = EPSN; // threshold for various cores cases
- float fRmse = .0f; // root mean square error of pSlice consume ratios
- const float kfMeanRatio = 1.0f / iSliceNum;
+ float fThr = EPSN; // threshold for various cores cases
+ float fRmse = .0f; // root mean square error of pSlice consume ratios
+ const float kfMeanRatio = 1.0f / iSliceNum;
do {
const float fRatio = 1.0f * pSliceConsume[iSliceIdx] / uiTotalConsume;
const float fDiffRatio = fRatio - kfMeanRatio;
@@ -195,15 +195,15 @@
SDqLayer* pCurDqLayer,
void* pComplexRatio,
int32_t iCurDid) {
- SSliceCtx* pSliceCtx = pCurDqLayer->pSliceEncCtx;
- const int32_t kiCountSliceNum = pSliceCtx->iSliceNumInFrame;
- const int32_t kiCountNumMb = pSliceCtx->iMbNumInFrame;
- int32_t iMinimalMbNum = pSliceCtx->iMbWidth; // in theory we need only 1 SMB, here let it as one SMB row required
- int32_t iMaximalMbNum = 0; // dynamically assign later
- int32_t* pSliceComplexRatio = (int32_t*)pComplexRatio;
- int32_t iMbNumLeft = kiCountNumMb;
- int32_t iRunLen[MAX_THREADS_NUM] = {0};
- int32_t iSliceIdx = 0;
+ SSliceCtx* pSliceCtx = pCurDqLayer->pSliceEncCtx;
+ const int32_t kiCountSliceNum = pSliceCtx->iSliceNumInFrame;
+ const int32_t kiCountNumMb = pSliceCtx->iMbNumInFrame;
+ int32_t iMinimalMbNum = pSliceCtx->iMbWidth; // in theory we need only 1 SMB, here let it as one SMB row required
+ int32_t iMaximalMbNum = 0; // dynamically assign later
+ int32_t* pSliceComplexRatio = (int32_t*)pComplexRatio;
+ int32_t iMbNumLeft = kiCountNumMb;
+ int32_t iRunLen[MAX_THREADS_NUM] = {0};
+ int32_t iSliceIdx = 0;
int32_t iNumMbInEachGom = 0;
SWelsSvcRc* pWelsSvcRc = &pCtx->pWelsSvcRc[iCurDid];
@@ -271,8 +271,8 @@
if (DynamicAdjustSlicePEncCtxAll (pSliceCtx, iRunLen) == 0) {
- const int32_t kiThreadNum = pCtx->pSvcParam->iCountThreadsNum;
- int32_t iThreadIdx = 0;
+ const int32_t kiThreadNum = pCtx->pSvcParam->iCountThreadsNum;
+ int32_t iThreadIdx = 0;
do {
WelsEventSignal (&pCtx->pSliceThreading->pUpdateMbListEvent[iThreadIdx]);
WelsEventSignal (&pCtx->pSliceThreading->pThreadMasterEvent[iThreadIdx]);
@@ -286,16 +286,16 @@
int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingParam, const int32_t iCountBsLen,
const int32_t iTargetSpatialBsSize) {
- CMemoryAlign* pMa = NULL;
+ CMemoryAlign* pMa = NULL;
SWelsSvcCodingParam* pPara = NULL;
- SSliceThreading* pSmt = NULL;
- SWelsSliceBs* pSliceB = NULL;
- uint8_t* pBsBase = NULL;
- int32_t iNumSpatialLayers = 0;
- int32_t iThreadNum = 0;
- int32_t iIdx = 0;
+ SSliceThreading* pSmt = NULL;
+ SWelsSliceBs* pSliceB = NULL;
+ uint8_t* pBsBase = NULL;
+ int32_t iNumSpatialLayers = 0;
+ int32_t iThreadNum = 0;
+ int32_t iIdx = 0;
int32_t iSliceBsBufferSize = 0;
- int16_t iMaxSliceNum = 1;
+ int16_t iMaxSliceNum = 1;
int32_t iReturn = ENC_RETURN_SUCCESS;
if (NULL == ppCtx || NULL == pCodingParam || NULL == *ppCtx || iCountBsLen <= 0)
@@ -333,8 +333,8 @@
pSmt->pSliceComplexRatio[iIdx] = (int32_t*)pMa->WelsMalloc (kiSliceNum * sizeof (int32_t), "pSliceComplexRatio[]");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceComplexRatio[iIdx]), FreeMemorySvc (ppCtx))
} else {
- pSmt->pSliceConsumeTime[iIdx] = NULL;
- pSmt->pSliceComplexRatio[iIdx] = NULL;
+ pSmt->pSliceConsumeTime[iIdx] = NULL;
+ pSmt->pSliceComplexRatio[iIdx] = NULL;
}
++ iIdx;
}
@@ -358,10 +358,10 @@
iIdx = 0;
while (iIdx < iThreadNum) {
- pSmt->pThreadPEncCtx[iIdx].pWelsPEncCtx = (void*) *ppCtx;
- pSmt->pThreadPEncCtx[iIdx].iSliceIndex = iIdx;
- pSmt->pThreadPEncCtx[iIdx].iThreadIndex = iIdx;
- pSmt->pThreadHandles[iIdx] = 0;
+ pSmt->pThreadPEncCtx[iIdx].pWelsPEncCtx = (void*) *ppCtx;
+ pSmt->pThreadPEncCtx[iIdx].iSliceIndex = iIdx;
+ pSmt->pThreadPEncCtx[iIdx].iThreadIndex = iIdx;
+ pSmt->pThreadHandles[iIdx] = 0;
WelsSnprintf (name, SEM_NAME_MAX, "ee%d%s", iIdx, pSmt->eventNamespace);
err = WelsEventOpen (&pSmt->pExitEncodeEvent[iIdx], name);
@@ -395,9 +395,9 @@
(*ppCtx)->pSliceBs = (SWelsSliceBs*)pMa->WelsMalloc (sizeof (SWelsSliceBs) * iMaxSliceNum, "pSliceBs");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSliceBs), FreeMemorySvc (ppCtx))
- pBsBase = (*ppCtx)->pFrameBs + iCountBsLen;
- pSliceB = (*ppCtx)->pSliceBs;
- iSliceBsBufferSize = iTargetSpatialBsSize;
+ pBsBase = (*ppCtx)->pFrameBs + iCountBsLen;
+ pSliceB = (*ppCtx)->pSliceBs;
+ iSliceBsBufferSize = iTargetSpatialBsSize;
iIdx = 0;
while (iIdx < iMaxSliceNum) {
pSliceB->pBsBuffer = (uint8_t*)pMa->WelsMalloc (iSliceBsBufferSize, "pSliceB->pBsBuffer");
@@ -406,12 +406,12 @@
pSliceB->uiSize = iSliceBsBufferSize;
if (iIdx > 0) {
- pSliceB->pBs = pBsBase;
- pSliceB->uiBsPos = 0;
- pBsBase += iSliceBsBufferSize;
+ pSliceB->pBs = pBsBase;
+ pSliceB->uiBsPos = 0;
+ pBsBase += iSliceBsBufferSize;
} else {
- pSliceB->pBs = NULL;
- pSliceB->uiBsPos = 0;
+ pSliceB->pBs = NULL;
+ pSliceB->uiBsPos = 0;
}
++ pSliceB;
++ iIdx;
@@ -431,22 +431,22 @@
}
void ReleaseMtResource (sWelsEncCtx** ppCtx) {
- SWelsSliceBs* pSliceB = NULL;
- SWelsSvcCodingParam* pCodingParam = NULL;
- SSliceThreading* pSmt = NULL;
- CMemoryAlign* pMa = NULL;
- int32_t iIdx = 0;
- int32_t iThreadNum = 0;
- int16_t uiSliceNum = 0;
+ SWelsSliceBs* pSliceB = NULL;
+ SWelsSvcCodingParam* pCodingParam = NULL;
+ SSliceThreading* pSmt = NULL;
+ CMemoryAlign* pMa = NULL;
+ int32_t iIdx = 0;
+ int32_t iThreadNum = 0;
+ int16_t uiSliceNum = 0;
if (NULL == ppCtx || NULL == *ppCtx)
return;
- pMa = (*ppCtx)->pMemAlign;
- pCodingParam = (*ppCtx)->pSvcParam;
- uiSliceNum = (*ppCtx)->iMaxSliceCount;
- iThreadNum = (*ppCtx)->pSvcParam->iCountThreadsNum;
- pSmt = (*ppCtx)->pSliceThreading;
+ pMa = (*ppCtx)->pMemAlign;
+ pCodingParam = (*ppCtx)->pSvcParam;
+ uiSliceNum = (*ppCtx)->iMaxSliceCount;
+ iThreadNum = (*ppCtx)->pSvcParam->iCountThreadsNum;
+ pSmt = (*ppCtx)->pSliceThreading;
if (NULL == pSmt)
return;
@@ -520,19 +520,19 @@
}
int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32_t iSliceCount) {
- SWelsSvcCodingParam* pCodingParam = pCtx->pSvcParam;
- SSpatialLayerConfig* pDlp = &pCodingParam->sSpatialLayers[pCtx->uiDependencyId];
- SWelsSliceBs* pSliceBs = NULL;
- const bool kbIsDynamicSlicingMode = (pDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE);
+ SWelsSvcCodingParam* pCodingParam = pCtx->pSvcParam;
+ SSpatialLayerConfig* pDlp = &pCodingParam->sSpatialLayers[pCtx->uiDependencyId];
+ SWelsSliceBs* pSliceBs = NULL;
+ const bool kbIsDynamicSlicingMode = (pDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE);
- int32_t iLayerSize = 0;
- int32_t iNalIdxBase = pLbi->iNalCount;
- int32_t iSliceIdx = 0;
+ int32_t iLayerSize = 0;
+ int32_t iNalIdxBase = pLbi->iNalCount;
+ int32_t iSliceIdx = 0;
if (!kbIsDynamicSlicingMode) {
- pSliceBs = &pCtx->pSliceBs[0];
- iLayerSize = pSliceBs->uiBsPos; // assign with base pSlice first
- iSliceIdx = 1; // pSlice 0 bs has been written to pFrameBs yet by now, so uiSliceIdx base should be 1
+ pSliceBs = &pCtx->pSliceBs[0];
+ iLayerSize = pSliceBs->uiBsPos; // assign with base pSlice first
+ iSliceIdx = 1; // pSlice 0 bs has been written to pFrameBs yet by now, so uiSliceIdx base should be 1
while (iSliceIdx < iSliceCount) {
++ pSliceBs;
if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) {
@@ -552,14 +552,14 @@
pLbi->pNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx];
++ iNalIdx;
}
- pLbi->iNalCount += iCountNal;
- iNalIdxBase += iCountNal;
+ pLbi->iNalCount += iCountNal;
+ iNalIdxBase += iCountNal;
}
++ iSliceIdx;
}
- } else { // for SM_DYN_SLICE
- const int32_t kiPartitionCnt = iSliceCount;
- int32_t iPartitionIdx = 0;
+ } else { // for SM_DYN_SLICE
+ const int32_t kiPartitionCnt = iSliceCount;
+ int32_t iPartitionIdx = 0;
// due partition_0 has been written to pFrameBsBuffer
// so iLayerSize need add it
@@ -584,8 +584,8 @@
pLbi->pNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx];
++ iNalIdx;
}
- pLbi->iNalCount += iCountNal;
- iNalIdxBase += iCountNal;
+ pLbi->iNalCount += iCountNal;
+ iNalIdxBase += iCountNal;
} else {
iLayerSize += pSliceBs->uiBsPos;
}
@@ -603,17 +603,17 @@
int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFrameBsBuffer, const int32_t iSliceIdx,
int32_t& iSliceSize) {
- SWelsSliceBs* pSliceBs = &pCtx->pSliceBs[iSliceIdx];
+ SWelsSliceBs* pSliceBs = &pCtx->pSliceBs[iSliceIdx];
SNalUnitHeaderExt* pNalHdrExt = &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt;
- uint8_t* pDst = pFrameBsBuffer;
- const int32_t kiNalCnt = pSliceBs->iNalIndex;
- int32_t iNalIdx = 0;
+ uint8_t* pDst = pFrameBsBuffer;
+ const int32_t kiNalCnt = pSliceBs->iNalIndex;
+ int32_t iNalIdx = 0;
int32_t iNalSize = 0;
- const int32_t iFirstSlice = (iSliceIdx == 0);
- int32_t iNalBase = iFirstSlice ? 0 : pLbi->iNalCount;
+ const int32_t iFirstSlice = (iSliceIdx == 0);
+ int32_t iNalBase = iFirstSlice ? 0 : pLbi->iNalCount;
int32_t iReturn = ENC_RETURN_SUCCESS;
const int32_t kiWrittenLength = pCtx->iPosBsBuffer;
- iSliceSize = 0;
+ iSliceSize = 0;
while (iNalIdx < kiNalCnt) {
iNalSize = 0;
@@ -630,13 +630,13 @@
pSliceBs->uiBsPos = iSliceSize;
if (iFirstSlice) {
// pBsBuffer has been updated at coding_slice_0_in_encoder_mother_thread()
- pLbi->uiLayerType = VIDEO_CODING_LAYER;
- pLbi->uiSpatialId = pNalHdrExt->uiDependencyId;
- pLbi->uiTemporalId = pNalHdrExt->uiTemporalId;
- pLbi->uiQualityId = 0;
- pLbi->iNalCount = kiNalCnt;
+ pLbi->uiLayerType = VIDEO_CODING_LAYER;
+ pLbi->uiSpatialId = pNalHdrExt->uiDependencyId;
+ pLbi->uiTemporalId = pNalHdrExt->uiTemporalId;
+ pLbi->uiQualityId = 0;
+ pLbi->iNalCount = kiNalCnt;
} else {
- pLbi->iNalCount += kiNalCnt;
+ pLbi->iNalCount += kiNalCnt;
}
return ENC_RETURN_SUCCESS;
@@ -643,13 +643,13 @@
}
int32_t WriteSliceBs (sWelsEncCtx* pCtx, uint8_t* pSliceBsBuf, const int32_t iSliceIdx, int32_t& iSliceSize) {
- SWelsSliceBs* pSliceBs = &pCtx->pSliceBs[iSliceIdx];
+ SWelsSliceBs* pSliceBs = &pCtx->pSliceBs[iSliceIdx];
SNalUnitHeaderExt* pNalHdrExt = &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt;
- uint8_t* pDst = pSliceBsBuf;
- int32_t* pNalLen = &pSliceBs->iNalLen[0];
- const int32_t kiNalCnt = pSliceBs->iNalIndex;
- int32_t iNalIdx = 0;
- int32_t iNalSize = 0;
+ uint8_t* pDst = pSliceBsBuf;
+ int32_t* pNalLen = &pSliceBs->iNalLen[0];
+ const int32_t kiNalCnt = pSliceBs->iNalIndex;
+ int32_t iNalIdx = 0;
+ int32_t iNalSize = 0;
int32_t iReturn = ENC_RETURN_SUCCESS;
const int32_t kiWrittenLength = (int32_t) (pSliceBs->sBsWrite.pCurBuf - pSliceBs->sBsWrite.pStartBuf);
@@ -675,34 +675,34 @@
// thread process for coding one pSlice
WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
- SSliceThreadPrivateData* pPrivateData = (SSliceThreadPrivateData*)arg;
- sWelsEncCtx* pEncPEncCtx = NULL;
- SDqLayer* pCurDq = NULL;
- SSlice* pSlice = NULL;
- SWelsSliceBs* pSliceBs = NULL;
+ SSliceThreadPrivateData* pPrivateData = (SSliceThreadPrivateData*)arg;
+ sWelsEncCtx* pEncPEncCtx = NULL;
+ SDqLayer* pCurDq = NULL;
+ SSlice* pSlice = NULL;
+ SWelsSliceBs* pSliceBs = NULL;
WELS_EVENT pEventsList[3];
- int32_t iEventCount = 0;
- WELS_THREAD_ERROR_CODE iWaitRet = WELS_THREAD_ERROR_GENERAL;
- uint32_t uiThrdRet = 0;
- int32_t iSliceSize = 0;
- int32_t iSliceIdx = -1;
- int32_t iThreadIdx = -1;
- int32_t iEventIdx = -1;
- bool bNeedPrefix = false;
- EWelsNalUnitType eNalType = NAL_UNIT_UNSPEC_0;
- EWelsNalRefIdc eNalRefIdc = NRI_PRI_LOWEST;
+ int32_t iEventCount = 0;
+ WELS_THREAD_ERROR_CODE iWaitRet = WELS_THREAD_ERROR_GENERAL;
+ uint32_t uiThrdRet = 0;
+ int32_t iSliceSize = 0;
+ int32_t iSliceIdx = -1;
+ int32_t iThreadIdx = -1;
+ int32_t iEventIdx = -1;
+ bool bNeedPrefix = false;
+ EWelsNalUnitType eNalType = NAL_UNIT_UNSPEC_0;
+ EWelsNalRefIdc eNalRefIdc = NRI_PRI_LOWEST;
int32_t iReturn = ENC_RETURN_SUCCESS;
if (NULL == pPrivateData)
WELS_THREAD_ROUTINE_RETURN (1);
- pEncPEncCtx = (sWelsEncCtx*)pPrivateData->pWelsPEncCtx;
+ pEncPEncCtx = (sWelsEncCtx*)pPrivateData->pWelsPEncCtx;
- iThreadIdx = pPrivateData->iThreadIndex;
- iEventIdx = iThreadIdx;
+ iThreadIdx = pPrivateData->iThreadIndex;
+ iEventIdx = iThreadIdx;
- pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pReadySliceCodingEvent[iEventIdx];
- pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pExitEncodeEvent[iEventIdx];
+ pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pReadySliceCodingEvent[iEventIdx];
+ pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pExitEncodeEvent[iEventIdx];
pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pUpdateMbListEvent[iEventIdx];
WelsThreadSetName ("OpenH264Enc_CodingSliceThreadProc");
@@ -716,24 +716,24 @@
&pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled
if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited
SLayerBSInfo* pLbi = pPrivateData->pLayerBs;
- const int32_t kiCurDid = pEncPEncCtx->uiDependencyId;
- const int32_t kiCurTid = pEncPEncCtx->uiTemporalId;
- SWelsSvcCodingParam* pCodingParam = pEncPEncCtx->pSvcParam;
- SSpatialLayerConfig* pParamD = &pCodingParam->sSpatialLayers[kiCurDid];
+ const int32_t kiCurDid = pEncPEncCtx->uiDependencyId;
+ const int32_t kiCurTid = pEncPEncCtx->uiTemporalId;
+ SWelsSvcCodingParam* pCodingParam = pEncPEncCtx->pSvcParam;
+ SSpatialLayerConfig* pParamD = &pCodingParam->sSpatialLayers[kiCurDid];
- pCurDq = pEncPEncCtx->pCurDqLayer;
- eNalType = pEncPEncCtx->eNalType;
- eNalRefIdc = pEncPEncCtx->eNalPriority;
- bNeedPrefix = pEncPEncCtx->bNeedPrefixNalFlag;
+ pCurDq = pEncPEncCtx->pCurDqLayer;
+ eNalType = pEncPEncCtx->eNalType;
+ eNalRefIdc = pEncPEncCtx->eNalPriority;
+ bNeedPrefix = pEncPEncCtx->bNeedPrefixNalFlag;
if (pParamD->sSliceCfg.uiSliceMode != SM_DYN_SLICE) {
int64_t iSliceStart = 0;
bool bDsaFlag = false;
- iSliceIdx = pPrivateData->iSliceIndex;
- pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx];
- pSliceBs = &pEncPEncCtx->pSliceBs[iSliceIdx];
+ iSliceIdx = pPrivateData->iSliceIndex;
+ pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx];
+ pSliceBs = &pEncPEncCtx->pSliceBs[iSliceIdx];
- bDsaFlag = (((pParamD->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
+ bDsaFlag = (((pParamD->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
|| (pParamD->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) &&
pCodingParam->iMultipleThreadIdc > 1 &&
pCodingParam->iMultipleThreadIdc >= pParamD->sSliceCfg.sSliceArgument.uiSliceNum);
@@ -740,8 +740,8 @@
if (bDsaFlag)
iSliceStart = WelsTime();
- pSliceBs->uiBsPos = 0;
- pSliceBs->iNalIndex = 0;
+ pSliceBs->uiBsPos = 0;
+ pSliceBs->iNalIndex = 0;
assert ((void*) (&pSliceBs->sBsWrite) == (void*)pSlice->pSliceBsa);
InitBits (&pSliceBs->sBsWrite, pSliceBs->pBsBuffer, pSliceBs->uiSize);
@@ -825,21 +825,21 @@
&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice
WelsEventSignal (
&pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent);
- } else { // for SM_DYN_SLICE parallelization
- SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;
- const int32_t kiPartitionId = iThreadIdx;
- const int32_t kiSliceIdxStep = pEncPEncCtx->iActiveThreadsNum;
- const int32_t kiFirstMbInPartition = pPrivateData->iStartMbIndex; // inclusive
- const int32_t kiEndMbInPartition = pPrivateData->iEndMbIndex; // exclusive
- int32_t iAnyMbLeftInPartition = kiEndMbInPartition - kiFirstMbInPartition;
+ } else { // for SM_DYN_SLICE parallelization
+ SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;
+ const int32_t kiPartitionId = iThreadIdx;
+ const int32_t kiSliceIdxStep = pEncPEncCtx->iActiveThreadsNum;
+ const int32_t kiFirstMbInPartition = pPrivateData->iStartMbIndex; // inclusive
+ const int32_t kiEndMbInPartition = pPrivateData->iEndMbIndex; // exclusive
+ int32_t iAnyMbLeftInPartition = kiEndMbInPartition - kiFirstMbInPartition;
iSliceIdx = pPrivateData->iSliceIndex;
- pSliceCtx->pFirstMbInSlice[iSliceIdx] = kiFirstMbInPartition;
- pCurDq->pNumSliceCodedOfPartition[kiPartitionId] = 1; // one pSlice per partition intialized, dynamic slicing inside
- pCurDq->pLastMbIdxOfPartition[kiPartitionId] = kiEndMbInPartition - 1;
+ pSliceCtx->pFirstMbInSlice[iSliceIdx] = kiFirstMbInPartition;
+ pCurDq->pNumSliceCodedOfPartition[kiPartitionId] = 1; // one pSlice per partition intialized, dynamic slicing inside
+ pCurDq->pLastMbIdxOfPartition[kiPartitionId] = kiEndMbInPartition - 1;
- pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId] = 0;
+ pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId] = 0;
while (iAnyMbLeftInPartition > 0) {
if (iSliceIdx >= pSliceCtx->iMaxSliceNumConstraint) {
@@ -849,11 +849,11 @@
break;
}
- pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx];
- pSliceBs = &pEncPEncCtx->pSliceBs[iSliceIdx];
+ pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx];
+ pSliceBs = &pEncPEncCtx->pSliceBs[iSliceIdx];
- pSliceBs->uiBsPos = 0;
- pSliceBs->iNalIndex = 0;
+ pSliceBs->uiBsPos = 0;
+ pSliceBs->iNalIndex = 0;
InitBits (&pSliceBs->sBsWrite, pSliceBs->pBsBuffer, pSliceBs->uiSize);
if (bNeedPrefix) {
@@ -978,8 +978,8 @@
int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList,
WELS_EVENT* pMasterEventsList, SLayerBSInfo* pLbi,
const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const bool bIsDynamicSlicingMode) {
- int32_t iEndMbIdx = 0;
- int32_t iIdx = 0;
+ int32_t iEndMbIdx = 0;
+ int32_t iIdx = 0;
const int32_t kiEventCnt = uiNumThreads;
if (pPriData == NULL || pLbi == NULL || kiEventCnt <= 0 || pEventsList == NULL) {
@@ -993,10 +993,10 @@
if (bIsDynamicSlicingMode) {
iEndMbIdx = pSliceCtx->iMbNumInFrame;
for (iIdx = kiEventCnt - 1; iIdx >= 0; --iIdx) {
- const int32_t iFirstMbIdx = pSliceCtx->pFirstMbInSlice[iIdx];
- pPriData[iIdx].iStartMbIndex = iFirstMbIdx;
- pPriData[iIdx].iEndMbIndex = iEndMbIdx;
- iEndMbIdx = iFirstMbIdx;
+ const int32_t iFirstMbIdx = pSliceCtx->pFirstMbInSlice[iIdx];
+ pPriData[iIdx].iStartMbIndex = iFirstMbIdx;
+ pPriData[iIdx].iEndMbIndex = iEndMbIdx;
+ iEndMbIdx = iFirstMbIdx;
}
}
@@ -1021,8 +1021,8 @@
}
int32_t AdjustBaseLayer (sWelsEncCtx* pCtx) {
- SDqLayer* pCurDq = pCtx->ppDqLayerList[0];
- int32_t iNeedAdj = 1;
+ SDqLayer* pCurDq = pCtx->ppDqLayerList[0];
+ int32_t iNeedAdj = 1;
#ifdef MT_DEBUG
int64_t iT0 = WelsTime();
#endif//MT_DEBUG
@@ -1121,10 +1121,10 @@
pPara = pCtx->pSvcParam;
while (iSpatialIdx < iSpatialNum) {
- const int32_t kiDid = pDidList[iSpatialIdx];
- SSpatialLayerInternal* pDlp = &pPara->sDependencyLayers[kiDid];
- SSliceConfig* pMso = &pDlp->sSliceCfg;
- SDqLayer* pCurDq = pCtx->ppDqLayerList[kiDid];
+ const int32_t kiDid = pDidList[iSpatialIdx];
+ SSpatialLayerInternal* pDlp = &pPara->sDependencyLayers[kiDid];
+ SSliceConfig* pMso = &pDlp->sSliceCfg;
+ SDqLayer* pCurDq = pCtx->ppDqLayerList[kiDid];
SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;
const uint32_t kuiCountSliceNum = pSliceCtx->iSliceNumInFrame;
if (pCtx->pSliceThreading) {
--- a/codec/encoder/core/src/svc_base_layer_md.cpp
+++ b/codec/encoder/core/src/svc_base_layer_md.cpp
@@ -269,41 +269,41 @@
int32_t iStrideY, iStrideUV;
int32_t iOffsetY, iOffsetUV;
- iStrideY = pCurLayer->iEncStride[0];
- iStrideUV = pCurLayer->iEncStride[1];
- iOffsetY = (kiMbX + kiMbY * iStrideY) << 4;
- iOffsetUV = (kiMbX + kiMbY * iStrideUV) << 3;
- pMbCache->SPicData.pEncMb[0] = pCurLayer->pEncData[0] + iOffsetY;
- pMbCache->SPicData.pEncMb[1] = pCurLayer->pEncData[1] + iOffsetUV;
- pMbCache->SPicData.pEncMb[2] = pCurLayer->pEncData[2] + iOffsetUV;
+ iStrideY = pCurLayer->iEncStride[0];
+ iStrideUV = pCurLayer->iEncStride[1];
+ iOffsetY = (kiMbX + kiMbY * iStrideY) << 4;
+ iOffsetUV = (kiMbX + kiMbY * iStrideUV) << 3;
+ pMbCache->SPicData.pEncMb[0] = pCurLayer->pEncData[0] + iOffsetY;
+ pMbCache->SPicData.pEncMb[1] = pCurLayer->pEncData[1] + iOffsetUV;
+ pMbCache->SPicData.pEncMb[2] = pCurLayer->pEncData[2] + iOffsetUV;
- iStrideY = pCurLayer->iCsStride[0];
- iStrideUV = pCurLayer->iCsStride[1];
- iOffsetY = (kiMbX + kiMbY * iStrideY) << 4;
- iOffsetUV = (kiMbX + kiMbY * iStrideUV) << 3;
- pMbCache->SPicData.pCsMb[0] = pCurLayer->pCsData[0] + iOffsetY;
- pMbCache->SPicData.pCsMb[1] = pCurLayer->pCsData[1] + iOffsetUV;
- pMbCache->SPicData.pCsMb[2] = pCurLayer->pCsData[2] + iOffsetUV;
+ iStrideY = pCurLayer->iCsStride[0];
+ iStrideUV = pCurLayer->iCsStride[1];
+ iOffsetY = (kiMbX + kiMbY * iStrideY) << 4;
+ iOffsetUV = (kiMbX + kiMbY * iStrideUV) << 3;
+ pMbCache->SPicData.pCsMb[0] = pCurLayer->pCsData[0] + iOffsetY;
+ pMbCache->SPicData.pCsMb[1] = pCurLayer->pCsData[1] + iOffsetUV;
+ pMbCache->SPicData.pCsMb[2] = pCurLayer->pCsData[2] + iOffsetUV;
- iStrideY = pCurLayer->pDecPic->iLineSize[0];
- iStrideUV = pCurLayer->pDecPic->iLineSize[1];
- iOffsetY = (kiMbX + kiMbY * iStrideY) << 4;
- iOffsetUV = (kiMbX + kiMbY * iStrideUV) << 3;
- pMbCache->SPicData.pDecMb[0] = pCurLayer->pDecPic->pData[0] + iOffsetY;
- pMbCache->SPicData.pDecMb[1] = pCurLayer->pDecPic->pData[1] + iOffsetUV;
- pMbCache->SPicData.pDecMb[2] = pCurLayer->pDecPic->pData[2] + iOffsetUV;
+ iStrideY = pCurLayer->pDecPic->iLineSize[0];
+ iStrideUV = pCurLayer->pDecPic->iLineSize[1];
+ iOffsetY = (kiMbX + kiMbY * iStrideY) << 4;
+ iOffsetUV = (kiMbX + kiMbY * iStrideUV) << 3;
+ pMbCache->SPicData.pDecMb[0] = pCurLayer->pDecPic->pData[0] + iOffsetY;
+ pMbCache->SPicData.pDecMb[1] = pCurLayer->pDecPic->pData[1] + iOffsetUV;
+ pMbCache->SPicData.pDecMb[2] = pCurLayer->pDecPic->pData[2] + iOffsetUV;
} else {
- pMbCache->SPicData.pEncMb[0] += MB_WIDTH_LUMA;
- pMbCache->SPicData.pEncMb[1] += MB_WIDTH_CHROMA;
- pMbCache->SPicData.pEncMb[2] += MB_WIDTH_CHROMA;
+ pMbCache->SPicData.pEncMb[0] += MB_WIDTH_LUMA;
+ pMbCache->SPicData.pEncMb[1] += MB_WIDTH_CHROMA;
+ pMbCache->SPicData.pEncMb[2] += MB_WIDTH_CHROMA;
- pMbCache->SPicData.pDecMb[0] += MB_WIDTH_LUMA;
- pMbCache->SPicData.pDecMb[1] += MB_WIDTH_CHROMA;
- pMbCache->SPicData.pDecMb[2] += MB_WIDTH_CHROMA;
+ pMbCache->SPicData.pDecMb[0] += MB_WIDTH_LUMA;
+ pMbCache->SPicData.pDecMb[1] += MB_WIDTH_CHROMA;
+ pMbCache->SPicData.pDecMb[2] += MB_WIDTH_CHROMA;
- pMbCache->SPicData.pCsMb[0] += MB_WIDTH_LUMA;
- pMbCache->SPicData.pCsMb[1] += MB_WIDTH_CHROMA;
- pMbCache->SPicData.pCsMb[2] += MB_WIDTH_CHROMA;
+ pMbCache->SPicData.pCsMb[0] += MB_WIDTH_LUMA;
+ pMbCache->SPicData.pCsMb[1] += MB_WIDTH_CHROMA;
+ pMbCache->SPicData.pCsMb[2] += MB_WIDTH_CHROMA;
}
//step 2. initial pWelsMd
@@ -320,10 +320,10 @@
void WelsMdInterInit (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb, const int32_t iSliceFirstMbXY) {
SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
const int32_t kiMbX = pCurMb->iMbX;
const int32_t kiMbY = pCurMb->iMbY;
- const int32_t kiMbXY = pCurMb->iMbXY;
+ const int32_t kiMbXY = pCurMb->iMbXY;
const int32_t kiMbWidth = pCurLayer->iMbWidth;
const int32_t kiMbHeight = pCurLayer->iMbHeight;
@@ -338,17 +338,17 @@
//step 4. locating current p_ref
// merge loops
if (0 == kiMbX || iSliceFirstMbXY == kiMbXY) {
- const int32_t kiRefStrideY = pCurLayer->pRefPic->iLineSize[0];
- const int32_t kiRefStrideUV = pCurLayer->pRefPic->iLineSize[1];
- const int32_t kiCurStrideY = (kiMbX + kiMbY * kiRefStrideY) << 4;
- const int32_t kiCurStrideUV = (kiMbX + kiMbY * kiRefStrideUV) << 3;
- pMbCache->SPicData.pRefMb[0] = pCurLayer->pRefPic->pData[0] + kiCurStrideY;
- pMbCache->SPicData.pRefMb[1] = pCurLayer->pRefPic->pData[1] + kiCurStrideUV;
- pMbCache->SPicData.pRefMb[2] = pCurLayer->pRefPic->pData[2] + kiCurStrideUV;
+ const int32_t kiRefStrideY = pCurLayer->pRefPic->iLineSize[0];
+ const int32_t kiRefStrideUV = pCurLayer->pRefPic->iLineSize[1];
+ const int32_t kiCurStrideY = (kiMbX + kiMbY * kiRefStrideY) << 4;
+ const int32_t kiCurStrideUV = (kiMbX + kiMbY * kiRefStrideUV) << 3;
+ pMbCache->SPicData.pRefMb[0] = pCurLayer->pRefPic->pData[0] + kiCurStrideY;
+ pMbCache->SPicData.pRefMb[1] = pCurLayer->pRefPic->pData[1] + kiCurStrideUV;
+ pMbCache->SPicData.pRefMb[2] = pCurLayer->pRefPic->pData[2] + kiCurStrideUV;
} else {
- pMbCache->SPicData.pRefMb[0] += MB_WIDTH_LUMA;
- pMbCache->SPicData.pRefMb[1] += MB_WIDTH_CHROMA;
- pMbCache->SPicData.pRefMb[2] += MB_WIDTH_CHROMA;
+ pMbCache->SPicData.pRefMb[0] += MB_WIDTH_LUMA;
+ pMbCache->SPicData.pRefMb[1] += MB_WIDTH_CHROMA;
+ pMbCache->SPicData.pRefMb[2] += MB_WIDTH_CHROMA;
}
pMbCache->uiRefMbType = pCurLayer->pRefPic->uiRefMbType[kiMbXY];
@@ -367,7 +367,7 @@
int32_t iAvailCount;
int32_t iIdx = 0;
uint8_t* pPredI16x16[2] = {pMbCache->pMemPredMb, pMbCache->pMemPredMb + 256};
- uint8_t* pDst = pPredI16x16[0];
+ uint8_t* pDst = pPredI16x16[0];
uint8_t* pDec = pMbCache->SPicData.pCsMb[0];
uint8_t* pEnc = pMbCache->SPicData.pEncMb[0];
int32_t iLineSizeDec = pCurDqLayer->iCsStride[0];
@@ -416,14 +416,14 @@
return iBestCost;
}
int32_t WelsMdI4x4 (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb, SMbCache* pMbCache) {
- SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
- SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
- int32_t iLambda = pWelsMd->iLambda;
- int32_t iBestCostLuma = pWelsMd->iCostLuma;
- uint8_t* pEncMb = pMbCache->SPicData.pEncMb[0];
- uint8_t* pDecMb = pMbCache->SPicData.pCsMb[0];
- const int32_t kiLineSizeEnc = pCurDqLayer->iEncStride[0];
- const int32_t kiLineSizeDec = pCurDqLayer->iCsStride[0];
+ SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
+ SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
+ int32_t iLambda = pWelsMd->iLambda;
+ int32_t iBestCostLuma = pWelsMd->iCostLuma;
+ uint8_t* pEncMb = pMbCache->SPicData.pEncMb[0];
+ uint8_t* pDecMb = pMbCache->SPicData.pCsMb[0];
+ const int32_t kiLineSizeEnc = pCurDqLayer->iEncStride[0];
+ const int32_t kiLineSizeDec = pCurDqLayer->iCsStride[0];
uint8_t* pCurEnc, *pCurDec, *pDst;
@@ -432,16 +432,16 @@
int32_t iAvailCount;
const uint8_t* kpAvailMode;
int32_t i, j, iCoordinateX, iCoordinateY, iIdxStrideEnc, iIdxStrideDec;
- int32_t lambda[2] = {iLambda << 2, iLambda};
- bool* pPrevIntra4x4PredModeFlag = pMbCache->pPrevIntra4x4PredModeFlag;
- int8_t* pRemIntra4x4PredModeFlag = pMbCache->pRemIntra4x4PredModeFlag;
- const uint8_t* kpIntra4x4AvailCount = &g_kiIntra4AvailCount[0];
- const uint8_t* kpCache48CountScan4 = &g_kuiCache48CountScan4Idx[0];
- const int8_t* kpNeighborIntraToI4x4 = g_kiNeighborIntraToI4x4[pMbCache->uiNeighborIntra];
- const int8_t* kpCoordinateIdxX = &g_kiCoordinateIdx4x4X[0];
- const int8_t* kpCoordinateIdxY = &g_kiCoordinateIdx4x4Y[0];
- int32_t iBestPredBufferNum = 0;
- int32_t iCosti4x4 = 0;
+ int32_t lambda[2] = {iLambda << 2, iLambda};
+ bool* pPrevIntra4x4PredModeFlag = pMbCache->pPrevIntra4x4PredModeFlag;
+ int8_t* pRemIntra4x4PredModeFlag = pMbCache->pRemIntra4x4PredModeFlag;
+ const uint8_t* kpIntra4x4AvailCount = &g_kiIntra4AvailCount[0];
+ const uint8_t* kpCache48CountScan4 = &g_kuiCache48CountScan4Idx[0];
+ const int8_t* kpNeighborIntraToI4x4 = g_kiNeighborIntraToI4x4[pMbCache->uiNeighborIntra];
+ const int8_t* kpCoordinateIdxX = &g_kiCoordinateIdx4x4X[0];
+ const int8_t* kpCoordinateIdxY = &g_kiCoordinateIdx4x4Y[0];
+ int32_t iBestPredBufferNum = 0;
+ int32_t iCosti4x4 = 0;
#if defined(X86_ASM)
WelsPrefetchZero_mmx (g_kiMapModeI4x4);
@@ -539,7 +539,7 @@
}
ST32 (pCurMb->pIntra4x4PredMode, LD32 (&pMbCache->iIntraPredMode[33]));
pCurMb->pIntra4x4PredMode[4] = pMbCache->iIntraPredMode[12];
- pCurMb->pIntra4x4PredMode[5] = pMbCache->iIntraPredMode[20];
+ pCurMb->pIntra4x4PredMode[5] = pMbCache->iIntraPredMode[20];
pCurMb->pIntra4x4PredMode[6] = pMbCache->iIntraPredMode[28];
iCosti4x4 += (iLambda << 4) + (iLambda << 3); //4*6*lambda from JVT SATD0
return iCosti4x4;
@@ -546,14 +546,14 @@
}
int32_t WelsMdI4x4Fast (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb, SMbCache* pMbCache) {
- SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
- SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
- int32_t iLambda = pWelsMd->iLambda;
- int32_t iBestCostLuma = pWelsMd->iCostLuma;
- uint8_t* pEncMb = pMbCache->SPicData.pEncMb[0];
- uint8_t* pDecMb = pMbCache->SPicData.pCsMb[0];
- const int32_t kiLineSizeEnc = pCurDqLayer->iEncStride[0];
- const int32_t kiLineSizeDec = pCurDqLayer->iCsStride[0];
+ SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
+ SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
+ int32_t iLambda = pWelsMd->iLambda;
+ int32_t iBestCostLuma = pWelsMd->iCostLuma;
+ uint8_t* pEncMb = pMbCache->SPicData.pEncMb[0];
+ uint8_t* pDecMb = pMbCache->SPicData.pCsMb[0];
+ const int32_t kiLineSizeEnc = pCurDqLayer->iEncStride[0];
+ const int32_t kiLineSizeDec = pCurDqLayer->iCsStride[0];
uint8_t* pCurEnc, *pCurDec, *pDst;
int8_t iPredMode, iCurMode, iBestMode, iFinalMode;
@@ -562,16 +562,16 @@
const uint8_t* kpAvailMode;
int32_t i, j, iCoordinateX, iCoordinateY, iIdxStrideEnc, iIdxStrideDec;
int32_t iCostH, iCostV, iCostVR, iCostHD, iCostVL, iCostHU, iBestModeFake;
- int32_t lambda[2] = {iLambda << 2, iLambda};
- bool* pPrevIntra4x4PredModeFlag = pMbCache->pPrevIntra4x4PredModeFlag;
- int8_t* pRemIntra4x4PredModeFlag = pMbCache->pRemIntra4x4PredModeFlag;
- const uint8_t* kpIntra4x4AvailCount = &g_kiIntra4AvailCount[0];
- const uint8_t* kpCache48CountScan4 = &g_kuiCache48CountScan4Idx[0];
- const int8_t* kpNeighborIntraToI4x4 = g_kiNeighborIntraToI4x4[pMbCache->uiNeighborIntra];
- const int8_t* kpCoordinateIdxX = &g_kiCoordinateIdx4x4X[0];
- const int8_t* kpCoordinateIdxY = &g_kiCoordinateIdx4x4Y[0];
- int32_t iBestPredBufferNum = 0;
- int32_t iCosti4x4 = 0;
+ int32_t lambda[2] = {iLambda << 2, iLambda};
+ bool* pPrevIntra4x4PredModeFlag = pMbCache->pPrevIntra4x4PredModeFlag;
+ int8_t* pRemIntra4x4PredModeFlag = pMbCache->pRemIntra4x4PredModeFlag;
+ const uint8_t* kpIntra4x4AvailCount = &g_kiIntra4AvailCount[0];
+ const uint8_t* kpCache48CountScan4 = &g_kuiCache48CountScan4Idx[0];
+ const int8_t* kpNeighborIntraToI4x4 = g_kiNeighborIntraToI4x4[pMbCache->uiNeighborIntra];
+ const int8_t* kpCoordinateIdxX = &g_kiCoordinateIdx4x4X[0];
+ const int8_t* kpCoordinateIdxY = &g_kiCoordinateIdx4x4Y[0];
+ int32_t iBestPredBufferNum = 0;
+ int32_t iCosti4x4 = 0;
#if defined(X86_ASM)
WelsPrefetchZero_mmx (g_kiMapModeI4x4);
WelsPrefetchZero_mmx ((int8_t*)&pFunc->pfGetLumaI4x4Pred);
@@ -858,7 +858,7 @@
}
ST32 (pCurMb->pIntra4x4PredMode, LD32 (&pMbCache->iIntraPredMode[33]));
pCurMb->pIntra4x4PredMode[4] = pMbCache->iIntraPredMode[12];
- pCurMb->pIntra4x4PredMode[5] = pMbCache->iIntraPredMode[20];
+ pCurMb->pIntra4x4PredMode[5] = pMbCache->iIntraPredMode[20];
pCurMb->pIntra4x4PredMode[6] = pMbCache->iIntraPredMode[28];
iCosti4x4 += (iLambda << 4) + (iLambda << 3); //4*6*lambda from JVT SATD0
return iCosti4x4;
@@ -868,14 +868,14 @@
const int8_t* kpAvailMode;
int32_t iAvailCount = 0;
int32_t iChmaIdx = 0;
- uint8_t* pPredIntraChma[2] = {pMbCache->pMemPredChroma, pMbCache->pMemPredChroma + 128};
- uint8_t* pDstChma = pPredIntraChma[0];
- uint8_t* pEncCb = pMbCache->SPicData.pEncMb[1];
- uint8_t* pEncCr = pMbCache->SPicData.pEncMb[2];
- uint8_t* pDecCb = pMbCache->SPicData.pCsMb[1];//pMbCache->SPicData.pDecMb[1];
- uint8_t* pDecCr = pMbCache->SPicData.pCsMb[2];//pMbCache->SPicData.pDecMb[2];
- const int32_t kiLineSizeEnc = pCurDqLayer->iEncStride[1];
- const int32_t kiLineSizeDec = pCurDqLayer->iCsStride[1];//pMbCache->SPicData.i_stride_dec[1];
+ uint8_t* pPredIntraChma[2] = {pMbCache->pMemPredChroma, pMbCache->pMemPredChroma + 128};
+ uint8_t* pDstChma = pPredIntraChma[0];
+ uint8_t* pEncCb = pMbCache->SPicData.pEncMb[1];
+ uint8_t* pEncCr = pMbCache->SPicData.pEncMb[2];
+ uint8_t* pDecCb = pMbCache->SPicData.pCsMb[1];//pMbCache->SPicData.pDecMb[1];
+ uint8_t* pDecCr = pMbCache->SPicData.pCsMb[2];//pMbCache->SPicData.pDecMb[2];
+ const int32_t kiLineSizeEnc = pCurDqLayer->iEncStride[1];
+ const int32_t kiLineSizeDec = pCurDqLayer->iCsStride[1];//pMbCache->SPicData.i_stride_dec[1];
int32_t i, iCurMode, iCurCost, iBestMode, iBestCost = INT_MAX;
@@ -979,8 +979,8 @@
SMbCache* pMbCache = &pSlice->sMbCacheInfo;
SWelsME* pMe16x16 = &pWelsMd->sMe.sMe16x16;
uint32_t uiNeighborAvail = pCurMb->uiNeighborAvail;
- const int32_t kiMbWidth = pCurLayer->iMbWidth; // for assign once
- const int32_t kiMbHeight = pCurLayer->iMbHeight;
+ const int32_t kiMbWidth = pCurLayer->iMbWidth; // for assign once
+ const int32_t kiMbHeight = pCurLayer->iMbHeight;
InitMe (*pWelsMd, BLOCK_16x16, pMbCache->SPicData.pEncMb[0], pMbCache->SPicData.pRefMb[0],
pCurLayer->pRefPic->pScreenBlockFeatureStorage,
*pMe16x16);
@@ -1218,10 +1218,10 @@
inline void VaaBackgroundMbDataUpdate (SWelsFuncPtrList* pFunc, SVAAFrameInfo* pVaaInfo, SMB* pCurMb) {
- const int32_t kiPicStride = pVaaInfo->iPicStride;
- const int32_t kiPicStrideUV = pVaaInfo->iPicStrideUV;
- const int32_t kiOffsetY = (pCurMb->iMbY * kiPicStride + pCurMb->iMbX) << 4;
- const int32_t kiOffsetUV = (pCurMb->iMbY * kiPicStrideUV + pCurMb->iMbX) << 3;
+ const int32_t kiPicStride = pVaaInfo->iPicStride;
+ const int32_t kiPicStrideUV = pVaaInfo->iPicStrideUV;
+ const int32_t kiOffsetY = (pCurMb->iMbY * kiPicStride + pCurMb->iMbX) << 4;
+ const int32_t kiOffsetUV = (pCurMb->iMbY * kiPicStrideUV + pCurMb->iMbX) << 3;
pFunc->pfCopy16x16Aligned (pVaaInfo->pCurY + kiOffsetY, kiPicStride, pVaaInfo->pRefY + kiOffsetY, kiPicStride);
pFunc->pfCopy8x8Aligned (pVaaInfo->pCurU + kiOffsetUV, kiPicStrideUV, pVaaInfo->pRefU + kiOffsetUV, kiPicStrideUV);
@@ -1230,22 +1230,22 @@
void WelsMdBackgroundMbEnc (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb, SMbCache* pMbCache, SSlice* pSlice,
bool bSkipMbFlag) {
- SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
- SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
- SMVUnitXY sMvp = { 0 };
- uint8_t* pRefLuma = pMbCache->SPicData.pRefMb[0];
- uint8_t* pRefCb = pMbCache->SPicData.pRefMb[1];
- uint8_t* pRefCr = pMbCache->SPicData.pRefMb[2];
- int32_t iLineSizeY = pCurDqLayer->pRefPic->iLineSize[0];
- int32_t iLineSizeUV = pCurDqLayer->pRefPic->iLineSize[1];
- uint8_t* pDstLuma = pMbCache->pSkipMb;
- uint8_t* pDstCb = pMbCache->pSkipMb + 256;
- uint8_t* pDstCr = pMbCache->pSkipMb + 256 + 64;
+ SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
+ SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
+ SMVUnitXY sMvp = { 0 };
+ uint8_t* pRefLuma = pMbCache->SPicData.pRefMb[0];
+ uint8_t* pRefCb = pMbCache->SPicData.pRefMb[1];
+ uint8_t* pRefCr = pMbCache->SPicData.pRefMb[2];
+ int32_t iLineSizeY = pCurDqLayer->pRefPic->iLineSize[0];
+ int32_t iLineSizeUV = pCurDqLayer->pRefPic->iLineSize[1];
+ uint8_t* pDstLuma = pMbCache->pSkipMb;
+ uint8_t* pDstCb = pMbCache->pSkipMb + 256;
+ uint8_t* pDstCr = pMbCache->pSkipMb + 256 + 64;
if (!bSkipMbFlag) {
- pDstLuma = pMbCache->pMemPredLuma;
- pDstCb = pMbCache->pMemPredChroma;
- pDstCr = pMbCache->pMemPredChroma + 64;
+ pDstLuma = pMbCache->pMemPredLuma;
+ pDstCb = pMbCache->pMemPredChroma;
+ pDstCr = pMbCache->pMemPredChroma + 64;
}
//MC
pFunc->sMcFuncs.pMcLumaFunc (pRefLuma, iLineSizeY, pDstLuma, 16, 0, 0, 16, 16);
@@ -1300,8 +1300,8 @@
}
bool WelsMdPSkipEnc (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb, SMbCache* pMbCache) {
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
uint8_t* pRefLuma = pMbCache->SPicData.pRefMb[0];
uint8_t* pRefCb = pMbCache->SPicData.pRefMb[1];
@@ -1316,8 +1316,8 @@
SMVUnitXY sMvp = { 0 };
int32_t n;
- int32_t iEncStride = pCurLayer->iEncStride[0];
- uint8_t* pEncMb = pMbCache->SPicData.pEncMb[0];
+ int32_t iEncStride = pCurLayer->iEncStride[0];
+ uint8_t* pEncMb = pMbCache->SPicData.pEncMb[0];
int32_t* pStrideEncBlockOffset = pEncCtx->pStrideTab->pStrideEncBlockOffset[pEncCtx->uiDependencyId];
int32_t* pEncBlockOffset;
@@ -1612,14 +1612,14 @@
}
void WelsMdInterMb (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SSlice* pSlice, SMB* pCurMb, SMbCache* pUnused) {
- SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
- const uint32_t kuiNeighborAvail = pCurMb->uiNeighborAvail;
- const int32_t kiMbWidth = pCurDqLayer->iMbWidth;
- const SMB* top_mb = pCurMb - kiMbWidth;
- const bool bMbLeftAvailPskip = ((kuiNeighborAvail & LEFT_MB_POS) ? IS_SKIP ((pCurMb - 1)->uiMbType) : false);
- const bool bMbTopAvailPskip = ((kuiNeighborAvail & TOP_MB_POS) ? IS_SKIP (top_mb->uiMbType) : false);
- const bool bMbTopLeftAvailPskip = ((kuiNeighborAvail & TOPLEFT_MB_POS) ? IS_SKIP ((top_mb - 1)->uiMbType) : false);
+ SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ const uint32_t kuiNeighborAvail = pCurMb->uiNeighborAvail;
+ const int32_t kiMbWidth = pCurDqLayer->iMbWidth;
+ const SMB* top_mb = pCurMb - kiMbWidth;
+ const bool bMbLeftAvailPskip = ((kuiNeighborAvail & LEFT_MB_POS) ? IS_SKIP ((pCurMb - 1)->uiMbType) : false);
+ const bool bMbTopAvailPskip = ((kuiNeighborAvail & TOP_MB_POS) ? IS_SKIP (top_mb->uiMbType) : false);
+ const bool bMbTopLeftAvailPskip = ((kuiNeighborAvail & TOPLEFT_MB_POS) ? IS_SKIP ((top_mb - 1)->uiMbType) : false);
const bool bMbTopRightAvailPskip = ((kuiNeighborAvail & TOPRIGHT_MB_POS) ? IS_SKIP ((top_mb + 1)->uiMbType) : false);
bool bTrySkip = bMbLeftAvailPskip || bMbTopAvailPskip || bMbTopLeftAvailPskip || bMbTopRightAvailPskip;
bool bKeepSkip = bMbLeftAvailPskip && bMbTopAvailPskip && bMbTopRightAvailPskip;
--- a/codec/encoder/core/src/svc_enc_slice_segment.cpp
+++ b/codec/encoder/core/src/svc_enc_slice_segment.cpp
@@ -76,8 +76,8 @@
while (uiSliceIdx < iSliceNum) {
const int32_t kiFirstMb = uiSliceIdx * kiMbWidth;
- pSliceSeg->pCountMbNumInSlice[uiSliceIdx] = kiMbWidth;
- pSliceSeg->pFirstMbInSlice[uiSliceIdx] = kiFirstMb;
+ pSliceSeg->pCountMbNumInSlice[uiSliceIdx] = kiMbWidth;
+ pSliceSeg->pFirstMbInSlice[uiSliceIdx] = kiFirstMb;
WelsSetMemMultiplebytes_c(pSliceSeg->pOverallMbMap + kiFirstMb, uiSliceIdx,
kiMbWidth, sizeof(uint16_t));
++ uiSliceIdx;
@@ -87,18 +87,18 @@
} else if (SM_RASTER_SLICE == pSliceSeg->uiSliceMode ||
SM_FIXEDSLCNUM_SLICE == pSliceSeg->uiSliceMode ||
SM_AUTO_SLICE == pSliceSeg->uiSliceMode) {
- const int32_t* kpSlicesAssignList = (int32_t*) & (kpMso->sSliceArgument.uiSliceMbNum[0]);
- const int32_t kiCountNumMbInFrame = pSliceSeg->iMbNumInFrame;
- const int32_t kiCountSliceNumInFrame = pSliceSeg->iSliceNumInFrame;
- uint16_t iSliceIdx = 0;
- int32_t iMbIdx = 0;
+ const int32_t* kpSlicesAssignList = (int32_t*) & (kpMso->sSliceArgument.uiSliceMbNum[0]);
+ const int32_t kiCountNumMbInFrame = pSliceSeg->iMbNumInFrame;
+ const int32_t kiCountSliceNumInFrame = pSliceSeg->iSliceNumInFrame;
+ uint16_t iSliceIdx = 0;
+ int32_t iMbIdx = 0;
do {
- const int32_t kiCurRunLength = kpSlicesAssignList[iSliceIdx];
- int32_t iRunIdx = 0;
+ const int32_t kiCurRunLength = kpSlicesAssignList[iSliceIdx];
+ int32_t iRunIdx = 0;
- pSliceSeg->pFirstMbInSlice[iSliceIdx] = iMbIdx;
- pSliceSeg->pCountMbNumInSlice[iSliceIdx] = kiCurRunLength;
+ pSliceSeg->pFirstMbInSlice[iSliceIdx] = iMbIdx;
+ pSliceSeg->pCountMbNumInSlice[iSliceIdx] = kiCurRunLength;
// due here need check validate mb_assign_map for input pData, can not use memset
do {
@@ -132,11 +132,11 @@
//slice parameter check for SM_FIXEDSLCNUM_SLICE
bool CheckFixedSliceNumMultiSliceSetting (const int32_t kiMbNumInFrame, SSliceArgument* pSliceArg) {
- int32_t* pSlicesAssignList = (int32_t*) & (pSliceArg->uiSliceMbNum[0]);
- const uint32_t kuiSliceNum = pSliceArg->uiSliceNum;
- uint32_t uiSliceIdx = 0;
- const int32_t kiMbNumPerSlice = kiMbNumInFrame / kuiSliceNum;
- int32_t iNumMbLeft = kiMbNumInFrame;
+ int32_t* pSlicesAssignList = (int32_t*) & (pSliceArg->uiSliceMbNum[0]);
+ const uint32_t kuiSliceNum = pSliceArg->uiSliceNum;
+ uint32_t uiSliceIdx = 0;
+ const int32_t kiMbNumPerSlice = kiMbNumInFrame / kuiSliceNum;
+ int32_t iNumMbLeft = kiMbNumInFrame;
if (NULL == pSlicesAssignList)
return false;
@@ -153,8 +153,8 @@
//slice parameter check for SM_ROWMB_SLICE
bool CheckRowMbMultiSliceSetting (const int32_t kiMbWidth, SSliceArgument* pSliceArg) {
int32_t* pSlicesAssignList = (int32_t*) & (pSliceArg->uiSliceMbNum[0]);
- const uint32_t kuiSliceNum = pSliceArg->uiSliceNum;
- uint32_t uiSliceIdx = 0;
+ const uint32_t kuiSliceNum = pSliceArg->uiSliceNum;
+ uint32_t uiSliceIdx = 0;
if (NULL == pSlicesAssignList)
return false;
@@ -168,19 +168,19 @@
//slice parameter check for SM_RASTER_SLICE
bool CheckRasterMultiSliceSetting (const int32_t kiMbNumInFrame, SSliceArgument* pSliceArg) {
- int32_t* pSlicesAssignList = (int32_t*) & (pSliceArg->uiSliceMbNum[0]);
- int32_t iActualSliceCount = 0;
+ int32_t* pSlicesAssignList = (int32_t*) & (pSliceArg->uiSliceMbNum[0]);
+ int32_t iActualSliceCount = 0;
//check mb_num setting
- uint32_t uiSliceIdx = 0;
- int32_t iCountMb = 0;
+ uint32_t uiSliceIdx = 0;
+ int32_t iCountMb = 0;
if (NULL == pSlicesAssignList)
return false;
while ((uiSliceIdx < MAX_SLICES_NUM) && (0 < pSlicesAssignList[uiSliceIdx])) {
- iCountMb += pSlicesAssignList[uiSliceIdx];
- iActualSliceCount = uiSliceIdx + 1;
+ iCountMb += pSlicesAssignList[uiSliceIdx];
+ iActualSliceCount = uiSliceIdx + 1;
if (iCountMb >= kiMbNumInFrame) {
break;
@@ -198,8 +198,8 @@
//need correction:
//setting is more than iMbNumInFrame,
//cut the last uiSliceMbNum; adjust iCountMb
- pSlicesAssignList[iActualSliceCount - 1] -= (iCountMb - kiMbNumInFrame);
- iCountMb = kiMbNumInFrame;
+ pSlicesAssignList[iActualSliceCount - 1] -= (iCountMb - kiMbNumInFrame);
+ iCountMb = kiMbNumInFrame;
} else if (iActualSliceCount < MAX_SLICES_NUM) {
//where ( iCountMb < iMbNumInFrame )
//can do correction:
@@ -220,8 +220,8 @@
// GOM based RC related for uiSliceNum decision, only used at SM_FIXEDSLCNUM_SLICE
bool GomValidCheckSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, uint32_t* pSliceNum) {
- const int32_t kiCountNumMb = kiMbWidth * kiMbHeight;
- uint32_t iSliceNum = *pSliceNum;
+ const int32_t kiCountNumMb = kiMbWidth * kiMbHeight;
+ uint32_t iSliceNum = *pSliceNum;
int32_t iGomSize;
//The default RC is Bit-rate mode[Yi], but need consider as below:
@@ -257,14 +257,14 @@
// GOM based RC related for uiSliceMbNum decision, only used at SM_FIXEDSLCNUM_SLICE
bool GomValidCheckSliceMbNum (const int32_t kiMbWidth, const int32_t kiMbHeight, SSliceArgument* pSliceArg) {
- uint32_t* pSlicesAssignList = & (pSliceArg->uiSliceMbNum[0]);
- const uint32_t kuiSliceNum = pSliceArg->uiSliceNum;
- const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight;
- const int32_t kiMbNumPerSlice = kiMbNumInFrame / kuiSliceNum;
- int32_t iNumMbLeft = kiMbNumInFrame;
+ uint32_t* pSlicesAssignList = & (pSliceArg->uiSliceMbNum[0]);
+ const uint32_t kuiSliceNum = pSliceArg->uiSliceNum;
+ const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight;
+ const int32_t kiMbNumPerSlice = kiMbNumInFrame / kuiSliceNum;
+ int32_t iNumMbLeft = kiMbNumInFrame;
- int32_t iMinimalMbNum = kiMbWidth; // in theory we need only 1 SMB, here let it as one SMB row required
- int32_t iMaximalMbNum = 0; // dynamically assign later
+ int32_t iMinimalMbNum = kiMbWidth; // in theory we need only 1 SMB, here let it as one SMB row required
+ int32_t iMaximalMbNum = 0; // dynamically assign later
int32_t iGomSize;
uint32_t uiSliceIdx = 0; // for test
@@ -385,11 +385,11 @@
pSliceSeg->pCountMbNumInSlice = NULL;
}
// just for safe
- pSliceSeg->iSliceNumInFrame = 0;
- pSliceSeg->iMbNumInFrame = 0;
- pSliceSeg->iMbWidth = 0;
- pSliceSeg->iMbHeight = 0;
- pSliceSeg->uiSliceMode = SM_SINGLE_SLICE; // sigle in default
+ pSliceSeg->iSliceNumInFrame = 0;
+ pSliceSeg->iMbNumInFrame = 0;
+ pSliceSeg->iMbWidth = 0;
+ pSliceSeg->iMbHeight = 0;
+ pSliceSeg->uiSliceMode = SM_SINGLE_SLICE; // sigle in default
}
if (SM_SINGLE_SLICE == uiSliceMode) {
@@ -407,12 +407,12 @@
"pSliceSeg->pCountMbNumInSlice");
WELS_VERIFY_RETURN_IF (1, NULL == pSliceSeg->pCountMbNumInSlice)
- pSliceSeg->uiSliceMode = uiSliceMode;
- pSliceSeg->iMbWidth = kiMbWidth;
- pSliceSeg->iMbHeight = kiMbHeight;
- pSliceSeg->iMbNumInFrame = kiCountMbNum;
- pSliceSeg->pCountMbNumInSlice[0] = kiCountMbNum;
- pSliceSeg->pFirstMbInSlice[0] = 0;
+ pSliceSeg->uiSliceMode = uiSliceMode;
+ pSliceSeg->iMbWidth = kiMbWidth;
+ pSliceSeg->iMbHeight = kiMbHeight;
+ pSliceSeg->iMbNumInFrame = kiCountMbNum;
+ pSliceSeg->pCountMbNumInSlice[0] = kiCountMbNum;
+ pSliceSeg->pFirstMbInSlice[0] = 0;
return AssignMbMapSingleSlice (pSliceSeg->pOverallMbMap, kiCountMbNum, sizeof (pSliceSeg->pOverallMbMap[0]));
} else { //if ( SM_MULTIPLE_SLICE == uiSliceMode )
@@ -441,10 +441,10 @@
"pSliceSeg->pFirstMbInSlice");
WELS_VERIFY_RETURN_IF (1, NULL == pSliceSeg->pFirstMbInSlice)
- pSliceSeg->uiSliceMode = pMso->uiSliceMode;
- pSliceSeg->iMbWidth = kiMbWidth;
- pSliceSeg->iMbHeight = kiMbHeight;
- pSliceSeg->iMbNumInFrame = kiCountMbNum;
+ pSliceSeg->uiSliceMode = pMso->uiSliceMode;
+ pSliceSeg->iMbWidth = kiMbWidth;
+ pSliceSeg->iMbHeight = kiMbHeight;
+ pSliceSeg->iMbNumInFrame = kiCountMbNum;
if (SM_DYN_SLICE == pMso->uiSliceMode) {
if (0 < pMso->sSliceArgument.uiSliceSizeConstraint) {
pSliceSeg->uiSliceSizeConstraint = pMso->sSliceArgument.uiSliceSizeConstraint;
@@ -491,11 +491,11 @@
pSliceSeg->pCountMbNumInSlice = NULL;
}
- pSliceSeg->iMbNumInFrame = 0;
- pSliceSeg->iMbWidth = 0;
- pSliceSeg->iMbHeight = 0;
- pSliceSeg->uiSliceMode = SM_SINGLE_SLICE; // single in default
- pSliceSeg->iSliceNumInFrame = 0;
+ pSliceSeg->iMbNumInFrame = 0;
+ pSliceSeg->iMbWidth = 0;
+ pSliceSeg->iMbHeight = 0;
+ pSliceSeg->uiSliceMode = SM_SINGLE_SLICE; // single in default
+ pSliceSeg->iSliceNumInFrame = 0;
}
}
@@ -664,11 +664,11 @@
}
int32_t DynamicAdjustSlicePEncCtxAll (SSliceCtx* pSliceCtx,
int32_t* pRunLength) {
- const int32_t iCountNumMbInFrame = pSliceCtx->iMbNumInFrame;
- const int32_t iCountSliceNumInFrame = pSliceCtx->iSliceNumInFrame;
- int32_t iSameRunLenFlag = 1;
- int32_t iFirstMbIdx = 0;
- int32_t iSliceIdx = 0;
+ const int32_t iCountNumMbInFrame = pSliceCtx->iMbNumInFrame;
+ const int32_t iCountSliceNumInFrame = pSliceCtx->iSliceNumInFrame;
+ int32_t iSameRunLenFlag = 1;
+ int32_t iFirstMbIdx = 0;
+ int32_t iSliceIdx = 0;
assert (iCountSliceNumInFrame <= MAX_THREADS_NUM);
@@ -687,8 +687,8 @@
do {
const int32_t kiSliceRun = pRunLength[iSliceIdx];
- pSliceCtx->pFirstMbInSlice[iSliceIdx] = iFirstMbIdx;
- pSliceCtx->pCountMbNumInSlice[iSliceIdx] = kiSliceRun;
+ pSliceCtx->pFirstMbInSlice[iSliceIdx] = iFirstMbIdx;
+ pSliceCtx->pCountMbNumInSlice[iSliceIdx] = kiSliceRun;
WelsSetMemMultiplebytes_c(pSliceCtx->pOverallMbMap + iFirstMbIdx, iSliceIdx,
kiSliceRun, sizeof(uint16_t));
--- a/codec/encoder/core/src/svc_encode_mb.cpp
+++ b/codec/encoder/core/src/svc_encode_mb.cpp
@@ -53,17 +53,17 @@
void WelsEncRecI16x16Y (sWelsEncCtx* pEncCtx, SMB* pCurMb, SMbCache* pMbCache) {
ENFORCE_STACK_ALIGN_1D (int16_t, aDctT4Dc, 16, 16)
- SWelsFuncPtrList* pFuncList = pEncCtx->pFuncList;
- SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
- const int32_t kiEncStride = pCurDqLayer->iEncStride[0];
- int16_t* pRes = pMbCache->pCoeffLevel;
- uint8_t* pPred = pMbCache->SPicData.pCsMb[0];
- const int32_t kiRecStride = pCurDqLayer->iCsStride[0];
- int16_t* pBlock = pMbCache->pDct->iLumaBlock[0];
- uint8_t* pBestPred = pMbCache->pMemPredLuma;
- const uint8_t* kpNoneZeroCountIdx = &g_kuiMbCountScan4Idx[0];
- uint8_t i, uiQp = pCurMb->uiLumaQp;
- uint32_t uiNoneZeroCount, uiNoneZeroCountMbAc = 0, uiCountI16x16Dc;
+ SWelsFuncPtrList* pFuncList = pEncCtx->pFuncList;
+ SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
+ const int32_t kiEncStride = pCurDqLayer->iEncStride[0];
+ int16_t* pRes = pMbCache->pCoeffLevel;
+ uint8_t* pPred = pMbCache->SPicData.pCsMb[0];
+ const int32_t kiRecStride = pCurDqLayer->iCsStride[0];
+ int16_t* pBlock = pMbCache->pDct->iLumaBlock[0];
+ uint8_t* pBestPred = pMbCache->pMemPredLuma;
+ const uint8_t* kpNoneZeroCountIdx = &g_kuiMbCountScan4Idx[0];
+ uint8_t i, uiQp = pCurMb->uiLumaQp;
+ uint32_t uiNoneZeroCount, uiNoneZeroCountMbAc = 0, uiCountI16x16Dc;
const int16_t* pMF = g_kiQuantMF[uiQp];
const int16_t* pFF = g_iQuantIntraFF[uiQp];
@@ -137,10 +137,10 @@
}
}
void WelsEncRecI4x4Y (sWelsEncCtx* pEncCtx, SMB* pCurMb, SMbCache* pMbCache, uint8_t uiI4x4Idx) {
- SWelsFuncPtrList* pFuncList = pEncCtx->pFuncList;
- SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
- int32_t iEncStride = pCurDqLayer->iEncStride[0];
- uint8_t uiQp = pCurMb->uiLumaQp;
+ SWelsFuncPtrList* pFuncList = pEncCtx->pFuncList;
+ SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
+ int32_t iEncStride = pCurDqLayer->iEncStride[0];
+ uint8_t uiQp = pCurMb->uiLumaQp;
int16_t* pResI4x4 = pMbCache->pCoeffLevel;
uint8_t* pPredI4x4;
@@ -178,17 +178,17 @@
}
void WelsEncInterY (SWelsFuncPtrList* pFuncList, SMB* pCurMb, SMbCache* pMbCache) {
- PQuantizationMaxFunc pfQuantizationFour4x4Max = pFuncList->pfQuantizationFour4x4Max;
- PSetMemoryZero pfSetMemZeroSize8 = pFuncList->pfSetMemZeroSize8;
- PSetMemoryZero pfSetMemZeroSize64 = pFuncList->pfSetMemZeroSize64;
- PScanFunc pfScan4x4 = pFuncList->pfScan4x4;
- PCalculateSingleCtrFunc pfCalculateSingleCtr4x4 = pFuncList->pfCalculateSingleCtr4x4;
- PGetNoneZeroCountFunc pfGetNoneZeroCount = pFuncList->pfGetNoneZeroCount;
- PDeQuantizationFunc pfDequantizationFour4x4 = pFuncList->pfDequantizationFour4x4;
- int16_t* pRes = pMbCache->pCoeffLevel;
- int32_t iSingleCtrMb = 0, iSingleCtr8x8[4];
- int16_t* pBlock = pMbCache->pDct->iLumaBlock[0];
- uint8_t uiQp = pCurMb->uiLumaQp;
+ PQuantizationMaxFunc pfQuantizationFour4x4Max = pFuncList->pfQuantizationFour4x4Max;
+ PSetMemoryZero pfSetMemZeroSize8 = pFuncList->pfSetMemZeroSize8;
+ PSetMemoryZero pfSetMemZeroSize64 = pFuncList->pfSetMemZeroSize64;
+ PScanFunc pfScan4x4 = pFuncList->pfScan4x4;
+ PCalculateSingleCtrFunc pfCalculateSingleCtr4x4 = pFuncList->pfCalculateSingleCtr4x4;
+ PGetNoneZeroCountFunc pfGetNoneZeroCount = pFuncList->pfGetNoneZeroCount;
+ PDeQuantizationFunc pfDequantizationFour4x4 = pFuncList->pfDequantizationFour4x4;
+ int16_t* pRes = pMbCache->pCoeffLevel;
+ int32_t iSingleCtrMb = 0, iSingleCtr8x8[4];
+ int16_t* pBlock = pMbCache->pDct->iLumaBlock[0];
+ uint8_t uiQp = pCurMb->uiLumaQp;
const int16_t* pMF = g_kiQuantMF[uiQp];
const int16_t* pFF = g_kiQuantInterFF[uiQp];
int16_t aMax[16];
@@ -244,20 +244,20 @@
}
void WelsEncRecUV (SWelsFuncPtrList* pFuncList, SMB* pCurMb, SMbCache* pMbCache, int16_t* pRes, int32_t iUV) {
- PQuantizationHadamardFunc pfQuantizationHadamard2x2 = pFuncList->pfQuantizationHadamard2x2;
- PQuantizationMaxFunc pfQuantizationFour4x4Max = pFuncList->pfQuantizationFour4x4Max;
- PSetMemoryZero pfSetMemZeroSize8 = pFuncList->pfSetMemZeroSize8;
- PSetMemoryZero pfSetMemZeroSize64 = pFuncList->pfSetMemZeroSize64;
- PScanFunc pfScan4x4Ac = pFuncList->pfScan4x4Ac;
- PCalculateSingleCtrFunc pfCalculateSingleCtr4x4 = pFuncList->pfCalculateSingleCtr4x4;
- PGetNoneZeroCountFunc pfGetNoneZeroCount = pFuncList->pfGetNoneZeroCount;
- PDeQuantizationFunc pfDequantizationFour4x4 = pFuncList->pfDequantizationFour4x4;
- const int32_t kiInterFlag = !IS_INTRA (pCurMb->uiMbType);
- const uint8_t kiQp = pCurMb->uiChromaQp;
- uint8_t i, uiNoneZeroCount, uiNoneZeroCountMbAc = 0, uiNoneZeroCountMbDc = 0;
- uint8_t uiNoneZeroCountOffset = (iUV - 1) << 1; //UV==1 or 2
- uint8_t uiSubMbIdx = 16 + ((iUV - 1) << 2); //uiSubMbIdx == 16 or 20
- int16_t* iChromaDc = pMbCache->pDct->iChromaDc[iUV - 1], *pBlock = pMbCache->pDct->iChromaBlock[ (iUV - 1) << 2];
+ PQuantizationHadamardFunc pfQuantizationHadamard2x2 = pFuncList->pfQuantizationHadamard2x2;
+ PQuantizationMaxFunc pfQuantizationFour4x4Max = pFuncList->pfQuantizationFour4x4Max;
+ PSetMemoryZero pfSetMemZeroSize8 = pFuncList->pfSetMemZeroSize8;
+ PSetMemoryZero pfSetMemZeroSize64 = pFuncList->pfSetMemZeroSize64;
+ PScanFunc pfScan4x4Ac = pFuncList->pfScan4x4Ac;
+ PCalculateSingleCtrFunc pfCalculateSingleCtr4x4 = pFuncList->pfCalculateSingleCtr4x4;
+ PGetNoneZeroCountFunc pfGetNoneZeroCount = pFuncList->pfGetNoneZeroCount;
+ PDeQuantizationFunc pfDequantizationFour4x4 = pFuncList->pfDequantizationFour4x4;
+ const int32_t kiInterFlag = !IS_INTRA (pCurMb->uiMbType);
+ const uint8_t kiQp = pCurMb->uiChromaQp;
+ uint8_t i, uiNoneZeroCount, uiNoneZeroCountMbAc = 0, uiNoneZeroCountMbDc = 0;
+ uint8_t uiNoneZeroCountOffset = (iUV - 1) << 1; //UV==1 or 2
+ uint8_t uiSubMbIdx = 16 + ((iUV - 1) << 2); //uiSubMbIdx == 16 or 20
+ int16_t* iChromaDc = pMbCache->pDct->iChromaDc[iUV - 1], *pBlock = pMbCache->pDct->iChromaBlock[ (iUV - 1) << 2];
int16_t aDct2x2[4], j, aMax[4];
int32_t iSingleCtr8x8 = 0;
const int16_t* pMF = g_kiQuantMF[kiQp];
@@ -307,17 +307,17 @@
WelsDequantIHadamard2x2Dc (aDct2x2, g_kuiDequantCoeff[kiQp][0]);
if (2 != (pCurMb->uiCbp >> 4))
pCurMb->uiCbp |= (0x01 << 4) ;
- pRes[0] = aDct2x2[0];
- pRes[16] = aDct2x2[1];
- pRes[32] = aDct2x2[2];
- pRes[48] = aDct2x2[3];
+ pRes[0] = aDct2x2[0];
+ pRes[16] = aDct2x2[1];
+ pRes[32] = aDct2x2[2];
+ pRes[48] = aDct2x2[3];
}
}
void WelsRecPskip (SDqLayer* pCurLayer, SWelsFuncPtrList* pFuncList, SMB* pCurMb, SMbCache* pMbCache) {
- int32_t* iRecStride = pCurLayer->iCsStride;
- uint8_t** pCsMb = &pMbCache->SPicData.pCsMb[0];
+ int32_t* iRecStride = pCurLayer->iCsStride;
+ uint8_t** pCsMb = &pMbCache->SPicData.pCsMb[0];
pFuncList->pfCopy16x16Aligned (pCsMb[0], *iRecStride++, pMbCache->pSkipMb, 16);
pFuncList->pfCopy8x8Aligned (pCsMb[1], *iRecStride++, pMbCache->pSkipMb + 256, 8);
--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -178,8 +178,8 @@
* \brief write reference picture list on reordering syntax in Slice header
*/
void WriteReferenceReorder (SBitStringAux* pBs, SSliceHeader* sSliceHeader) {
- SRefPicListReorderSyntax* pRefOrdering = &sSliceHeader->sRefReordering;
- uint8_t eSliceType = sSliceHeader->eSliceType % 5;
+ SRefPicListReorderSyntax* pRefOrdering = &sSliceHeader->sRefReordering;
+ uint8_t eSliceType = sSliceHeader->eSliceType % 5;
int16_t n = 0;
if (I_SLICE != eSliceType && SI_SLICE != eSliceType) { // !I && !SI
@@ -417,14 +417,14 @@
//only BaseLayer inter MB and SpatialLayer (uiQualityId = 0) inter MB calling this pFunc.
//only for I SSlice
void WelsIMbChromaEncode (sWelsEncCtx* pEncCtx, SMB* pCurMb, SMbCache* pMbCache) {
- SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- const int32_t kiEncStride = pCurLayer->iEncStride[1];
- const int32_t kiCsStride = pCurLayer->iCsStride[1];
- int16_t* pCurRS = pMbCache->pCoeffLevel;
- uint8_t* pBestPred = pMbCache->pBestPredIntraChroma;
- uint8_t* pCsCb = pMbCache->SPicData.pCsMb[1];
- uint8_t* pCsCr = pMbCache->SPicData.pCsMb[2];
+ SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ const int32_t kiEncStride = pCurLayer->iEncStride[1];
+ const int32_t kiCsStride = pCurLayer->iCsStride[1];
+ int16_t* pCurRS = pMbCache->pCoeffLevel;
+ uint8_t* pBestPred = pMbCache->pBestPredIntraChroma;
+ uint8_t* pCsCb = pMbCache->SPicData.pCsMb[1];
+ uint8_t* pCsCr = pMbCache->SPicData.pCsMb[2];
//cb
pFunc->pfDctFourT4 (pCurRS, pMbCache->SPicData.pEncMb[1], kiEncStride, pBestPred, 8);
@@ -441,12 +441,12 @@
//only BaseLayer inter MB and SpatialLayer (uiQualityId = 0) inter MB calling this pFunc.
//for P SSlice (intra part + inter part)
void WelsPMbChromaEncode (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb) {
- SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- const int32_t kiEncStride = pCurLayer->iEncStride[1];
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
- int16_t* pCurRS = pMbCache->pCoeffLevel + 256;
- uint8_t* pBestPred = pMbCache->pMemPredChroma;
+ SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ const int32_t kiEncStride = pCurLayer->iEncStride[1];
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ int16_t* pCurRS = pMbCache->pCoeffLevel + 256;
+ uint8_t* pBestPred = pMbCache->pMemPredChroma;
pFunc->pfDctFourT4 (pCurRS, pMbCache->SPicData.pEncMb[1], kiEncStride, pBestPred, 8);
pFunc->pfDctFourT4 (pCurRS + 64, pMbCache->SPicData.pEncMb[2], kiEncStride, pBestPred + 64, 8);
@@ -457,15 +457,15 @@
void OutputPMbWithoutConstructCsRsNoCopy (sWelsEncCtx* pCtx, SDqLayer* pDq, SSlice* pSlice, SMB* pMb) {
if ((IS_INTER (pMb->uiMbType) && !IS_SKIP (pMb->uiMbType))
- || IS_I_BL (pMb->uiMbType)) { //intra have been reconstructed, NO COPY from CS to pDecPic--
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
- uint8_t* pDecY = pMbCache->SPicData.pDecMb[0];
- uint8_t* pDecU = pMbCache->SPicData.pDecMb[1];
- uint8_t* pDecV = pMbCache->SPicData.pDecMb[2];
- int16_t* pScaledTcoeff = pMbCache->pCoeffLevel;
- const int32_t kiDecStrideLuma = pDq->pDecPic->iLineSize[0];
- const int32_t kiDecStrideChroma = pDq->pDecPic->iLineSize[1];
- PIDctFunc pfIdctFour4x4 = pCtx->pFuncList->pfIDctFourT4;
+ || IS_I_BL (pMb->uiMbType)) { //intra have been reconstructed, NO COPY from CS to pDecPic--
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ uint8_t* pDecY = pMbCache->SPicData.pDecMb[0];
+ uint8_t* pDecU = pMbCache->SPicData.pDecMb[1];
+ uint8_t* pDecV = pMbCache->SPicData.pDecMb[2];
+ int16_t* pScaledTcoeff = pMbCache->pCoeffLevel;
+ const int32_t kiDecStrideLuma = pDq->pDecPic->iLineSize[0];
+ const int32_t kiDecStrideChroma = pDq->pDecPic->iLineSize[1];
+ PIDctFunc pfIdctFour4x4 = pCtx->pFuncList->pfIDctFourT4;
WelsIDctT4RecOnMb (pDecY, kiDecStrideLuma, pDecY, kiDecStrideLuma, pScaledTcoeff, pfIdctFour4x4);
pfIdctFour4x4 (pDecU, kiDecStrideChroma, pDecU, kiDecStrideChroma, pScaledTcoeff + 256);
@@ -482,17 +482,17 @@
//first. store base or highest Dependency Layer with only one quality (without CS RS reconstruction)
//second. lower than highest Dependency Layer, and for every Dependency Layer with one quality layer(single layer)
int32_t WelsISliceMdEnc (sWelsEncCtx* pEncCtx, SSlice* pSlice) { //pMd + encoding
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
- SSliceHeaderExt* pSliceHdExt = &pSlice->sSliceHeaderExt;
- SMB* pMbList = pCurLayer->sMbDataP;
- SMB* pCurMb = NULL;
- const int32_t kiSliceFirstMbXY = pSliceHdExt->sSliceHeader.iFirstMbInSlice;
- int32_t iNextMbIdx = kiSliceFirstMbXY;
- const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
- int32_t iCurMbIdx = 0, iNumMbCoded = 0;
- const int32_t kiSliceIdx = pSlice->uiSliceIdx;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ SSliceHeaderExt* pSliceHdExt = &pSlice->sSliceHeaderExt;
+ SMB* pMbList = pCurLayer->sMbDataP;
+ SMB* pCurMb = NULL;
+ const int32_t kiSliceFirstMbXY = pSliceHdExt->sSliceHeader.iFirstMbInSlice;
+ int32_t iNextMbIdx = kiSliceFirstMbXY;
+ const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
+ int32_t iCurMbIdx = 0, iNumMbCoded = 0;
+ const int32_t kiSliceIdx = pSlice->uiSliceIdx;
const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
SWelsMD sMd;
@@ -544,19 +544,19 @@
// Only for intra dynamic slicing
int32_t WelsISliceMdEncDynamic (sWelsEncCtx* pEncCtx, SSlice* pSlice) { //pMd + encoding
- SBitStringAux* pBs = pSlice->pSliceBsa;
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
- SSliceHeaderExt* pSliceHdExt = &pSlice->sSliceHeaderExt;
- SMB* pMbList = pCurLayer->sMbDataP;
- SMB* pCurMb = NULL;
- const int32_t kiSliceFirstMbXY = pSliceHdExt->sSliceHeader.iFirstMbInSlice;
- int32_t iNextMbIdx = kiSliceFirstMbXY;
- const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
- int32_t iCurMbIdx = 0, iNumMbCoded = 0;
- const int32_t kiSliceIdx = pSlice->uiSliceIdx;
- const int32_t kiPartitionId = (kiSliceIdx % pEncCtx->iActiveThreadsNum);
+ SBitStringAux* pBs = pSlice->pSliceBsa;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ SSliceHeaderExt* pSliceHdExt = &pSlice->sSliceHeaderExt;
+ SMB* pMbList = pCurLayer->sMbDataP;
+ SMB* pCurMb = NULL;
+ const int32_t kiSliceFirstMbXY = pSliceHdExt->sSliceHeader.iFirstMbInSlice;
+ int32_t iNextMbIdx = kiSliceFirstMbXY;
+ const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
+ int32_t iCurMbIdx = 0, iNumMbCoded = 0;
+ const int32_t kiSliceIdx = pSlice->uiSliceIdx;
+ const int32_t kiPartitionId = (kiSliceIdx % pEncCtx->iActiveThreadsNum);
const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
int32_t iEncReturn = ENC_RETURN_SUCCESS;
@@ -631,13 +631,13 @@
// first. store base or highest Dependency Layer with only one quality (without CS RS reconstruction)
// second. lower than highest Dependency Layer, and for every Dependency Layer with one quality layer(single layer)
int32_t WelsPSliceMdEnc (sWelsEncCtx* pEncCtx, SSlice* pSlice, const bool kbIsHighestDlayerFlag) { //pMd + encoding
- const SSliceHeaderExt* kpShExt = &pSlice->sSliceHeaderExt;
- const SSliceHeader* kpSh = &kpShExt->sSliceHeader;
- const int32_t kiSliceFirstMbXY = kpSh->iFirstMbInSlice;
+ const SSliceHeaderExt* kpShExt = &pSlice->sSliceHeaderExt;
+ const SSliceHeader* kpSh = &kpShExt->sSliceHeader;
+ const int32_t kiSliceFirstMbXY = kpSh->iFirstMbInSlice;
SWelsMD sMd;
- sMd.uiRef = kpSh->uiRefIndex;
- sMd.bMdUsingSad = kbIsHighestDlayerFlag;
+ sMd.uiRef = kpSh->uiRefIndex;
+ sMd.bMdUsingSad = kbIsHighestDlayerFlag;
if (!pEncCtx->pCurDqLayer->bBaseLayerAvailableFlag || !kbIsHighestDlayerFlag)
memset (&sMd.sMe, 0, sizeof (sMd.sMe));
@@ -646,13 +646,13 @@
}
int32_t WelsPSliceMdEncDynamic (sWelsEncCtx* pEncCtx, SSlice* pSlice, const bool kbIsHighestDlayerFlag) {
- const SSliceHeaderExt* kpShExt = &pSlice->sSliceHeaderExt;
- const SSliceHeader* kpSh = &kpShExt->sSliceHeader;
- const int32_t kiSliceFirstMbXY = kpSh->iFirstMbInSlice;
+ const SSliceHeaderExt* kpShExt = &pSlice->sSliceHeaderExt;
+ const SSliceHeader* kpSh = &kpShExt->sSliceHeader;
+ const int32_t kiSliceFirstMbXY = kpSh->iFirstMbInSlice;
SWelsMD sMd;
- sMd.uiRef = kpSh->uiRefIndex;
- sMd.bMdUsingSad = kbIsHighestDlayerFlag;
+ sMd.uiRef = kpSh->uiRefIndex;
+ sMd.bMdUsingSad = kbIsHighestDlayerFlag;
if (!pEncCtx->pCurDqLayer->bBaseLayerAvailableFlag || !kbIsHighestDlayerFlag)
memset (&sMd.sMe, 0, sizeof (sMd.sMe));
@@ -711,11 +711,11 @@
int32_t WelsCodeOneSlice (sWelsEncCtx* pEncCtx, const int32_t kiSliceIdx, const int32_t kiNalType) {
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SNalUnitHeaderExt* pNalHeadExt = &pCurLayer->sLayerInfo.sNalHeaderExt;
- SSlice* pCurSlice = &pCurLayer->sLayerInfo.pSliceInLayer[kiSliceIdx];
- SBitStringAux* pBs = pCurSlice->pSliceBsa;
- const int32_t kiDynamicSliceFlag = (pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId].sSliceCfg.uiSliceMode
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ SNalUnitHeaderExt* pNalHeadExt = &pCurLayer->sLayerInfo.sNalHeaderExt;
+ SSlice* pCurSlice = &pCurLayer->sLayerInfo.pSliceInLayer[kiSliceIdx];
+ SBitStringAux* pBs = pCurSlice->pSliceBsa;
+ const int32_t kiDynamicSliceFlag = (pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId].sSliceCfg.uiSliceMode
==
SM_DYN_SLICE);
@@ -763,19 +763,19 @@
SMB* pMbList,
const int32_t kiFirstMbIdxOfNextSlice,
const int32_t kiLastMbIdxInPartition) {
- const int32_t kiMbWidth = pSliceCtx->iMbWidth;
- int32_t iIdx = kiFirstMbIdxOfNextSlice;
- int32_t iNextSliceFirstMbIdxRowStart = ((kiFirstMbIdxOfNextSlice % kiMbWidth) ? 1 : 0);
- int32_t iCountMbUpdate = kiMbWidth +
+ const int32_t kiMbWidth = pSliceCtx->iMbWidth;
+ int32_t iIdx = kiFirstMbIdxOfNextSlice;
+ int32_t iNextSliceFirstMbIdxRowStart = ((kiFirstMbIdxOfNextSlice % kiMbWidth) ? 1 : 0);
+ int32_t iCountMbUpdate = kiMbWidth +
iNextSliceFirstMbIdxRowStart; //need to update MB(iMbXY+1) to MB(iMbXY+1+row) in common case
- const int32_t kiEndMbNeedUpdate = kiFirstMbIdxOfNextSlice + iCountMbUpdate;
- SMB* pMb = &pMbList[iIdx];
+ const int32_t kiEndMbNeedUpdate = kiFirstMbIdxOfNextSlice + iCountMbUpdate;
+ SMB* pMb = &pMbList[iIdx];
do {
- uint32_t uiNeighborAvailFlag = 0;
- const int32_t kiMbXY = pMb->iMbXY;
- const int32_t kiMbX = pMb->iMbX;
- const int32_t kiMbY = pMb->iMbY;
+ uint32_t uiNeighborAvailFlag = 0;
+ const int32_t kiMbXY = pMb->iMbXY;
+ const int32_t kiMbX = pMb->iMbX;
+ const int32_t kiMbY = pMb->iMbY;
bool bLeft;
bool bTop;
bool bLeftTop;
@@ -817,12 +817,12 @@
void AddSliceBoundary (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, SSliceCtx* pSliceCtx, SMB* pCurMb,
int32_t iFirstMbIdxOfNextSlice, const int32_t kiLastMbIdxInPartition) {
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- int32_t iCurMbIdx = pCurMb->iMbXY;
- uint16_t iCurSliceIdc = pSliceCtx->pOverallMbMap[ iCurMbIdx ];
- const int32_t kiSliceIdxStep = pEncCtx->iActiveThreadsNum;
- uint16_t iNextSliceIdc = iCurSliceIdc + kiSliceIdxStep;
- SSlice* pNextSlice = NULL;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ int32_t iCurMbIdx = pCurMb->iMbXY;
+ uint16_t iCurSliceIdc = pSliceCtx->pOverallMbMap[ iCurMbIdx ];
+ const int32_t kiSliceIdxStep = pEncCtx->iActiveThreadsNum;
+ uint16_t iNextSliceIdc = iCurSliceIdc + kiSliceIdxStep;
+ SSlice* pNextSlice = NULL;
SMB* pMbList = pCurLayer->sMbDataP;
@@ -855,9 +855,9 @@
SDynamicSlicingStack* pDss) {
sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;
SSlice* pCurSlice = (SSlice*)pSlice;
- int32_t iCurMbIdx = pCurMb->iMbXY;
- uint32_t uiLen = 0;
- int32_t iPosBitOffset = 0;
+ int32_t iCurMbIdx = pCurMb->iMbXY;
+ uint32_t uiLen = 0;
+ int32_t iPosBitOffset = 0;
const int32_t kiActiveThreadsNum = pEncCtx->iActiveThreadsNum;
const int32_t kiPartitaionId = pCurSlice->uiSliceIdx % kiActiveThreadsNum;
const int32_t kiLastMbIdxInPartition = pEncCtx->pCurDqLayer->pLastMbIdxOfPartition[kiPartitaionId];
@@ -933,26 +933,26 @@
SWelsMD* pMd) {
pMd->iLambda = g_kiQpCostTable[pCurMb->uiLumaQp];
pMd->pMvdCost = &pMvdCostTable[pCurMb->uiLumaQp * kiMvdInterTableStride];
- pMd-> iMbPixX = (pCurMb->iMbX << 4);
- pMd-> iMbPixY = (pCurMb->iMbY << 4);
+ pMd-> iMbPixX = (pCurMb->iMbX << 4);
+ pMd-> iMbPixY = (pCurMb->iMbY << 4);
memset (&pMd->iBlock8x8StaticIdc[0], 0, sizeof (pMd->iBlock8x8StaticIdc));
}
// for inter non-dynamic pSlice
int32_t WelsMdInterMbLoop (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pWelsMd, const int32_t kiSliceFirstMbXY) {
- SWelsMD* pMd = (SWelsMD*)pWelsMd;
- SBitStringAux* pBs = pSlice->pSliceBsa;
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
- SMB* pMbList = pCurLayer->sMbDataP;
- SMB* pCurMb = NULL;
- int32_t iNumMbCoded = 0;
- int32_t iNextMbIdx = kiSliceFirstMbXY;
- int32_t iCurMbIdx = -1;
- const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
- const int32_t kiMvdInterTableStride = pEncCtx->iMvdCostTableStride;
- uint16_t* pMvdCostTable = &pEncCtx->pMvdCostTable[pEncCtx->iMvdCostTableSize];
- const int32_t kiSliceIdx = pSlice->uiSliceIdx;
+ SWelsMD* pMd = (SWelsMD*)pWelsMd;
+ SBitStringAux* pBs = pSlice->pSliceBsa;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ SMB* pMbList = pCurLayer->sMbDataP;
+ SMB* pCurMb = NULL;
+ int32_t iNumMbCoded = 0;
+ int32_t iNextMbIdx = kiSliceFirstMbXY;
+ int32_t iCurMbIdx = -1;
+ const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
+ const int32_t kiMvdInterTableStride = pEncCtx->iMvdCostTableStride;
+ uint16_t* pMvdCostTable = &pEncCtx->pMvdCostTable[pEncCtx->iMvdCostTableSize];
+ const int32_t kiSliceIdx = pSlice->uiSliceIdx;
const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
int32_t iEncReturn = ENC_RETURN_SUCCESS;
SDynamicSlicingStack sDss;
@@ -1030,21 +1030,21 @@
// Only for inter dynamic slicing
int32_t WelsMdInterMbLoopOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pWelsMd,
const int32_t kiSliceFirstMbXY) {
- SWelsMD* pMd = (SWelsMD*)pWelsMd;
- SBitStringAux* pBs = pSlice->pSliceBsa;
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
- SMB* pMbList = pCurLayer->sMbDataP;
- SMB* pCurMb = NULL;
- int32_t iNumMbCoded = 0;
- const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
- int32_t iNextMbIdx = kiSliceFirstMbXY;
- int32_t iCurMbIdx = -1;
- const int32_t kiMvdInterTableStride = pEncCtx->iMvdCostTableStride;
- uint16_t* pMvdCostTable = &pEncCtx->pMvdCostTable[pEncCtx->iMvdCostTableSize];
- const int32_t kiSliceIdx = pSlice->uiSliceIdx;
- const int32_t kiPartitionId = (kiSliceIdx % pEncCtx->iActiveThreadsNum);
+ SWelsMD* pMd = (SWelsMD*)pWelsMd;
+ SBitStringAux* pBs = pSlice->pSliceBsa;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ SMB* pMbList = pCurLayer->sMbDataP;
+ SMB* pCurMb = NULL;
+ int32_t iNumMbCoded = 0;
+ const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
+ int32_t iNextMbIdx = kiSliceFirstMbXY;
+ int32_t iCurMbIdx = -1;
+ const int32_t kiMvdInterTableStride = pEncCtx->iMvdCostTableStride;
+ uint16_t* pMvdCostTable = &pEncCtx->pMvdCostTable[pEncCtx->iMvdCostTableSize];
+ const int32_t kiSliceIdx = pSlice->uiSliceIdx;
+ const int32_t kiPartitionId = (kiSliceIdx % pEncCtx->iActiveThreadsNum);
const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
int32_t iEncReturn = ENC_RETURN_SUCCESS;
--- a/codec/encoder/core/src/svc_mode_decision.cpp
+++ b/codec/encoder/core/src/svc_mode_decision.cpp
@@ -58,11 +58,10 @@
const uint32_t kuiNeighborAvail = pCurMb->uiNeighborAvail;
const int32_t kiMbWidth = pCurDqLayer->iMbWidth;
const SMB* kpTopMb = pCurMb - kiMbWidth;
- const bool kbMbLeftAvailPskip = ((kuiNeighborAvail & LEFT_MB_POS) ? IS_SKIP ((pCurMb - 1)->uiMbType) : false);
- const bool kbMbTopAvailPskip = ((kuiNeighborAvail & TOP_MB_POS) ? IS_SKIP (kpTopMb->uiMbType) : false);
- const bool kbMbTopLeftAvailPskip = ((kuiNeighborAvail & TOPLEFT_MB_POS) ? IS_SKIP ((kpTopMb - 1)->uiMbType) : false);
- const bool kbMbTopRightAvailPskip = ((kuiNeighborAvail & TOPRIGHT_MB_POS) ? IS_SKIP ((
- kpTopMb + 1)->uiMbType) : false);
+ const bool kbMbLeftAvailPskip = ((kuiNeighborAvail & LEFT_MB_POS) ? IS_SKIP ((pCurMb - 1)->uiMbType) : false);
+ const bool kbMbTopAvailPskip = ((kuiNeighborAvail & TOP_MB_POS) ? IS_SKIP (kpTopMb->uiMbType) : false);
+ const bool kbMbTopLeftAvailPskip = ((kuiNeighborAvail & TOPLEFT_MB_POS) ? IS_SKIP ((kpTopMb - 1)->uiMbType) : false);
+ const bool kbMbTopRightAvailPskip = ((kuiNeighborAvail & TOPRIGHT_MB_POS) ? IS_SKIP ((kpTopMb + 1)->uiMbType) : false);
bool bTrySkip = kbMbLeftAvailPskip | kbMbTopAvailPskip | kbMbTopLeftAvailPskip | kbMbTopRightAvailPskip;
bool bKeepSkip = kbMbLeftAvailPskip & kbMbTopAvailPskip & kbMbTopRightAvailPskip;
@@ -107,10 +106,10 @@
void WelsMdInterMbEnhancelayer (sWelsEncCtx* pEncCtx, SWelsMD* pMd, SSlice* pSlice, SMB* pCurMb, SMbCache* pMbCache) {
- SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SWelsMD* pWelsMd = (SWelsMD*)pMd;
- const SMB* kpInterLayerRefMb = GetRefMb (pCurLayer, pCurMb);
- const Mb_Type kuiInterLayerRefMbType = kpInterLayerRefMb->uiMbType;
+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
+ SWelsMD* pWelsMd = (SWelsMD*)pMd;
+ const SMB* kpInterLayerRefMb = GetRefMb (pCurLayer, pCurMb);
+ const Mb_Type kuiInterLayerRefMbType = kpInterLayerRefMb->uiMbType;
SetMvBaseEnhancelayer (pWelsMd, pCurMb,
kpInterLayerRefMb); // initial sMvBase here only when pRef mb type is inter, if not sMvBase will be not used!
@@ -180,12 +179,12 @@
uint8_t* pCbEnc = pMbCache->SPicData.pEncMb[1];
uint8_t* pCrEnc = pMbCache->SPicData.pEncMb[2];
- uint8_t* pCbRef = pMbCache->SPicData.pRefMb[1];
+ uint8_t* pCbRef = pMbCache->SPicData.pRefMb[1];
uint8_t* pCrRef = pMbCache->SPicData.pRefMb[2];
const int32_t iCbEncStride = pCurDqLayer->iEncStride[1];
- const int32_t iCrEncStride = pCurDqLayer->iEncStride[2];
- const int32_t iChromaRefStride = pCurDqLayer->pRefPic->iLineSize[1];
+ const int32_t iCrEncStride = pCurDqLayer->iEncStride[2];
+ const int32_t iChromaRefStride = pCurDqLayer->pRefPic->iLineSize[1];
const int32_t iCbSad = GetChromaCost (pSad, pCbEnc, iCbEncStride, pCbRef, iChromaRefStride);
const int32_t iCrSad = GetChromaCost (pSad, pCrEnc, iCrEncStride, pCrRef, iChromaRefStride);
@@ -220,7 +219,7 @@
const int32_t kiRefMbQp = pCurDqLayer->pRefPic->pRefMbQp[pCurMb->iMbXY];
const int32_t kiCurMbQp = pCurMb->uiLumaQp;// unsigned -> signed
- int8_t* pVaaBgMbFlag = pEncCtx->pVaa->pVaaBackgroundMbFlag + pCurMb->iMbXY;
+ int8_t* pVaaBgMbFlag = pEncCtx->pVaa->pVaaBackgroundMbFlag + pCurMb->iMbXY;
const int32_t kiMbWidth = pCurDqLayer->iMbWidth;
@@ -332,8 +331,8 @@
SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
SPicture* pRefOri = pCurDqLayer->pRefOri[0];
if (pRefOri != NULL) {
- iStrideUV = pCurDqLayer->iEncStride[1];
- iOffsetUV = (kiMbX + kiMbY * iStrideUV) << 3;
+ iStrideUV = pCurDqLayer->iEncStride[1];
+ iOffsetUV = (kiMbX + kiMbY * iStrideUV) << 3;
int32_t iSadCostCb = CalUVSadCost (pFunc, pMbCache->SPicData.pEncMb[1], iStrideUV, pRefOri->pData[1] + iOffsetUV,
pRefOri->iLineSize[1]);
@@ -372,8 +371,8 @@
if (CheckBorder (kiMbX, kiMbY, iScrollMvX, iScrollMvY, kiMbWidth, kiMbHeight)) {
bTryScrollSkip = false;
} else {
- iStrideUV = pCurDqLayer->iEncStride[1];
- iOffsetUV = (kiMbX << 3) + (iScrollMvX >> 1) + ((kiMbY << 3) + (iScrollMvY >> 1)) * iStrideUV;
+ iStrideUV = pCurDqLayer->iEncStride[1];
+ iOffsetUV = (kiMbX << 3) + (iScrollMvX >> 1) + ((kiMbY << 3) + (iScrollMvY >> 1)) * iStrideUV;
int32_t iSadCostCb = CalUVSadCost (pFunc, pMbCache->SPicData.pEncMb[1], iStrideUV, pRefOri->pData[1] + iOffsetUV,
pRefOri->iLineSize[1]);
@@ -391,27 +390,27 @@
void SvcMdSCDMbEnc (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb, SMbCache* pMbCache, SSlice* pSlice,
bool bQpSimilarFlag,
bool bMbSkipFlag, SMVUnitXY sCurMbMv[], ESkipModes eSkipMode) {
- SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
- SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
- SMVUnitXY sMvp = { 0};
+ SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
+ SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
+ SMVUnitXY sMvp = { 0};
ST16 (&sMvp.iMvX, sCurMbMv[eSkipMode].iMvX);
ST16 (&sMvp.iMvY, sCurMbMv[eSkipMode].iMvY);
- uint8_t* pRefLuma = pMbCache->SPicData.pRefMb[0];
- uint8_t* pRefCb = pMbCache->SPicData.pRefMb[1];
- uint8_t* pRefCr = pMbCache->SPicData.pRefMb[2];
- int32_t iLineSizeY = pCurDqLayer->pRefPic->iLineSize[0];
- int32_t iLineSizeUV = pCurDqLayer->pRefPic->iLineSize[1];
- uint8_t* pDstLuma = pMbCache->pSkipMb;
- uint8_t* pDstCb = pMbCache->pSkipMb + 256;
- uint8_t* pDstCr = pMbCache->pSkipMb + 256 + 64;
+ uint8_t* pRefLuma = pMbCache->SPicData.pRefMb[0];
+ uint8_t* pRefCb = pMbCache->SPicData.pRefMb[1];
+ uint8_t* pRefCr = pMbCache->SPicData.pRefMb[2];
+ int32_t iLineSizeY = pCurDqLayer->pRefPic->iLineSize[0];
+ int32_t iLineSizeUV = pCurDqLayer->pRefPic->iLineSize[1];
+ uint8_t* pDstLuma = pMbCache->pSkipMb;
+ uint8_t* pDstCb = pMbCache->pSkipMb + 256;
+ uint8_t* pDstCr = pMbCache->pSkipMb + 256 + 64;
- const int32_t iOffsetY = (sCurMbMv[eSkipMode].iMvX >> 2) + (sCurMbMv[eSkipMode].iMvY >> 2) * iLineSizeY;
+ const int32_t iOffsetY = (sCurMbMv[eSkipMode].iMvX >> 2) + (sCurMbMv[eSkipMode].iMvY >> 2) * iLineSizeY;
const int32_t iOffsetUV = (sCurMbMv[eSkipMode].iMvX >> 3) + (sCurMbMv[eSkipMode].iMvY >> 3) * iLineSizeUV;
if (!bQpSimilarFlag || !bMbSkipFlag) {
pDstLuma = pMbCache->pMemPredLuma;
- pDstCb = pMbCache->pMemPredChroma;
- pDstCr = pMbCache->pMemPredChroma + 64;
+ pDstCb = pMbCache->pMemPredChroma;
+ pDstCr = pMbCache->pMemPredChroma + 64;
}
//MC
pFunc->sMcFuncs.pMcLumaFunc (pRefLuma + iOffsetY, iLineSizeY, pDstLuma, 16, 0, 0, 16, 16);
@@ -466,8 +465,8 @@
bool MdInterSCDPskipProcess (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SSlice* pSlice, SMB* pCurMb, SMbCache* pMbCache,
ESkipModes eSkipMode) {
- SVAAFrameInfoExt_t* pVaaExt = static_cast<SVAAFrameInfoExt_t*> (pEncCtx->pVaa);
- SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
+ SVAAFrameInfoExt_t* pVaaExt = static_cast<SVAAFrameInfoExt_t*> (pEncCtx->pVaa);
+ SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
const int32_t kiRefMbQp = pCurDqLayer->pRefPic->pRefMbQp[pCurMb->iMbXY];
const int32_t kiCurMbQp = pCurMb->uiLumaQp;// unsigned -> signed
--- a/codec/encoder/core/src/svc_set_mb_syn_cavlc.cpp
+++ b/codec/encoder/core/src/svc_set_mb_syn_cavlc.cpp
@@ -57,8 +57,8 @@
//============================Enhance Layer CAVLC Writing===========================
void WelsSpatialWriteMbPred (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb) {
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
- SBitStringAux* pBs = pSlice->pSliceBsa;
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ SBitStringAux* pBs = pSlice->pSliceBsa;
SSliceHeaderExt* pSliceHeadExt = &pSlice->sSliceHeaderExt;
int32_t iNumRefIdxl0ActiveMinus1 = pSliceHeadExt->sSliceHeader.uiNumRefIdxL0Active - 1;
@@ -169,8 +169,8 @@
}
void WelsSpatialWriteSubMbPred (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb) {
- SMbCache* pMbCache = &pSlice->sMbCacheInfo;
- SBitStringAux* pBs = pSlice->pSliceBsa;
+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
+ SBitStringAux* pBs = pSlice->pSliceBsa;
SSliceHeaderExt* pSliceHeadExt = &pSlice->sSliceHeaderExt;
int32_t iNumRefIdxl0ActiveMinus1 = pSliceHeadExt->sSliceHeader.uiNumRefIdxL0Active - 1;
@@ -271,10 +271,10 @@
int32_t WelsWriteMbResidual (SWelsFuncPtrList* pFuncList, SMbCache* sMbCacheInfo, SMB* pCurMb, SBitStringAux* pBs) {
int32_t i;
- Mb_Type uiMbType = pCurMb->uiMbType;
- const int32_t kiCbpChroma = pCurMb->uiCbp >> 4;
- const int32_t kiCbpLuma = pCurMb->uiCbp & 0x0F;
- int8_t* pNonZeroCoeffCount = sMbCacheInfo->iNonZeroCoeffCount;
+ Mb_Type uiMbType = pCurMb->uiMbType;
+ const int32_t kiCbpChroma = pCurMb->uiCbp >> 4;
+ const int32_t kiCbpLuma = pCurMb->uiCbp & 0x0F;
+ int8_t* pNonZeroCoeffCount = sMbCacheInfo->iNonZeroCoeffCount;
int16_t* pBlock;
int8_t iA, iB, iC;
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -122,9 +122,9 @@
}
int32_t CWelsPreProcess::AllocSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCodingParam* pParam) {
- CMemoryAlign* pMa = pCtx->pMemAlign;
- const int32_t kiDlayerCount = pParam->iSpatialLayerNum;
- int32_t iDlayerIndex = 0;
+ CMemoryAlign* pMa = pCtx->pMemAlign;
+ const int32_t kiDlayerCount = pParam->iSpatialLayerNum;
+ int32_t iDlayerIndex = 0;
// spatial pictures
iDlayerIndex = 0;
@@ -294,21 +294,21 @@
int8_t iDependencyId = pSvcParam->iSpatialLayerNum - 1;
int32_t iPicturePos = m_uiSpatialLayersInTemporal[iDependencyId] - 1;
- SPicture* pSrcPic = NULL; // large
- SPicture* pDstPic = NULL; // small
- SSpatialLayerConfig* pDlayerParam = NULL;
- SSpatialLayerInternal* pDlayerParamInternal = NULL;
- int32_t iSpatialNum = 0;
- int32_t iSrcWidth = 0;
- int32_t iSrcHeight = 0;
- int32_t iTargetWidth = 0;
- int32_t iTargetHeight = 0;
+ SPicture* pSrcPic = NULL; // large
+ SPicture* pDstPic = NULL; // small
+ SSpatialLayerConfig* pDlayerParam = NULL;
+ SSpatialLayerInternal* pDlayerParamInternal = NULL;
+ int32_t iSpatialNum = 0;
+ int32_t iSrcWidth = 0;
+ int32_t iSrcHeight = 0;
+ int32_t iTargetWidth = 0;
+ int32_t iTargetHeight = 0;
int32_t iTemporalId = 0;
- int32_t iActualSpatialLayerNum = 0;
+ int32_t iActualSpatialLayerNum = 0;
pDlayerParamInternal = &pSvcParam->sDependencyLayers[iDependencyId];
pDlayerParam = &pSvcParam->sSpatialLayers[iDependencyId];
- iTargetWidth = pDlayerParam->iVideoWidth;
+ iTargetWidth = pDlayerParam->iVideoWidth;
iTargetHeight = pDlayerParam->iVideoHeight;
iTemporalId = pDlayerParamInternal->uiCodingIdx2TemporalId[pCtx->iCodingIndex & (pSvcParam->uiGopSize - 1)];
iSrcWidth = pSvcParam->SUsedPicRect.iWidth;
@@ -374,10 +374,10 @@
while (iDependencyId >= 0) {
pDlayerParamInternal = &pSvcParam->sDependencyLayers[iDependencyId];
pDlayerParam = &pSvcParam->sSpatialLayers[iDependencyId];
- iTargetWidth = pDlayerParam->iVideoWidth;
- iTargetHeight = pDlayerParam->iVideoHeight;
+ iTargetWidth = pDlayerParam->iVideoWidth;
+ iTargetHeight = pDlayerParam->iVideoHeight;
iTemporalId = pDlayerParamInternal->uiCodingIdx2TemporalId[pCtx->iCodingIndex & (pSvcParam->uiGopSize - 1)];
- iPicturePos = m_uiSpatialLayersInTemporal[iDependencyId] - 1;
+ iPicturePos = m_uiSpatialLayersInTemporal[iDependencyId] - 1;
// NOT work for CGS, FIXME
// spatial layer is able to encode indeed
@@ -408,10 +408,10 @@
* \brief Whether input picture need be scaled?
*/
bool JudgeNeedOfScaling (SWelsSvcCodingParam* pParam, Scaled_Picture* pScaledPicture) {
- const int32_t kiInputPicWidth = pParam->SUsedPicRect.iWidth;
+ const int32_t kiInputPicWidth = pParam->SUsedPicRect.iWidth;
const int32_t kiInputPicHeight = pParam->SUsedPicRect.iHeight;
- const int32_t kiDstPicWidth = pParam->sDependencyLayers[pParam->iSpatialLayerNum - 1].iActualWidth;
- const int32_t kiDstPicHeight = pParam->sDependencyLayers[pParam->iSpatialLayerNum - 1].iActualHeight;
+ const int32_t kiDstPicWidth = pParam->sDependencyLayers[pParam->iSpatialLayerNum - 1].iActualWidth;
+ const int32_t kiDstPicHeight = pParam->sDependencyLayers[pParam->iSpatialLayerNum - 1].iActualHeight;
bool bNeedDownsampling = true;
int32_t iSpatialIdx = pParam->iSpatialLayerNum - 1;
@@ -423,10 +423,10 @@
for (; iSpatialIdx >= 0; iSpatialIdx --) {
SSpatialLayerInternal* pCurLayer = &pParam->sDependencyLayers[iSpatialIdx];
- int32_t iCurDstWidth = pCurLayer->iActualWidth;
- int32_t iCurDstHeight = pCurLayer->iActualHeight;
- int32_t iInputWidthXDstHeight = kiInputPicWidth * iCurDstHeight;
- int32_t iInputHeightXDstWidth = kiInputPicHeight * iCurDstWidth;
+ int32_t iCurDstWidth = pCurLayer->iActualWidth;
+ int32_t iCurDstHeight = pCurLayer->iActualHeight;
+ int32_t iInputWidthXDstHeight = kiInputPicWidth * iCurDstHeight;
+ int32_t iInputHeightXDstWidth = kiInputPicHeight * iCurDstWidth;
if (iInputWidthXDstHeight > iInputHeightXDstWidth) {
pScaledPicture->iScaledWidth[iSpatialIdx] = WELS_MAX (iCurDstWidth, 4);
@@ -459,9 +459,9 @@
}
int32_t CWelsPreProcess::InitLastSpatialPictures (sWelsEncCtx* pCtx) {
- SWelsSvcCodingParam* pParam = pCtx->pSvcParam;
- const int32_t kiDlayerCount = pParam->iSpatialLayerNum;
- int32_t iDlayerIndex = 0;
+ SWelsSvcCodingParam* pParam = pCtx->pSvcParam;
+ const int32_t kiDlayerCount = pParam->iSpatialLayerNum;
+ int32_t iDlayerIndex = 0;
if (pParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
for (; iDlayerIndex < MAX_DEPENDENCY_LAYER; iDlayerIndex++) {
m_pLastSpatialPicture[iDlayerIndex][0] = m_pLastSpatialPicture[iDlayerIndex][1] = NULL;
@@ -469,11 +469,11 @@
} else {
for (; iDlayerIndex < kiDlayerCount; iDlayerIndex++) {
const int32_t kiLayerInTemporal = m_uiSpatialLayersInTemporal[iDlayerIndex];
- m_pLastSpatialPicture[iDlayerIndex][0] = m_pSpatialPic[iDlayerIndex][kiLayerInTemporal - 2];
- m_pLastSpatialPicture[iDlayerIndex][1] = NULL;
+ m_pLastSpatialPicture[iDlayerIndex][0] = m_pSpatialPic[iDlayerIndex][kiLayerInTemporal - 2];
+ m_pLastSpatialPicture[iDlayerIndex][1] = NULL;
}
for (; iDlayerIndex < MAX_DEPENDENCY_LAYER; iDlayerIndex++) {
- m_pLastSpatialPicture[iDlayerIndex][0] = m_pLastSpatialPicture[iDlayerIndex][1] = NULL;
+ m_pLastSpatialPicture[iDlayerIndex][0] = m_pLastSpatialPicture[iDlayerIndex][1] = NULL;
}
}
return 0;
@@ -614,9 +614,9 @@
sRefPixMap.iStride[0] = pRefPicture->iLineSize[0];
sRefPixMap.eFormat = VIDEO_FORMAT_I420;
- calc_param.iCalcVar = bCalculateVar;
- calc_param.iCalcBgd = bCalculateBGD;
- calc_param.iCalcSsd = bCalculateSQDiff;
+ calc_param.iCalcVar = bCalculateVar;
+ calc_param.iCalcBgd = bCalculateBGD;
+ calc_param.iCalcSsd = bCalculateSQDiff;
calc_param.pCalcResult = &pVaaInfo->sVaaCalcInfo;
m_pInterfaceVp->Set (iMethodIdx, &calc_param);
@@ -630,14 +630,14 @@
pVaaInfo->iPicWidth = pCurPicture->iWidthInPixel;
pVaaInfo->iPicHeight = pCurPicture->iHeightInPixel;
- pVaaInfo->iPicStride = pCurPicture->iLineSize[0];
- pVaaInfo->iPicStrideUV = pCurPicture->iLineSize[1];
- pVaaInfo->pCurY = pCurPicture->pData[0];
- pVaaInfo->pRefY = pRefPicture->pData[0];
- pVaaInfo->pCurU = pCurPicture->pData[1];
- pVaaInfo->pRefU = pRefPicture->pData[1];
- pVaaInfo->pCurV = pCurPicture->pData[2];
- pVaaInfo->pRefV = pRefPicture->pData[2];
+ pVaaInfo->iPicStride = pCurPicture->iLineSize[0];
+ pVaaInfo->iPicStrideUV = pCurPicture->iLineSize[1];
+ pVaaInfo->pCurY = pCurPicture->pData[0];
+ pVaaInfo->pRefY = pRefPicture->pData[0];
+ pVaaInfo->pCurU = pCurPicture->pData[1];
+ pVaaInfo->pRefU = pRefPicture->pData[1];
+ pVaaInfo->pCurV = pCurPicture->pData[2];
+ pVaaInfo->pRefV = pRefPicture->pData[2];
int32_t iMethodIdx = METHOD_BACKGROUND_DETECTION;
SPixMap sSrcPixMap;
@@ -673,8 +673,8 @@
m_pInterfaceVp->Set (iMethodIdx, (void*)&BGDParam);
m_pInterfaceVp->Process (iMethodIdx, &sSrcPixMap, &sRefPixMap);
} else {
- int32_t iPicWidthInMb = (pCurPicture->iWidthInPixel + 15) >> 4;
- int32_t iPicHeightInMb = (pCurPicture->iHeightInPixel + 15) >> 4;
+ int32_t iPicWidthInMb = (pCurPicture->iWidthInPixel + 15) >> 4;
+ int32_t iPicHeightInMb = (pCurPicture->iHeightInPixel + 15) >> 4;
memset (pVaaInfo->pVaaBackgroundMbFlag, 0, iPicWidthInMb * iPicHeightInMb);
}
}
@@ -713,11 +713,11 @@
}
void CWelsPreProcess::SetRefMbType (sWelsEncCtx* pCtx, uint32_t** pRefMbTypeArray, int32_t iRefPicType) {
- const uint8_t uiTid = pCtx->uiTemporalId;
+ const uint8_t uiTid = pCtx->uiTemporalId;
const uint8_t uiDid = pCtx->uiDependencyId;
SRefList* pRefPicLlist = pCtx->ppRefPicListExt[uiDid];
- SLTRState* pLtr = &pCtx->pLtr[uiDid];
- uint8_t i = 0;
+ SLTRState* pLtr = &pCtx->pLtr[uiDid];
+ uint8_t i = 0;
if (pCtx->pSvcParam->bEnableLongTermReference && pLtr->bReceivedT0LostFlag && uiTid == 0) {
for (i = 0; i < pRefPicLlist->uiLongRefCount; i++) {
@@ -1292,12 +1292,12 @@
int32_t iSrcWidth = kpSrc->iPicWidth;
int32_t iSrcHeight = kpSrc->iPicHeight;
- if (iSrcHeight > kiTargetHeight) iSrcHeight = kiTargetHeight;
- if (iSrcWidth > kiTargetWidth) iSrcWidth = kiTargetWidth;
+ if (iSrcHeight > kiTargetHeight) iSrcHeight = kiTargetHeight;
+ if (iSrcWidth > kiTargetWidth) iSrcWidth = kiTargetWidth;
// copy from fr26 to fix the odd uiSize failed issue
- if (iSrcWidth & 0x1) -- iSrcWidth;
- if (iSrcHeight & 0x1) -- iSrcHeight;
+ if (iSrcWidth & 0x1) -- iSrcWidth;
+ if (iSrcHeight & 0x1) -- iSrcHeight;
const int32_t kiSrcTopOffsetY = pSvcParam->SUsedPicRect.iTop;
const int32_t kiSrcTopOffsetUV = (kiSrcTopOffsetY >> 1);
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -124,8 +124,8 @@
m_pFileBs = WelsFopen (strStreamFileName, "wb");
m_pFileBsSize = WelsFopen (strLenFileName, "wb");
- m_bSwitch = false;
- m_iSwitchTimes = 0;
+ m_bSwitch = false;
+ m_iSwitchTimes = 0;
#endif//OUTPUT_BIT_STREAM
InitEncoder();
@@ -149,8 +149,8 @@
WelsFclose (m_pFileBsSize);
m_pFileBsSize = NULL;
}
- m_bSwitch = false;
- m_iSwitchTimes = 0;
+ m_bSwitch = false;
+ m_iSwitchTimes = 0;
#endif//OUTPUT_BIT_STREAM
Uninitialize();
@@ -323,13 +323,13 @@
}
const int32_t kiDecStages = WELS_LOG2 (pCfg->uiGopSize);
- pCfg->iTemporalLayerNum = (int8_t) (1 + kiDecStages);
- pCfg->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pCfg->iLoopFilterAlphaC0Offset, -6, 6);
- pCfg->iLoopFilterBetaOffset = WELS_CLIP3 (pCfg->iLoopFilterBetaOffset, -6, 6);
+ pCfg->iTemporalLayerNum = (int8_t) (1 + kiDecStages);
+ pCfg->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pCfg->iLoopFilterAlphaC0Offset, -6, 6);
+ pCfg->iLoopFilterBetaOffset = WELS_CLIP3 (pCfg->iLoopFilterBetaOffset, -6, 6);
// decide property list size between INIT_TYPE_PARAMETER_BASED/INIT_TYPE_CONFIG_BASED
- m_iMaxPicWidth = pCfg->iPicWidth;
- m_iMaxPicHeight = pCfg->iPicHeight;
+ m_iMaxPicWidth = pCfg->iPicWidth;
+ m_iMaxPicHeight = pCfg->iPicHeight;
TraceParamInfo (pCfg);
if (WelsInitEncoderExt (&m_pEncContext, pCfg, &m_pWelsTrace->m_sLogCtx, NULL)) {
@@ -683,9 +683,9 @@
m_pEncContext->pSvcParam->uiIntraPeriod = (uint32_t)iValue;
}
break;
- case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: { // SVC Encoding Parameter
- SEncParamBase sEncodingParam;
- SWelsSvcCodingParam sConfig;
+ case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: { // SVC Encoding Parameter
+ SEncParamBase sEncodingParam;
+ SWelsSvcCodingParam sConfig;
int32_t iTargetWidth = 0;
int32_t iTargetHeight = 0;
@@ -694,12 +694,12 @@
return cmInitParaError;
}
/* New configuration available here */
- iTargetWidth = sConfig.iPicWidth;
- iTargetHeight = sConfig.iPicHeight;
+ iTargetWidth = sConfig.iPicWidth;
+ iTargetHeight = sConfig.iPicHeight;
if (m_iMaxPicWidth != iTargetWidth
|| m_iMaxPicHeight != iTargetHeight) {
- m_iMaxPicWidth = iTargetWidth;
- m_iMaxPicHeight = iTargetHeight;
+ m_iMaxPicWidth = iTargetWidth;
+ m_iMaxPicHeight = iTargetHeight;
}
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;fMaxFrameRate= %.6ff;iRCMode= %d",
@@ -715,9 +715,9 @@
}
break;
- case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter
- SEncParamExt sEncodingParam;
- SWelsSvcCodingParam sConfig;
+ case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter
+ SEncParamExt sEncodingParam;
+ SWelsSvcCodingParam sConfig;
int32_t iTargetWidth = 0;
int32_t iTargetHeight = 0;
@@ -756,12 +756,12 @@
}
/* New configuration available here */
- iTargetWidth = sConfig.iPicWidth;
- iTargetHeight = sConfig.iPicHeight;
+ iTargetWidth = sConfig.iPicWidth;
+ iTargetHeight = sConfig.iPicHeight;
if (m_iMaxPicWidth != iTargetWidth
|| m_iMaxPicHeight != iTargetHeight) {
- m_iMaxPicWidth = iTargetWidth;
- m_iMaxPicHeight = iTargetHeight;
+ m_iMaxPicWidth = iTargetWidth;
+ m_iMaxPicHeight = iTargetHeight;
}
/* Check every field whether there is new request for memory block changed or else, Oct. 24, 2008 */
if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) {
--- a/codec/processing/src/adaptivequantization/AdaptiveQuantization.cpp
+++ b/codec/processing/src/adaptivequantization/AdaptiveQuantization.cpp
@@ -66,8 +66,8 @@
SMotionTextureUnit* pMotionTexture = NULL;
SVAACalcResult* pVaaCalcResults = NULL;
int32_t iMotionTextureIndexToDeltaQp = 0;
- int32_t iAverMotionTextureIndexToDeltaQp = 0; // double to uint32
- int64_t iAverageMotionIndex = 0; // double to float
+ int32_t iAverMotionTextureIndexToDeltaQp = 0; // double to uint32
+ int64_t iAverageMotionIndex = 0; // double to float
int64_t iAverageTextureIndex = 0;
int64_t iQStep = 0;
--- a/codec/processing/src/backgrounddetection/BackgroundDetection.cpp
+++ b/codec/processing/src/backgrounddetection/BackgroundDetection.cpp
@@ -107,16 +107,16 @@
}
inline SBackgroundOU* CBackgroundDetection::AllocateOUArrayMemory (int32_t iWidth, int32_t iHeight) {
- int32_t iMaxOUWidth = (BGD_OU_SIZE - 1 + iWidth) >> LOG2_BGD_OU_SIZE;
- int32_t iMaxOUHeight = (BGD_OU_SIZE - 1 + iHeight) >> LOG2_BGD_OU_SIZE;
+ int32_t iMaxOUWidth = (BGD_OU_SIZE - 1 + iWidth) >> LOG2_BGD_OU_SIZE;
+ int32_t iMaxOUHeight = (BGD_OU_SIZE - 1 + iHeight) >> LOG2_BGD_OU_SIZE;
return (SBackgroundOU*)WelsMalloc (iMaxOUWidth * iMaxOUHeight * sizeof (SBackgroundOU));
}
void CBackgroundDetection::GetOUParameters (SVAACalcResult* sVaaCalcInfo, int32_t iMbIndex, int32_t iMbWidth,
SBackgroundOU* pBgdOU) {
- int32_t iSubSD[4];
- uint8_t iSubMAD[4];
- int32_t iSubSAD[4];
+ int32_t iSubSD[4];
+ uint8_t iSubMAD[4];
+ int32_t iSubSAD[4];
uint8_t (*pMad8x8)[4];
int32_t (*pSad8x8)[4];
@@ -141,9 +141,9 @@
iSubMAD[2] = pMad8x8[iMbIndex][2];
iSubMAD[3] = pMad8x8[iMbIndex][3];
- pBgdOU->iSD = iSubSD[0] + iSubSD[1] + iSubSD[2] + iSubSD[3];
- pBgdOU->iSAD = iSubSAD[0] + iSubSAD[1] + iSubSAD[2] + iSubSAD[3];
- pBgdOU->iSD = WELS_ABS (pBgdOU->iSD);
+ pBgdOU->iSD = iSubSD[0] + iSubSD[1] + iSubSD[2] + iSubSD[3];
+ pBgdOU->iSAD = iSubSAD[0] + iSubSAD[1] + iSubSAD[2] + iSubSAD[3];
+ pBgdOU->iSD = WELS_ABS (pBgdOU->iSD);
// get the max absolute difference (MAD) of OU and min value of the MAD of sub-blocks of OU
pBgdOU->iMAD = WELS_MAX (WELS_MAX (iSubMAD[0], iSubMAD[1]), WELS_MAX (iSubMAD[2], iSubMAD[3]));
@@ -155,9 +155,9 @@
}
void CBackgroundDetection::ForegroundBackgroundDivision (vBGDParam* pBgdParam) {
- int32_t iPicWidthInOU = pBgdParam->iBgdWidth >> LOG2_BGD_OU_SIZE;
- int32_t iPicHeightInOU = pBgdParam->iBgdHeight >> LOG2_BGD_OU_SIZE;
- int32_t iPicWidthInMb = (15 + pBgdParam->iBgdWidth) >> 4;
+ int32_t iPicWidthInOU = pBgdParam->iBgdWidth >> LOG2_BGD_OU_SIZE;
+ int32_t iPicHeightInOU = pBgdParam->iBgdHeight >> LOG2_BGD_OU_SIZE;
+ int32_t iPicWidthInMb = (15 + pBgdParam->iBgdWidth) >> 4;
SBackgroundOU* pBackgroundOU = pBgdParam->pOU_array;
@@ -187,8 +187,8 @@
}
}
inline int32_t CBackgroundDetection::CalculateAsdChromaEdge (uint8_t* pOriRef, uint8_t* pOriCur, int32_t iStride) {
- int32_t ASD = 0;
- int32_t idx;
+ int32_t ASD = 0;
+ int32_t idx;
for (idx = 0; idx < BGD_OU_SIZE_UV; idx++) {
ASD += *pOriCur - *pOriRef;
pOriRef += iStride;
@@ -199,16 +199,16 @@
inline bool CBackgroundDetection::ForegroundDilation23Luma (SBackgroundOU* pBackgroundOU,
SBackgroundOU* pOUNeighbours[]) {
- SBackgroundOU* pOU_L = pOUNeighbours[0];
- SBackgroundOU* pOU_R = pOUNeighbours[1];
- SBackgroundOU* pOU_U = pOUNeighbours[2];
- SBackgroundOU* pOU_D = pOUNeighbours[3];
+ SBackgroundOU* pOU_L = pOUNeighbours[0];
+ SBackgroundOU* pOU_R = pOUNeighbours[1];
+ SBackgroundOU* pOU_U = pOUNeighbours[2];
+ SBackgroundOU* pOU_D = pOUNeighbours[3];
if (pBackgroundOU->iMAD > pBackgroundOU->iMinSubMad << 1) {
int32_t iMaxNbrForegroundMad;
int32_t iMaxNbrBackgroundMad;
- int32_t aBackgroundMad[4];
- int32_t aForegroundMad[4];
+ int32_t aBackgroundMad[4];
+ int32_t aForegroundMad[4];
aForegroundMad[0] = (pOU_L->iBackgroundFlag - 1) & pOU_L->iMAD;
aForegroundMad[1] = (pOU_R->iBackgroundFlag - 1) & pOU_R->iMAD;
@@ -232,9 +232,9 @@
inline bool CBackgroundDetection::ForegroundDilation23Chroma (int8_t iNeighbourForegroundFlags,
int32_t iStartSamplePos, int32_t iPicStrideUV, vBGDParam* pBgdParam) {
- static const int8_t kaOUPos[4] = {OU_LEFT, OU_RIGHT, OU_TOP, OU_BOTTOM};
- int32_t aEdgeOffset[4] = {0, BGD_OU_SIZE_UV - 1, 0, iPicStrideUV* (BGD_OU_SIZE_UV - 1)};
- int32_t iStride[4] = {iPicStrideUV, iPicStrideUV, 1, 1};
+ static const int8_t kaOUPos[4] = {OU_LEFT, OU_RIGHT, OU_TOP, OU_BOTTOM};
+ int32_t aEdgeOffset[4] = {0, BGD_OU_SIZE_UV - 1, 0, iPicStrideUV* (BGD_OU_SIZE_UV - 1)};
+ int32_t iStride[4] = {iPicStrideUV, iPicStrideUV, 1, 1};
// V component first, high probability because V stands for red color and human skin colors have more weight on this component
for (int32_t i = 0; i < 4; i++) {
@@ -262,8 +262,8 @@
inline void CBackgroundDetection::ForegroundDilation (SBackgroundOU* pBackgroundOU, SBackgroundOU* pOUNeighbours[],
vBGDParam* pBgdParam, int32_t iChromaSampleStartPos) {
- int32_t iPicStrideUV = pBgdParam->iStride[1];
- int32_t iSumNeighBackgroundFlags = pOUNeighbours[0]->iBackgroundFlag + pOUNeighbours[1]->iBackgroundFlag +
+ int32_t iPicStrideUV = pBgdParam->iStride[1];
+ int32_t iSumNeighBackgroundFlags = pOUNeighbours[0]->iBackgroundFlag + pOUNeighbours[1]->iBackgroundFlag +
pOUNeighbours[2]->iBackgroundFlag + pOUNeighbours[3]->iBackgroundFlag;
if (pBackgroundOU->iSAD > BGD_OU_SIZE * Q_FACTOR) {
@@ -318,10 +318,10 @@
inline void CBackgroundDetection::UpperOUForegroundCheck (SBackgroundOU* pCurOU, int8_t* pBackgroundMbFlag,
int32_t iPicWidthInOU, int32_t iPicWidthInMb) {
if (pCurOU->iSAD > BGD_OU_SIZE * Q_FACTOR) {
- SBackgroundOU* pOU_L = pCurOU - 1;
- SBackgroundOU* pOU_R = pCurOU + 1;
- SBackgroundOU* pOU_U = pCurOU - iPicWidthInOU;
- SBackgroundOU* pOU_D = pCurOU + iPicWidthInOU;
+ SBackgroundOU* pOU_L = pCurOU - 1;
+ SBackgroundOU* pOU_R = pCurOU + 1;
+ SBackgroundOU* pOU_U = pCurOU - iPicWidthInOU;
+ SBackgroundOU* pOU_D = pCurOU + iPicWidthInOU;
if (pOU_L->iBackgroundFlag + pOU_R->iBackgroundFlag + pOU_U->iBackgroundFlag + pOU_D->iBackgroundFlag <= 1) {
SetBackgroundMbFlag (pBackgroundMbFlag, iPicWidthInMb, 0);
pCurOU->iBackgroundFlag = 0;
@@ -330,21 +330,21 @@
}
void CBackgroundDetection::ForegroundDilationAndBackgroundErosion (vBGDParam* pBgdParam) {
- int32_t iPicStrideUV = pBgdParam->iStride[1];
- int32_t iPicWidthInOU = pBgdParam->iBgdWidth >> LOG2_BGD_OU_SIZE;
- int32_t iPicHeightInOU = pBgdParam->iBgdHeight >> LOG2_BGD_OU_SIZE;
- int32_t iOUStrideUV = iPicStrideUV << (LOG2_BGD_OU_SIZE - 1);
- int32_t iPicWidthInMb = (15 + pBgdParam->iBgdWidth) >> 4;
+ int32_t iPicStrideUV = pBgdParam->iStride[1];
+ int32_t iPicWidthInOU = pBgdParam->iBgdWidth >> LOG2_BGD_OU_SIZE;
+ int32_t iPicHeightInOU = pBgdParam->iBgdHeight >> LOG2_BGD_OU_SIZE;
+ int32_t iOUStrideUV = iPicStrideUV << (LOG2_BGD_OU_SIZE - 1);
+ int32_t iPicWidthInMb = (15 + pBgdParam->iBgdWidth) >> 4;
SBackgroundOU* pBackgroundOU = pBgdParam->pOU_array;
- int8_t* pVaaBackgroundMbFlag = (int8_t*)pBgdParam->pBackgroundMbFlag;
- SBackgroundOU* pOUNeighbours[4];//0: left; 1: right; 2: top; 3: bottom
+ int8_t* pVaaBackgroundMbFlag = (int8_t*)pBgdParam->pBackgroundMbFlag;
+ SBackgroundOU* pOUNeighbours[4];//0: left; 1: right; 2: top; 3: bottom
- pOUNeighbours[2] = pBackgroundOU;//top OU
+ pOUNeighbours[2] = pBackgroundOU;//top OU
for (int32_t j = 0; j < iPicHeightInOU; j ++) {
int8_t* pRowSkipFlag = pVaaBackgroundMbFlag;
- pOUNeighbours[0] = pBackgroundOU;//left OU
- pOUNeighbours[3] = pBackgroundOU + (iPicWidthInOU & ((j == iPicHeightInOU - 1) - 1)); //bottom OU
+ pOUNeighbours[0] = pBackgroundOU;//left OU
+ pOUNeighbours[3] = pBackgroundOU + (iPicWidthInOU & ((j == iPicHeightInOU - 1) - 1)); //bottom OU
for (int32_t i = 0; i < iPicWidthInOU; i++) {
pOUNeighbours[1] = pBackgroundOU + (i < iPicWidthInOU - 1); //right OU
@@ -367,7 +367,7 @@
pOUNeighbours[3]++;
pBackgroundOU++;
}
- pOUNeighbours[2] = pBackgroundOU - iPicWidthInOU;
+ pOUNeighbours[2] = pBackgroundOU - iPicWidthInOU;
pVaaBackgroundMbFlag += OU_SIZE_IN_MB * iPicWidthInMb;
}
}
--- a/codec/processing/src/common/memory.cpp
+++ b/codec/processing/src/common/memory.cpp
@@ -36,11 +36,11 @@
/////////////////////////////////////////////////////////////////////////////////
void* WelsMalloc (const uint32_t kuiSize, char* pTag) {
- const int32_t kiSizeVoidPointer = sizeof (void**);
- const int32_t kiSizeInt32 = sizeof (int32_t);
- const int32_t kiAlignedBytes = ALIGNBYTES - 1;
+ const int32_t kiSizeVoidPointer = sizeof (void**);
+ const int32_t kiSizeInt32 = sizeof (int32_t);
+ const int32_t kiAlignedBytes = ALIGNBYTES - 1;
- uint8_t* pBuf = (uint8_t*) ::malloc (kuiSize + kiAlignedBytes + kiSizeVoidPointer + kiSizeInt32);
+ uint8_t* pBuf = (uint8_t*) ::malloc (kuiSize + kiAlignedBytes + kiSizeVoidPointer + kiSizeInt32);
uint8_t* pAlignedBuf = NULL;
if (NULL == pBuf)
--- a/codec/processing/src/complexityanalysis/ComplexityAnalysis.cpp
+++ b/codec/processing/src/complexityanalysis/ComplexityAnalysis.cpp
@@ -350,8 +350,8 @@
void CComplexityAnalysisScreen::GomComplexityAnalysisIntra (SPixMap* pSrc) {
int32_t iWidth = pSrc->sRect.iRectWidth;
int32_t iHeight = pSrc->sRect.iRectHeight;
- int32_t iBlockWidth = iWidth >> 4;
- int32_t iBlockHeight = iHeight >> 4;
+ int32_t iBlockWidth = iWidth >> 4;
+ int32_t iBlockHeight = iHeight >> 4;
int32_t iBlockSadH, iBlockSadV, iGomSad = 0;
int32_t iIdx = 0;
@@ -406,8 +406,8 @@
void CComplexityAnalysisScreen::GomComplexityAnalysisInter (SPixMap* pSrc, SPixMap* pRef, bool bScrollFlag) {
int32_t iWidth = pSrc->sRect.iRectWidth;
int32_t iHeight = pSrc->sRect.iRectHeight;
- int32_t iBlockWidth = iWidth >> 4;
- int32_t iBlockHeight = iHeight >> 4;
+ int32_t iBlockWidth = iWidth >> 4;
+ int32_t iBlockHeight = iHeight >> 4;
int32_t iInterSad, iScrollSad, iBlockSadH, iBlockSadV, iGomSad = 0;
int32_t iIdx = 0;
--- a/codec/processing/src/denoise/denoise.cpp
+++ b/codec/processing/src/denoise/denoise.cpp
@@ -46,7 +46,7 @@
m_uiSpaceRadius = DENOISE_GRAY_RADIUS;
m_fSigmaGrey = DENOISE_GRAY_SIGMA;
- m_uiType = DENOISE_ALL_COMPONENT;
+ m_uiType = DENOISE_ALL_COMPONENT;
InitDenoiseFunc (m_pfDenoise, m_CPUFlag);
}
--- a/codec/processing/src/downsample/downsamplefuncs.cpp
+++ b/codec/processing/src/downsample/downsamplefuncs.cpp
@@ -49,11 +49,11 @@
const int32_t kiSrcWidth, const int32_t kiSrcHeight)
{
- uint8_t* pDstLine = pDst;
- uint8_t* pSrcLine = pSrc;
- const int32_t kiSrcStridex2 = kiSrcStride << 1;
- const int32_t kiDstWidth = kiSrcWidth >> 1;
- const int32_t kiDstHeight = kiSrcHeight >> 1;
+ uint8_t* pDstLine = pDst;
+ uint8_t* pSrcLine = pSrc;
+ const int32_t kiSrcStridex2 = kiSrcStride << 1;
+ const int32_t kiDstWidth = kiSrcWidth >> 1;
+ const int32_t kiDstHeight = kiSrcHeight >> 1;
for (int32_t j = 0; j < kiDstHeight; j ++) {
for (int32_t i = 0; i < kiDstWidth; i ++) {
@@ -63,8 +63,8 @@
pDstLine[i] = (uint8_t) ((kiTempRow1 + kiTempRow2 + 1) >> 1);
}
- pDstLine += kiDstStride;
- pSrcLine += kiSrcStridex2;
+ pDstLine += kiDstStride;
+ pSrcLine += kiSrcStridex2;
}
}
--- a/codec/processing/src/scrolldetection/ScrollDetectionFuncs.cpp
+++ b/codec/processing/src/scrolldetection/ScrollDetectionFuncs.cpp
@@ -69,9 +69,9 @@
int32_t SelectTestLine (uint8_t* pY, int32_t iWidth, int32_t iHeight, int32_t iPicHeight,
int32_t iStride, int32_t iOffsetX, int32_t iOffsetY) {
- const int32_t kiHalfHeight = iHeight >> 1;
- const int32_t kiMidPos = iOffsetY + kiHalfHeight;
- int32_t TestPos = kiMidPos;
+ const int32_t kiHalfHeight = iHeight >> 1;
+ const int32_t kiMidPos = iOffsetY + kiHalfHeight;
+ int32_t TestPos = kiMidPos;
int32_t iOffsetAbs;
uint8_t* pTmp;
--- a/codec/processing/src/vaacalc/vaacalculation.cpp
+++ b/codec/processing/src/vaacalc/vaacalculation.cpp
@@ -87,11 +87,11 @@
}
EResult CVAACalculation::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap) {
- uint8_t* pCurData = (uint8_t*)pSrcPixMap->pPixel[0];
- uint8_t* pRefData = (uint8_t*)pRefPixMap->pPixel[0];
- int32_t iPicWidth = pSrcPixMap->sRect.iRectWidth;
- int32_t iPicHeight = pSrcPixMap->sRect.iRectHeight;
- int32_t iPicStride = pSrcPixMap->iStride[0];
+ uint8_t* pCurData = (uint8_t*)pSrcPixMap->pPixel[0];
+ uint8_t* pRefData = (uint8_t*)pRefPixMap->pPixel[0];
+ int32_t iPicWidth = pSrcPixMap->sRect.iRectWidth;
+ int32_t iPicHeight = pSrcPixMap->sRect.iRectHeight;
+ int32_t iPicStride = pSrcPixMap->iStride[0];
SVAACalcResult* pResult = m_sCalcParam.pCalcResult;
--- a/test/api/encode_decode_api_test.cpp
+++ b/test/api/encode_decode_api_test.cpp
@@ -543,15 +543,15 @@
unsigned int uiSliceIdx = 0;
unsigned int uiActualSliceCount = 0;
- uiMbWidth = (param_.iPicWidth + 15) >> 4;
- uiMbHeight = (param_.iPicHeight + 15) >> 4;
+ uiMbWidth = (param_.iPicWidth + 15) >> 4;
+ uiMbHeight = (param_.iPicHeight + 15) >> 4;
uiMbNumInFrame = uiMbWidth * uiMbHeight;
uiSliceIdx = 0;
while (uiSliceIdx < MAX_SLICES_NUM) {
param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiSliceIdx] = rand() % uiMbNumInFrame;
- uiCountMb += param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiSliceIdx];
- uiActualSliceCount = uiSliceIdx + 1;
+ uiCountMb += param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiSliceIdx];
+ uiActualSliceCount = uiSliceIdx + 1;
if (uiCountMb >= uiMbNumInFrame) {
break;
--- a/test/common/ExpandPicture.cpp
+++ b/test/common/ExpandPicture.cpp
@@ -218,23 +218,23 @@
if (uiCpuFlag & WELS_CPU_SSE2) {
iPicWidth = WELS_ALIGN (iPicWidth, 32);
}
- iStride[0] = WELS_ALIGN (iPicWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with width of horizon
- int32_t iPicHeightExt = WELS_ALIGN (iPicHeight, MB_HEIGHT_LUMA) + (PADDING_LENGTH << 1); // with height of vertical
- iStride[1] = iStride[0] >> 1;
- int32_t iPicChromaHeightExt = iPicHeightExt >> 1;
- iStride[2] = iStride[1];
- int32_t iLumaSize = iStride[0] * iPicHeightExt;
- int32_t iChromaSize = iStride[1] * iPicChromaHeightExt;
+ iStride[0] = WELS_ALIGN (iPicWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with width of horizon
+ int32_t iPicHeightExt = WELS_ALIGN (iPicHeight, MB_HEIGHT_LUMA) + (PADDING_LENGTH << 1); // with height of vertical
+ iStride[1] = iStride[0] >> 1;
+ int32_t iPicChromaHeightExt = iPicHeightExt >> 1;
+ iStride[2] = iStride[1];
+ int32_t iLumaSize = iStride[0] * iPicHeightExt;
+ int32_t iChromaSize = iStride[1] * iPicChromaHeightExt;
pPicAnchorBuffer = static_cast<uint8_t*> (WelsMallocz (iLumaSize + (iChromaSize << 1), "pPicAnchor"));
- pPicAnchor[0] = pPicAnchorBuffer + (1 + iStride[0]) * PADDING_LENGTH;
- pPicAnchor[1] = pPicAnchorBuffer + iLumaSize + (((1 + iStride[1]) * PADDING_LENGTH) >> 1);
- pPicAnchor[2] = pPicAnchorBuffer + iLumaSize + iChromaSize + (((1 + iStride[2]) * PADDING_LENGTH) >> 1);
+ pPicAnchor[0] = pPicAnchorBuffer + (1 + iStride[0]) * PADDING_LENGTH;
+ pPicAnchor[1] = pPicAnchorBuffer + iLumaSize + (((1 + iStride[1]) * PADDING_LENGTH) >> 1);
+ pPicAnchor[2] = pPicAnchorBuffer + iLumaSize + iChromaSize + (((1 + iStride[2]) * PADDING_LENGTH) >> 1);
pPicTestBuffer = static_cast<uint8_t*> (WelsMallocz (iLumaSize + (iChromaSize << 1), "pPicTest"));
- pPicTest[0] = pPicTestBuffer + (1 + iStride[0]) * PADDING_LENGTH;
- pPicTest[1] = pPicTestBuffer + iLumaSize + (((1 + iStride[1]) * PADDING_LENGTH) >> 1);
- pPicTest[2] = pPicTestBuffer + iLumaSize + iChromaSize + (((1 + iStride[2]) * PADDING_LENGTH) >> 1);
+ pPicTest[0] = pPicTestBuffer + (1 + iStride[0]) * PADDING_LENGTH;
+ pPicTest[1] = pPicTestBuffer + iLumaSize + (((1 + iStride[1]) * PADDING_LENGTH) >> 1);
+ pPicTest[2] = pPicTestBuffer + iLumaSize + iChromaSize + (((1 + iStride[2]) * PADDING_LENGTH) >> 1);
// Generate Src
--- a/test/decoder/DecUT_IdctResAddPred.cpp
+++ b/test/decoder/DecUT_IdctResAddPred.cpp
@@ -7,9 +7,9 @@
void IdctResAddPred_ref (uint8_t* pPred, const int32_t kiStride, int16_t* pRs) {
int16_t iSrc[16];
- uint8_t* pDst = pPred;
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
+ uint8_t* pDst = pPred;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
int32_t i;
for (i = 0; i < 4; i++) {
@@ -26,16 +26,16 @@
}
for (i = 0; i < 4; i++) {
- int32_t kT1 = iSrc[i] + iSrc[i + 8];
- int32_t kT2 = iSrc[i + 4] + (iSrc[i + 12] >> 1);
- int32_t kT3 = (32 + kT1 + kT2) >> 6;
- int32_t kT4 = (32 + kT1 - kT2) >> 6;
+ int32_t kT1 = iSrc[i] + iSrc[i + 8];
+ int32_t kT2 = iSrc[i + 4] + (iSrc[i + 12] >> 1);
+ int32_t kT3 = (32 + kT1 + kT2) >> 6;
+ int32_t kT4 = (32 + kT1 - kT2) >> 6;
pDst[i] = WelsClip1 (kT3 + pPred[i]);
pDst[i + kiStride3] = WelsClip1 (kT4 + pPred[i + kiStride3]);
- kT1 = iSrc[i] - iSrc[i + 8];
- kT2 = (iSrc[i + 4] >> 1) - iSrc[i + 12];
+ kT1 = iSrc[i] - iSrc[i + 8];
+ kT2 = (iSrc[i + 4] >> 1) - iSrc[i + 12];
pDst[i + kiStride] = WelsClip1 (((32 + kT1 + kT2) >> 6) + pDst[i + kiStride]);
pDst[i + kiStride2] = WelsClip1 (((32 + kT1 - kT2) >> 6) + pDst[i + kiStride2]);
}
--- a/test/decoder/DecUT_IntraPrediction.cpp
+++ b/test/decoder/DecUT_IntraPrediction.cpp
@@ -93,25 +93,25 @@
/*down pLeft*/
void WelsI4x4LumaPredDDL_ref (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
/*get pTop*/
- uint8_t* ptop = &pPred[-kiStride];
- const uint8_t kuiT0 = *ptop;
- const uint8_t kuiT1 = * (ptop + 1);
- const uint8_t kuiT2 = * (ptop + 2);
- const uint8_t kuiT3 = * (ptop + 3);
- const uint8_t kuiT4 = * (ptop + 4);
- const uint8_t kuiT5 = * (ptop + 5);
- const uint8_t kuiT6 = * (ptop + 6);
- const uint8_t kuiT7 = * (ptop + 7);
- const uint8_t kuiDDL0 = (2 + kuiT0 + kuiT2 + (kuiT1 << 1)) >> 2; // kDDL0
- const uint8_t kuiDDL1 = (2 + kuiT1 + kuiT3 + (kuiT2 << 1)) >> 2; // kDDL1
- const uint8_t kuiDDL2 = (2 + kuiT2 + kuiT4 + (kuiT3 << 1)) >> 2; // kDDL2
- const uint8_t kuiDDL3 = (2 + kuiT3 + kuiT5 + (kuiT4 << 1)) >> 2; // kDDL3
- const uint8_t kuiDDL4 = (2 + kuiT4 + kuiT6 + (kuiT5 << 1)) >> 2; // kDDL4
- const uint8_t kuiDDL5 = (2 + kuiT5 + kuiT7 + (kuiT6 << 1)) >> 2; // kDDL5
- const uint8_t kuiDDL6 = (2 + kuiT6 + kuiT7 + (kuiT7 << 1)) >> 2; // kDDL6
+ uint8_t* ptop = &pPred[-kiStride];
+ const uint8_t kuiT0 = *ptop;
+ const uint8_t kuiT1 = * (ptop + 1);
+ const uint8_t kuiT2 = * (ptop + 2);
+ const uint8_t kuiT3 = * (ptop + 3);
+ const uint8_t kuiT4 = * (ptop + 4);
+ const uint8_t kuiT5 = * (ptop + 5);
+ const uint8_t kuiT6 = * (ptop + 6);
+ const uint8_t kuiT7 = * (ptop + 7);
+ const uint8_t kuiDDL0 = (2 + kuiT0 + kuiT2 + (kuiT1 << 1)) >> 2; // kDDL0
+ const uint8_t kuiDDL1 = (2 + kuiT1 + kuiT3 + (kuiT2 << 1)) >> 2; // kDDL1
+ const uint8_t kuiDDL2 = (2 + kuiT2 + kuiT4 + (kuiT3 << 1)) >> 2; // kDDL2
+ const uint8_t kuiDDL3 = (2 + kuiT3 + kuiT5 + (kuiT4 << 1)) >> 2; // kDDL3
+ const uint8_t kuiDDL4 = (2 + kuiT4 + kuiT6 + (kuiT5 << 1)) >> 2; // kDDL4
+ const uint8_t kuiDDL5 = (2 + kuiT5 + kuiT7 + (kuiT6 << 1)) >> 2; // kDDL5
+ const uint8_t kuiDDL6 = (2 + kuiT6 + kuiT7 + (kuiT7 << 1)) >> 2; // kDDL6
const uint8_t kuiList[8] = { kuiDDL0, kuiDDL1, kuiDDL2, kuiDDL3, kuiDDL4, kuiDDL5, kuiDDL6, 0 };
ST32 (pPred , LD32 (kuiList));
@@ -122,22 +122,22 @@
/*down pLeft*/
void WelsI4x4LumaPredDDLTop_ref (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
/*get pTop*/
- uint8_t* ptop = &pPred[-kiStride];
- const uint8_t kuiT0 = *ptop;
- const uint8_t kuiT1 = * (ptop + 1);
- const uint8_t kuiT2 = * (ptop + 2);
- const uint8_t kuiT3 = * (ptop + 3);
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
- const uint16_t kuiT33 = 1 + (kuiT3 << 1);
- const uint8_t kuiDLT0 = (kuiT01 + kuiT12) >> 2; // kDLT0
- const uint8_t kuiDLT1 = (kuiT12 + kuiT23) >> 2; // kDLT1
- const uint8_t kuiDLT2 = (kuiT23 + kuiT33) >> 2; // kDLT2
- const uint8_t kuiDLT3 = kuiT33 >> 1; // kDLT3
+ uint8_t* ptop = &pPred[-kiStride];
+ const uint8_t kuiT0 = *ptop;
+ const uint8_t kuiT1 = * (ptop + 1);
+ const uint8_t kuiT2 = * (ptop + 2);
+ const uint8_t kuiT3 = * (ptop + 3);
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
+ const uint16_t kuiT33 = 1 + (kuiT3 << 1);
+ const uint8_t kuiDLT0 = (kuiT01 + kuiT12) >> 2; // kDLT0
+ const uint8_t kuiDLT1 = (kuiT12 + kuiT23) >> 2; // kDLT1
+ const uint8_t kuiDLT2 = (kuiT23 + kuiT33) >> 2; // kDLT2
+ const uint8_t kuiDLT3 = kuiT33 >> 1; // kDLT3
const uint8_t kuiList[8] = { kuiDLT0, kuiDLT1, kuiDLT2, kuiDLT3, kuiDLT3, kuiDLT3, kuiDLT3 , kuiDLT3 };
ST32 (pPred, LD32 (kuiList));
@@ -149,36 +149,36 @@
/*down right*/
void WelsI4x4LumaPredDDR_ref (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
- uint8_t* ptopleft = &pPred[- (kiStride + 1)];
- uint8_t* pleft = &pPred[-1];
- const uint8_t kuiLT = *ptopleft;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
+ uint8_t* ptopleft = &pPred[- (kiStride + 1)];
+ uint8_t* pleft = &pPred[-1];
+ const uint8_t kuiLT = *ptopleft;
/*get pLeft and pTop*/
- const uint8_t kuiL0 = *pleft;
- const uint8_t kuiL1 = * (pleft + kiStride);
- const uint8_t kuiL2 = * (pleft + kiStride2);
- const uint8_t kuiL3 = * (pleft + kiStride3);
- const uint8_t kuiT0 = * (ptopleft + 1);
- const uint8_t kuiT1 = * (ptopleft + 2);
- const uint8_t kuiT2 = * (ptopleft + 3);
- const uint8_t kuiT3 = * (ptopleft + 4);
- const uint16_t kuiTL0 = 1 + kuiLT + kuiL0;
- const uint16_t kuiLT0 = 1 + kuiLT + kuiT0;
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
- const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
- const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
- const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
- const uint8_t kuiDDR0 = (kuiTL0 + kuiLT0) >> 2; // kuiDDR0
- const uint8_t kuiDDR1 = (kuiLT0 + kuiT01) >> 2; // kuiDDR1
- const uint8_t kuiDDR2 = (kuiT01 + kuiT12) >> 2; // kuiDDR2
- const uint8_t kuiDDR3 = (kuiT12 + kuiT23) >> 2; // kuiDDR3
- const uint8_t kuiDDR4 = (kuiTL0 + kuiL01) >> 2; // kuiDDR4
- const uint8_t kuiDDR5 = (kuiL01 + kuiL12) >> 2; // kuiDDR5
- const uint8_t kuiDDR6 = (kuiL12 + kuiL23) >> 2; // kuiDDR6
- const uint8_t kuiList[8] = { kuiDDR6, kuiDDR5, kuiDDR4, kuiDDR0, kuiDDR1, kuiDDR2, kuiDDR3, 0 };
+ const uint8_t kuiL0 = *pleft;
+ const uint8_t kuiL1 = * (pleft + kiStride);
+ const uint8_t kuiL2 = * (pleft + kiStride2);
+ const uint8_t kuiL3 = * (pleft + kiStride3);
+ const uint8_t kuiT0 = * (ptopleft + 1);
+ const uint8_t kuiT1 = * (ptopleft + 2);
+ const uint8_t kuiT2 = * (ptopleft + 3);
+ const uint8_t kuiT3 = * (ptopleft + 4);
+ const uint16_t kuiTL0 = 1 + kuiLT + kuiL0;
+ const uint16_t kuiLT0 = 1 + kuiLT + kuiT0;
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
+ const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
+ const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
+ const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
+ const uint8_t kuiDDR0 = (kuiTL0 + kuiLT0) >> 2; // kuiDDR0
+ const uint8_t kuiDDR1 = (kuiLT0 + kuiT01) >> 2; // kuiDDR1
+ const uint8_t kuiDDR2 = (kuiT01 + kuiT12) >> 2; // kuiDDR2
+ const uint8_t kuiDDR3 = (kuiT12 + kuiT23) >> 2; // kuiDDR3
+ const uint8_t kuiDDR4 = (kuiTL0 + kuiL01) >> 2; // kuiDDR4
+ const uint8_t kuiDDR5 = (kuiL01 + kuiL12) >> 2; // kuiDDR5
+ const uint8_t kuiDDR6 = (kuiL12 + kuiL23) >> 2; // kuiDDR6
+ const uint8_t kuiList[8] = { kuiDDR6, kuiDDR5, kuiDDR4, kuiDDR0, kuiDDR1, kuiDDR2, kuiDDR3, 0 };
ST32 (pPred , LD32 (kuiList + 3));
ST32 (pPred + kiStride , LD32 (kuiList + 2));
@@ -189,34 +189,34 @@
/*vertical pLeft*/
void WelsI4x4LumaPredVL_ref (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
- uint8_t* ptopleft = &pPred[- (kiStride + 1)];
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
+ uint8_t* ptopleft = &pPred[- (kiStride + 1)];
/*get pTop*/
- const uint8_t kuiT0 = * (ptopleft + 1);
- const uint8_t kuiT1 = * (ptopleft + 2);
- const uint8_t kuiT2 = * (ptopleft + 3);
- const uint8_t kuiT3 = * (ptopleft + 4);
- const uint8_t kuiT4 = * (ptopleft + 5);
- const uint8_t kuiT5 = * (ptopleft + 6);
- const uint8_t kuiT6 = * (ptopleft + 7);
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
- const uint16_t kuiT34 = 1 + kuiT3 + kuiT4;
- const uint16_t kuiT45 = 1 + kuiT4 + kuiT5;
- const uint16_t kuiT56 = 1 + kuiT5 + kuiT6;
- const uint8_t kuiVL0 = kuiT01 >> 1; // kuiVL0
- const uint8_t kuiVL1 = kuiT12 >> 1; // kuiVL1
- const uint8_t kuiVL2 = kuiT23 >> 1; // kuiVL2
- const uint8_t kuiVL3 = kuiT34 >> 1; // kuiVL3
- const uint8_t kuiVL4 = kuiT45 >> 1; // kuiVL4
- const uint8_t kuiVL5 = (kuiT01 + kuiT12) >> 2; // kuiVL5
- const uint8_t kuiVL6 = (kuiT12 + kuiT23) >> 2; // kuiVL6
- const uint8_t kuiVL7 = (kuiT23 + kuiT34) >> 2; // kuiVL7
- const uint8_t kuiVL8 = (kuiT34 + kuiT45) >> 2; // kuiVL8
- const uint8_t kuiVL9 = (kuiT45 + kuiT56) >> 2; // kuiVL9
- const uint8_t kuiList[10] = { kuiVL0, kuiVL1, kuiVL2, kuiVL3, kuiVL4, kuiVL5, kuiVL6, kuiVL7, kuiVL8, kuiVL9 };
+ const uint8_t kuiT0 = * (ptopleft + 1);
+ const uint8_t kuiT1 = * (ptopleft + 2);
+ const uint8_t kuiT2 = * (ptopleft + 3);
+ const uint8_t kuiT3 = * (ptopleft + 4);
+ const uint8_t kuiT4 = * (ptopleft + 5);
+ const uint8_t kuiT5 = * (ptopleft + 6);
+ const uint8_t kuiT6 = * (ptopleft + 7);
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
+ const uint16_t kuiT34 = 1 + kuiT3 + kuiT4;
+ const uint16_t kuiT45 = 1 + kuiT4 + kuiT5;
+ const uint16_t kuiT56 = 1 + kuiT5 + kuiT6;
+ const uint8_t kuiVL0 = kuiT01 >> 1; // kuiVL0
+ const uint8_t kuiVL1 = kuiT12 >> 1; // kuiVL1
+ const uint8_t kuiVL2 = kuiT23 >> 1; // kuiVL2
+ const uint8_t kuiVL3 = kuiT34 >> 1; // kuiVL3
+ const uint8_t kuiVL4 = kuiT45 >> 1; // kuiVL4
+ const uint8_t kuiVL5 = (kuiT01 + kuiT12) >> 2; // kuiVL5
+ const uint8_t kuiVL6 = (kuiT12 + kuiT23) >> 2; // kuiVL6
+ const uint8_t kuiVL7 = (kuiT23 + kuiT34) >> 2; // kuiVL7
+ const uint8_t kuiVL8 = (kuiT34 + kuiT45) >> 2; // kuiVL8
+ const uint8_t kuiVL9 = (kuiT45 + kuiT56) >> 2; // kuiVL9
+ const uint8_t kuiList[10] = { kuiVL0, kuiVL1, kuiVL2, kuiVL3, kuiVL4, kuiVL5, kuiVL6, kuiVL7, kuiVL8, kuiVL9 };
ST32 (pPred, LD32 (kuiList));
ST32 (pPred + kiStride, LD32 (kuiList + 5));
@@ -226,27 +226,27 @@
/*vertical pLeft*/
void WelsI4x4LumaPredVLTop_ref (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
- uint8_t* ptopleft = &pPred[- (kiStride + 1)];
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
+ uint8_t* ptopleft = &pPred[- (kiStride + 1)];
/*get pTop*/
- const uint8_t kuiT0 = * (ptopleft + 1);
- const uint8_t kuiT1 = * (ptopleft + 2);
- const uint8_t kuiT2 = * (ptopleft + 3);
- const uint8_t kuiT3 = * (ptopleft + 4);
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
- const uint16_t kuiT33 = 1 + (kuiT3 << 1);
- const uint8_t kuiVL0 = kuiT01 >> 1;
- const uint8_t kuiVL1 = kuiT12 >> 1;
- const uint8_t kuiVL2 = kuiT23 >> 1;
- const uint8_t kuiVL3 = kuiT33 >> 1;
- const uint8_t kuiVL4 = (kuiT01 + kuiT12) >> 2;
- const uint8_t kuiVL5 = (kuiT12 + kuiT23) >> 2;
- const uint8_t kuiVL6 = (kuiT23 + kuiT33) >> 2;
- const uint8_t kuiVL7 = kuiVL3;
- const uint8_t kuiList[10] = { kuiVL0, kuiVL1, kuiVL2, kuiVL3, kuiVL3, kuiVL4, kuiVL5, kuiVL6, kuiVL7, kuiVL7 };
+ const uint8_t kuiT0 = * (ptopleft + 1);
+ const uint8_t kuiT1 = * (ptopleft + 2);
+ const uint8_t kuiT2 = * (ptopleft + 3);
+ const uint8_t kuiT3 = * (ptopleft + 4);
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiT23 = 1 + kuiT2 + kuiT3;
+ const uint16_t kuiT33 = 1 + (kuiT3 << 1);
+ const uint8_t kuiVL0 = kuiT01 >> 1;
+ const uint8_t kuiVL1 = kuiT12 >> 1;
+ const uint8_t kuiVL2 = kuiT23 >> 1;
+ const uint8_t kuiVL3 = kuiT33 >> 1;
+ const uint8_t kuiVL4 = (kuiT01 + kuiT12) >> 2;
+ const uint8_t kuiVL5 = (kuiT12 + kuiT23) >> 2;
+ const uint8_t kuiVL6 = (kuiT23 + kuiT33) >> 2;
+ const uint8_t kuiVL7 = kuiVL3;
+ const uint8_t kuiList[10] = { kuiVL0, kuiVL1, kuiVL2, kuiVL3, kuiVL3, kuiVL4, kuiVL5, kuiVL6, kuiVL7, kuiVL7 };
ST32 (pPred , LD32 (kuiList));
ST32 (pPred + kiStride , LD32 (kuiList + 5));
@@ -257,28 +257,28 @@
/*vertical right*/
void WelsI4x4LumaPredVR_ref (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
- const uint8_t kuiLT = pPred[-kiStride - 1];
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
+ const uint8_t kuiLT = pPred[-kiStride - 1];
/*get pLeft and pTop*/
- const uint8_t kuiL0 = pPred[ -1];
- const uint8_t kuiL1 = pPred[kiStride - 1];
- const uint8_t kuiL2 = pPred[kiStride2 - 1];
- const uint8_t kuiT0 = pPred[ -kiStride];
- const uint8_t kuiT1 = pPred[1 - kiStride];
- const uint8_t kuiT2 = pPred[2 - kiStride];
- const uint8_t kuiT3 = pPred[3 - kiStride];
- const uint8_t kuiVR0 = (1 + kuiLT + kuiT0) >> 1; // kuiVR0
- const uint8_t kuiVR1 = (1 + kuiT0 + kuiT1) >> 1; // kuiVR1
- const uint8_t kuiVR2 = (1 + kuiT1 + kuiT2) >> 1; // kuiVR2
- const uint8_t kuiVR3 = (1 + kuiT2 + kuiT3) >> 1; // kuiVR3
- const uint8_t kuiVR4 = (2 + kuiL0 + (kuiLT << 1) + kuiT0) >> 2; // kuiVR4
- const uint8_t kuiVR5 = (2 + kuiLT + (kuiT0 << 1) + kuiT1) >> 2; // kuiVR5
- const uint8_t kuiVR6 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2; // kuiVR6
- const uint8_t kuiVR7 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2; // kuiVR7
- const uint8_t kuiVR8 = (2 + kuiLT + (kuiL0 << 1) + kuiL1) >> 2; // kuiVR8
- const uint8_t kuiVR9 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2; // kuiVR9
- const uint8_t kuiList[10] = { kuiVR8, kuiVR0, kuiVR1, kuiVR2, kuiVR3, kuiVR9, kuiVR4, kuiVR5, kuiVR6, kuiVR7 };
+ const uint8_t kuiL0 = pPred[ - 1];
+ const uint8_t kuiL1 = pPred[kiStride - 1];
+ const uint8_t kuiL2 = pPred[kiStride2 - 1];
+ const uint8_t kuiT0 = pPred[ -kiStride];
+ const uint8_t kuiT1 = pPred[1 - kiStride];
+ const uint8_t kuiT2 = pPred[2 - kiStride];
+ const uint8_t kuiT3 = pPred[3 - kiStride];
+ const uint8_t kuiVR0 = (1 + kuiLT + kuiT0) >> 1; // kuiVR0
+ const uint8_t kuiVR1 = (1 + kuiT0 + kuiT1) >> 1; // kuiVR1
+ const uint8_t kuiVR2 = (1 + kuiT1 + kuiT2) >> 1; // kuiVR2
+ const uint8_t kuiVR3 = (1 + kuiT2 + kuiT3) >> 1; // kuiVR3
+ const uint8_t kuiVR4 = (2 + kuiL0 + (kuiLT << 1) + kuiT0) >> 2; // kuiVR4
+ const uint8_t kuiVR5 = (2 + kuiLT + (kuiT0 << 1) + kuiT1) >> 2; // kuiVR5
+ const uint8_t kuiVR6 = (2 + kuiT0 + (kuiT1 << 1) + kuiT2) >> 2; // kuiVR6
+ const uint8_t kuiVR7 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2; // kuiVR7
+ const uint8_t kuiVR8 = (2 + kuiLT + (kuiL0 << 1) + kuiL1) >> 2; // kuiVR8
+ const uint8_t kuiVR9 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2; // kuiVR9
+ const uint8_t kuiList[10] = { kuiVR8, kuiVR0, kuiVR1, kuiVR2, kuiVR3, kuiVR9, kuiVR4, kuiVR5, kuiVR6, kuiVR7 };
ST32 (pPred , LD32 (kuiList + 1));
ST32 (pPred + kiStride , LD32 (kuiList + 6));
@@ -288,23 +288,23 @@
/*horizontal up*/
void WelsI4x4LumaPredHU_ref (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
/*get pLeft*/
- const uint8_t kuiL0 = pPred[ -1];
- const uint8_t kuiL1 = pPred[kiStride - 1];
- const uint8_t kuiL2 = pPred[kiStride2 - 1];
- const uint8_t kuiL3 = pPred[kiStride3 - 1];
- const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
- const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
- const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
- const uint8_t kuiHU0 = kuiL01 >> 1;
- const uint8_t kuiHU1 = (kuiL01 + kuiL12) >> 2;
- const uint8_t kuiHU2 = kuiL12 >> 1;
- const uint8_t kuiHU3 = (kuiL12 + kuiL23) >> 2;
- const uint8_t kuiHU4 = kuiL23 >> 1;
- const uint8_t kuiHU5 = (1 + kuiL23 + (kuiL3 << 1)) >> 2;
- const uint8_t kuiList[10] = { kuiHU0, kuiHU1, kuiHU2, kuiHU3, kuiHU4, kuiHU5, kuiL3, kuiL3, kuiL3, kuiL3 };
+ const uint8_t kuiL0 = pPred[ - 1];
+ const uint8_t kuiL1 = pPred[kiStride - 1];
+ const uint8_t kuiL2 = pPred[kiStride2 - 1];
+ const uint8_t kuiL3 = pPred[kiStride3 - 1];
+ const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
+ const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
+ const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
+ const uint8_t kuiHU0 = kuiL01 >> 1;
+ const uint8_t kuiHU1 = (kuiL01 + kuiL12) >> 2;
+ const uint8_t kuiHU2 = kuiL12 >> 1;
+ const uint8_t kuiHU3 = (kuiL12 + kuiL23) >> 2;
+ const uint8_t kuiHU4 = kuiL23 >> 1;
+ const uint8_t kuiHU5 = (1 + kuiL23 + (kuiL3 << 1)) >> 2;
+ const uint8_t kuiList[10] = { kuiHU0, kuiHU1, kuiHU2, kuiHU3, kuiHU4, kuiHU5, kuiL3, kuiL3, kuiL3, kuiL3 };
ST32 (pPred , LD32 (kuiList));
ST32 (pPred + kiStride , LD32 (kuiList + 2));
@@ -314,35 +314,35 @@
/*horizontal down*/
void WelsI4x4LumaPredHD_ref (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
- const uint8_t kuiLT = pPred[- (kiStride + 1)];
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
+ const uint8_t kuiLT = pPred[- (kiStride + 1)];
/*get pLeft and pTop*/
- const uint8_t kuiL0 = pPred[-1 ];
- const uint8_t kuiL1 = pPred[-1 + kiStride ];
- const uint8_t kuiL2 = pPred[-1 + kiStride2];
- const uint8_t kuiL3 = pPred[-1 + kiStride3];
- const uint8_t kuiT0 = pPred[-kiStride ];
- const uint8_t kuiT1 = pPred[-kiStride + 1 ];
- const uint8_t kuiT2 = pPred[-kiStride + 2 ];
- const uint16_t kuiTL0 = 1 + kuiLT + kuiL0;
- const uint16_t kuiLT0 = 1 + kuiLT + kuiT0;
- const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
- const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
- const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
- const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
- const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
- const uint8_t kuiHD0 = kuiTL0 >> 1;
- const uint8_t kuiHD1 = (kuiTL0 + kuiLT0) >> 2;
- const uint8_t kuiHD2 = (kuiLT0 + kuiT01) >> 2;
- const uint8_t kuiHD3 = (kuiT01 + kuiT12) >> 2;
- const uint8_t kuiHD4 = kuiL01 >> 1;
- const uint8_t kuiHD5 = (kuiTL0 + kuiL01) >> 2;
- const uint8_t kuiHD6 = kuiL12 >> 1;
- const uint8_t kuiHD7 = (kuiL01 + kuiL12) >> 2;
- const uint8_t kuiHD8 = kuiL23 >> 1;
- const uint8_t kuiHD9 = (kuiL12 + kuiL23) >> 2;
- const uint8_t kuiList[10] = { kuiHD8, kuiHD9, kuiHD6, kuiHD7, kuiHD4, kuiHD5, kuiHD0, kuiHD1, kuiHD2, kuiHD3 };
+ const uint8_t kuiL0 = pPred[-1 ];
+ const uint8_t kuiL1 = pPred[-1 + kiStride ];
+ const uint8_t kuiL2 = pPred[-1 + kiStride2];
+ const uint8_t kuiL3 = pPred[-1 + kiStride3];
+ const uint8_t kuiT0 = pPred[-kiStride ];
+ const uint8_t kuiT1 = pPred[-kiStride + 1 ];
+ const uint8_t kuiT2 = pPred[-kiStride + 2 ];
+ const uint16_t kuiTL0 = 1 + kuiLT + kuiL0;
+ const uint16_t kuiLT0 = 1 + kuiLT + kuiT0;
+ const uint16_t kuiT01 = 1 + kuiT0 + kuiT1;
+ const uint16_t kuiT12 = 1 + kuiT1 + kuiT2;
+ const uint16_t kuiL01 = 1 + kuiL0 + kuiL1;
+ const uint16_t kuiL12 = 1 + kuiL1 + kuiL2;
+ const uint16_t kuiL23 = 1 + kuiL2 + kuiL3;
+ const uint8_t kuiHD0 = kuiTL0 >> 1;
+ const uint8_t kuiHD1 = (kuiTL0 + kuiLT0) >> 2;
+ const uint8_t kuiHD2 = (kuiLT0 + kuiT01) >> 2;
+ const uint8_t kuiHD3 = (kuiT01 + kuiT12) >> 2;
+ const uint8_t kuiHD4 = kuiL01 >> 1;
+ const uint8_t kuiHD5 = (kuiTL0 + kuiL01) >> 2;
+ const uint8_t kuiHD6 = kuiL12 >> 1;
+ const uint8_t kuiHD7 = (kuiL01 + kuiL12) >> 2;
+ const uint8_t kuiHD8 = kuiL23 >> 1;
+ const uint8_t kuiHD9 = (kuiL12 + kuiL23) >> 2;
+ const uint8_t kuiList[10] = { kuiHD8, kuiHD9, kuiHD6, kuiHD7, kuiHD4, kuiHD5, kuiHD0, kuiHD1, kuiHD2, kuiHD3 };
ST32 (pPred , LD32 (kuiList + 6));
ST32 (pPred + kiStride , LD32 (kuiList + 4));
@@ -433,27 +433,27 @@
void WelsIChromaPredDc_ref (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiL1 = kiStride - 1;
- const int32_t kiL2 = kiL1 + kiStride;
- const int32_t kiL3 = kiL2 + kiStride;
- const int32_t kiL4 = kiL3 + kiStride;
- const int32_t kiL5 = kiL4 + kiStride;
- const int32_t kiL6 = kiL5 + kiStride;
- const int32_t kiL7 = kiL6 + kiStride;
+ const int32_t kiL1 = kiStride - 1;
+ const int32_t kiL2 = kiL1 + kiStride;
+ const int32_t kiL3 = kiL2 + kiStride;
+ const int32_t kiL4 = kiL3 + kiStride;
+ const int32_t kiL5 = kiL4 + kiStride;
+ const int32_t kiL6 = kiL5 + kiStride;
+ const int32_t kiL7 = kiL6 + kiStride;
/*caculate the kMean value*/
- const uint8_t kuiM1 = (pPred[-kiStride] + pPred[1 - kiStride] + pPred[2 - kiStride] + pPred[3 - kiStride] +
+ const uint8_t kuiM1 = (pPred[-kiStride] + pPred[1 - kiStride] + pPred[2 - kiStride] + pPred[3 - kiStride] +
pPred[-1] + pPred[kiL1] + pPred[kiL2] + pPred[kiL3] + 4) >> 3 ;
- const uint32_t kuiSum2 = pPred[4 - kiStride] + pPred[5 - kiStride] + pPred[6 - kiStride] + pPred[7 - kiStride];
- const uint32_t kuiSum3 = pPred[kiL4] + pPred[kiL5] + pPred[kiL6] + pPred[kiL7];
- const uint8_t kuiM2 = (kuiSum2 + 2) >> 2;
- const uint8_t kuiM3 = (kuiSum3 + 2) >> 2;
- const uint8_t kuiM4 = (kuiSum2 + kuiSum3 + 4) >> 3;
- const uint8_t kuiMUP[8] = {kuiM1, kuiM1, kuiM1, kuiM1, kuiM2, kuiM2, kuiM2, kuiM2};
- const uint8_t kuiMDown[8] = {kuiM3, kuiM3, kuiM3, kuiM3, kuiM4, kuiM4, kuiM4, kuiM4};
- const uint64_t kuiUP64 = LD64 (kuiMUP);
- const uint64_t kuiDN64 = LD64 (kuiMDown);
+ const uint32_t kuiSum2 = pPred[4 - kiStride] + pPred[5 - kiStride] + pPred[6 - kiStride] + pPred[7 - kiStride];
+ const uint32_t kuiSum3 = pPred[kiL4] + pPred[kiL5] + pPred[kiL6] + pPred[kiL7];
+ const uint8_t kuiM2 = (kuiSum2 + 2) >> 2;
+ const uint8_t kuiM3 = (kuiSum3 + 2) >> 2;
+ const uint8_t kuiM4 = (kuiSum2 + kuiSum3 + 4) >> 3;
+ const uint8_t kuiMUP[8] = {kuiM1, kuiM1, kuiM1, kuiM1, kuiM2, kuiM2, kuiM2, kuiM2};
+ const uint8_t kuiMDown[8] = {kuiM3, kuiM3, kuiM3, kuiM3, kuiM4, kuiM4, kuiM4, kuiM4};
+ const uint64_t kuiUP64 = LD64 (kuiMUP);
+ const uint64_t kuiDN64 = LD64 (kuiMDown);
- ST64 (pPred , kuiUP64);
+ ST64 (pPred , kuiUP64);
ST64 (pPred + kiL1 + 1, kuiUP64);
ST64 (pPred + kiL2 + 1, kuiUP64);
ST64 (pPred + kiL3 + 1, kuiUP64);
@@ -464,13 +464,13 @@
}
void WelsIChromaPredDcLeft_ref (uint8_t* pPred, const int32_t kiStride) {
- const int32_t kiL1 = -1 + kiStride;
- const int32_t kiL2 = kiL1 + kiStride;
- const int32_t kiL3 = kiL2 + kiStride;
- const int32_t kiL4 = kiL3 + kiStride;
- const int32_t kiL5 = kiL4 + kiStride;
- const int32_t kiL6 = kiL5 + kiStride;
- const int32_t kiL7 = kiL6 + kiStride;
+ const int32_t kiL1 = -1 + kiStride;
+ const int32_t kiL2 = kiL1 + kiStride;
+ const int32_t kiL3 = kiL2 + kiStride;
+ const int32_t kiL4 = kiL3 + kiStride;
+ const int32_t kiL5 = kiL4 + kiStride;
+ const int32_t kiL6 = kiL5 + kiStride;
+ const int32_t kiL7 = kiL6 + kiStride;
/*caculate the kMean value*/
const uint8_t kuiMUP = (pPred[-1] + pPred[kiL1] + pPred[kiL2] + pPred[kiL3] + 2) >> 2 ;
const uint8_t kuiMDown = (pPred[kiL4] + pPred[kiL5] + pPred[kiL6] + pPred[kiL7] + 2) >> 2;
@@ -477,7 +477,7 @@
const uint64_t kuiUP64 = 0x0101010101010101ULL * kuiMUP;
const uint64_t kuiDN64 = 0x0101010101010101ULL * kuiMDown;
- ST64 (pPred , kuiUP64);
+ ST64 (pPred , kuiUP64);
ST64 (pPred + kiL1 + 1, kuiUP64);
ST64 (pPred + kiL2 + 1, kuiUP64);
ST64 (pPred + kiL3 + 1, kuiUP64);
--- a/test/encoder/EncUT_EncoderMbAux.cpp
+++ b/test/encoder/EncUT_EncoderMbAux.cpp
@@ -421,8 +421,8 @@
int32_t i, iIdx;
for (i = 0 ; i < 16 ; i += 4) {
iIdx = ((i & 0x08) << 4) + ((i & 0x04) << 3);
- s[0] = pDct[iIdx ] + pDct[iIdx + 80];
- s[3] = pDct[iIdx ] - pDct[iIdx + 80];
+ s[0] = pDct[iIdx ] + pDct[iIdx + 80];
+ s[3] = pDct[iIdx ] - pDct[iIdx + 80];
s[1] = pDct[iIdx + 16] + pDct[iIdx + 64];
s[2] = pDct[iIdx + 16] - pDct[iIdx + 64];
p[i ] = s[0] + s[1];
--- a/test/encoder/EncUT_GetIntraPredictor.cpp
+++ b/test/encoder/EncUT_GetIntraPredictor.cpp
@@ -9,7 +9,7 @@
TEST (GetIntraPredictorTest, TestGetI4x4LumaPredV) {
uint8_t* pPred = new uint8_t[64];
- uint8_t* pRef = new uint8_t[64];
+ uint8_t* pRef = new uint8_t[64];
for (int i = 0; i < 64; i++)
pRef[i] = rand() % 256;
@@ -137,8 +137,8 @@
TEST (GetIntraPredictorTest, TestGetI4x4LumaPredDDR) {
const int32_t kiStride = rand() % 256 + 16;
- const int32_t kiStride2 = kiStride << 1;
- const int32_t kiStride3 = kiStride + kiStride2;
+ const int32_t kiStride2 = kiStride << 1;
+ const int32_t kiStride3 = kiStride + kiStride2;
uint8_t* pPred = new uint8_t[64];
uint8_t* pRef = new uint8_t[kiStride3 + kiStride + 1];
--- a/test/encoder/EncUT_MemoryAlloc.cpp
+++ b/test/encoder/EncUT_MemoryAlloc.cpp
@@ -30,16 +30,16 @@
const uint32_t kuiTargetAlignSize[4] = {32, 16, 64, 8};
const uint32_t kuiZero = 0;
for (int i = 0; i < 4; i++) {
- const uint32_t kuiTestAlignSize = kuiTargetAlignSize[i];
- const uint32_t kuiTestDataSize = abs (rand());
+ const uint32_t kuiTestAlignSize = kuiTargetAlignSize[i];
+ const uint32_t kuiTestDataSize = abs (rand());
CMemoryAlign cTestMa (kuiTestAlignSize);
const uint32_t uiSize = kuiTestDataSize;
const char strUnitTestTag[100] = "pUnitTestData";
- const uint32_t kuiUsedCacheLineSize = ((kuiTestAlignSize == 0)
+ const uint32_t kuiUsedCacheLineSize = ((kuiTestAlignSize == 0)
|| (kuiTestAlignSize & 0x0F)) ? (16) : (kuiTestAlignSize);
- const uint32_t kuiExtraAlignSize = kuiUsedCacheLineSize - 1;
- const uint32_t kuiExpectedSize = sizeof (void**) + sizeof (int32_t) + kuiExtraAlignSize + uiSize;
+ const uint32_t kuiExtraAlignSize = kuiUsedCacheLineSize - 1;
+ const uint32_t kuiExpectedSize = sizeof (void**) + sizeof (int32_t) + kuiExtraAlignSize + uiSize;
uint8_t* pUnitTestData = static_cast<uint8_t*> (cTestMa.WelsMalloc (uiSize, strUnitTestTag));
if (pUnitTestData != NULL) {
ASSERT_TRUE ((((uintptr_t) (pUnitTestData)) & kuiExtraAlignSize) == 0);
--- a/test/encoder/EncUT_MotionEstimate.cpp
+++ b/test/encoder/EncUT_MotionEstimate.cpp
@@ -142,9 +142,9 @@
m_iMvRange = m_iUsageType ? EXPANDED_MV_RANGE : CAMERA_STARTMV_RANGE;
m_iMvdRange = (m_iUsageType ? EXPANDED_MVD_RANGE : ((m_iNumDependencyLayers == 1) ? CAMERA_MVD_RANGE :
CAMERA_HIGHLAYER_MVD_RANGE));
- m_uiMvdInterTableSize = (m_iMvdRange << 2); //intepel*4=qpel
- m_uiMvdInterTableStride = 1 + (m_uiMvdInterTableSize << 1);//qpel_mv_range*2=(+/-);
- m_uiMvdCacheAlignedSize = m_uiMvdInterTableStride * sizeof (uint16_t);
+ m_uiMvdInterTableSize = (m_iMvdRange << 2); //intepel*4=qpel
+ m_uiMvdInterTableStride = 1 + (m_uiMvdInterTableSize << 1);//qpel_mv_range*2=(+/-);
+ m_uiMvdCacheAlignedSize = m_uiMvdInterTableStride * sizeof (uint16_t);
m_pMa = new CMemoryAlign (16);
ASSERT_TRUE (NULL != m_pMa);
--- a/test/processing/ProcessUT_DownSample.cpp
+++ b/test/processing/ProcessUT_DownSample.cpp
@@ -11,11 +11,11 @@
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* pDstLine = pDst;
- uint8_t* pSrcLine = pSrc;
- const int32_t kiSrcStridex2 = kiSrcStride << 1;
- const int32_t kiDstWidth = kiSrcWidth >> 1;
- const int32_t kiDstHeight = kiSrcHeight >> 1;
+ uint8_t* pDstLine = pDst;
+ uint8_t* pSrcLine = pSrc;
+ const int32_t kiSrcStridex2 = kiSrcStride << 1;
+ const int32_t kiDstWidth = kiSrcWidth >> 1;
+ const int32_t kiDstHeight = kiSrcHeight >> 1;
for (int32_t j = 0; j < kiDstHeight; j ++) {
for (int32_t i = 0; i < kiDstWidth; i ++) {
@@ -25,8 +25,8 @@
pDstLine[i] = (uint8_t) ((kiTempRow1 + kiTempRow2 + 1) >> 1);
}
- pDstLine += kiDstStride;
- pSrcLine += kiSrcStridex2;
+ pDstLine += kiDstStride;
+ pSrcLine += kiSrcStridex2;
}
}