Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 11 files). Show all
Unified · Split
| @@ -85,7 +85,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 84 unmodified lines | |||
| 85 | return ENC_RETURN_UNSUPPORTED_PARA; | 85 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 86 | } | 86 | } |
| 87 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { | 87 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { |
| 88 | SDLayerParam* fDlp = &pCfg->sDependencyLayers[i]; | 88 | SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i]; |
| 89 | if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn | 89 | if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn |
| 90 | && fDlp->fInputFrameRate <= fEpsn) | 90 | && fDlp->fInputFrameRate <= fEpsn) |
| 91 | || (fDlp->fOutputFrameRate >= -fEpsn && fDlp->fOutputFrameRate <= fEpsn)) { | 91 | || (fDlp->fOutputFrameRate >= -fEpsn && fDlp->fOutputFrameRate <= fEpsn)) { |
| @@ -103,7 +103,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 11 unmodified lines | |||
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { | 105 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { |
| 106 | SDLayerParam* fDlp = &pCfg->sDependencyLayers[i]; | 106 | SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i]; |
| 107 | if (fDlp->fInputFrameRate > fMaxFrameRate) | 107 | if (fDlp->fInputFrameRate > fMaxFrameRate) |
| 108 | fMaxFrameRate = fDlp->fInputFrameRate; | 108 | fMaxFrameRate = fDlp->fInputFrameRate; |
| 109 | } | 109 | } |
| @@ -117,8 +117,8 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 7 unmodified lines | |||
| 117 | if (pCfg->iRCMode != RC_OFF_MODE) { | 117 | if (pCfg->iRCMode != RC_OFF_MODE) { |
| 118 | int32_t iTotalBitrate = 0; | 118 | int32_t iTotalBitrate = 0; |
| 119 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { | 119 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { |
| 120 | SDLayerParam* fDlp = &pCfg->sDependencyLayers[i]; | 120 | SSpatialLayerConfig* pSpatialLayer = &pCfg->sSpatialLayers[i]; |
| 121 | iTotalBitrate += fDlp->iSpatialBitrate; | 121 | iTotalBitrate += pSpatialLayer->iSpatialBitrate; |
| 122 | } | 122 | } |
| 123 | if (iTotalBitrate > pCfg->iTargetBitrate) { | 123 | if (iTotalBitrate > pCfg->iTargetBitrate) { |
| 124 | WelsLog (pLogCtx, WELS_LOG_ERROR, | 124 | WelsLog (pLogCtx, WELS_LOG_ERROR, |
| @@ -190,9 +190,9 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 65 unmodified lines | |||
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | for (i = 0; i < pCodingParam->iSpatialLayerNum; ++ i) { | 192 | for (i = 0; i < pCodingParam->iSpatialLayerNum; ++ i) { |
| 193 | SDLayerParam* fDlp = &pCodingParam->sDependencyLayers[i]; | 193 | SSpatialLayerConfig* pSpatialLayer = &pCodingParam->sSpatialLayers[i]; |
| 194 | const int32_t kiPicWidth = fDlp->iFrameWidth; | 194 | const int32_t kiPicWidth = pSpatialLayer->iVideoWidth; |
| 195 | const int32_t kiPicHeight = fDlp->iFrameHeight; | 195 | const int32_t kiPicHeight = pSpatialLayer->iVideoHeight; |
| 196 | uint32_t iMbWidth = 0; | 196 | uint32_t iMbWidth = 0; |
| 197 | uint32_t iMbHeight = 0; | 197 | uint32_t iMbHeight = 0; |
| 198 | int32_t iMbNumInFrame = 0; | 198 | int32_t iMbNumInFrame = 0; |
| @@ -209,118 +209,119 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 10 unmodified lines | |||
| 209 | return ENC_RETURN_UNSUPPORTED_PARA; | 209 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | if (fDlp->sSliceCfg.uiSliceMode >= SM_RESERVED) { | 212 | if (pSpatialLayer->sSliceCfg.uiSliceMode >= SM_RESERVED) { |
| 213 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", | 213 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", |
| 214 | fDlp->sSliceCfg.uiSliceMode); | 214 | pSpatialLayer->sSliceCfg.uiSliceMode); |
| 215 | return ENC_RETURN_UNSUPPORTED_PARA; | 215 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 216 | } | 216 | } |
| 217 | if ((pCodingParam->uiMaxNalSize != 0) && (fDlp->sSliceCfg.uiSliceMode != SM_DYN_SLICE)) { | 217 | if ((pCodingParam->uiMaxNalSize != 0) && (pSpatialLayer->sSliceCfg.uiSliceMode != SM_DYN_SLICE)) { |
| 218 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!,MaxNalSize = %d\n", | 218 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!,MaxNalSize = %d\n", |
| 219 | fDlp->sSliceCfg.uiSliceMode, pCodingParam->uiMaxNalSize); | 219 | pSpatialLayer->sSliceCfg.uiSliceMode, pCodingParam->uiMaxNalSize); |
| 220 | return ENC_RETURN_UNSUPPORTED_PARA; | 220 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 221 | } | 221 | } |
| 222 | //check pSlice settings under multi-pSlice | 222 | //check pSlice settings under multi-pSlice |
| 223 | if (kiPicWidth <= 16 && kiPicHeight <= 16) { | 223 | if (kiPicWidth <= 16 && kiPicHeight <= 16) { |
| 224 | //only have one MB, set to single_slice | 224 | //only have one MB, set to single_slice |
| 225 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; | 225 | pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 226 | } | 226 | } |
| 227 | switch (fDlp->sSliceCfg.uiSliceMode) { | 227 | switch (pSpatialLayer->sSliceCfg.uiSliceMode) { |
| 228 | case SM_SINGLE_SLICE: | 228 | case SM_SINGLE_SLICE: |
| 229 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1; | 229 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = 1; |
| 230 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; | 230 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; |
| 231 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 0; | 231 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = 0; |
| 232 | for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) { | 232 | for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) { |
| 233 | fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[iIdx] = 0; | 233 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[iIdx] = 0; |
| 234 | } | 234 | } |
| 235 | break; | 235 | break; |
| 236 | case SM_FIXEDSLCNUM_SLICE: { | 236 | case SM_FIXEDSLCNUM_SLICE: { |
| 237 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; | 237 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; |
| 238 | 238 | ||
| 239 | iMbWidth = (kiPicWidth + 15) >> 4; | 239 | iMbWidth = (kiPicWidth + 15) >> 4; |
| 240 | iMbHeight = (kiPicHeight + 15) >> 4; | 240 | iMbHeight = (kiPicHeight + 15) >> 4; |
| 241 | iMbNumInFrame = iMbWidth * iMbHeight; | 241 | iMbNumInFrame = iMbWidth * iMbHeight; |
| 242 | iMaxSliceNum = MAX_SLICES_NUM; | 242 | iMaxSliceNum = MAX_SLICES_NUM; |
| 243 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 0 | 243 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0 |
| 244 | || fDlp->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { | 244 | || pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { |
| 245 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", | 245 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", |
| 246 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum); | 246 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum); |
| 247 | return ENC_RETURN_UNSUPPORTED_PARA; | 247 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 248 | } | 248 | } |
| 249 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum == 1) { | 249 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum == 1) { |
| 250 | WelsLog (pCtx, WELS_LOG_DEBUG, | 250 | WelsLog (pCtx, WELS_LOG_DEBUG, |
| 251 | "ParamValidationExt(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!\n", | 251 | "ParamValidationExt(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!\n", |
| 252 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum); | 252 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum); |
| 253 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; | 253 | pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 254 | break; | 254 | break; |
| 255 | } | 255 | } |
| 256 | if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom | 256 | if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom |
| 257 | //check uiSliceNum | 257 | //check uiSliceNum |
| 258 | GomValidCheckSliceNum (iMbWidth, iMbHeight, &fDlp->sSliceCfg.sSliceArgument.uiSliceNum); | 258 | GomValidCheckSliceNum (iMbWidth, iMbHeight, &pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum); |
| 259 | assert (fDlp->sSliceCfg.sSliceArgument.uiSliceNum > 1); | 259 | assert (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > 1); |
| 260 | //set uiSliceMbNum with current uiSliceNum | 260 | //set uiSliceMbNum with current uiSliceNum |
| 261 | GomValidCheckSliceMbNum (iMbWidth, iMbHeight, &fDlp->sSliceCfg.sSliceArgument); | 261 | GomValidCheckSliceMbNum (iMbWidth, iMbHeight, &pSpatialLayer->sSliceCfg.sSliceArgument); |
| 262 | } else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame, | 262 | } else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame, |
| 263 | &fDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings | 263 | &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings |
| 264 | //check uiSliceMbNum with current uiSliceNum | 264 | //check uiSliceMbNum with current uiSliceNum |
| 265 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | 265 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", |
| 266 | fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); | 266 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 267 | return ENC_RETURN_UNSUPPORTED_PARA; | 267 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 268 | } | 268 | } |
| 269 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting | 269 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting |
| 270 | if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) { | 270 | if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) { |
| 271 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; | 271 | pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 272 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1; | 272 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = 1; |
| 273 | break; | 273 | break; |
| 274 | } | 274 | } |
| 275 | } | 275 | } |
| 276 | break; | 276 | break; |
| 277 | case SM_AUTO_SLICE: { | 277 | case SM_AUTO_SLICE: { |
| 278 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; | 278 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; |
| 279 | } | 279 | } |
| 280 | break; | 280 | break; |
| 281 | case SM_RASTER_SLICE: { | 281 | case SM_RASTER_SLICE: { |
| 282 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; | 282 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; |
| 283 | 283 | ||
| 284 | iMbWidth = (kiPicWidth + 15) >> 4; | 284 | iMbWidth = (kiPicWidth + 15) >> 4; |
| 285 | iMbHeight = (kiPicHeight + 15) >> 4; | 285 | iMbHeight = (kiPicHeight + 15) >> 4; |
| 286 | iMbNumInFrame = iMbWidth * iMbHeight; | 286 | iMbNumInFrame = iMbWidth * iMbHeight; |
| 287 | iMaxSliceNum = MAX_SLICES_NUM; | 287 | iMaxSliceNum = MAX_SLICES_NUM; |
| 288 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0] <= 0) { | 288 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0] <= 0) { |
| 289 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | 289 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", |
| 290 | fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); | 290 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 291 | return ENC_RETURN_UNSUPPORTED_PARA; | 291 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | if (!CheckRasterMultiSliceSetting (iMbNumInFrame, &fDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings | 294 | if (!CheckRasterMultiSliceSetting (iMbNumInFrame, |
| 295 | &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings | ||
| 295 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | 296 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", |
| 296 | fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); | 297 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 297 | return ENC_RETURN_UNSUPPORTED_PARA; | 298 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 298 | } | 299 | } |
| 299 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 0 | 300 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0 |
| 300 | || fDlp->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings | 301 | || pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings |
| 301 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!\n", | 302 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!\n", |
| 302 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum); | 303 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum); |
| 303 | return ENC_RETURN_UNSUPPORTED_PARA; | 304 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 304 | } | 305 | } |
| 305 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum == 1) { | 306 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum == 1) { |
| 306 | WelsLog (pCtx, WELS_LOG_ERROR, | 307 | WelsLog (pCtx, WELS_LOG_ERROR, |
| 307 | "ParamValidationExt(), pSlice setting for SM_RASTER_SLICE now turn to SM_SINGLE_SLICE!\n"); | 308 | "ParamValidationExt(), pSlice setting for SM_RASTER_SLICE now turn to SM_SINGLE_SLICE!\n"); |
| 308 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; | 309 | pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 309 | break; | 310 | break; |
| 310 | } | 311 | } |
| 311 | if ((pCodingParam->iRCMode != RC_OFF_MODE) && fDlp->sSliceCfg.sSliceArgument.uiSliceNum > 1) { | 312 | if ((pCodingParam->iRCMode != RC_OFF_MODE) && pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > 1) { |
| 312 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), WARNING: GOM based RC do not support SM_RASTER_SLICE!\n"); | 313 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), WARNING: GOM based RC do not support SM_RASTER_SLICE!\n"); |
| 313 | } | 314 | } |
| 314 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting | 315 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting |
| 315 | if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) { | 316 | if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) { |
| 316 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; | 317 | pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 317 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1; | 318 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = 1; |
| 318 | break; | 319 | break; |
| 319 | } | 320 | } |
| 320 | } | 321 | } |
| 321 | break; | 322 | break; |
| 322 | case SM_ROWMB_SLICE: { | 323 | case SM_ROWMB_SLICE: { |
| 323 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; | 324 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; |
| 324 | 325 | ||
| 325 | iMbWidth = (kiPicWidth + 15) >> 4; | 326 | iMbWidth = (kiPicWidth + 15) >> 4; |
| 326 | iMbHeight = (kiPicHeight + 15) >> 4; | 327 | iMbHeight = (kiPicHeight + 15) >> 4; |
| @@ -329,16 +330,17 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 2 unmodified lines | |||
| 329 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings more than MAX!\n", iMbHeight); | 330 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings more than MAX!\n", iMbHeight); |
| 330 | return ENC_RETURN_UNSUPPORTED_PARA; | 331 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 331 | } | 332 | } |
| 332 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = iMbHeight; | 333 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = iMbHeight; |
| 333 | 334 | ||
| 334 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 0) { | 335 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0) { |
| 335 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", | 336 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", |
| 336 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum); | 337 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum); |
| 337 | return ENC_RETURN_UNSUPPORTED_PARA; | 338 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 338 | } | 339 | } |
| 339 | if (!CheckRowMbMultiSliceSetting (iMbWidth, &fDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings | 340 | if (!CheckRowMbMultiSliceSetting (iMbWidth, |
| 341 | &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings | ||
| 340 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | 342 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", |
| 341 | fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); | 343 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 342 | return ENC_RETURN_UNSUPPORTED_PARA; | 344 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 343 | } | 345 | } |
| 344 | } | 346 | } |
| @@ -346,9 +348,9 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 1 unmodified line | |||
| 346 | case SM_DYN_SLICE: { | 348 | case SM_DYN_SLICE: { |
| 347 | iMbWidth = (kiPicWidth + 15) >> 4; | 349 | iMbWidth = (kiPicWidth + 15) >> 4; |
| 348 | iMbHeight = (kiPicHeight + 15) >> 4; | 350 | iMbHeight = (kiPicHeight + 15) >> 4; |
| 349 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint <= 0) { | 351 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint <= 0) { |
| 350 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid iSliceSize (%d) settings!\n", | 352 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid iSliceSize (%d) settings!\n", |
| 351 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint); | 353 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint); |
| 352 | return ENC_RETURN_UNSUPPORTED_PARA; | 354 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 353 | } | 355 | } |
| 354 | 356 | ||
| @@ -358,24 +360,25 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 3 unmodified lines | |||
| 358 | return ENC_RETURN_UNSUPPORTED_PARA; | 360 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 359 | } | 361 | } |
| 360 | 362 | ||
| 361 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES)) { | 363 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize - |
| 364 | NAL_HEADER_ADD_0X30BYTES)) { | ||
| 362 | WelsLog (pCtx, WELS_LOG_WARNING, | 365 | WelsLog (pCtx, WELS_LOG_WARNING, |
| 363 | "ParamValidationExt(), slice mode = SM_DYN_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d!\n", | 366 | "ParamValidationExt(), slice mode = SM_DYN_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d!\n", |
| 364 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize); | 367 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize); |
| 365 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES; | 368 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES; |
| 366 | } | 369 | } |
| 367 | 370 | ||
| 368 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting | 371 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting |
| 369 | if (iMbWidth * iMbHeight <= MIN_NUM_MB_PER_SLICE) { | 372 | if (iMbWidth * iMbHeight <= MIN_NUM_MB_PER_SLICE) { |
| 370 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; | 373 | pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 371 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1; | 374 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = 1; |
| 372 | break; | 375 | break; |
| 373 | } | 376 | } |
| 374 | } | 377 | } |
| 375 | break; | 378 | break; |
| 376 | default: { | 379 | default: { |
| 377 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", | 380 | WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", |
| 378 | pCodingParam->sDependencyLayers[0].sSliceCfg.uiSliceMode); | 381 | pCodingParam->sSpatialLayers[0].sSliceCfg.uiSliceMode); |
| 379 | return ENC_RETURN_UNSUPPORTED_PARA; | 382 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 380 | 383 | ||
| 381 | } | 384 | } |
| @@ -388,7 +391,7 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 6 unmodified lines | |||
| 388 | 391 | ||
| 389 | 392 | ||
| 390 | void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam) { | 393 | void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam) { |
| 391 | SDLayerParam* pLayerParam; | 394 | SSpatialLayerInternal* pLayerParam; |
| 392 | const float kfEpsn = 0.000001f; | 395 | const float kfEpsn = 0.000001f; |
| 393 | const int32_t kiNumLayer = pParam->iSpatialLayerNum; | 396 | const int32_t kiNumLayer = pParam->iSpatialLayerNum; |
| 394 | int32_t i; | 397 | int32_t i; |
| @@ -416,7 +419,7 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 21 unmodified lines | |||
| 416 | //TODO (Sijia): this is a temporary solution which keep the ratio between layers | 419 | //TODO (Sijia): this is a temporary solution which keep the ratio between layers |
| 417 | //but it is also possible to fulfill the bitrate of lower layer first | 420 | //but it is also possible to fulfill the bitrate of lower layer first |
| 418 | 421 | ||
| 419 | SDLayerParam* pLayerParam; | 422 | SSpatialLayerConfig* pLayerParam; |
| 420 | const int32_t iNumLayers = pParam->iSpatialLayerNum; | 423 | const int32_t iNumLayers = pParam->iSpatialLayerNum; |
| 421 | int32_t i, iOrigTotalBitrate = 0; | 424 | int32_t i, iOrigTotalBitrate = 0; |
| 422 | if (iLayer == SPATIAL_LAYER_ALL) { | 425 | if (iLayer == SPATIAL_LAYER_ALL) { |
| @@ -428,12 +431,12 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 5 unmodified lines | |||
| 428 | } | 431 | } |
| 429 | //read old BR | 432 | //read old BR |
| 430 | for (i = 0; i < iNumLayers; i++) { | 433 | for (i = 0; i < iNumLayers; i++) { |
| 431 | iOrigTotalBitrate += pParam->sDependencyLayers[i].iSpatialBitrate; | 434 | iOrigTotalBitrate += pParam->sSpatialLayers[i].iSpatialBitrate; |
| 432 | } | 435 | } |
| 433 | //write new BR | 436 | //write new BR |
| 434 | float fRatio = 0.0; | 437 | float fRatio = 0.0; |
| 435 | for (i = 0; i < iNumLayers; i++) { | 438 | for (i = 0; i < iNumLayers; i++) { |
| 436 | pLayerParam = & (pParam->sDependencyLayers[i]); | 439 | pLayerParam = & (pParam->sSpatialLayers[i]); |
| 437 | fRatio = pLayerParam->iSpatialBitrate / (static_cast<float> (iOrigTotalBitrate)); | 440 | fRatio = pLayerParam->iSpatialBitrate / (static_cast<float> (iOrigTotalBitrate)); |
| 438 | pLayerParam->iSpatialBitrate = static_cast<int32_t> (pParam->iTargetBitrate * fRatio); | 441 | pLayerParam->iSpatialBitrate = static_cast<int32_t> (pParam->iTargetBitrate * fRatio); |
| 439 | } | 442 | } |
| @@ -468,7 +471,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 28 unmodified lines | |||
| 468 | iNumDependencyLayers = pParam->iSpatialLayerNum; | 471 | iNumDependencyLayers = pParam->iSpatialLayerNum; |
| 469 | 472 | ||
| 470 | do { | 473 | do { |
| 471 | SDLayerParam* pDLayer = &pParam->sDependencyLayers[iDIndex]; | 474 | SSpatialLayerConfig* pDLayer = &pParam->sSpatialLayers[iDIndex]; |
| 472 | // pDLayer->ptr_cfg = pParam; | 475 | // pDLayer->ptr_cfg = pParam; |
| 473 | int32_t iOrgNumNals = iCountNumNals; | 476 | int32_t iOrgNumNals = iCountNumNals; |
| 474 | 477 | ||
| @@ -484,8 +487,8 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 9 unmodified lines | |||
| 484 | // MAX_SLICES_NUM < MAX_LAYER_NUM_OF_FRAME ensured at svc_enc_slice_segment.h | 487 | // MAX_SLICES_NUM < MAX_LAYER_NUM_OF_FRAME ensured at svc_enc_slice_segment.h |
| 485 | assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER); | 488 | assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER); |
| 486 | } else { /*if ( SM_SINGLE_SLICE != pDLayer->sSliceCfg.uiSliceMode )*/ | 489 | } else { /*if ( SM_SINGLE_SLICE != pDLayer->sSliceCfg.uiSliceMode )*/ |
| 487 | const int32_t kiNumOfSlice = GetInitialSliceNum ((pDLayer->iFrameWidth + 0x0f) >> 4, | 490 | const int32_t kiNumOfSlice = GetInitialSliceNum ((pDLayer->iVideoWidth + 0x0f) >> 4, |
| 488 | (pDLayer->iFrameHeight + 0x0f) >> 4, | 491 | (pDLayer->iVideoHeight + 0x0f) >> 4, |
| 489 | &pDLayer->sSliceCfg); | 492 | &pDLayer->sSliceCfg); |
| 490 | 493 | ||
| 491 | // NEED check iCountNals value in case multiple slices is used | 494 | // NEED check iCountNals value in case multiple slices is used |
| @@ -616,8 +619,8 @@ int32_t InitMbListD (sWelsEncCtx** ppCtx) { · 124 unmodified lines | |||
| 616 | return 1; | 619 | return 1; |
| 617 | 620 | ||
| 618 | for (i = 0; i < iNumDlayer; i++) { | 621 | for (i = 0; i < iNumDlayer; i++) { |
| 619 | iMbWidth = ((*ppCtx)->pSvcParam->sDependencyLayers[i].iFrameWidth + 15) >> 4; | 622 | iMbWidth = ((*ppCtx)->pSvcParam->sSpatialLayers[i].iVideoWidth + 15) >> 4; |
| 620 | iMbHeight = ((*ppCtx)->pSvcParam->sDependencyLayers[i].iFrameHeight + 15) >> 4; | 623 | iMbHeight = ((*ppCtx)->pSvcParam->sSpatialLayers[i].iVideoHeight + 15) >> 4; |
| 621 | iMbSize[i] = iMbWidth * iMbHeight; | 624 | iMbSize[i] = iMbWidth * iMbHeight; |
| 622 | iOverallMbNum += iMbSize[i]; | 625 | iOverallMbNum += iMbSize[i]; |
| 623 | } | 626 | } |
| @@ -733,8 +736,8 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 109 unmodified lines | |||
| 733 | while (iDlayerIndex < iDlayerCount) { | 736 | while (iDlayerIndex < iDlayerCount) { |
| 734 | SRefList* pRefList = NULL; | 737 | SRefList* pRefList = NULL; |
| 735 | uint32_t i = 0; | 738 | uint32_t i = 0; |
| 736 | const int32_t kiWidth = pParam->sDependencyLayers[iDlayerIndex].iFrameWidth; | 739 | const int32_t kiWidth = pParam->sSpatialLayers[iDlayerIndex].iVideoWidth; |
| 737 | const int32_t kiHeight = pParam->sDependencyLayers[iDlayerIndex].iFrameHeight; | 740 | const int32_t kiHeight = pParam->sSpatialLayers[iDlayerIndex].iVideoHeight; |
| 738 | int32_t iPicWidth = WELS_ALIGN (kiWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with iWidth of horizon | 741 | int32_t iPicWidth = WELS_ALIGN (kiWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with iWidth of horizon |
| 739 | int32_t iPicChromaWidth = iPicWidth >> 1; | 742 | int32_t iPicChromaWidth = iPicWidth >> 1; |
| 740 | 743 | ||
| @@ -762,9 +765,9 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 21 unmodified lines | |||
| 762 | iDlayerIndex = 0; | 765 | iDlayerIndex = 0; |
| 763 | while (iDlayerIndex < iDlayerCount) { | 766 | while (iDlayerIndex < iDlayerCount) { |
| 764 | SDqLayer* pDqLayer = NULL; | 767 | SDqLayer* pDqLayer = NULL; |
| 765 | SDLayerParam* pDlayer = &pParam->sDependencyLayers[iDlayerIndex]; | 768 | SSpatialLayerConfig* pDlayer = &pParam->sSpatialLayers[iDlayerIndex]; |
| 766 | const int32_t kiMbW = (pDlayer->iFrameWidth + 0x0f) >> 4; | 769 | const int32_t kiMbW = (pDlayer->iVideoWidth + 0x0f) >> 4; |
| 767 | const int32_t kiMbH = (pDlayer->iFrameHeight + 0x0f) >> 4; | 770 | const int32_t kiMbH = (pDlayer->iVideoHeight + 0x0f) >> 4; |
| 768 | int32_t iMaxSliceNum = 1; | 771 | int32_t iMaxSliceNum = 1; |
| 769 | const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sSliceCfg); | 772 | const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sSliceCfg); |
| 770 | if (iMaxSliceNum < kiSliceNum) | 773 | if (iMaxSliceNum < kiSliceNum) |
| @@ -851,7 +854,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 80 unmodified lines | |||
| 851 | pDqLayer->pFeatureSearchPreparation = static_cast<SFeatureSearchPreparation*> (pMa->WelsMallocz (sizeof ( | 854 | pDqLayer->pFeatureSearchPreparation = static_cast<SFeatureSearchPreparation*> (pMa->WelsMallocz (sizeof ( |
| 852 | SFeatureSearchPreparation), "pFeatureSearchPreparation")); | 855 | SFeatureSearchPreparation), "pFeatureSearchPreparation")); |
| 853 | WELS_VERIFY_RETURN_PROC_IF (1, NULL == pDqLayer->pFeatureSearchPreparation, FreeMemorySvc (ppCtx)); | 856 | WELS_VERIFY_RETURN_PROC_IF (1, NULL == pDqLayer->pFeatureSearchPreparation, FreeMemorySvc (ppCtx)); |
| 854 | int32_t iReturn = RequestFeatureSearchPreparation (pMa, pDlayer->iFrameWidth, pDlayer->iFrameHeight, | 857 | int32_t iReturn = RequestFeatureSearchPreparation (pMa, pDlayer->iVideoWidth, pDlayer->iVideoHeight, |
| 855 | kiNeedFeatureStorage, | 858 | kiNeedFeatureStorage, |
| 856 | pDqLayer->pFeatureSearchPreparation); | 859 | pDqLayer->pFeatureSearchPreparation); |
| 857 | WELS_VERIFY_RETURN_PROC_IF (1, ENC_RETURN_SUCCESS != iReturn, FreeMemorySvc (ppCtx)); | 860 | WELS_VERIFY_RETURN_PROC_IF (1, ENC_RETURN_SUCCESS != iReturn, FreeMemorySvc (ppCtx)); |
| @@ -882,7 +885,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 24 unmodified lines | |||
| 882 | while (iDlayerIndex < iDlayerCount) { | 885 | while (iDlayerIndex < iDlayerCount) { |
| 883 | SDqIdc* pDqIdc = & (*ppCtx)->pDqIdcMap[iDlayerIndex]; | 886 | SDqIdc* pDqIdc = & (*ppCtx)->pDqIdcMap[iDlayerIndex]; |
| 884 | const bool bUseSubsetSps = (iDlayerIndex > BASE_DEPENDENCY_ID); | 887 | const bool bUseSubsetSps = (iDlayerIndex > BASE_DEPENDENCY_ID); |
| 885 | SDLayerParam* pDlayerParam = &pParam->sDependencyLayers[iDlayerIndex]; | 888 | SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex]; |
| 886 | 889 | ||
| 887 | pDqIdc->uiSpatialId = iDlayerIndex; | 890 | pDqIdc->uiSpatialId = iDlayerIndex; |
| 888 | pPps = & (*ppCtx)->pPPSArray[iPpsId]; | 891 | pPps = & (*ppCtx)->pPPSArray[iPpsId]; |
| @@ -895,8 +898,8 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 6 unmodified lines | |||
| 895 | 898 | ||
| 896 | // Need port pSps/pPps initialization due to spatial scalability changed | 899 | // Need port pSps/pPps initialization due to spatial scalability changed |
| 897 | if (!bUseSubsetSps) { | 900 | if (!bUseSubsetSps) { |
| 898 | WelsInitSps (pSps, pDlayerParam, pParam->uiIntraPeriod, pParam->iNumRefFrame, iSpsId, | 901 | WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, pParam->iNumRefFrame, |
| 899 | pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE); | 902 | iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE); |
| 900 | 903 | ||
| 901 | if (iDlayerCount > 1) { | 904 | if (iDlayerCount > 1) { |
| 902 | pSps->bConstraintSet0Flag = true; | 905 | pSps->bConstraintSet0Flag = true; |
| @@ -904,8 +907,9 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 1 unmodified line | |||
| 904 | pSps->bConstraintSet2Flag = true; | 907 | pSps->bConstraintSet2Flag = true; |
| 905 | } | 908 | } |
| 906 | } else { | 909 | } else { |
| 907 | WelsInitSubsetSps (pSubsetSps, pDlayerParam, pParam->uiIntraPeriod, pParam->iNumRefFrame, iSpsId, | 910 | WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, |
| 908 | pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE); | 911 | pParam->iNumRefFrame, |
| 912 | iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE); | ||
| 909 | } | 913 | } |
| 910 | 914 | ||
| 911 | // initialize pPps | 915 | // initialize pPps |
| @@ -984,8 +988,8 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers · 72 unmodified lines | |||
| 984 | 988 | ||
| 985 | iSpatialIdx = 0; | 989 | iSpatialIdx = 0; |
| 986 | while (iSpatialIdx < kiNumSpatialLayers) { | 990 | while (iSpatialIdx < kiNumSpatialLayers) { |
| 987 | const int32_t kiTmpWidth = (pParam->sDependencyLayers[iSpatialIdx].iFrameWidth + 15) >> 4; | 991 | const int32_t kiTmpWidth = (pParam->sSpatialLayers[iSpatialIdx].iVideoWidth + 15) >> 4; |
| 988 | const int32_t kiTmpHeight = (pParam->sDependencyLayers[iSpatialIdx].iFrameHeight + 15) >> 4; | 992 | const int32_t kiTmpHeight = (pParam->sSpatialLayers[iSpatialIdx].iVideoHeight + 15) >> 4; |
| 989 | int32_t iNumMb = kiTmpWidth * kiTmpHeight; | 993 | int32_t iNumMb = kiTmpWidth * kiTmpHeight; |
| 990 | 994 | ||
| 991 | sMbSizeMap[iSpatialIdx].iMbWidth = kiTmpWidth; | 995 | sMbSizeMap[iSpatialIdx].iMbWidth = kiTmpWidth; |
| @@ -1005,9 +1009,9 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers · 13 unmodified lines | |||
| 1005 | 1009 | ||
| 1006 | iSpatialIdx = 0; | 1010 | iSpatialIdx = 0; |
| 1007 | while (iSpatialIdx < kiNumSpatialLayers) { | 1011 | while (iSpatialIdx < kiNumSpatialLayers) { |
| 1008 | SDLayerParam* fDlp = &pParam->sDependencyLayers[iSpatialIdx]; | 1012 | SSpatialLayerConfig* fDlp = &pParam->sSpatialLayers[iSpatialIdx]; |
| 1009 | 1013 | ||
| 1010 | const int32_t kiWidthPad = WELS_ALIGN (fDlp->iFrameWidth, 16) + (PADDING_LENGTH << 1); | 1014 | const int32_t kiWidthPad = WELS_ALIGN (fDlp->iVideoWidth, 16) + (PADDING_LENGTH << 1); |
| 1011 | iLineSizeY[iSpatialIdx][kbBaseTemporalFlag] = WELS_ALIGN (kiWidthPad, 32); | 1015 | iLineSizeY[iSpatialIdx][kbBaseTemporalFlag] = WELS_ALIGN (kiWidthPad, 32); |
| 1012 | iLineSizeUV[iSpatialIdx][kbBaseTemporalFlag] = WELS_ALIGN ((kiWidthPad >> 1), 16); | 1016 | iLineSizeUV[iSpatialIdx][kbBaseTemporalFlag] = WELS_ALIGN ((kiWidthPad >> 1), 16); |
| 1013 | 1017 | ||
| @@ -1230,7 +1234,7 @@ void ReleaseMemoryVaaScreen (SVAAFrameInfo* pVaa, CMemoryAlign* pMa, const int3 · 216 unmodified lines | |||
| 1230 | int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { | 1234 | int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { |
| 1231 | SWelsSvcCodingParam* pParam = (*ppCtx)->pSvcParam; | 1235 | SWelsSvcCodingParam* pParam = (*ppCtx)->pSvcParam; |
| 1232 | CMemoryAlign* pMa = (*ppCtx)->pMemAlign; | 1236 | CMemoryAlign* pMa = (*ppCtx)->pMemAlign; |
| 1233 | SDLayerParam* pFinalSpatial = NULL; | 1237 | SSpatialLayerConfig* pFinalSpatial = NULL; |
| 1234 | int32_t iCountBsLen = 0; | 1238 | int32_t iCountBsLen = 0; |
| 1235 | int32_t iCountNals = 0; | 1239 | int32_t iCountNals = 0; |
| 1236 | int32_t iMaxPicWidth = 0; | 1240 | int32_t iMaxPicWidth = 0; |
| @@ -1265,9 +1269,9 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 28 unmodified lines | |||
| 1265 | return 1; | 1269 | return 1; |
| 1266 | } | 1270 | } |
| 1267 | 1271 | ||
| 1268 | pFinalSpatial = &pParam->sDependencyLayers[kiNumDependencyLayers - 1]; | 1272 | pFinalSpatial = &pParam->sSpatialLayers[kiNumDependencyLayers - 1]; |
| 1269 | iMaxPicWidth = pFinalSpatial->iFrameWidth; | 1273 | iMaxPicWidth = pFinalSpatial->iVideoWidth; |
| 1270 | iMaxPicHeight = pFinalSpatial->iFrameHeight; | 1274 | iMaxPicHeight = pFinalSpatial->iVideoHeight; |
| 1271 | iCountMaxMbNum = ((15 + iMaxPicWidth) >> 4) * ((15 + iMaxPicHeight) >> 4); | 1275 | iCountMaxMbNum = ((15 + iMaxPicWidth) >> 4) * ((15 + iMaxPicHeight) >> 4); |
| 1272 | 1276 | ||
| 1273 | iResult = AcquireLayersNals (ppCtx, pParam, &iCountLayers, &iCountNals); | 1277 | iResult = AcquireLayersNals (ppCtx, pParam, &iCountLayers, &iCountNals); |
| @@ -1283,11 +1287,11 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 9 unmodified lines | |||
| 1283 | int32_t iLayerBsSize = 0; | 1287 | int32_t iLayerBsSize = 0; |
| 1284 | iIndex = 0; | 1288 | iIndex = 0; |
| 1285 | while (iIndex < pParam->iSpatialLayerNum) { | 1289 | while (iIndex < pParam->iSpatialLayerNum) { |
| 1286 | SDLayerParam* fDlp = &pParam->sDependencyLayers[iIndex]; | 1290 | SSpatialLayerConfig* fDlp = &pParam->sSpatialLayers[iIndex]; |
| 1287 | 1291 | ||
| 1288 | fCompressRatioThr = COMPRESS_RATIO_THR; | 1292 | fCompressRatioThr = COMPRESS_RATIO_THR; |
| 1289 | 1293 | ||
| 1290 | iLayerBsSize = WELS_ROUND (((3 * fDlp->iFrameWidth * fDlp->iFrameHeight) >> 1) * fCompressRatioThr) + | 1294 | iLayerBsSize = WELS_ROUND (((3 * fDlp->iVideoWidth * fDlp->iVideoHeight) >> 1) * fCompressRatioThr) + |
| 1291 | MAX_MACROBLOCK_SIZE_IN_BYTE; | 1295 | MAX_MACROBLOCK_SIZE_IN_BYTE; |
| 1292 | iLayerBsSize = WELS_ALIGN (iLayerBsSize, 4); // 4 bytes alinged | 1296 | iLayerBsSize = WELS_ALIGN (iLayerBsSize, 4); // 4 bytes alinged |
| 1293 | iVclLayersBsSizeCount += iLayerBsSize; | 1297 | iVclLayersBsSizeCount += iLayerBsSize; |
| @@ -1581,7 +1585,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 287 unmodified lines | |||
| 1581 | if (NULL != pCtx->ppDqLayerList && pParam != NULL) { | 1585 | if (NULL != pCtx->ppDqLayerList && pParam != NULL) { |
| 1582 | while (ilayer < pParam->iSpatialLayerNum) { | 1586 | while (ilayer < pParam->iSpatialLayerNum) { |
| 1583 | SDqLayer* pDq = pCtx->ppDqLayerList[ilayer]; | 1587 | SDqLayer* pDq = pCtx->ppDqLayerList[ilayer]; |
| 1584 | SDLayerParam* pDlp = &pCtx->pSvcParam->sDependencyLayers[ilayer]; | 1588 | SSpatialLayerConfig* pDlp = &pCtx->pSvcParam->sSpatialLayers[ilayer]; |
| 1585 | 1589 | ||
| 1586 | const bool kbIsDynamicSlicing = (SM_DYN_SLICE == pDlp->sSliceCfg.uiSliceMode); | 1590 | const bool kbIsDynamicSlicing = (SM_DYN_SLICE == pDlp->sSliceCfg.uiSliceMode); |
| 1587 | 1591 | ||
| @@ -1740,11 +1744,11 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar · 152 unmodified lines | |||
| 1740 | uint16_t iMaxSliceCount = 0; | 1744 | uint16_t iMaxSliceCount = 0; |
| 1741 | 1745 | ||
| 1742 | do { | 1746 | do { |
| 1743 | SDLayerParam* pDlp = &pCodingParam->sDependencyLayers[iSpatialIdx]; | 1747 | SSpatialLayerConfig* pDlp = &pCodingParam->sSpatialLayers[iSpatialIdx]; |
| 1744 | SSliceConfig* pMso = &pDlp->sSliceCfg; | 1748 | SSliceConfig* pMso = &pDlp->sSliceCfg; |
| 1745 | SSliceArgument* pSlcArg = &pMso->sSliceArgument; | 1749 | SSliceArgument* pSlcArg = &pMso->sSliceArgument; |
| 1746 | const int32_t kiMbWidth = (pDlp->iFrameWidth + 15) >> 4; | 1750 | const int32_t kiMbWidth = (pDlp->iVideoWidth + 15) >> 4; |
| 1747 | const int32_t kiMbHeight = (pDlp->iFrameHeight + 15) >> 4; | 1751 | const int32_t kiMbHeight = (pDlp->iVideoHeight + 15) >> 4; |
| 1748 | const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight; | 1752 | const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight; |
| 1749 | int32_t iSliceNum = (SM_AUTO_SLICE == pMso->uiSliceMode) ? kiCpuCores : pSlcArg->uiSliceNum; | 1753 | int32_t iSliceNum = (SM_AUTO_SLICE == pMso->uiSliceMode) ? kiCpuCores : pSlcArg->uiSliceNum; |
| 1750 | // NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode, | 1754 | // NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode, |
| @@ -2155,7 +2159,7 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 404 unmodified lines | |||
| 2155 | /*! | 2159 | /*! |
| 2156 | * \brief get temporal level due to configuration and coding context | 2160 | * \brief get temporal level due to configuration and coding context |
| 2157 | */ | 2161 | */ |
| 2158 | int32_t GetTemporalLevel (SDLayerParam* fDlp, const int32_t kiFrameNum, const int32_t kiGopSize) { | 2162 | int32_t GetTemporalLevel (SSpatialLayerInternal* fDlp, const int32_t kiFrameNum, const int32_t kiGopSize) { |
| 2159 | const int32_t kiCodingIdx = kiFrameNum & (kiGopSize - 1); | 2163 | const int32_t kiCodingIdx = kiFrameNum & (kiGopSize - 1); |
| 2160 | 2164 | ||
| 2161 | return fDlp->uiCodingIdx2TemporalId[kiCodingIdx]; | 2165 | return fDlp->uiCodingIdx2TemporalId[kiCodingIdx]; |
| @@ -2274,12 +2278,12 @@ void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) { · 112 unmodified lines | |||
| 2274 | if (pCtx->pSvcParam->iRCMode != RC_OFF_MODE) { | 2278 | if (pCtx->pSvcParam->iRCMode != RC_OFF_MODE) { |
| 2275 | //RC case | 2279 | //RC case |
| 2276 | uiFrmByte = ( | 2280 | uiFrmByte = ( |
| 2277 | ((uint32_t) (pCtx->pSvcParam->sDependencyLayers[iCurDid].iSpatialBitrate) | 2281 | ((uint32_t) (pCtx->pSvcParam->sSpatialLayers[iCurDid].iSpatialBitrate) |
| 2278 | / (uint32_t) (pCtx->pSvcParam->sDependencyLayers[iCurDid].fInputFrameRate)) >> 3); | 2282 | / (uint32_t) (pCtx->pSvcParam->sDependencyLayers[iCurDid].fInputFrameRate)) >> 3); |
| 2279 | } else { | 2283 | } else { |
| 2280 | //fixed QP case | 2284 | //fixed QP case |
| 2281 | const int32_t iTtlMbNumInFrame = pSliceCtx->iMbNumInFrame; | 2285 | const int32_t iTtlMbNumInFrame = pSliceCtx->iMbNumInFrame; |
| 2282 | int32_t iQDeltaTo26 = (26 - pCtx->pSvcParam->sDependencyLayers[iCurDid].iDLayerQp); | 2286 | int32_t iQDeltaTo26 = (26 - pCtx->pSvcParam->sSpatialLayers[iCurDid].iDLayerQp); |
| 2283 | 2287 | ||
| 2284 | uiFrmByte = (iTtlMbNumInFrame * byte_complexIMBat26); | 2288 | uiFrmByte = (iTtlMbNumInFrame * byte_complexIMBat26); |
| 2285 | if (iQDeltaTo26 > 0) { | 2289 | if (iQDeltaTo26 > 0) { |
| @@ -2325,7 +2329,7 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx, · 39 unmodified lines | |||
| 2325 | SSlice* pSlice = NULL; | 2329 | SSlice* pSlice = NULL; |
| 2326 | const uint8_t kiCurDid = pCtx->uiDependencyId; | 2330 | const uint8_t kiCurDid = pCtx->uiDependencyId; |
| 2327 | const bool kbUseSubsetSpsFlag = (kiCurDid > BASE_DEPENDENCY_ID); | 2331 | const bool kbUseSubsetSpsFlag = (kiCurDid > BASE_DEPENDENCY_ID); |
| 2328 | SDLayerParam* fDlp = &pParam->sDependencyLayers[kiCurDid]; | 2332 | SSpatialLayerConfig* fDlp = &pParam->sSpatialLayers[kiCurDid]; |
| 2329 | SNalUnitHeaderExt* pNalHdExt = &pCurDq->sLayerInfo.sNalHeaderExt; | 2333 | SNalUnitHeaderExt* pNalHdExt = &pCurDq->sLayerInfo.sNalHeaderExt; |
| 2330 | SNalUnitHeader* pNalHd = &pNalHdExt->sNalHeader; | 2334 | SNalUnitHeader* pNalHd = &pNalHdExt->sNalHeader; |
| 2331 | SDqIdc* pDqIdc = &pCtx->pDqIdcMap[kiCurDid]; | 2335 | SDqIdc* pDqIdc = &pCtx->pDqIdcMap[kiCurDid]; |
| @@ -2962,7 +2966,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 630 unmodified lines | |||
| 2962 | 2966 | ||
| 2963 | while (iSpatialIdx < iSpatialNum) { | 2967 | while (iSpatialIdx < iSpatialNum) { |
| 2964 | const int32_t iDidIdx = (pSpatialIndexMap + iSpatialIdx)->iDid; // get iDid | 2968 | const int32_t iDidIdx = (pSpatialIndexMap + iSpatialIdx)->iDid; // get iDid |
| 2965 | SDLayerParam* pParam = &pSvcParam->sDependencyLayers[iDidIdx]; | 2969 | SSpatialLayerConfig* pParam = &pSvcParam->sSpatialLayers[iDidIdx]; |
| 2966 | 2970 | ||
| 2967 | pCtx->uiDependencyId = iCurDid = (int8_t)iDidIdx; | 2971 | pCtx->uiDependencyId = iCurDid = (int8_t)iDidIdx; |
| 2968 | pCtx->pVpp->AnalyzeSpatialPic (pCtx, iDidIdx); | 2972 | pCtx->pVpp->AnalyzeSpatialPic (pCtx, iDidIdx); |
| @@ -2971,8 +2975,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2 unmodified lines | |||
| 2971 | pCtx->pEncPic->iPictureType = pCtx->eSliceType; | 2975 | pCtx->pEncPic->iPictureType = pCtx->eSliceType; |
| 2972 | pCtx->pEncPic->iFramePoc = pCtx->iPOC; | 2976 | pCtx->pEncPic->iFramePoc = pCtx->iPOC; |
| 2973 | 2977 | ||
| 2974 | iCurWidth = pParam->iFrameWidth; | 2978 | iCurWidth = pParam->iVideoWidth; |
| 2975 | iCurHeight = pParam->iFrameHeight; | 2979 | iCurHeight = pParam->iVideoHeight; |
| 2976 | 2980 | ||
| 2977 | iDidList[iSpatialIdx] = iCurDid; | 2981 | iDidList[iSpatialIdx] = iCurDid; |
| 2978 | 2982 | ||
| @@ -2982,8 +2986,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3 unmodified lines | |||
| 2982 | case SM_FIXEDSLCNUM_SLICE: | 2986 | case SM_FIXEDSLCNUM_SLICE: |
| 2983 | case SM_AUTO_SLICE: { | 2987 | case SM_AUTO_SLICE: { |
| 2984 | if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) && | 2988 | if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) && |
| 2985 | (pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE | 2989 | (pSvcParam->sSpatialLayers[iCurDid].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE |
| 2986 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.sSliceArgument.uiSliceNum) | 2990 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[iCurDid].sSliceCfg.sSliceArgument.uiSliceNum) |
| 2987 | ) | 2991 | ) |
| 2988 | AdjustEnhanceLayer (pCtx, iCurDid); | 2992 | AdjustEnhanceLayer (pCtx, iCurDid); |
| 2989 | break; | 2993 | break; |
| @@ -3297,7 +3301,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 307 unmodified lines | |||
| 3297 | if ( | 3301 | if ( |
| 3298 | (!pCtx->pCurDqLayer->bDeblockingParallelFlag) && | 3302 | (!pCtx->pCurDqLayer->bDeblockingParallelFlag) && |
| 3299 | #if !defined(ENABLE_FRAME_DUMP) | 3303 | #if !defined(ENABLE_FRAME_DUMP) |
| 3300 | ((eNalRefIdc != NRI_PRI_LOWEST) && (pParam->iHighestTemporalId == 0 || iCurTid < pParam->iHighestTemporalId)) && | 3304 | ((eNalRefIdc != NRI_PRI_LOWEST) && (pSvcParam->sDependencyLayers[iDidIdx].iHighestTemporalId == 0 |
| 3305 | || iCurTid < pSvcParam->sDependencyLayers[iDidIdx].iHighestTemporalId)) && | ||
| 3301 | #endif//!ENABLE_FRAME_DUMP | 3306 | #endif//!ENABLE_FRAME_DUMP |
| 3302 | true | 3307 | true |
| 3303 | ) { | 3308 | ) { |
| @@ -3478,12 +3483,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 174 unmodified lines | |||
| 3478 | #endif//MT_DEBUG | 3483 | #endif//MT_DEBUG |
| 3479 | 3484 | ||
| 3480 | if (pSvcParam->iMultipleThreadIdc > 1 && iDidList[0] == BASE_DEPENDENCY_ID | 3485 | if (pSvcParam->iMultipleThreadIdc > 1 && iDidList[0] == BASE_DEPENDENCY_ID |
| 3481 | && ((pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE) | 3486 | && ((pSvcParam->sSpatialLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE) |
| 3482 | || (pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) | 3487 | || (pSvcParam->sSpatialLayers[0].sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) |
| 3483 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sSliceCfg.sSliceArgument.uiSliceNum | 3488 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum |
| 3484 | && ((pSvcParam->sDependencyLayers[iDidList[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE) | 3489 | && ((pSvcParam->sSpatialLayers[iDidList[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE) |
| 3485 | || (pSvcParam->sDependencyLayers[iDidList[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) | 3490 | || (pSvcParam->sSpatialLayers[iDidList[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) |
| 3486 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[iDidList[iSpatialNum - | 3491 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[iDidList[iSpatialNum - |
| 3487 | 1]].sSliceCfg.sSliceArgument.uiSliceNum) { | 3492 | 1]].sSliceCfg.sSliceArgument.uiSliceNum) { |
| 3488 | AdjustBaseLayer (pCtx); | 3493 | AdjustBaseLayer (pCtx); |
| 3489 | } | 3494 | } |
| @@ -3538,22 +3543,24 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 48 unmodified lines | |||
| 3538 | iIndexD = 0; | 3543 | iIndexD = 0; |
| 3539 | assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum); | 3544 | assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum); |
| 3540 | do { | 3545 | do { |
| 3541 | const SDLayerParam* kpOldDlp = &pOldParam->sDependencyLayers[iIndexD]; | 3546 | const SSpatialLayerInternal* kpOldDlp = &pOldParam->sDependencyLayers[iIndexD]; |
| 3542 | const SDLayerParam* kpNewDlp = &pNewParam->sDependencyLayers[iIndexD]; | 3547 | const SSpatialLayerInternal* kpNewDlp = &pNewParam->sDependencyLayers[iIndexD]; |
| 3543 | float fT1 = .0f; | 3548 | float fT1 = .0f; |
| 3544 | float fT2 = .0f; | 3549 | float fT2 = .0f; |
| 3545 | 3550 | ||
| 3546 | // check frame size settings | 3551 | // check frame size settings |
| 3547 | if (kpOldDlp->iFrameWidth != kpNewDlp->iFrameWidth || | 3552 | if (pOldParam->sSpatialLayers[iIndexD].iVideoWidth != pNewParam->sSpatialLayers[iIndexD].iVideoWidth || |
| 3548 | kpOldDlp->iFrameHeight != kpNewDlp->iFrameHeight || | 3553 | pOldParam->sSpatialLayers[iIndexD].iVideoHeight != pNewParam->sSpatialLayers[iIndexD].iVideoHeight || |
| 3549 | kpOldDlp->iActualWidth != kpNewDlp->iActualWidth || | 3554 | kpOldDlp->iActualWidth != kpNewDlp->iActualWidth || |
| 3550 | kpOldDlp->iActualHeight != kpNewDlp->iActualHeight) { | 3555 | kpOldDlp->iActualHeight != kpNewDlp->iActualHeight) { |
| 3551 | bNeedReset = true; | 3556 | bNeedReset = true; |
| 3552 | break; | 3557 | break; |
| 3553 | } | 3558 | } |
| 3554 | 3559 | ||
| 3555 | if (kpOldDlp->sSliceCfg.uiSliceMode != kpNewDlp->sSliceCfg.uiSliceMode || | 3560 | if (pOldParam->sSpatialLayers[iIndexD].sSliceCfg.uiSliceMode != pNewParam->sSpatialLayers[iIndexD].sSliceCfg.uiSliceMode |
| 3556 | kpOldDlp->sSliceCfg.sSliceArgument.uiSliceNum != kpNewDlp->sSliceCfg.sSliceArgument.uiSliceNum) { | 3561 | || |
| 3562 | pOldParam->sSpatialLayers[iIndexD].sSliceCfg.sSliceArgument.uiSliceNum != | ||
| 3563 | pNewParam->sSpatialLayers[iIndexD].sSliceCfg.sSliceArgument.uiSliceNum) { | ||
| 3557 | bNeedReset = true; | 3564 | bNeedReset = true; |
| 3558 | break; | 3565 | break; |
| 3559 | } | 3566 | } |
| @@ -3653,21 +3660,24 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 93 unmodified lines | |||
| 3653 | // d | 3660 | // d |
| 3654 | iIndexD = 0; | 3661 | iIndexD = 0; |
| 3655 | do { | 3662 | do { |
| 3656 | SDLayerParam* pOldDlp = &pOldParam->sDependencyLayers[iIndexD]; | 3663 | SSpatialLayerInternal* pOldDlpInternal = &pOldParam->sDependencyLayers[iIndexD]; |
| 3657 | SDLayerParam* pNewDlp = &pNewParam->sDependencyLayers[iIndexD]; | 3664 | SSpatialLayerInternal* pNewDlpInternal = &pNewParam->sDependencyLayers[iIndexD]; |
| 3658 | 3665 | ||
| 3659 | pOldDlp->fInputFrameRate = pNewDlp->fInputFrameRate; // input frame rate | 3666 | SSpatialLayerConfig* pOldDlp = &pOldParam->sSpatialLayers[iIndexD]; |
| 3660 | pOldDlp->fOutputFrameRate = pNewDlp->fOutputFrameRate; // output frame rate | 3667 | SSpatialLayerConfig* pNewDlp = &pNewParam->sSpatialLayers[iIndexD]; |
| 3668 | |||
| 3669 | pOldDlpInternal->fInputFrameRate = pNewDlpInternal->fInputFrameRate; // input frame rate | ||
| 3670 | pOldDlpInternal->fOutputFrameRate = pNewDlpInternal->fOutputFrameRate; // output frame rate | ||
| 3661 | pOldDlp->iSpatialBitrate = pNewDlp->iSpatialBitrate; | 3671 | pOldDlp->iSpatialBitrate = pNewDlp->iSpatialBitrate; |
| 3662 | 3672 | ||
| 3663 | pOldDlp->uiProfileIdc = pNewDlp->uiProfileIdc; // value of profile IDC (0 for auto-detection) | 3673 | pOldDlp->uiProfileIdc = pNewDlp->uiProfileIdc; // value of profile IDC (0 for auto-detection) |
| 3664 | 3674 | ||
| 3665 | /* Derived variants below */ | 3675 | /* Derived variants below */ |
| 3666 | pOldDlp->iTemporalResolution = pNewDlp->iTemporalResolution; | 3676 | pOldDlpInternal->iTemporalResolution = pNewDlpInternal->iTemporalResolution; |
| 3667 | pOldDlp->iDecompositionStages = pNewDlp->iDecompositionStages; | 3677 | pOldDlpInternal->iDecompositionStages = pNewDlpInternal->iDecompositionStages; |
| 3668 | 3678 | ||
| 3669 | memcpy (pOldDlp->uiCodingIdx2TemporalId, pNewDlp->uiCodingIdx2TemporalId, | 3679 | memcpy (pOldDlpInternal->uiCodingIdx2TemporalId, pNewDlpInternal->uiCodingIdx2TemporalId, |
| 3670 | sizeof (pOldDlp->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage | 3680 | sizeof (pOldDlpInternal->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage |
| 3671 | 3681 | ||
| 3672 | ++ iIndexD; | 3682 | ++ iIndexD; |
| 3673 | } while (iIndexD < pOldParam->iSpatialLayerNum); | 3683 | } while (iIndexD < pOldParam->iSpatialLayerNum); |