History

update format

Karina committed 10 years ago

Commit 57c87f11 parent cd755412 files · +100 −79Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 2 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+91−73
@@ -166,9 +166,9 @@ void CheckReferenceNumSetting (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam · 165 unmodified lines
166 }166 }
167}167}
168 168
169int32_t SliceArgumentValidationFixedSliceMode(SLogContext* pLogCtx,169int32_t SliceArgumentValidationFixedSliceMode (SLogContext* pLogCtx,
170 SSliceArgument* pSliceArgument, const RC_MODES kiRCMode,170 SSliceArgument* pSliceArgument, const RC_MODES kiRCMode,
171 const int32_t kiPicWidth, const int32_t kiPicHeight) {171 const int32_t kiPicWidth, const int32_t kiPicHeight) {
172 int32_t iCpuCores = 0;172 int32_t iCpuCores = 0;
173 int32_t iIdx = 0;173 int32_t iIdx = 0;
174 const int32_t iMbWidth = (kiPicWidth + 15) >> 4;174 const int32_t iMbWidth = (kiPicWidth + 15) >> 4;
@@ -180,7 +180,7 @@ int32_t SliceArgumentValidationFixedSliceMode(SLogContext* pLogCtx, · 5 unmodified lines
180 180
181 if (pSliceArgument->uiSliceNum == 0) {181 if (pSliceArgument->uiSliceNum == 0) {
182 WelsCPUFeatureDetect (&iCpuCores);182 WelsCPUFeatureDetect (&iCpuCores);
183 if (0 == iCpuCores ) {183 if (0 == iCpuCores) {
184 // cpuid not supported or doesn't expose the number of cores,184 // cpuid not supported or doesn't expose the number of cores,
185 // use high level system API as followed to detect number of pysical/logic processor185 // use high level system API as followed to detect number of pysical/logic processor
186 iCpuCores = DynamicDetectCpuCores();186 iCpuCores = DynamicDetectCpuCores();
@@ -189,15 +189,17 @@ int32_t SliceArgumentValidationFixedSliceMode(SLogContext* pLogCtx, · 2 unmodified lines
189 }189 }
190 190
191 if (pSliceArgument->uiSliceNum <= 1) {191 if (pSliceArgument->uiSliceNum <= 1) {
192 WelsLog (pLogCtx, WELS_LOG_INFO, "SliceArgumentValidationFixedSliceMode(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!",192 WelsLog (pLogCtx, WELS_LOG_INFO,
193 pSliceArgument->uiSliceNum);193 "SliceArgumentValidationFixedSliceMode(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!",
194 pSliceArgument->uiSliceNum);
194 bSingleMode = true;195 bSingleMode = true;
195 }196 }
196 197
197 // considering the coding efficient and performance,198 // considering the coding efficient and performance,
198 // iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting199 // iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting
199 if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {200 if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {
200 WelsLog (pLogCtx, WELS_LOG_INFO, "SliceArgumentValidationFixedSliceMode(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type as CountMbNum less than MIN_NUM_MB_PER_SLICE!",201 WelsLog (pLogCtx, WELS_LOG_INFO,
202 "SliceArgumentValidationFixedSliceMode(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type as CountMbNum less than MIN_NUM_MB_PER_SLICE!",
201 pSliceArgument->uiSliceNum);203 pSliceArgument->uiSliceNum);
202 bSingleMode = true;204 bSingleMode = true;
203 }205 }
@@ -213,15 +215,17 @@ int32_t SliceArgumentValidationFixedSliceMode(SLogContext* pLogCtx, · 9 unmodified lines
213 215
214 if (pSliceArgument->uiSliceNum > MAX_SLICES_NUM) {216 if (pSliceArgument->uiSliceNum > MAX_SLICES_NUM) {
215 pSliceArgument->uiSliceNum = MAX_SLICES_NUM;217 pSliceArgument->uiSliceNum = MAX_SLICES_NUM;
216 WelsLog (pLogCtx, WELS_LOG_WARNING, "SliceArgumentValidationFixedSliceMode(), uiSliceNum exceed MAX_SLICES_NUM! So setting slice num eqaul to MAX_SLICES_NUM(%d)!",218 WelsLog (pLogCtx, WELS_LOG_WARNING,
219 "SliceArgumentValidationFixedSliceMode(), uiSliceNum exceed MAX_SLICES_NUM! So setting slice num eqaul to MAX_SLICES_NUM(%d)!",
217 pSliceArgument->uiSliceNum);220 pSliceArgument->uiSliceNum);
218 }221 }
219 222
220 if (kiRCMode != RC_OFF_MODE) { // multiple slices verify with gom223 if (kiRCMode != RC_OFF_MODE) { // multiple slices verify with gom
221 //check uiSliceNum and set uiSliceMbNum with current uiSliceNum224 //check uiSliceNum and set uiSliceMbNum with current uiSliceNum
222 if (!GomValidCheckSliceNum (iMbWidth, iMbHeight, &pSliceArgument->uiSliceNum)) {225 if (!GomValidCheckSliceNum (iMbWidth, iMbHeight, &pSliceArgument->uiSliceNum)) {
223 WelsLog (pLogCtx, WELS_LOG_WARNING, "SliceArgumentValidationFixedSliceMode(), unsupported setting with Resolution and uiSliceNum combination under RC on! So uiSliceNum is changed to %d!",226 WelsLog (pLogCtx, WELS_LOG_WARNING,
224 pSliceArgument->uiSliceNum);227 "SliceArgumentValidationFixedSliceMode(), unsupported setting with Resolution and uiSliceNum combination under RC on! So uiSliceNum is changed to %d!",
228 pSliceArgument->uiSliceNum);
225 }229 }
226 230
227 if (pSliceArgument->uiSliceNum <= 1 ||231 if (pSliceArgument->uiSliceNum <= 1 ||
@@ -235,7 +239,7 @@ int32_t SliceArgumentValidationFixedSliceMode(SLogContext* pLogCtx, · 7 unmodified lines
235 //check uiSliceMbNum with current uiSliceNum239 //check uiSliceMbNum with current uiSliceNum
236 WelsLog (pLogCtx, WELS_LOG_ERROR,240 WelsLog (pLogCtx, WELS_LOG_ERROR,
237 "SliceArgumentValidationFixedSliceMode(), invalid uiSliceMbNum (%d) settings!,now turn to SM_SINGLE_SLICE type",241 "SliceArgumentValidationFixedSliceMode(), invalid uiSliceMbNum (%d) settings!,now turn to SM_SINGLE_SLICE type",
238 pSliceArgument->uiSliceMbNum[0]);242 pSliceArgument->uiSliceMbNum[0]);
239 pSliceArgument->uiSliceMode = SM_SINGLE_SLICE;243 pSliceArgument->uiSliceMode = SM_SINGLE_SLICE;
240 pSliceArgument->uiSliceNum = 1;244 pSliceArgument->uiSliceNum = 1;
241 for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) {245 for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) {
@@ -500,7 +504,8 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 258 unmodified lines
500 return ENC_RETURN_UNSUPPORTED_PARA;504 return ENC_RETURN_UNSUPPORTED_PARA;
501 }505 }
502 if ((pCodingParam->uiMaxNalSize != 0) && (pSpatialLayer->sSliceArgument.uiSliceMode != SM_SIZELIMITED_SLICE)) {506 if ((pCodingParam->uiMaxNalSize != 0) && (pSpatialLayer->sSliceArgument.uiSliceMode != SM_SIZELIMITED_SLICE)) {
503 WelsLog (pLogCtx, WELS_LOG_WARNING, "ParamValidationExt(), current layer %d uiSliceMode (%d) settings may not fulfill MaxNalSize = %d", i,507 WelsLog (pLogCtx, WELS_LOG_WARNING,
508 "ParamValidationExt(), current layer %d uiSliceMode (%d) settings may not fulfill MaxNalSize = %d", i,
504 pSpatialLayer->sSliceArgument.uiSliceMode, pCodingParam->uiMaxNalSize);509 pSpatialLayer->sSliceArgument.uiSliceMode, pCodingParam->uiMaxNalSize);
505 }510 }
506 CheckProfileSetting (pLogCtx, pCodingParam, i, pSpatialLayer->uiProfileIdc);511 CheckProfileSetting (pLogCtx, pCodingParam, i, pSpatialLayer->uiProfileIdc);
@@ -519,9 +524,9 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 12 unmodified lines
519 }524 }
520 break;525 break;
521 case SM_FIXEDSLCNUM_SLICE: {526 case SM_FIXEDSLCNUM_SLICE: {
522 iReturn = SliceArgumentValidationFixedSliceMode(pLogCtx, &pSpatialLayer->sSliceArgument, pCodingParam->iRCMode,527 iReturn = SliceArgumentValidationFixedSliceMode (pLogCtx, &pSpatialLayer->sSliceArgument, pCodingParam->iRCMode,
523 kiPicWidth, kiPicHeight);528 kiPicWidth, kiPicHeight);
524 if(iReturn)529 if (iReturn)
525 return ENC_RETURN_UNSUPPORTED_PARA;530 return ENC_RETURN_UNSUPPORTED_PARA;
526 }531 }
527 break;532 break;
@@ -539,7 +544,7 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 11 unmodified lines
539 return ENC_RETURN_UNSUPPORTED_PARA;544 return ENC_RETURN_UNSUPPORTED_PARA;
540 }545 }
541 pSpatialLayer->sSliceArgument.uiSliceNum = iMbHeight;546 pSpatialLayer->sSliceArgument.uiSliceNum = iMbHeight;
542 for (uint32_t j=0; j<iMbHeight; j++) {547 for (uint32_t j = 0; j < iMbHeight; j++) {
543 pSpatialLayer->sSliceArgument.uiSliceMbNum[j] = iMbWidth;548 pSpatialLayer->sSliceArgument.uiSliceMbNum[j] = iMbWidth;
544 }549 }
545 if (!CheckRowMbMultiSliceSetting (iMbWidth,550 if (!CheckRowMbMultiSliceSetting (iMbWidth,
@@ -598,10 +603,10 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 52 unmodified lines
598 }603 }
599 604
600 if (pSpatialLayer->sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize -605 if (pSpatialLayer->sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize -
601 NAL_HEADER_ADD_0X30BYTES)) {606 NAL_HEADER_ADD_0X30BYTES)) {
602 WelsLog (pLogCtx, WELS_LOG_WARNING,607 WelsLog (pLogCtx, WELS_LOG_WARNING,
603 "ParamValidationExt(), slice mode = SM_SIZELIMITED_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d, will take uiMaxNalsize!",608 "ParamValidationExt(), slice mode = SM_SIZELIMITED_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d, will take uiMaxNalsize!",
604 pSpatialLayer->sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize);609 pSpatialLayer->sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize);
605 pSpatialLayer->sSliceArgument.uiSliceSizeConstraint = pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES;610 pSpatialLayer->sSliceArgument.uiSliceSizeConstraint = pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES;
606 }611 }
607 }612 }
@@ -905,7 +910,7 @@ int32_t AllocMbCacheAligned (SMbCache* pMbCache, CMemoryAlign* pMa) { · 297 unmodified lines
905 "pMbCache->pPrevIntra4x4PredModeFlag");910 "pMbCache->pPrevIntra4x4PredModeFlag");
906 WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pPrevIntra4x4PredModeFlag));911 WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pPrevIntra4x4PredModeFlag));
907 pMbCache->pRemIntra4x4PredModeFlag = (int8_t*)pMa->WelsMalloc (16 * sizeof (int8_t),912 pMbCache->pRemIntra4x4PredModeFlag = (int8_t*)pMa->WelsMalloc (16 * sizeof (int8_t),
908 "pMbCache->pRemIntra4x4PredModeFlag");913 "pMbCache->pRemIntra4x4PredModeFlag");
909 WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pRemIntra4x4PredModeFlag));914 WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pRemIntra4x4PredModeFlag));
910 pMbCache->pDct = (SDCTCoeff*)pMa->WelsMalloc (sizeof (SDCTCoeff), "pMbCache->pDct");915 pMbCache->pDct = (SDCTCoeff*)pMa->WelsMalloc (sizeof (SDCTCoeff), "pMbCache->pDct");
911 WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pDct));916 WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pDct));
@@ -1095,7 +1100,7 @@ int32_t FindExistingPps (SWelsSPS* pSps, SSubsetSps* pSubsetSps, const bool kbUs · 183 unmodified lines
1095}1100}
1096 1101
1097static inline int32_t InitpSliceInLayer (sWelsEncCtx** ppCtx, SDqLayer* pDqLayer, CMemoryAlign* pMa,1102static inline int32_t InitpSliceInLayer (sWelsEncCtx** ppCtx, SDqLayer* pDqLayer, CMemoryAlign* pMa,
1098 const int32_t iMaxSliceNum, const int32_t kiDlayerIndex) {1103 const int32_t iMaxSliceNum, const int32_t kiDlayerIndex) {
1099 int32_t iMaxSliceBufferSize = (*ppCtx)->iSliceBufferSize[kiDlayerIndex];1104 int32_t iMaxSliceBufferSize = (*ppCtx)->iSliceBufferSize[kiDlayerIndex];
1100 int32_t iSliceIdx = 0;1105 int32_t iSliceIdx = 0;
1101 SliceModeEnum uiSliceMode = (*ppCtx)->pSvcParam->sSpatialLayers[kiDlayerIndex].sSliceArgument.uiSliceMode;1106 SliceModeEnum uiSliceMode = (*ppCtx)->pSvcParam->sSpatialLayers[kiDlayerIndex].sSliceArgument.uiSliceMode;
@@ -1105,7 +1110,7 @@ static inline int32_t InitpSliceInLayer (sWelsEncCtx** ppCtx, SDqLayer* pDqLayer · 3 unmodified lines
1105 bool bIndependenceBsBuffer = ((*ppCtx)->pSvcParam->iMultipleThreadIdc > 1 &&1110 bool bIndependenceBsBuffer = ((*ppCtx)->pSvcParam->iMultipleThreadIdc > 1 &&
1106 SM_SINGLE_SLICE != uiSliceMode) ? true : false;1111 SM_SINGLE_SLICE != uiSliceMode) ? true : false;
1107 1112
1108 if ( iMaxSliceBufferSize <= 0) {1113 if (iMaxSliceBufferSize <= 0) {
1109 return ENC_RETURN_UNEXPECTED;1114 return ENC_RETURN_UNEXPECTED;
1110 }1115 }
1111 1116
@@ -1115,10 +1120,10 @@ static inline int32_t InitpSliceInLayer (sWelsEncCtx** ppCtx, SDqLayer* pDqLayer · 3 unmodified lines
1115 pSlice->uiSliceIdx = iSliceIdx;1120 pSlice->uiSliceIdx = iSliceIdx;
1116 pSlice->sSliceBs.uiSize = iMaxSliceBufferSize;1121 pSlice->sSliceBs.uiSize = iMaxSliceBufferSize;
1117 pSlice->sSliceBs.uiBsPos = 0;1122 pSlice->sSliceBs.uiBsPos = 0;
1118 if (bIndependenceBsBuffer){1123 if (bIndependenceBsBuffer) {
1119 pSlice->pSliceBsa = &pSlice->sSliceBs.sBsWrite;1124 pSlice->pSliceBsa = &pSlice->sSliceBs.sBsWrite;
1120 pSlice->sSliceBs.pBs = (uint8_t*)pMa->WelsMalloc (iMaxSliceBufferSize, "SliceBs");1125 pSlice->sSliceBs.pBs = (uint8_t*)pMa->WelsMalloc (iMaxSliceBufferSize, "SliceBs");
1121 if ( NULL == pSlice->sSliceBs.pBs) {1126 if (NULL == pSlice->sSliceBs.pBs) {
1122 return ENC_RETURN_MEMALLOCERR;1127 return ENC_RETURN_MEMALLOCERR;
1123 }1128 }
1124 } else {1129 } else {
@@ -1176,7 +1181,8 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 51 unmodified lines
1176 int32_t iPicWidth = WELS_ALIGN (kiWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with iWidth of horizon1181 int32_t iPicWidth = WELS_ALIGN (kiWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with iWidth of horizon
1177 int32_t iPicChromaWidth = iPicWidth >> 1;1182 int32_t iPicChromaWidth = iPicWidth >> 1;
1178 1183
1179 iPicWidth = WELS_ALIGN (iPicWidth, 32); // 32(or 16 for chroma below) to match original imp. here instead of iCacheLineSize1184 iPicWidth = WELS_ALIGN (iPicWidth,
1185 32); // 32(or 16 for chroma below) to match original imp. here instead of iCacheLineSize
1180 iPicChromaWidth = WELS_ALIGN (iPicChromaWidth, 16);1186 iPicChromaWidth = WELS_ALIGN (iPicChromaWidth, 16);
1181 1187
1182 WelsGetEncBlockStrideOffset ((*ppCtx)->pStrideTab->pStrideEncBlockOffset[iDlayerIndex], iPicWidth, iPicChromaWidth);1188 WelsGetEncBlockStrideOffset ((*ppCtx)->pStrideTab->pStrideEncBlockOffset[iDlayerIndex], iPicWidth, iPicChromaWidth);
@@ -1826,12 +1832,13 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 643 unmodified lines
1826 uiMaxSliceNumEstimation = WELS_MIN (AVERSLICENUM_CONSTRAINT,1832 uiMaxSliceNumEstimation = WELS_MIN (AVERSLICENUM_CONSTRAINT,
1827 (iLayerBsSize / pSliceArgument->uiSliceSizeConstraint) + 1);1833 (iLayerBsSize / pSliceArgument->uiSliceSizeConstraint) + 1);
1828 (*ppCtx)->iMaxSliceCount = WELS_MAX ((*ppCtx)->iMaxSliceCount, (int) uiMaxSliceNumEstimation);1834 (*ppCtx)->iMaxSliceCount = WELS_MAX ((*ppCtx)->iMaxSliceCount, (int) uiMaxSliceNumEstimation);
1829 iSliceBufferSize = (WELS_MAX(pSliceArgument->uiSliceSizeConstraint, iLayerBsSize/uiMaxSliceNumEstimation)<<1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;1835 iSliceBufferSize = (WELS_MAX (pSliceArgument->uiSliceSizeConstraint,
1836 iLayerBsSize / uiMaxSliceNumEstimation) << 1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
1830 } else {1837 } else {
1831 (*ppCtx)->iMaxSliceCount = WELS_MAX ((*ppCtx)->iMaxSliceCount, (int) pSliceArgument->uiSliceNum);1838 (*ppCtx)->iMaxSliceCount = WELS_MAX ((*ppCtx)->iMaxSliceCount, (int) pSliceArgument->uiSliceNum);
1832 iSliceBufferSize = ((iLayerBsSize / pSliceArgument->uiSliceNum)<<1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;1839 iSliceBufferSize = ((iLayerBsSize / pSliceArgument->uiSliceNum) << 1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
1833 }1840 }
1834 iMaxSliceBufferSize = WELS_MAX(iMaxSliceBufferSize, iSliceBufferSize);1841 iMaxSliceBufferSize = WELS_MAX (iMaxSliceBufferSize, iSliceBufferSize);
1835 (*ppCtx)->iSliceBufferSize[iIndex] = iSliceBufferSize;1842 (*ppCtx)->iSliceBufferSize[iIndex] = iSliceBufferSize;
1836 ++ iIndex;1843 ++ iIndex;
1837 }1844 }
@@ -1842,8 +1849,8 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 4 unmodified lines
1842 iTotalLength = iCountBsLen;1849 iTotalLength = iCountBsLen;
1843 1850
1844 pParam->iNumRefFrame = WELS_CLIP3 (pParam->iNumRefFrame, MIN_REF_PIC_COUNT,1851 pParam->iNumRefFrame = WELS_CLIP3 (pParam->iNumRefFrame, MIN_REF_PIC_COUNT,
1845 (pParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :1852 (pParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
1846 MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));1853 MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));
1847 1854
1848 // Output1855 // Output
1849 (*ppCtx)->pOut = (SWelsEncoderOutput*)pMa->WelsMalloc (sizeof (SWelsEncoderOutput), "SWelsEncoderOutput");1856 (*ppCtx)->pOut = (SWelsEncoderOutput*)pMa->WelsMalloc (sizeof (SWelsEncoderOutput), "SWelsEncoderOutput");
@@ -1866,7 +1873,8 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 16 unmodified lines
1866 (*ppCtx)->iPosBsBuffer = 0;1873 (*ppCtx)->iPosBsBuffer = 0;
1867 1874
1868 // for pSlice bs buffers1875 // for pSlice bs buffers
1869 if (pParam->iMultipleThreadIdc > 1 && RequestMtResource (ppCtx, pParam, iCountBsLen, iMaxSliceBufferSize, bDynamicSlice)) {1876 if (pParam->iMultipleThreadIdc > 1
1877 && RequestMtResource (ppCtx, pParam, iCountBsLen, iMaxSliceBufferSize, bDynamicSlice)) {
1870 WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMtResource failed!");1878 WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMtResource failed!");
1871 FreeMemorySvc (ppCtx);1879 FreeMemorySvc (ppCtx);
1872 return 1;1880 return 1;
@@ -1889,7 +1897,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 16 unmodified lines
1889 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pRefIndexBlock4x4), FreeMemorySvc (ppCtx))1897 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pRefIndexBlock4x4), FreeMemorySvc (ppCtx))
1890 1898
1891 (*ppCtx)->pSadCostMb = static_cast<int32_t*>1899 (*ppCtx)->pSadCostMb = static_cast<int32_t*>
1892 (pMa->WelsMallocz (iCountMaxMbNum * sizeof (int32_t), "pSadCostMb"));1900 (pMa->WelsMallocz (iCountMaxMbNum * sizeof (int32_t), "pSadCostMb"));
1893 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSadCostMb), FreeMemorySvc (ppCtx))1901 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSadCostMb), FreeMemorySvc (ppCtx))
1894 1902
1895 (*ppCtx)->bEncCurFrmAsIdrFlag = true; // make sure first frame is IDR1903 (*ppCtx)->bEncCurFrmAsIdrFlag = true; // make sure first frame is IDR
@@ -2148,8 +2156,8 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 252 unmodified lines
2148 FreeMbCache (&pSlice->sMbCacheInfo, pMa);2156 FreeMbCache (&pSlice->sMbCacheInfo, pMa);
2149 2157
2150 //slice bs buffer2158 //slice bs buffer
2151 if(NULL != pSlice->sSliceBs.pBs) {2159 if (NULL != pSlice->sSliceBs.pBs) {
2152 pMa->WelsFree(pSlice->sSliceBs.pBs,"sSliceBs.pBs");2160 pMa->WelsFree (pSlice->sSliceBs.pBs, "sSliceBs.pBs");
2153 pSlice->sSliceBs.pBs = NULL;2161 pSlice->sSliceBs.pBs = NULL;
2154 }2162 }
2155 ++ iSliceIdx;2163 ++ iSliceIdx;
@@ -2292,16 +2300,16 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodin · 136 unmodified lines
2292 iMaxSliceCount = AVERSLICENUM_CONSTRAINT;2300 iMaxSliceCount = AVERSLICENUM_CONSTRAINT;
2293 break; // go through for SM_SIZELIMITED_SLICE?2301 break; // go through for SM_SIZELIMITED_SLICE?
2294 case SM_FIXEDSLCNUM_SLICE: {2302 case SM_FIXEDSLCNUM_SLICE: {
2295 iReturn = SliceArgumentValidationFixedSliceMode(pLogCtx, &pDlp->sSliceArgument, pCodingParam->iRCMode,2303 iReturn = SliceArgumentValidationFixedSliceMode (pLogCtx, &pDlp->sSliceArgument, pCodingParam->iRCMode,
2296 pDlp->iVideoWidth, pDlp->iVideoHeight);2304 pDlp->iVideoWidth, pDlp->iVideoHeight);
2297 if(iReturn)2305 if (iReturn)
2298 return ENC_RETURN_UNSUPPORTED_PARA;2306 return ENC_RETURN_UNSUPPORTED_PARA;
2299 2307
2300 if (pSliceArgument->uiSliceNum > iMaxSliceCount) {2308 if (pSliceArgument->uiSliceNum > iMaxSliceCount) {
2301 iMaxSliceCount = pSliceArgument->uiSliceNum;2309 iMaxSliceCount = pSliceArgument->uiSliceNum;
2302 }2310 }
2303 }2311 }
2304 break;2312 break;
2305 case SM_SINGLE_SLICE:2313 case SM_SINGLE_SLICE:
2306 if (pSliceArgument->uiSliceNum > iMaxSliceCount)2314 if (pSliceArgument->uiSliceNum > iMaxSliceCount)
2307 iMaxSliceCount = pSliceArgument->uiSliceNum;2315 iMaxSliceCount = pSliceArgument->uiSliceNum;
@@ -2380,7 +2388,8 @@ void OutputCpuFeaturesLog (SLogContext* pLogCtx, uint32_t uiCpuFeatureFlags, uin · 72 unmodified lines
2380int32_t GetMultipleThreadIdc (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingParam, int16_t& iSliceNum,2388int32_t GetMultipleThreadIdc (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingParam, int16_t& iSliceNum,
2381 int32_t& iCacheLineSize, uint32_t& uiCpuFeatureFlags) {2389 int32_t& iCacheLineSize, uint32_t& uiCpuFeatureFlags) {
2382 // for cpu features detection, Only detect once??2390 // for cpu features detection, Only detect once??
2383 int32_t uiCpuCores = 0; // number of logic processors on physical processor package, zero logic processors means HTT not supported2391 int32_t uiCpuCores =
2392 0; // number of logic processors on physical processor package, zero logic processors means HTT not supported
2384 uiCpuFeatureFlags = WelsCPUFeatureDetect (&uiCpuCores); // detect cpu capacity features2393 uiCpuFeatureFlags = WelsCPUFeatureDetect (&uiCpuCores); // detect cpu capacity features
2385 2394
2386#ifdef X86_ASM2395#ifdef X86_ASM
@@ -2403,8 +2412,8 @@ int32_t GetMultipleThreadIdc (SLogContext* pLogCtx, SWelsSvcCodingParam* pCoding · 16 unmodified lines
2403 uiCpuCores = DynamicDetectCpuCores();2412 uiCpuCores = DynamicDetectCpuCores();
2404 }2413 }
2405 2414
2406 if(0 == pCodingParam->iMultipleThreadIdc)2415 if (0 == pCodingParam->iMultipleThreadIdc)
2407 pCodingParam->iMultipleThreadIdc = (uiCpuCores > 0) ? uiCpuCores : 1;2416 pCodingParam->iMultipleThreadIdc = (uiCpuCores > 0) ? uiCpuCores : 1;
2408 2417
2409 // So far so many cpu cores up to MAX_THREADS_NUM mean for server platforms,2418 // So far so many cpu cores up to MAX_THREADS_NUM mean for server platforms,
2410 // for client application here it is constrained by maximal to MAX_THREADS_NUM2419 // for client application here it is constrained by maximal to MAX_THREADS_NUM
@@ -2673,7 +2682,7 @@ void DynslcUpdateMbNeighbourInfoListForAllSlices (SDqLayer* pCurDq, SMB* pMbList · 262 unmodified lines
2673 2682
2674 do {2683 do {
2675 SMB* pMb = &pMbList[iIdx];2684 SMB* pMb = &pMbList[iIdx];
2676 UpdateMbNeighbor(pCurDq, pMb, kiMbWidth, WelsMbToSliceIdc (pCurDq, pMb->iMbXY));2685 UpdateMbNeighbor (pCurDq, pMb, kiMbWidth, WelsMbToSliceIdc (pCurDq, pMb->iMbXY));
2677 ++ iIdx;2686 ++ iIdx;
2678 } while (iIdx <= kiEndMbInSlice);2687 } while (iIdx <= kiEndMbInSlice);
2679}2688}
@@ -2881,7 +2890,7 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx, · 201 unmodified lines
2881 }2890 }
2882 2891
2883 if (pCtx->pTaskManage) {2892 if (pCtx->pTaskManage) {
2884 pCtx->pTaskManage->InitFrame(kiCurDid);2893 pCtx->pTaskManage->InitFrame (kiCurDid);
2885 }2894 }
2886}2895}
2887 2896
@@ -3045,7 +3054,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 157 unmodified lines
3045 const int32_t kiCurTid = pCtx->uiTemporalId;3054 const int32_t kiCurTid = pCtx->uiTemporalId;
3046 if (pCurLayer->bDeblockingParallelFlag && (pCurLayer->iLoopFilterDisableIdc != 1)3055 if (pCurLayer->bDeblockingParallelFlag && (pCurLayer->iLoopFilterDisableIdc != 1)
3047#if !defined(ENABLE_FRAME_DUMP)3056#if !defined(ENABLE_FRAME_DUMP)
3048 && ( NRI_PRI_LOWEST != pCtx->eNalPriority )3057 && (NRI_PRI_LOWEST != pCtx->eNalPriority)
3049 && (pCtx->pSvcParam->sDependencyLayers[kiCurDid].iHighestTemporalId == 03058 && (pCtx->pSvcParam->sDependencyLayers[kiCurDid].iHighestTemporalId == 0
3050 || kiCurTid < pCtx->pSvcParam->sDependencyLayers[kiCurDid].iHighestTemporalId)3059 || kiCurTid < pCtx->pSvcParam->sDependencyLayers[kiCurDid].iHighestTemporalId)
3051#endif// !ENABLE_FRAME_DUMP3060#endif// !ENABLE_FRAME_DUMP
@@ -3658,7 +3667,7 @@ void StackBackEncoderStatus (sWelsEncCtx* pEncCtx, · 606 unmodified lines
3658 pEncCtx->iPOC = (1 << pEncCtx->pSps->iLog2MaxPocLsb) - 2;3667 pEncCtx->iPOC = (1 << pEncCtx->pSps->iLog2MaxPocLsb) - 2;
3659 }3668 }
3660 3669
3661 LoadBackFrameNum(pEncCtx);3670 LoadBackFrameNum (pEncCtx);
3662 pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;3671 pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;
3663 pEncCtx->eSliceType = P_SLICE;3672 pEncCtx->eSliceType = P_SLICE;
3664 //pEncCtx->eNalPriority = pEncCtx->eLastNalPriority; //not need this since eNalPriority will be updated at the beginning of coding a frame3673 //pEncCtx->eNalPriority = pEncCtx->eLastNalPriority; //not need this since eNalPriority will be updated at the beginning of coding a frame
@@ -3709,7 +3718,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 44 unmodified lines
3709 int32_t iDidList[MAX_DEPENDENCY_LAYER] = {0};3718 int32_t iDidList[MAX_DEPENDENCY_LAYER] = {0};
3710 int32_t iLayerNum = 0;3719 int32_t iLayerNum = 0;
3711 int32_t iLayerSize = 0;3720 int32_t iLayerSize = 0;
3712 int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame3721 int32_t iSpatialNum =
3722 0; // available count number of spatial layers due to frame size changed in this given frame
3713 int32_t iSpatialIdx = 0; // iIndex of spatial layers due to frame size changed in this given frame3723 int32_t iSpatialIdx = 0; // iIndex of spatial layers due to frame size changed in this given frame
3714 int32_t iFrameSize = 0;3724 int32_t iFrameSize = 0;
3715 int32_t iNalIdxInLayer = 0;3725 int32_t iNalIdxInLayer = 0;
@@ -3851,8 +3861,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 135 unmodified lines
3851 iNalIdxInLayer = 0;3861 iNalIdxInLayer = 0;
3852 bAvcBased = ((pSvcParam->bSimulcastAVC) || (iCurDid == BASE_DEPENDENCY_ID));3862 bAvcBased = ((pSvcParam->bSimulcastAVC) || (iCurDid == BASE_DEPENDENCY_ID));
3853 pCtx->bNeedPrefixNalFlag = ((!pSvcParam->bSimulcastAVC) && (bAvcBased &&3863 pCtx->bNeedPrefixNalFlag = ((!pSvcParam->bSimulcastAVC) && (bAvcBased &&
3854 (pSvcParam->bPrefixNalAddingCtrl ||3864 (pSvcParam->bPrefixNalAddingCtrl ||
3855 (pSvcParam->iSpatialLayerNum > 1))));3865 (pSvcParam->iSpatialLayerNum > 1))));
3856 3866
3857 if (eFrameType == videoFrameTypeP) {3867 if (eFrameType == videoFrameTypeP) {
3858 eNalType = bAvcBased ? NAL_UNIT_CODED_SLICE : NAL_UNIT_CODED_SLICE_EXT;3868 eNalType = bAvcBased ? NAL_UNIT_CODED_SLICE : NAL_UNIT_CODED_SLICE_EXT;
@@ -4009,7 +4019,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 150 unmodified lines
4009#else4019#else
4010 int32_t iEndMbIdx = pCtx->pCurDqLayer->sSliceEncCtx.iMbNumInFrame;4020 int32_t iEndMbIdx = pCtx->pCurDqLayer->sSliceEncCtx.iMbNumInFrame;
4011 for (int32_t iIdx = kiPartitionCnt - 1; iIdx >= 0; --iIdx) {4021 for (int32_t iIdx = kiPartitionCnt - 1; iIdx >= 0; --iIdx) {
4012 const int32_t iFirstMbIdx = pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iIdx].sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;4022 const int32_t iFirstMbIdx =
4023 pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iIdx].sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;
4013 pCtx->pSliceThreading->pThreadPEncCtx[iIdx].iStartMbIndex = iFirstMbIdx;4024 pCtx->pSliceThreading->pThreadPEncCtx[iIdx].iStartMbIndex = iFirstMbIdx;
4014 pCtx->pSliceThreading->pThreadPEncCtx[iIdx].iEndMbIndex = iEndMbIdx;4025 pCtx->pSliceThreading->pThreadPEncCtx[iIdx].iEndMbIndex = iEndMbIdx;
4015 iEndMbIdx = iFirstMbIdx;4026 iEndMbIdx = iFirstMbIdx;
@@ -4109,7 +4120,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 93 unmodified lines
4109 pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, iSpatialNum);4120 pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, iSpatialNum);
4110 }4121 }
4111 4122
4112 WelsRcPostFrameSkippedUpdate(pCtx, iCurDid);4123 WelsRcPostFrameSkippedUpdate (pCtx, iCurDid);
4113 WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,4124 WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
4114 "[Rc] Frame timestamp = %lld, skip one frame due to post skip, continual skipped %d frames",4125 "[Rc] Frame timestamp = %lld, skip one frame due to post skip, continual skipped %d frames",
4115 pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames);4126 pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames);
@@ -4432,18 +4443,18 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 316 unmodified lines
4432 /* Decide whether need reset for IDR frame based on adjusting prarameters changed */4443 /* Decide whether need reset for IDR frame based on adjusting prarameters changed */
4433 /* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */4444 /* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */
4434 bNeedReset = (pOldParam == NULL) ||4445 bNeedReset = (pOldParam == NULL) ||
4435 (pOldParam->bSimulcastAVC != pNewParam->bSimulcastAVC) ||4446 (pOldParam->bSimulcastAVC != pNewParam->bSimulcastAVC) ||
4436 (pOldParam->iSpatialLayerNum != pNewParam->iSpatialLayerNum) ||4447 (pOldParam->iSpatialLayerNum != pNewParam->iSpatialLayerNum) ||
4437 (pOldParam->iPicWidth != pNewParam->iPicWidth4448 (pOldParam->iPicWidth != pNewParam->iPicWidth
4438 || pOldParam->iPicHeight != pNewParam->iPicHeight) ||4449 || pOldParam->iPicHeight != pNewParam->iPicHeight) ||
4439 (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth4450 (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth
4440 || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) ||4451 || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) ||
4441 (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference) ||4452 (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference) ||
4442 (pOldParam->iLTRRefNum != pNewParam->iLTRRefNum) ||4453 (pOldParam->iLTRRefNum != pNewParam->iLTRRefNum) ||
4443 (pOldParam->iMultipleThreadIdc != pNewParam->iMultipleThreadIdc) ||4454 (pOldParam->iMultipleThreadIdc != pNewParam->iMultipleThreadIdc) ||
4444 (pOldParam->bEnableBackgroundDetection != pNewParam->bEnableBackgroundDetection) ||4455 (pOldParam->bEnableBackgroundDetection != pNewParam->bEnableBackgroundDetection) ||
4445 (pOldParam->bEnableAdaptiveQuant != pNewParam->bEnableAdaptiveQuant) ||4456 (pOldParam->bEnableAdaptiveQuant != pNewParam->bEnableAdaptiveQuant) ||
4446 (pOldParam->eSpsPpsIdStrategy != pNewParam->eSpsPpsIdStrategy);4457 (pOldParam->eSpsPpsIdStrategy != pNewParam->eSpsPpsIdStrategy);
4447 if (pNewParam->iMaxNumRefFrame > pOldParam->iMaxNumRefFrame) {4458 if (pNewParam->iMaxNumRefFrame > pOldParam->iMaxNumRefFrame) {
4448 bNeedReset = true;4459 bNeedReset = true;
4449 }4460 }
@@ -4466,7 +4477,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 16 unmodified lines
4466 break;4477 break;
4467 }4478 }
4468 4479
4469 if (pOldParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceMode != pNewParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceMode4480 if (pOldParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceMode !=
4481 pNewParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceMode
4470 ||4482 ||
4471 pOldParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceNum !=4483 pOldParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceNum !=
4472 pNewParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceNum) {4484 pNewParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceNum) {
@@ -4571,8 +4583,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 98 unmodified lines
4571 } else {4583 } else {
4572 /* maybe adjustment introduced in bitrate or little settings adjustment and so on.. */4584 /* maybe adjustment introduced in bitrate or little settings adjustment and so on.. */
4573 pNewParam->iNumRefFrame = WELS_CLIP3 (pNewParam->iNumRefFrame, MIN_REF_PIC_COUNT,4585 pNewParam->iNumRefFrame = WELS_CLIP3 (pNewParam->iNumRefFrame, MIN_REF_PIC_COUNT,
4574 (pNewParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :4586 (pNewParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
4575 MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));4587 MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));
4576 pNewParam->iLoopFilterDisableIdc = WELS_CLIP3 (pNewParam->iLoopFilterDisableIdc, 0, 6);4588 pNewParam->iLoopFilterDisableIdc = WELS_CLIP3 (pNewParam->iLoopFilterDisableIdc, 0, 6);
4577 pNewParam->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pNewParam->iLoopFilterAlphaC0Offset, -6, 6);4589 pNewParam->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pNewParam->iLoopFilterAlphaC0Offset, -6, 6);
4578 pNewParam->iLoopFilterBetaOffset = WELS_CLIP3 (pNewParam->iLoopFilterBetaOffset, -6, 6);4590 pNewParam->iLoopFilterBetaOffset = WELS_CLIP3 (pNewParam->iLoopFilterBetaOffset, -6, 6);
@@ -4612,13 +4624,16 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 33 unmodified lines
4612 /* Motion search */4624 /* Motion search */
4613 4625
4614 /* Deblocking loop filter */4626 /* Deblocking loop filter */
4615 pOldParam->iLoopFilterDisableIdc = pNewParam->iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries4627 pOldParam->iLoopFilterDisableIdc =
4628 pNewParam->iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries
4616 pOldParam->iLoopFilterAlphaC0Offset = pNewParam->iLoopFilterAlphaC0Offset;// AlphaOffset: valid range [-6, 6], default 04629 pOldParam->iLoopFilterAlphaC0Offset = pNewParam->iLoopFilterAlphaC0Offset;// AlphaOffset: valid range [-6, 6], default 0
4617 pOldParam->iLoopFilterBetaOffset = pNewParam->iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 04630 pOldParam->iLoopFilterBetaOffset =
4631 pNewParam->iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
4618 4632
4619 /* Rate Control */4633 /* Rate Control */
4620 pOldParam->iRCMode = pNewParam->iRCMode;4634 pOldParam->iRCMode = pNewParam->iRCMode;
4621 pOldParam->iTargetBitrate = pNewParam->iTargetBitrate; // overall target bitrate introduced in RC module4635 pOldParam->iTargetBitrate =
4636 pNewParam->iTargetBitrate; // overall target bitrate introduced in RC module
4622 pOldParam->iPaddingFlag = pNewParam->iPaddingFlag;4637 pOldParam->iPaddingFlag = pNewParam->iPaddingFlag;
4623 4638
4624 /* Layer definition */4639 /* Layer definition */
@@ -4637,7 +4652,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 12 unmodified lines
4637 pOldDlpInternal->fOutputFrameRate = pNewDlpInternal->fOutputFrameRate; // output frame rate4652 pOldDlpInternal->fOutputFrameRate = pNewDlpInternal->fOutputFrameRate; // output frame rate
4638 pOldDlp->iSpatialBitrate = pNewDlp->iSpatialBitrate;4653 pOldDlp->iSpatialBitrate = pNewDlp->iSpatialBitrate;
4639 4654
4640 pOldDlp->uiProfileIdc = pNewDlp->uiProfileIdc; // value of profile IDC (0 for auto-detection)4655 pOldDlp->uiProfileIdc =
4656 pNewDlp->uiProfileIdc; // value of profile IDC (0 for auto-detection)
4641 pOldDlp->iDLayerQp = pNewDlp->iDLayerQp;4657 pOldDlp->iDLayerQp = pNewDlp->iDLayerQp;
4642 4658
4643 /* Derived variants below */4659 /* Derived variants below */
@@ -4679,7 +4695,7 @@ int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConf · 35 unmodified lines
4679 sConfig.iLTRRefNum = 0;4695 sConfig.iLTRRefNum = 0;
4680 }4696 }
4681 iNumRefFrame = ((uiGopSize >> 1) > 1) ? ((uiGopSize >> 1) + sConfig.iLTRRefNum) : (MIN_REF_PIC_COUNT +4697 iNumRefFrame = ((uiGopSize >> 1) > 1) ? ((uiGopSize >> 1) + sConfig.iLTRRefNum) : (MIN_REF_PIC_COUNT +
4682 sConfig.iLTRRefNum);4698 sConfig.iLTRRefNum);
4683 iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA);4699 iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA);
4684 4700
4685 }4701 }
@@ -4794,13 +4810,14 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 108 unmodified lines
4794 uiSliceIdx = iMaxSliceNumOld;4810 uiSliceIdx = iMaxSliceNumOld;
4795 SRCSlicing* pSORC = &pSlcingOverRc[uiSliceIdx];4811 SRCSlicing* pSORC = &pSlcingOverRc[uiSliceIdx];
4796 const int32_t kiBitsPerMb = WELS_DIV_ROUND (pCtx->pWelsSvcRc[kiCurDid].iTargetBits * INT_MULTIPLY,4812 const int32_t kiBitsPerMb = WELS_DIV_ROUND (pCtx->pWelsSvcRc[kiCurDid].iTargetBits * INT_MULTIPLY,
4797 pCtx->pWelsSvcRc[kiCurDid].iNumberMbFrame);4813 pCtx->pWelsSvcRc[kiCurDid].iNumberMbFrame);
4798 while (uiSliceIdx < iMaxSliceNum) {4814 while (uiSliceIdx < iMaxSliceNum) {
4799 pSORC->iComplexityIndexSlice = 0;4815 pSORC->iComplexityIndexSlice = 0;
4800 pSORC->iCalculatedQpSlice = pCtx->iGlobalQp;4816 pSORC->iCalculatedQpSlice = pCtx->iGlobalQp;
4801 pSORC->iTotalQpSlice = 0;4817 pSORC->iTotalQpSlice = 0;
4802 pSORC->iTotalMbSlice = 0;4818 pSORC->iTotalMbSlice = 0;
4803 pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurLayer->sLayerInfo.pSliceInLayer[uiSliceIdx].iCountMbNumInSlice,4819 pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb *
4820 pCurLayer->sLayerInfo.pSliceInLayer[uiSliceIdx].iCountMbNumInSlice,
4804 INT_MULTIPLY);4821 INT_MULTIPLY);
4805 pSORC->iFrameBitsSlice = 0;4822 pSORC->iFrameBitsSlice = 0;
4806 pSORC->iGomBitsSlice = 0;4823 pSORC->iGomBitsSlice = 0;
@@ -4845,7 +4862,8 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 38 unmodified lines
4845 //init4862 //init
4846 {4863 {
4847 pStartSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = iFirstMbInPartition;4864 pStartSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = iFirstMbInPartition;
4848 pCurLayer->pNumSliceCodedOfPartition[kiPartitionId] = 1; // one slice per partition intialized, dynamic slicing inside4865 pCurLayer->pNumSliceCodedOfPartition[kiPartitionId] =
4866 1; // one slice per partition intialized, dynamic slicing inside
4849 pCurLayer->pLastMbIdxOfPartition[kiPartitionId] = iEndMbInPartition - 1;4867 pCurLayer->pLastMbIdxOfPartition[kiPartitionId] = iEndMbInPartition - 1;
4850 }4868 }
4851 pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = 0;4869 pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t