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