ref: 38ffbf7df48df92592410fe904e372f27b857dab
parent: 7c868cab4d6f962f7e0c6440e5151cb24253dec4
author: Sijia Chen <sijchen@cisco.com>
date: Fri May 8 07:10:19 EDT 2015
fix an improper mb-size assignment
--- a/codec/encoder/core/src/svc_enc_slice_segment.cpp
+++ b/codec/encoder/core/src/svc_enc_slice_segment.cpp
@@ -280,33 +280,33 @@
iGomSize = kiMbWidth * GOM_ROW_MODE0_360P;
else
iGomSize = kiMbWidth * GOM_ROW_MODE0_720P;
+ // GOM boundary aligned
+ int32_t iNumMbAssigning = WELS_DIV_ROUND (INT_MULTIPLY * kiMbNumPerSlice, iGomSize * INT_MULTIPLY) * iGomSize;
+ int32_t iCurNumMbAssigning = 0;
iMinimalMbNum = iGomSize;
- iMaximalMbNum = kiMbNumInFrame - (kuiSliceNum - 1) * iMinimalMbNum;
-
while (uiSliceIdx + 1 < kuiSliceNum) {
- // GOM boundary aligned
- int32_t iNumMbAssigning = WELS_DIV_ROUND (INT_MULTIPLY * kiMbNumPerSlice, iGomSize * INT_MULTIPLY) * iGomSize;
+ iMaximalMbNum = iNumMbLeft - (kuiSliceNum - uiSliceIdx - 1) * iMinimalMbNum; // get maximal num_mb in left parts
// make sure one GOM at least in each slice for safe
if (iNumMbAssigning < iMinimalMbNum)
- iNumMbAssigning = iMinimalMbNum;
+ iCurNumMbAssigning = iMinimalMbNum;
else if (iNumMbAssigning > iMaximalMbNum)
- iNumMbAssigning = iMaximalMbNum;
+ iCurNumMbAssigning = ( iMaximalMbNum / iGomSize ) * iGomSize;
+ else
+ iCurNumMbAssigning = iNumMbAssigning;
- if (iNumMbAssigning <= 0) {
+ if (iCurNumMbAssigning <= 0) {
return false;
}
- iNumMbLeft -= iNumMbAssigning;
+ iNumMbLeft -= iCurNumMbAssigning;
if (iNumMbLeft <= 0) {
return false;
}
- pSlicesAssignList[uiSliceIdx] = iNumMbAssigning;
-
+ pSlicesAssignList[uiSliceIdx] = iCurNumMbAssigning;
++ uiSliceIdx;
- iMaximalMbNum = iNumMbLeft - (kuiSliceNum - uiSliceIdx - 1) * iMinimalMbNum; // get maximal num_mb in left parts
}
pSlicesAssignList[uiSliceIdx] = iNumMbLeft;