Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 30 files). Show all
Unified · Split
| @@ -88,7 +88,7 @@ int32_t ParamValidation (SWelsSvcCodingParam* pCfg) { · 87 unmodified lines | |||
| 88 | 88 | ||
| 89 | assert (pCfg != NULL); | 89 | assert (pCfg != NULL); |
| 90 | 90 | ||
| 91 | for (i = 0; i < pCfg->iNumDependencyLayer; ++ i) { | 91 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { |
| 92 | SDLayerParam* fDlp = &pCfg->sDependencyLayers[i]; | 92 | SDLayerParam* fDlp = &pCfg->sDependencyLayers[i]; |
| 93 | if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn | 93 | if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn |
| 94 | && fDlp->fInputFrameRate <= fEpsn) | 94 | && fDlp->fInputFrameRate <= fEpsn) |
| @@ -109,7 +109,7 @@ int32_t ParamValidation (SWelsSvcCodingParam* pCfg) { · 14 unmodified lines | |||
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | for (i = 0; i < pCfg->iNumDependencyLayer; ++ i) { | 112 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { |
| 113 | SDLayerParam* fDlp = &pCfg->sDependencyLayers[i]; | 113 | SDLayerParam* fDlp = &pCfg->sDependencyLayers[i]; |
| 114 | if (fDlp->fInputFrameRate > fMaxFrameRate) | 114 | if (fDlp->fInputFrameRate > fMaxFrameRate) |
| 115 | fMaxFrameRate = fDlp->fInputFrameRate; | 115 | fMaxFrameRate = fDlp->fInputFrameRate; |
| @@ -120,7 +120,7 @@ int32_t ParamValidation (SWelsSvcCodingParam* pCfg) { · 4 unmodified lines | |||
| 120 | pCfg->fMaxFrameRate = fMaxFrameRate; | 120 | pCfg->fMaxFrameRate = fMaxFrameRate; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | for (i = 0; i < pCfg->iNumDependencyLayer; ++ i) { | 123 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { |
| 124 | SDLayerParam* fDlp = &pCfg->sDependencyLayers[i]; | 124 | SDLayerParam* fDlp = &pCfg->sDependencyLayers[i]; |
| 125 | 125 | ||
| 126 | pLastSpatialParam = fDlp; | 126 | pLastSpatialParam = fDlp; |
| @@ -142,19 +142,19 @@ int32_t ParamValidationExt (void* pParam) { · 15 unmodified lines | |||
| 142 | if (NULL == pCodingParam) | 142 | if (NULL == pCodingParam) |
| 143 | return 1; | 143 | return 1; |
| 144 | 144 | ||
| 145 | if (pCodingParam->iNumDependencyLayer < 1 || pCodingParam->iNumDependencyLayer > MAX_DEPENDENCY_LAYER) { | 145 | if (pCodingParam->iSpatialLayerNum < 1 || pCodingParam->iSpatialLayerNum > MAX_DEPENDENCY_LAYER) { |
| 146 | #if defined (_DEBUG) | 146 | #if defined (_DEBUG) |
| 147 | fprintf (stderr, "ParamValidationExt(), monitor invalid pCodingParam->iNumDependencyLayer: %d!\n", | 147 | fprintf (stderr, "ParamValidationExt(), monitor invalid pCodingParam->iSpatialLayerNum: %d!\n", |
| 148 | pCodingParam->iNumDependencyLayer); | 148 | pCodingParam->iSpatialLayerNum); |
| 149 | #endif//#if _DEBUG | 149 | #endif//#if _DEBUG |
| 150 | 150 | ||
| 151 | return 1; | 151 | return 1; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | if (pCodingParam->iNumTemporalLayer < 1 || pCodingParam->iNumTemporalLayer > MAX_TEMPORAL_LEVEL) { | 154 | if (pCodingParam->iTemporalLayerNum < 1 || pCodingParam->iTemporalLayerNum > MAX_TEMPORAL_LEVEL) { |
| 155 | #if defined (_DEBUG) | 155 | #if defined (_DEBUG) |
| 156 | fprintf (stderr, "ParamValidationExt(), monitor invalid pCodingParam->iNumTemporalLayer: %d!\n", | 156 | fprintf (stderr, "ParamValidationExt(), monitor invalid pCodingParam->iTemporalLayerNum: %d!\n", |
| 157 | pCodingParam->iNumTemporalLayer); | 157 | pCodingParam->iTemporalLayerNum); |
| 158 | #endif//#if _DEBUG | 158 | #endif//#if _DEBUG |
| 159 | return 1; | 159 | return 1; |
| 160 | } | 160 | } |
| @@ -201,7 +201,7 @@ int32_t ParamValidationExt (void* pParam) { · 40 unmodified lines | |||
| 201 | pCodingParam->bDeblockingParallelFlag = false; | 201 | pCodingParam->bDeblockingParallelFlag = false; |
| 202 | #endif//MT_ENABLED | 202 | #endif//MT_ENABLED |
| 203 | 203 | ||
| 204 | for (i = 0; i < pCodingParam->iNumDependencyLayer; ++ i) { | 204 | for (i = 0; i < pCodingParam->iSpatialLayerNum; ++ i) { |
| 205 | SDLayerParam* fDlp = &pCodingParam->sDependencyLayers[i]; | 205 | SDLayerParam* fDlp = &pCodingParam->sDependencyLayers[i]; |
| 206 | const int32_t kiPicWidth = fDlp->iFrameWidth; | 206 | const int32_t kiPicWidth = fDlp->iFrameWidth; |
| 207 | const int32_t kiPicHeight = fDlp->iFrameHeight; | 207 | const int32_t kiPicHeight = fDlp->iFrameHeight; |
| @@ -224,9 +224,9 @@ int32_t ParamValidationExt (void* pParam) { · 16 unmodified lines | |||
| 224 | return 1; | 224 | return 1; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | if (fDlp->sMso.uiSliceMode >= SM_RESERVED) { | 227 | if (fDlp->sSliceCfg.uiSliceMode >= SM_RESERVED) { |
| 228 | #if defined (_DEBUG) | 228 | #if defined (_DEBUG) |
| 229 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", fDlp->sMso.uiSliceMode); | 229 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", fDlp->sSliceCfg.uiSliceMode); |
| 230 | #endif//#if _DEBUG | 230 | #endif//#if _DEBUG |
| 231 | return 1; | 231 | return 1; |
| 232 | } | 232 | } |
| @@ -234,102 +234,102 @@ int32_t ParamValidationExt (void* pParam) { · 1 unmodified line | |||
| 234 | //check pSlice settings under multi-pSlice | 234 | //check pSlice settings under multi-pSlice |
| 235 | if (kiPicWidth <= 16 && kiPicHeight <= 16) { | 235 | if (kiPicWidth <= 16 && kiPicHeight <= 16) { |
| 236 | //only have one MB, set to single_slice | 236 | //only have one MB, set to single_slice |
| 237 | fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE; | 237 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 238 | } | 238 | } |
| 239 | switch (fDlp->sMso.uiSliceMode) { | 239 | switch (fDlp->sSliceCfg.uiSliceMode) { |
| 240 | case SM_SINGLE_SLICE: | 240 | case SM_SINGLE_SLICE: |
| 241 | fDlp->sMso.sSliceArgument.iSliceNum = 1; | 241 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1; |
| 242 | fDlp->sMso.sSliceArgument.uiSliceSizeConstraint = 0; | 242 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; |
| 243 | fDlp->sMso.sSliceArgument.iSliceNum = 0; | 243 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 0; |
| 244 | for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) { | 244 | for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) { |
| 245 | fDlp->sMso.sSliceArgument.uiSliceMbNum[iIdx] = 0; | 245 | fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[iIdx] = 0; |
| 246 | } | 246 | } |
| 247 | break; | 247 | break; |
| 248 | case SM_FIXEDSLCNUM_SLICE: { | 248 | case SM_FIXEDSLCNUM_SLICE: { |
| 249 | fDlp->sMso.sSliceArgument.uiSliceSizeConstraint = 0; | 249 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; |
| 250 | 250 | ||
| 251 | iMbWidth = (kiPicWidth + 15) >> 4; | 251 | iMbWidth = (kiPicWidth + 15) >> 4; |
| 252 | iMbHeight = (kiPicHeight + 15) >> 4; | 252 | iMbHeight = (kiPicHeight + 15) >> 4; |
| 253 | iMbNumInFrame = iMbWidth * iMbHeight; | 253 | iMbNumInFrame = iMbWidth * iMbHeight; |
| 254 | iMaxSliceNum = MAX_SLICES_NUM; | 254 | iMaxSliceNum = MAX_SLICES_NUM; |
| 255 | if (fDlp->sMso.sSliceArgument.iSliceNum <= 0 | 255 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 0 |
| 256 | || fDlp->sMso.sSliceArgument.iSliceNum > iMaxSliceNum) { | 256 | || fDlp->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { |
| 257 | #if defined (_DEBUG) | 257 | #if defined (_DEBUG) |
| 258 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", fDlp->sMso.sSliceArgument.iSliceNum); | 258 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", fDlp->sSliceCfg.sSliceArgument.uiSliceNum); |
| 259 | #endif//#if _DEBUG | 259 | #endif//#if _DEBUG |
| 260 | return 1; | 260 | return 1; |
| 261 | } | 261 | } |
| 262 | if (fDlp->sMso.sSliceArgument.iSliceNum == 1) { | 262 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum == 1) { |
| 263 | #if defined (_DEBUG) | 263 | #if defined (_DEBUG) |
| 264 | fprintf (stderr, | 264 | fprintf (stderr, |
| 265 | "ParamValidationExt(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!\n", | 265 | "ParamValidationExt(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!\n", |
| 266 | fDlp->sMso.sSliceArgument.iSliceNum); | 266 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum); |
| 267 | #endif//#if _DEBUG | 267 | #endif//#if _DEBUG |
| 268 | fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE; | 268 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 269 | break; | 269 | break; |
| 270 | } | 270 | } |
| 271 | if (pCodingParam->bEnableRc) { // multiple slices verify with gom | 271 | if (pCodingParam->bEnableRc) { // multiple slices verify with gom |
| 272 | //check uiSliceNum | 272 | //check uiSliceNum |
| 273 | GomValidCheckSliceNum (iMbWidth, iMbHeight, (int32_t*)&fDlp->sMso.sSliceArgument.iSliceNum); | 273 | GomValidCheckSliceNum (iMbWidth, iMbHeight, (int32_t*)&fDlp->sSliceCfg.sSliceArgument.uiSliceNum); |
| 274 | assert (fDlp->sMso.sSliceArgument.iSliceNum > 1); | 274 | assert (fDlp->sSliceCfg.sSliceArgument.uiSliceNum > 1); |
| 275 | //set uiSliceMbNum with current uiSliceNum | 275 | //set uiSliceMbNum with current uiSliceNum |
| 276 | GomValidCheckSliceMbNum (iMbWidth, iMbHeight, &fDlp->sMso.sSliceArgument); | 276 | GomValidCheckSliceMbNum (iMbWidth, iMbHeight, &fDlp->sSliceCfg.sSliceArgument); |
| 277 | } else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame, | 277 | } else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame, |
| 278 | &fDlp->sMso.sSliceArgument)) { // verify interleave mode settings | 278 | &fDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings |
| 279 | //check uiSliceMbNum with current uiSliceNum | 279 | //check uiSliceMbNum with current uiSliceNum |
| 280 | #if defined (_DEBUG) | 280 | #if defined (_DEBUG) |
| 281 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | 281 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", |
| 282 | fDlp->sMso.sSliceArgument.uiSliceMbNum[0]); | 282 | fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 283 | #endif//#if _DEBUG | 283 | #endif//#if _DEBUG |
| 284 | return 1; | 284 | return 1; |
| 285 | } | 285 | } |
| 286 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting | 286 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting |
| 287 | if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) { | 287 | if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) { |
| 288 | fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE; | 288 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 289 | fDlp->sMso.sSliceArgument.iSliceNum = 1; | 289 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1; |
| 290 | break; | 290 | break; |
| 291 | } | 291 | } |
| 292 | } | 292 | } |
| 293 | break; | 293 | break; |
| 294 | case SM_RASTER_SLICE: { | 294 | case SM_RASTER_SLICE: { |
| 295 | fDlp->sMso.sSliceArgument.uiSliceSizeConstraint = 0; | 295 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; |
| 296 | 296 | ||
| 297 | iMbWidth = (kiPicWidth + 15) >> 4; | 297 | iMbWidth = (kiPicWidth + 15) >> 4; |
| 298 | iMbHeight = (kiPicHeight + 15) >> 4; | 298 | iMbHeight = (kiPicHeight + 15) >> 4; |
| 299 | iMbNumInFrame = iMbWidth * iMbHeight; | 299 | iMbNumInFrame = iMbWidth * iMbHeight; |
| 300 | iMaxSliceNum = MAX_SLICES_NUM; | 300 | iMaxSliceNum = MAX_SLICES_NUM; |
| 301 | if (fDlp->sMso.sSliceArgument.uiSliceMbNum[0] <= 0) { | 301 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0] <= 0) { |
| 302 | #if defined (_DEBUG) | 302 | #if defined (_DEBUG) |
| 303 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | 303 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", |
| 304 | fDlp->sMso.sSliceArgument.uiSliceMbNum[0]); | 304 | fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 305 | #endif//#if _DEBUG | 305 | #endif//#if _DEBUG |
| 306 | return 1; | 306 | return 1; |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | if (!CheckRasterMultiSliceSetting (iMbNumInFrame, &fDlp->sMso.sSliceArgument)) { // verify interleave mode settings | 309 | if (!CheckRasterMultiSliceSetting (iMbNumInFrame, &fDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings |
| 310 | #if defined (_DEBUG) | 310 | #if defined (_DEBUG) |
| 311 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | 311 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", |
| 312 | fDlp->sMso.sSliceArgument.uiSliceMbNum[0]); | 312 | fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 313 | #endif//#if _DEBUG | 313 | #endif//#if _DEBUG |
| 314 | return 1; | 314 | return 1; |
| 315 | } | 315 | } |
| 316 | if (fDlp->sMso.sSliceArgument.iSliceNum <= 0 | 316 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 0 |
| 317 | || fDlp->sMso.sSliceArgument.iSliceNum > iMaxSliceNum) { // verify interleave mode settings | 317 | || fDlp->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings |
| 318 | #if defined (_DEBUG) | 318 | #if defined (_DEBUG) |
| 319 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!\n", | 319 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!\n", |
| 320 | fDlp->sMso.sSliceArgument.iSliceNum); | 320 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum); |
| 321 | #endif//#if _DEBUG | 321 | #endif//#if _DEBUG |
| 322 | return 1; | 322 | return 1; |
| 323 | } | 323 | } |
| 324 | if (fDlp->sMso.sSliceArgument.iSliceNum == 1) { | 324 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum == 1) { |
| 325 | #if defined (_DEBUG) | 325 | #if defined (_DEBUG) |
| 326 | fprintf (stderr, "ParamValidationExt(), pSlice setting for SM_RASTER_SLICE now turn to SM_SINGLE_SLICE!\n"); | 326 | fprintf (stderr, "ParamValidationExt(), pSlice setting for SM_RASTER_SLICE now turn to SM_SINGLE_SLICE!\n"); |
| 327 | #endif//#if _DEBUG | 327 | #endif//#if _DEBUG |
| 328 | fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE; | 328 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 329 | break; | 329 | break; |
| 330 | } | 330 | } |
| 331 | #ifdef MT_ENABLED | 331 | #ifdef MT_ENABLED |
| 332 | if (pCodingParam->bEnableRc && fDlp->sMso.sSliceArgument.iSliceNum > 1) { | 332 | if (pCodingParam->bEnableRc && fDlp->sSliceCfg.sSliceArgument.uiSliceNum > 1) { |
| 333 | #if defined (_DEBUG) | 333 | #if defined (_DEBUG) |
| 334 | fprintf (stderr, "ParamValidationExt(), WARNING: GOM based RC do not support SM_RASTER_SLICE!\n"); | 334 | fprintf (stderr, "ParamValidationExt(), WARNING: GOM based RC do not support SM_RASTER_SLICE!\n"); |
| 335 | #endif//#if _DEBUG | 335 | #endif//#if _DEBUG |
| @@ -337,14 +337,14 @@ int32_t ParamValidationExt (void* pParam) { · 1 unmodified line | |||
| 337 | #endif | 337 | #endif |
| 338 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting | 338 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting |
| 339 | if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) { | 339 | if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) { |
| 340 | fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE; | 340 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 341 | fDlp->sMso.sSliceArgument.iSliceNum = 1; | 341 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1; |
| 342 | break; | 342 | break; |
| 343 | } | 343 | } |
| 344 | } | 344 | } |
| 345 | break; | 345 | break; |
| 346 | case SM_ROWMB_SLICE: { | 346 | case SM_ROWMB_SLICE: { |
| 347 | fDlp->sMso.sSliceArgument.uiSliceSizeConstraint = 0; | 347 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0; |
| 348 | 348 | ||
| 349 | iMbWidth = (kiPicWidth + 15) >> 4; | 349 | iMbWidth = (kiPicWidth + 15) >> 4; |
| 350 | iMbHeight = (kiPicHeight + 15) >> 4; | 350 | iMbHeight = (kiPicHeight + 15) >> 4; |
| @@ -355,18 +355,18 @@ int32_t ParamValidationExt (void* pParam) { · 4 unmodified lines | |||
| 355 | #endif//#if _DEBUG | 355 | #endif//#if _DEBUG |
| 356 | return 1; | 356 | return 1; |
| 357 | } | 357 | } |
| 358 | fDlp->sMso.sSliceArgument.iSliceNum = iMbHeight; | 358 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = iMbHeight; |
| 359 | 359 | ||
| 360 | if (fDlp->sMso.sSliceArgument.iSliceNum <= 0) { | 360 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 0) { |
| 361 | #if defined (_DEBUG) | 361 | #if defined (_DEBUG) |
| 362 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", fDlp->sMso.sSliceArgument.iSliceNum); | 362 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", fDlp->sSliceCfg.sSliceArgument.uiSliceNum); |
| 363 | #endif//#if _DEBUG | 363 | #endif//#if _DEBUG |
| 364 | return 1; | 364 | return 1; |
| 365 | } | 365 | } |
| 366 | if (!CheckRowMbMultiSliceSetting (iMbWidth, &fDlp->sMso.sSliceArgument)) { // verify interleave mode settings | 366 | if (!CheckRowMbMultiSliceSetting (iMbWidth, &fDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings |
| 367 | #if defined (_DEBUG) | 367 | #if defined (_DEBUG) |
| 368 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | 368 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", |
| 369 | fDlp->sMso.sSliceArgument.uiSliceMbNum[0]); | 369 | fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 370 | #endif//#if _DEBUG | 370 | #endif//#if _DEBUG |
| 371 | return 1; | 371 | return 1; |
| 372 | } | 372 | } |
| @@ -375,17 +375,17 @@ int32_t ParamValidationExt (void* pParam) { · 2 unmodified lines | |||
| 375 | case SM_DYN_SLICE: { | 375 | case SM_DYN_SLICE: { |
| 376 | iMbWidth = (kiPicWidth + 15) >> 4; | 376 | iMbWidth = (kiPicWidth + 15) >> 4; |
| 377 | iMbHeight = (kiPicHeight + 15) >> 4; | 377 | iMbHeight = (kiPicHeight + 15) >> 4; |
| 378 | if (fDlp->sMso.sSliceArgument.uiSliceSizeConstraint <= 0) { | 378 | if (fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint <= 0) { |
| 379 | #if defined (_DEBUG) | 379 | #if defined (_DEBUG) |
| 380 | fprintf (stderr, "ParamValidationExt(), invalid iSliceSize (%d) settings!\n", | 380 | fprintf (stderr, "ParamValidationExt(), invalid iSliceSize (%d) settings!\n", |
| 381 | fDlp->sMso.sSliceArgument.uiSliceSizeConstraint); | 381 | fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint); |
| 382 | #endif//#if _DEBUG | 382 | #endif//#if _DEBUG |
| 383 | return 1; | 383 | return 1; |
| 384 | } | 384 | } |
| 385 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting | 385 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting |
| 386 | if (iMbWidth * iMbHeight <= MIN_NUM_MB_PER_SLICE) { | 386 | if (iMbWidth * iMbHeight <= MIN_NUM_MB_PER_SLICE) { |
| 387 | fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE; | 387 | fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 388 | fDlp->sMso.sSliceArgument.iSliceNum = 1; | 388 | fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1; |
| 389 | break; | 389 | break; |
| 390 | } | 390 | } |
| 391 | } | 391 | } |
| @@ -394,7 +394,7 @@ int32_t ParamValidationExt (void* pParam) { · 2 unmodified lines | |||
| 394 | 394 | ||
| 395 | #if defined (_DEBUG) | 395 | #if defined (_DEBUG) |
| 396 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", | 396 | fprintf (stderr, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", |
| 397 | pCodingParam->sDependencyLayers[0].sMso.uiSliceMode); | 397 | pCodingParam->sDependencyLayers[0].sSliceCfg.uiSliceMode); |
| 398 | #endif//#if _DEBUG | 398 | #endif//#if _DEBUG |
| 399 | return 1; | 399 | return 1; |
| 400 | 400 | ||
| @@ -411,7 +411,7 @@ void WelsEncoderApplyFrameRate(SWelsSvcCodingParam* pParam) · 10 unmodified lines | |||
| 411 | { | 411 | { |
| 412 | SDLayerParam* pLayerParam; | 412 | SDLayerParam* pLayerParam; |
| 413 | const float kfEpsn = 0.000001f; | 413 | const float kfEpsn = 0.000001f; |
| 414 | const int32_t kiNumLayer = pParam->iNumDependencyLayer; | 414 | const int32_t kiNumLayer = pParam->iSpatialLayerNum; |
| 415 | int32_t i; | 415 | int32_t i; |
| 416 | const float kfMaxFrameRate = pParam->fMaxFrameRate; | 416 | const float kfMaxFrameRate = pParam->fMaxFrameRate; |
| 417 | float fRatio; | 417 | float fRatio; |
| @@ -439,7 +439,7 @@ void WelsEncoderApplyBitRate(SWelsSvcCodingParam* pParam) · 21 unmodified lines | |||
| 439 | //but it is also possible to fulfill the bitrate of lower layer first | 439 | //but it is also possible to fulfill the bitrate of lower layer first |
| 440 | 440 | ||
| 441 | SDLayerParam* pLayerParam; | 441 | SDLayerParam* pLayerParam; |
| 442 | const int32_t iNumLayers = pParam->iNumDependencyLayer; | 442 | const int32_t iNumLayers = pParam->iSpatialLayerNum; |
| 443 | int32_t i, iOrigTotalBitrate=0; | 443 | int32_t i, iOrigTotalBitrate=0; |
| 444 | //read old BR | 444 | //read old BR |
| 445 | for (i=0;i<iNumLayers;i++) { | 445 | for (i=0;i<iNumLayers;i++) { |
| @@ -474,7 +474,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 28 unmodified lines | |||
| 474 | if (NULL == pParam || NULL == ppCtx || NULL == *ppCtx) | 474 | if (NULL == pParam || NULL == ppCtx || NULL == *ppCtx) |
| 475 | return 1; | 475 | return 1; |
| 476 | 476 | ||
| 477 | iNumDependencyLayers = pParam->iNumDependencyLayer; | 477 | iNumDependencyLayers = pParam->iSpatialLayerNum; |
| 478 | 478 | ||
| 479 | do { | 479 | do { |
| 480 | SDLayerParam* pDLayer = &pParam->sDependencyLayers[iDIndex]; | 480 | SDLayerParam* pDLayer = &pParam->sDependencyLayers[iDIndex]; |
| @@ -485,7 +485,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 4 unmodified lines | |||
| 485 | //Review this part and suggest no change, since the memory over-use | 485 | //Review this part and suggest no change, since the memory over-use |
| 486 | //(1) counts little to the overall performance | 486 | //(1) counts little to the overall performance |
| 487 | //(2) should not be critial even under mobile case | 487 | //(2) should not be critial even under mobile case |
| 488 | if (SM_DYN_SLICE == pDLayer->sMso.uiSliceMode) { | 488 | if (SM_DYN_SLICE == pDLayer->sSliceCfg.uiSliceMode) { |
| 489 | iCountNumNals += MAX_SLICES_NUM; | 489 | iCountNumNals += MAX_SLICES_NUM; |
| 490 | // plus prefix NALs | 490 | // plus prefix NALs |
| 491 | if (iDIndex == 0) | 491 | if (iDIndex == 0) |
| @@ -497,10 +497,10 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 5 unmodified lines | |||
| 497 | #else//!MT_ENABLED || !PACKING_ONE_SLICE_PER_LAYER | 497 | #else//!MT_ENABLED || !PACKING_ONE_SLICE_PER_LAYER |
| 498 | assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER); | 498 | assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER); |
| 499 | #endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER | 499 | #endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER |
| 500 | } else { /*if ( SM_SINGLE_SLICE != pDLayer->sMso.uiSliceMode )*/ | 500 | } else { /*if ( SM_SINGLE_SLICE != pDLayer->sSliceCfg.uiSliceMode )*/ |
| 501 | const int32_t kiNumOfSlice = GetInitialSliceNum ((pDLayer->iFrameWidth + 0x0f) >> 4, | 501 | const int32_t kiNumOfSlice = GetInitialSliceNum ((pDLayer->iFrameWidth + 0x0f) >> 4, |
| 502 | (pDLayer->iFrameHeight + 0x0f) >> 4, | 502 | (pDLayer->iFrameHeight + 0x0f) >> 4, |
| 503 | &pDLayer->sMso); | 503 | &pDLayer->sSliceCfg); |
| 504 | 504 | ||
| 505 | // NEED check iCountNals value in case multiple slices is used | 505 | // NEED check iCountNals value in case multiple slices is used |
| 506 | iCountNumNals += kiNumOfSlice; // for pSlice VCL NALs | 506 | iCountNumNals += kiNumOfSlice; // for pSlice VCL NALs |
| @@ -644,7 +644,7 @@ static void InitMbInfo (sWelsEncCtx* pEnc, SMB* pList, SDqLayer* pLayer, con · 137 unmodified lines | |||
| 644 | 644 | ||
| 645 | 645 | ||
| 646 | int32_t InitMbListD (sWelsEncCtx** ppCtx) { | 646 | int32_t InitMbListD (sWelsEncCtx** ppCtx) { |
| 647 | int32_t iNumDlayer = (*ppCtx)->pSvcParam->iNumDependencyLayer; | 647 | int32_t iNumDlayer = (*ppCtx)->pSvcParam->iSpatialLayerNum; |
| 648 | int32_t iMbSize[MAX_DEPENDENCY_LAYER] = { 0 }; | 648 | int32_t iMbSize[MAX_DEPENDENCY_LAYER] = { 0 }; |
| 649 | int32_t iOverallMbNum = 0; | 649 | int32_t iOverallMbNum = 0; |
| 650 | int32_t iMbWidth = 0; | 650 | int32_t iMbWidth = 0; |
| @@ -760,7 +760,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 109 unmodified lines | |||
| 760 | 760 | ||
| 761 | pMa = (*ppCtx)->pMemAlign; | 761 | pMa = (*ppCtx)->pMemAlign; |
| 762 | pParam = (*ppCtx)->pSvcParam; | 762 | pParam = (*ppCtx)->pSvcParam; |
| 763 | iDlayerCount = pParam->iNumDependencyLayer; | 763 | iDlayerCount = pParam->iSpatialLayerNum; |
| 764 | iNumRef = pParam->iNumRefFrame; | 764 | iNumRef = pParam->iNumRefFrame; |
| 765 | // highest_layers_in_temporal = 1 + WELS_MAX(pParam->iDecompStages, 1); | 765 | // highest_layers_in_temporal = 1 + WELS_MAX(pParam->iDecompStages, 1); |
| 766 | pStrideTab = (*ppCtx)->pStrideTab; | 766 | pStrideTab = (*ppCtx)->pStrideTab; |
| @@ -802,7 +802,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 35 unmodified lines | |||
| 802 | const int32_t kiMbW = (pDlayer->iFrameWidth + 0x0f) >> 4; | 802 | const int32_t kiMbW = (pDlayer->iFrameWidth + 0x0f) >> 4; |
| 803 | const int32_t kiMbH = (pDlayer->iFrameHeight + 0x0f) >> 4; | 803 | const int32_t kiMbH = (pDlayer->iFrameHeight + 0x0f) >> 4; |
| 804 | int32_t iMaxSliceNum = 1; | 804 | int32_t iMaxSliceNum = 1; |
| 805 | const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sMso); | 805 | const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sSliceCfg); |
| 806 | if (iMaxSliceNum < kiSliceNum) | 806 | if (iMaxSliceNum < kiSliceNum) |
| 807 | iMaxSliceNum = kiSliceNum; | 807 | iMaxSliceNum = kiSliceNum; |
| 808 | 808 | ||
| @@ -811,7 +811,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 2 unmodified lines | |||
| 811 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pDqLayer), FreeMemorySvc (ppCtx)) | 811 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pDqLayer), FreeMemorySvc (ppCtx)) |
| 812 | 812 | ||
| 813 | // for dynamic slicing mode | 813 | // for dynamic slicing mode |
| 814 | if (SM_DYN_SLICE == pDlayer->sMso.uiSliceMode) { | 814 | if (SM_DYN_SLICE == pDlayer->sSliceCfg.uiSliceMode) { |
| 815 | const int32_t iSize = pParam->iCountThreadsNum * sizeof (int32_t); | 815 | const int32_t iSize = pParam->iCountThreadsNum * sizeof (int32_t); |
| 816 | 816 | ||
| 817 | pDqLayer->pNumSliceCodedOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pNumSliceCodedOfPartition"); | 817 | pDqLayer->pNumSliceCodedOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pNumSliceCodedOfPartition"); |
| @@ -828,7 +828,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 10 unmodified lines | |||
| 828 | pDqLayer->iMbWidth = kiMbW; | 828 | pDqLayer->iMbWidth = kiMbW; |
| 829 | pDqLayer->iMbHeight = kiMbH; | 829 | pDqLayer->iMbHeight = kiMbH; |
| 830 | #ifndef MT_ENABLED | 830 | #ifndef MT_ENABLED |
| 831 | if (SM_DYN_SLICE == pDlayer->sMso.uiSliceMode) { //wmalloc pSliceInLayer | 831 | if (SM_DYN_SLICE == pDlayer->sSliceCfg.uiSliceMode) { //wmalloc pSliceInLayer |
| 832 | SSlice* pSlice = NULL; | 832 | SSlice* pSlice = NULL; |
| 833 | int32_t iSliceIdx = 0; | 833 | int32_t iSliceIdx = 0; |
| 834 | //wmalloc AVERSLICENUM_CONSTANT of pDqLayer->sLayerInfo.pSliceInLayer, | 834 | //wmalloc AVERSLICENUM_CONSTANT of pDqLayer->sLayerInfo.pSliceInLayer, |
| @@ -901,7 +901,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 66 unmodified lines | |||
| 901 | pDqLayer->bDeblockingParallelFlag = pParam->bDeblockingParallelFlag; | 901 | pDqLayer->bDeblockingParallelFlag = pParam->bDeblockingParallelFlag; |
| 902 | 902 | ||
| 903 | //deblocking parameter adjustment | 903 | //deblocking parameter adjustment |
| 904 | if (SM_SINGLE_SLICE == pDlayer->sMso.uiSliceMode) { | 904 | if (SM_SINGLE_SLICE == pDlayer->sSliceCfg.uiSliceMode) { |
| 905 | //iLoopFilterDisableIdc: will be 0 or 1 under single_slice | 905 | //iLoopFilterDisableIdc: will be 0 or 1 under single_slice |
| 906 | if (2 == pParam->iLoopFilterDisableIdc) { | 906 | if (2 == pParam->iLoopFilterDisableIdc) { |
| 907 | pDqLayer->iLoopFilterDisableIdc = 0; | 907 | pDqLayer->iLoopFilterDisableIdc = 0; |
| @@ -980,7 +980,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 72 unmodified lines | |||
| 980 | false, | 980 | false, |
| 981 | pSps->iMbWidth, | 981 | pSps->iMbWidth, |
| 982 | pSps->iMbHeight, | 982 | pSps->iMbHeight, |
| 983 | & (pDlayerParam->sMso), | 983 | & (pDlayerParam->sSliceCfg), |
| 984 | pPps); | 984 | pPps); |
| 985 | if (iResult) { | 985 | if (iResult) { |
| 986 | WelsLog (*ppCtx, WELS_LOG_WARNING, "InitDqLayers(), InitSlicePEncCtx failed(%d)!", iResult); | 986 | WelsLog (*ppCtx, WELS_LOG_WARNING, "InitDqLayers(), InitSlicePEncCtx failed(%d)!", iResult); |
| @@ -1042,7 +1042,7 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers · 55 unmodified lines | |||
| 1042 | return 1; | 1042 | return 1; |
| 1043 | (*ppCtx)->pStrideTab = pPtr; | 1043 | (*ppCtx)->pStrideTab = pPtr; |
| 1044 | 1044 | ||
| 1045 | iCntTid = pParam->iNumTemporalLayer > 1 ? 2 : 1; | 1045 | iCntTid = pParam->iTemporalLayerNum > 1 ? 2 : 1; |
| 1046 | 1046 | ||
| 1047 | iSpatialIdx = 0; | 1047 | iSpatialIdx = 0; |
| 1048 | while (iSpatialIdx < kiNumSpatialLayers) { | 1048 | while (iSpatialIdx < kiNumSpatialLayers) { |
| @@ -1278,7 +1278,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 229 unmodified lines | |||
| 1278 | int32_t iCountLayers = 0; | 1278 | int32_t iCountLayers = 0; |
| 1279 | int32_t iResult = 0; | 1279 | int32_t iResult = 0; |
| 1280 | float fCompressRatioThr = .5f; | 1280 | float fCompressRatioThr = .5f; |
| 1281 | const int32_t kiNumDependencyLayers = pParam->iNumDependencyLayer; | 1281 | const int32_t kiNumDependencyLayers = pParam->iSpatialLayerNum; |
| 1282 | const uint32_t kuiMvdInterTableSize = (kiNumDependencyLayers == 1 ? (1 + (648 << 1)) : (1 + (972 << 1))); | 1282 | const uint32_t kuiMvdInterTableSize = (kiNumDependencyLayers == 1 ? (1 + (648 << 1)) : (1 + (972 << 1))); |
| 1283 | const uint32_t kuiMvdCacheAlginedSize = kuiMvdInterTableSize * sizeof (uint16_t); | 1283 | const uint32_t kuiMvdCacheAlginedSize = kuiMvdInterTableSize * sizeof (uint16_t); |
| 1284 | int32_t iVclLayersBsSizeCount = 0; | 1284 | int32_t iVclLayersBsSizeCount = 0; |
| @@ -1314,12 +1314,12 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 29 unmodified lines | |||
| 1314 | return 1; | 1314 | return 1; |
| 1315 | } | 1315 | } |
| 1316 | 1316 | ||
| 1317 | iNonVclLayersBsSizeCount = SSEI_BUFFER_SIZE + pParam->iNumDependencyLayer * SPS_BUFFER_SIZE + | 1317 | iNonVclLayersBsSizeCount = SSEI_BUFFER_SIZE + pParam->iSpatialLayerNum * SPS_BUFFER_SIZE + |
| 1318 | (1 + pParam->iNumDependencyLayer) * PPS_BUFFER_SIZE; | 1318 | (1 + pParam->iSpatialLayerNum) * PPS_BUFFER_SIZE; |
| 1319 | 1319 | ||
| 1320 | int32_t iLayerBsSize = 0; | 1320 | int32_t iLayerBsSize = 0; |
| 1321 | iIndex = 0; | 1321 | iIndex = 0; |
| 1322 | while (iIndex < pParam->iNumDependencyLayer) { | 1322 | while (iIndex < pParam->iSpatialLayerNum) { |
| 1323 | SDLayerParam* fDlp = &pParam->sDependencyLayers[iIndex]; | 1323 | SDLayerParam* fDlp = &pParam->sDependencyLayers[iIndex]; |
| 1324 | 1324 | ||
| 1325 | fCompressRatioThr = COMPRESS_RATIO_DECIDED_BY_RESOLUTION (fDlp->iFrameWidth, fDlp->iFrameHeight); | 1325 | fCompressRatioThr = COMPRESS_RATIO_DECIDED_BY_RESOLUTION (fDlp->iFrameWidth, fDlp->iFrameHeight); |
| @@ -1607,16 +1607,17 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 281 unmodified lines | |||
| 1607 | // pDq layers list | 1607 | // pDq layers list |
| 1608 | ilayer = 0; | 1608 | ilayer = 0; |
| 1609 | if (NULL != pCtx->ppDqLayerList && pParam != NULL) { | 1609 | if (NULL != pCtx->ppDqLayerList && pParam != NULL) { |
| 1610 | while (ilayer < pParam->iNumDependencyLayer) { | 1610 | while (ilayer < pParam->iSpatialLayerNum) { |
| 1611 | SDqLayer* pDq = pCtx->ppDqLayerList[ilayer]; | 1611 | SDqLayer* pDq = pCtx->ppDqLayerList[ilayer]; |
| 1612 | SDLayerParam* pDlp = &pCtx->pSvcParam->sDependencyLayers[ilayer]; | 1612 | SDLayerParam* pDlp = &pCtx->pSvcParam->sDependencyLayers[ilayer]; |
| 1613 | const bool kbIsDynamicSlicing = (SM_DYN_SLICE == pDlp->sMso.uiSliceMode); | 1613 | |
| 1614 | const bool kbIsDynamicSlicing = (SM_DYN_SLICE == pDlp->sSliceCfg.uiSliceMode); | ||
| 1614 | 1615 | ||
| 1615 | // pDq layers | 1616 | // pDq layers |
| 1616 | if (NULL != pDq) { | 1617 | if (NULL != pDq) { |
| 1617 | if (NULL != pDq->sLayerInfo.pSliceInLayer) { | 1618 | if (NULL != pDq->sLayerInfo.pSliceInLayer) { |
| 1618 | int32_t iSliceIdx = 0; | 1619 | int32_t iSliceIdx = 0; |
| 1619 | int32_t iSliceNum = GetInitialSliceNum (pDq->iMbWidth, pDq->iMbHeight, &pDlp->sMso); | 1620 | int32_t iSliceNum = GetInitialSliceNum (pDq->iMbWidth, pDq->iMbHeight, &pDlp->sSliceCfg); |
| 1620 | if (iSliceNum < 1) | 1621 | if (iSliceNum < 1) |
| 1621 | iSliceNum = 1; | 1622 | iSliceNum = 1; |
| 1622 | while (iSliceIdx < iSliceNum) { | 1623 | while (iSliceIdx < iSliceNum) { |
| @@ -1648,7 +1649,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 25 unmodified lines | |||
| 1648 | // reference picture list extension | 1649 | // reference picture list extension |
| 1649 | if (NULL != pCtx->ppRefPicListExt && pParam != NULL) { | 1650 | if (NULL != pCtx->ppRefPicListExt && pParam != NULL) { |
| 1650 | ilayer = 0; | 1651 | ilayer = 0; |
| 1651 | while (ilayer < pParam->iNumDependencyLayer) { | 1652 | while (ilayer < pParam->iSpatialLayerNum) { |
| 1652 | SRefList* pRefList = pCtx->ppRefPicListExt[ilayer]; | 1653 | SRefList* pRefList = pCtx->ppRefPicListExt[ilayer]; |
| 1653 | if (NULL != pRefList) { | 1654 | if (NULL != pRefList) { |
| 1654 | int32_t iRef = 0; | 1655 | int32_t iRef = 0; |
| @@ -1672,7 +1673,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 17 unmodified lines | |||
| 1672 | // pSlice context list | 1673 | // pSlice context list |
| 1673 | if (NULL != pCtx->pSliceCtxList && pParam != NULL) { | 1674 | if (NULL != pCtx->pSliceCtxList && pParam != NULL) { |
| 1674 | ilayer = 0; | 1675 | ilayer = 0; |
| 1675 | while (ilayer < pParam->iNumDependencyLayer) { | 1676 | while (ilayer < pParam->iSpatialLayerNum) { |
| 1676 | SSliceCtx* pSliceCtx = &pCtx->pSliceCtxList[ilayer]; | 1677 | SSliceCtx* pSliceCtx = &pCtx->pSliceCtxList[ilayer]; |
| 1677 | if (NULL != pSliceCtx) | 1678 | if (NULL != pSliceCtx) |
| 1678 | UninitSlicePEncCtx (pSliceCtx, pMa); | 1679 | UninitSlicePEncCtx (pSliceCtx, pMa); |
| @@ -1758,12 +1759,12 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 79 unmodified lines | |||
| 1758 | } | 1759 | } |
| 1759 | 1760 | ||
| 1760 | int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCpuCores, int16_t* pMaxSliceCount) { | 1761 | int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCpuCores, int16_t* pMaxSliceCount) { |
| 1761 | int32_t iSpatialIdx = 0, iSpatialNum = pCodingParam->iNumDependencyLayer; | 1762 | int32_t iSpatialIdx = 0, iSpatialNum = pCodingParam->iSpatialLayerNum; |
| 1762 | int16_t iMaxSliceCount = 0; | 1763 | int16_t iMaxSliceCount = 0; |
| 1763 | 1764 | ||
| 1764 | do { | 1765 | do { |
| 1765 | SDLayerParam* pDlp = &pCodingParam->sDependencyLayers[iSpatialIdx]; | 1766 | SDLayerParam* pDlp = &pCodingParam->sDependencyLayers[iSpatialIdx]; |
| 1766 | SMulSliceOption* pMso = &pDlp->sMso; | 1767 | SSliceConfig* pMso = &pDlp->sSliceCfg; |
| 1767 | SSliceArgument* pSlcArg = &pMso->sSliceArgument; | 1768 | SSliceArgument* pSlcArg = &pMso->sSliceArgument; |
| 1768 | const int32_t kiMbWidth = (pDlp->iFrameWidth + 15) >> 4; | 1769 | const int32_t kiMbWidth = (pDlp->iFrameWidth + 15) >> 4; |
| 1769 | const int32_t kiMbHeight = (pDlp->iFrameHeight + 15) >> 4; | 1770 | const int32_t kiMbHeight = (pDlp->iFrameHeight + 15) >> 4; |
| @@ -1772,7 +1773,7 @@ int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCp · 2 unmodified lines | |||
| 1772 | #if defined(DYNAMIC_SLICE_ASSIGN) | 1773 | #if defined(DYNAMIC_SLICE_ASSIGN) |
| 1773 | int32_t iSliceNum = (SM_FIXEDSLCNUM_SLICE == pMso->uiSliceMode | 1774 | int32_t iSliceNum = (SM_FIXEDSLCNUM_SLICE == pMso->uiSliceMode |
| 1774 | || SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores : | 1775 | || SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores : |
| 1775 | pSlcArg->iSliceNum; // uiSliceNum per input has been validated at ParamValidationExt() | 1776 | pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt() |
| 1776 | #else//!DYNAMIC_SLICE_ASSIGN | 1777 | #else//!DYNAMIC_SLICE_ASSIGN |
| 1777 | int32_t iSliceNum = (SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores : | 1778 | int32_t iSliceNum = (SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores : |
| 1778 | pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt() | 1779 | pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt() |
| @@ -1784,7 +1785,7 @@ int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCp · 5 unmodified lines | |||
| 1784 | // NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode, | 1785 | // NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode, |
| 1785 | // uiSliceNum of current spatial layer settings equals to uiCpuCores number; SM_DYN_SLICE mode, | 1786 | // uiSliceNum of current spatial layer settings equals to uiCpuCores number; SM_DYN_SLICE mode, |
| 1786 | // uiSliceNum intials as uiCpuCores also, stay tuned dynamically slicing in future | 1787 | // uiSliceNum intials as uiCpuCores also, stay tuned dynamically slicing in future |
| 1787 | pSlcArg->iSliceNum = iSliceNum; // used fixed one | 1788 | pSlcArg->uiSliceNum = iSliceNum; // used fixed one |
| 1788 | 1789 | ||
| 1789 | switch (pMso->uiSliceMode) { | 1790 | switch (pMso->uiSliceMode) { |
| 1790 | case SM_DYN_SLICE: | 1791 | case SM_DYN_SLICE: |
| @@ -2034,7 +2035,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 243 unmodified lines | |||
| 2034 | #endif//ENABLE_TRACE_FILE | 2035 | #endif//ENABLE_TRACE_FILE |
| 2035 | 2036 | ||
| 2036 | pCodingParam->DetermineTemporalSettings(); | 2037 | pCodingParam->DetermineTemporalSettings(); |
| 2037 | iRet = AllocCodingParam (&pCtx->pSvcParam, pCtx->pMemAlign, pCodingParam->iNumDependencyLayer); | 2038 | iRet = AllocCodingParam (&pCtx->pSvcParam, pCtx->pMemAlign, pCodingParam->iSpatialLayerNum); |
| 2038 | if (iRet != 0) { | 2039 | if (iRet != 0) { |
| 2039 | FreeMemorySvc (&pCtx); | 2040 | FreeMemorySvc (&pCtx); |
| 2040 | return iRet; | 2041 | return iRet; |
| @@ -2098,7 +2099,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 57 unmodified lines | |||
| 2098 | void StatOverallEncodingExt (sWelsEncCtx* pCtx) { | 2099 | void StatOverallEncodingExt (sWelsEncCtx* pCtx) { |
| 2099 | int8_t i = 0; | 2100 | int8_t i = 0; |
| 2100 | int8_t j = 0; | 2101 | int8_t j = 0; |
| 2101 | for (i = 0; i < pCtx->pSvcParam->iNumDependencyLayer; i++) { | 2102 | for (i = 0; i < pCtx->pSvcParam->iSpatialLayerNum; i++) { |
| 2102 | fprintf (stdout, "\nDependency layer : %d\n", i); | 2103 | fprintf (stdout, "\nDependency layer : %d\n", i); |
| 2103 | fprintf (stdout, "Quality layer : %d\n", j); | 2104 | fprintf (stdout, "Quality layer : %d\n", j); |
| 2104 | { | 2105 | { |
| @@ -2511,8 +2512,8 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx, · 406 unmodified lines | |||
| 2511 | 2512 | ||
| 2512 | pCurDq->pDecPic = pDecPic; | 2513 | pCurDq->pDecPic = pDecPic; |
| 2513 | 2514 | ||
| 2514 | if (fDlp->sMso.uiSliceMode == SM_DYN_SLICE) // need get extra slices for update | 2515 | if (fDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE) // need get extra slices for update |
| 2515 | iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sMso); | 2516 | iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sSliceCfg); |
| 2516 | else | 2517 | else |
| 2517 | iSliceCount = GetCurrentSliceNum (pCurDq->pSliceEncCtx); | 2518 | iSliceCount = GetCurrentSliceNum (pCurDq->pSliceEncCtx); |
| 2518 | assert (iSliceCount > 0); | 2519 | assert (iSliceCount > 0); |
| @@ -2592,7 +2593,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 73 unmodified lines | |||
| 2592 | 2593 | ||
| 2593 | if (P_SLICE == pCtx->eSliceType) { | 2594 | if (P_SLICE == pCtx->eSliceType) { |
| 2594 | if (kbBaseAvail) { | 2595 | if (kbBaseAvail) { |
| 2595 | if (pCtx->pSvcParam->iNumDependencyLayer == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1)) { // | 2596 | if (pCtx->pSvcParam->iSpatialLayerNum == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1)) { // |
| 2596 | pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearchSad; | 2597 | pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearchSad; |
| 2597 | pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode; | 2598 | pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode; |
| 2598 | pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa; | 2599 | pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa; |
| @@ -2615,7 +2616,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 16 unmodified lines | |||
| 2615 | pCtx->pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; | 2616 | pCtx->pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; |
| 2616 | } else { | 2617 | } else { |
| 2617 | //case 3: pBase layer MD + encoding | 2618 | //case 3: pBase layer MD + encoding |
| 2618 | if (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1 == pCtx->pSvcParam->iNumDependencyLayer) { | 2619 | if (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1 == pCtx->pSvcParam->iSpatialLayerNum) { |
| 2619 | pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearchSad; | 2620 | pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearchSad; |
| 2620 | pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode; | 2621 | pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode; |
| 2621 | pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa; | 2622 | pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa; |
| @@ -2638,7 +2639,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 16 unmodified lines | |||
| 2638 | pCtx->pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; | 2639 | pCtx->pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; |
| 2639 | } | 2640 | } |
| 2640 | } else if (I_SLICE == pCtx->eSliceType) { | 2641 | } else if (I_SLICE == pCtx->eSliceType) { |
| 2641 | if (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1 == pCtx->pSvcParam->iNumDependencyLayer) { | 2642 | if (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1 == pCtx->pSvcParam->iSpatialLayerNum) { |
| 2642 | pCtx->pFuncList->sSampleDealingFuncs.pfMdCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSad; | 2643 | pCtx->pFuncList->sSampleDealingFuncs.pfMdCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSad; |
| 2643 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 = | 2644 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 = |
| 2644 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Sad; | 2645 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Sad; |
| @@ -3084,7 +3085,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 439 unmodified lines | |||
| 3084 | pFbi->iLayerNum = 0; // for initialization | 3085 | pFbi->iLayerNum = 0; // for initialization |
| 3085 | 3086 | ||
| 3086 | // perform csc/denoise/downsample/padding, generate spatial layers | 3087 | // perform csc/denoise/downsample/padding, generate spatial layers |
| 3087 | iSpatialNum = pCtx->pVpp->WelsPreprocessStep1 (pCtx, ppSrcList, iConfiguredLayerNum); | 3088 | iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, ppSrcList, iConfiguredLayerNum); |
| 3088 | if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) | 3089 | if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) |
| 3089 | ++ pCtx->iCodingIndex; | 3090 | ++ pCtx->iCodingIndex; |
| 3090 | return WELS_FRAME_TYPE_SKIP; | 3091 | return WELS_FRAME_TYPE_SKIP; |
| @@ -3132,7 +3133,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 41 unmodified lines | |||
| 3132 | SDLayerParam* param_d = &pSvcParam->sDependencyLayers[d_idx]; | 3133 | SDLayerParam* param_d = &pSvcParam->sDependencyLayers[d_idx]; |
| 3133 | 3134 | ||
| 3134 | pCtx->uiDependencyId = iCurDid = (int8_t)d_idx; | 3135 | pCtx->uiDependencyId = iCurDid = (int8_t)d_idx; |
| 3135 | pCtx->pVpp->WelsPreprocessStep3 (pCtx, d_idx); | 3136 | pCtx->pVpp->AnalyzeSpatialPic (pCtx, d_idx); |
| 3136 | 3137 | ||
| 3137 | pCtx->pEncPic = pEncPic = (pSpatialIndexMap + iSpatialIdx)->pSrc; | 3138 | pCtx->pEncPic = pEncPic = (pSpatialIndexMap + iSpatialIdx)->pSrc; |
| 3138 | pCtx->pEncPic->iPictureType = pCtx->eSliceType; | 3139 | pCtx->pEncPic->iPictureType = pCtx->eSliceType; |
| @@ -3147,12 +3148,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 8 unmodified lines | |||
| 3147 | 3148 | ||
| 3148 | // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed | 3149 | // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed |
| 3149 | 3150 | ||
| 3150 | switch (param_d->sMso.uiSliceMode) { | 3151 | switch (param_d->sSliceCfg.uiSliceMode) { |
| 3151 | case SM_FIXEDSLCNUM_SLICE: { | 3152 | case SM_FIXEDSLCNUM_SLICE: { |
| 3152 | #if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN) | 3153 | #if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN) |
| 3153 | if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) && | 3154 | if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) && |
| 3154 | (pSvcParam->sDependencyLayers[iCurDid].sMso.uiSliceMode == SM_FIXEDSLCNUM_SLICE | 3155 | (pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE |
| 3155 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[iCurDid].sMso.sSliceArgument.iSliceNum) | 3156 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.sSliceArgument.uiSliceNum) |
| 3156 | ) | 3157 | ) |
| 3157 | AdjustEnhanceLayer (pCtx, iCurDid); | 3158 | AdjustEnhanceLayer (pCtx, iCurDid); |
| 3158 | #endif//MT_ENABLED && DYNAMIC_SLICE_ASSIGN | 3159 | #endif//MT_ENABLED && DYNAMIC_SLICE_ASSIGN |
| @@ -3183,7 +3184,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 24 unmodified lines | |||
| 3183 | bAvcBased = (iCurDid == BASE_DEPENDENCY_ID); | 3184 | bAvcBased = (iCurDid == BASE_DEPENDENCY_ID); |
| 3184 | pCtx->bNeedPrefixNalFlag = (bAvcBased && | 3185 | pCtx->bNeedPrefixNalFlag = (bAvcBased && |
| 3185 | (pSvcParam->bPrefixNalAddingCtrl || | 3186 | (pSvcParam->bPrefixNalAddingCtrl || |
| 3186 | (pSvcParam->iNumDependencyLayer > 1))); | 3187 | (pSvcParam->iSpatialLayerNum > 1))); |
| 3187 | 3188 | ||
| 3188 | if (eFrameType == WELS_FRAME_TYPE_P) { | 3189 | if (eFrameType == WELS_FRAME_TYPE_P) { |
| 3189 | eNalType = bAvcBased ? NAL_UNIT_CODED_SLICE : NAL_UNIT_CODED_SLICE_EXT; | 3190 | eNalType = bAvcBased ? NAL_UNIT_CODED_SLICE : NAL_UNIT_CODED_SLICE_EXT; |
| @@ -3229,7 +3230,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 39 unmodified lines | |||
| 3229 | PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer() | 3230 | PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer() |
| 3230 | 3231 | ||
| 3231 | iLayerSize = 0; | 3232 | iLayerSize = 0; |
| 3232 | if (SM_SINGLE_SLICE == param_d->sMso.uiSliceMode) { // only one slice within a sQualityStat layer | 3233 | if (SM_SINGLE_SLICE == param_d->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer |
| 3233 | int32_t iSliceSize = 0; | 3234 | int32_t iSliceSize = 0; |
| 3234 | 3235 | ||
| 3235 | if (pCtx->bNeedPrefixNalFlag) { | 3236 | if (pCtx->bNeedPrefixNalFlag) { |
| @@ -3258,9 +3259,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 22 unmodified lines | |||
| 3258 | } | 3259 | } |
| 3259 | // for dynamic slicing single threading.. | 3260 | // for dynamic slicing single threading.. |
| 3260 | #ifndef MT_ENABLED | 3261 | #ifndef MT_ENABLED |
| 3261 | else if (SM_DYN_SLICE == param_d->sMso.uiSliceMode) | 3262 | else if (SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode) |
| 3262 | #else // MT_ENABLED | 3263 | #else // MT_ENABLED |
| 3263 | else if ((SM_DYN_SLICE == param_d->sMso.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) | 3264 | else if ((SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) |
| 3264 | #endif//MT_ENABLED | 3265 | #endif//MT_ENABLED |
| 3265 | { | 3266 | { |
| 3266 | const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->pSliceEncCtx->iMbNumInFrame; | 3267 | const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->pSliceEncCtx->iMbNumInFrame; |
| @@ -3270,7 +3271,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 3 unmodified lines | |||
| 3270 | #if defined(MT_ENABLED) | 3271 | #if defined(MT_ENABLED) |
| 3271 | int err = 0; | 3272 | int err = 0; |
| 3272 | // THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_DYN_SLICE | 3273 | // THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_DYN_SLICE |
| 3273 | if ((SM_DYN_SLICE != param_d->sMso.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { | 3274 | if ((SM_DYN_SLICE != param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { |
| 3274 | iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx); | 3275 | iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx); |
| 3275 | if (iLayerNum + | 3276 | if (iLayerNum + |
| 3276 | #if defined(PACKING_ONE_SLICE_PER_LAYER) | 3277 | #if defined(PACKING_ONE_SLICE_PER_LAYER) |
| @@ -3281,7 +3282,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 4 unmodified lines | |||
| 3281 | >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed | 3282 | >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed |
| 3282 | WelsLog (pCtx, WELS_LOG_ERROR, | 3283 | WelsLog (pCtx, WELS_LOG_ERROR, |
| 3283 | "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!", | 3284 | "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!", |
| 3284 | iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, param_d->sMso.uiSliceMode, iSliceCount); | 3285 | iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, param_d->sSliceCfg.uiSliceMode, iSliceCount); |
| 3285 | return -1; | 3286 | return -1; |
| 3286 | } | 3287 | } |
| 3287 | if (iSliceCount <= 1) { | 3288 | if (iSliceCount <= 1) { |
| @@ -3311,7 +3312,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 23 unmodified lines | |||
| 3311 | if (err) { | 3312 | if (err) { |
| 3312 | WelsLog (pCtx, WELS_LOG_ERROR, | 3313 | WelsLog (pCtx, WELS_LOG_ERROR, |
| 3313 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", | 3314 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", |
| 3314 | err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sMso.uiSliceMode, pSvcParam->iMultipleThreadIdc); | 3315 | err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); |
| 3315 | return -1; | 3316 | return -1; |
| 3316 | } | 3317 | } |
| 3317 | 3318 | ||
| @@ -3370,7 +3371,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 52 unmodified lines | |||
| 3370 | if (err) { | 3371 | if (err) { |
| 3371 | WelsLog (pCtx, WELS_LOG_ERROR, | 3372 | WelsLog (pCtx, WELS_LOG_ERROR, |
| 3372 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", | 3373 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", |
| 3373 | err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sMso.uiSliceMode, pSvcParam->iMultipleThreadIdc); | 3374 | err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); |
| 3374 | return -1; | 3375 | return -1; |
| 3375 | } | 3376 | } |
| 3376 | 3377 | ||
| @@ -3447,7 +3448,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 70 unmodified lines | |||
| 3447 | } | 3448 | } |
| 3448 | } | 3449 | } |
| 3449 | // THREAD_FULLY_FIRE_MODE && SM_DYN_SLICE | 3450 | // THREAD_FULLY_FIRE_MODE && SM_DYN_SLICE |
| 3450 | else if ((SM_DYN_SLICE == param_d->sMso.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { | 3451 | else if ((SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { |
| 3451 | const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum; | 3452 | const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum; |
| 3452 | #if defined(PACKING_ONE_SLICE_PER_LAYER) | 3453 | #if defined(PACKING_ONE_SLICE_PER_LAYER) |
| 3453 | ResetCountBsSizeInPartitions (pCtx->pSliceThreading->pCountBsSizeInPartition, kiPartitionCnt); | 3454 | ResetCountBsSizeInPartitions (pCtx->pSliceThreading->pCountBsSizeInPartition, kiPartitionCnt); |
| @@ -3462,7 +3463,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 8 unmodified lines | |||
| 3462 | if (err) { | 3463 | if (err) { |
| 3463 | WelsLog (pCtx, WELS_LOG_ERROR, | 3464 | WelsLog (pCtx, WELS_LOG_ERROR, |
| 3464 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", | 3465 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", |
| 3465 | err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sMso.uiSliceMode, pSvcParam->iMultipleThreadIdc); | 3466 | err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); |
| 3466 | return -1; | 3467 | return -1; |
| 3467 | } | 3468 | } |
| 3468 | 3469 | ||
| @@ -3552,7 +3553,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 83 unmodified lines | |||
| 3552 | 3553 | ||
| 3553 | #ifdef ENABLE_FRAME_DUMP | 3554 | #ifdef ENABLE_FRAME_DUMP |
| 3554 | // Dump reconstruction picture for each sQualityStat layer | 3555 | // Dump reconstruction picture for each sQualityStat layer |
| 3555 | if (iCurDid + 1 < pSvcParam->iNumDependencyLayer) | 3556 | if (iCurDid + 1 < pSvcParam->iSpatialLayerNum) |
| 3556 | DumpDependencyRec (fsnr, ¶m_d->sRecFileName[0], iCurDid); | 3557 | DumpDependencyRec (fsnr, ¶m_d->sRecFileName[0], iCurDid); |
| 3557 | #endif//ENABLE_FRAME_DUMP | 3558 | #endif//ENABLE_FRAME_DUMP |
| 3558 | 3559 | ||
| @@ -3634,7 +3635,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 75 unmodified lines | |||
| 3634 | #endif//STAT_OUTPUT | 3635 | #endif//STAT_OUTPUT |
| 3635 | 3636 | ||
| 3636 | #if defined(MT_ENABLED) && defined(PACKING_ONE_SLICE_PER_LAYER) | 3637 | #if defined(MT_ENABLED) && defined(PACKING_ONE_SLICE_PER_LAYER) |
| 3637 | if (pSvcParam->iMultipleThreadIdc <= 1 || SM_SINGLE_SLICE == param_d->sMso.uiSliceMode) // sigle thread actually used | 3638 | if (pSvcParam->iMultipleThreadIdc <= 1 || SM_SINGLE_SLICE == param_d->sSliceCfg.uiSliceMode) // sigle thread actually used |
| 3638 | #else | 3639 | #else |
| 3639 | if (1) | 3640 | if (1) |
| 3640 | #endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER | 3641 | #endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER |
| @@ -3673,8 +3674,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 32 unmodified lines | |||
| 3673 | } | 3674 | } |
| 3674 | 3675 | ||
| 3675 | #if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) | 3676 | #if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) |
| 3676 | if (param_d->sMso.uiSliceMode == SM_FIXEDSLCNUM_SLICE && pSvcParam->iMultipleThreadIdc > 1 && | 3677 | if (param_d->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE && pSvcParam->iMultipleThreadIdc > 1 && |
| 3677 | pSvcParam->iMultipleThreadIdc >= param_d->sMso.sSliceArgument.iSliceNum) { | 3678 | pSvcParam->iMultipleThreadIdc >= param_d->sSliceCfg.sSliceArgument.uiSliceNum) { |
| 3678 | CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx, | 3679 | CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx, |
| 3679 | pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]); | 3680 | pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]); |
| 3680 | #if defined(MT_DEBUG) | 3681 | #if defined(MT_DEBUG) |
| @@ -3685,7 +3686,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 4 unmodified lines | |||
| 3685 | 3686 | ||
| 3686 | ++ iSpatialIdx; | 3687 | ++ iSpatialIdx; |
| 3687 | 3688 | ||
| 3688 | if (iCurDid + 1 < pSvcParam->iNumDependencyLayer) { | 3689 | if (iCurDid + 1 < pSvcParam->iSpatialLayerNum) { |
| 3689 | WelsSwapDqLayers (pCtx); | 3690 | WelsSwapDqLayers (pCtx); |
| 3690 | } | 3691 | } |
| 3691 | 3692 | ||
| @@ -3711,17 +3712,17 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 19 unmodified lines | |||
| 3711 | 3712 | ||
| 3712 | #if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN) | 3713 | #if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN) |
| 3713 | if (pSvcParam->iMultipleThreadIdc > 1 && did_list[0] == BASE_DEPENDENCY_ID | 3714 | if (pSvcParam->iMultipleThreadIdc > 1 && did_list[0] == BASE_DEPENDENCY_ID |
| 3714 | && pSvcParam->sDependencyLayers[0].sMso.uiSliceMode == SM_FIXEDSLCNUM_SLICE | 3715 | && pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE |
| 3715 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sMso.sSliceArgument.iSliceNum | 3716 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sSliceCfg.sSliceArgument.uiSliceNum |
| 3716 | && pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sMso.uiSliceMode == SM_FIXEDSLCNUM_SLICE | 3717 | && pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE |
| 3717 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[did_list[iSpatialNum - | 3718 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[did_list[iSpatialNum - |
| 3718 | 1]].sMso.sSliceArgument.iSliceNum) { | 3719 | 1]].sSliceCfg.sSliceArgument.uiSliceNum) { |
| 3719 | AdjustBaseLayer (pCtx); | 3720 | AdjustBaseLayer (pCtx); |
| 3720 | } | 3721 | } |
| 3721 | #endif//DYNAMIC_SLICE_ASSIGN | 3722 | #endif//DYNAMIC_SLICE_ASSIGN |
| 3722 | 3723 | ||
| 3723 | #ifdef ENABLE_FRAME_DUMP | 3724 | #ifdef ENABLE_FRAME_DUMP |
| 3724 | DumpRecFrame (fsnr, &pSvcParam->sDependencyLayers[pSvcParam->iNumDependencyLayer - | 3725 | DumpRecFrame (fsnr, &pSvcParam->sDependencyLayers[pSvcParam->iSpatialLayerNum - |
| 3725 | 1].sRecFileName[0]); // pDecPic: final reconstruction output | 3726 | 1].sRecFileName[0]); // pDecPic: final reconstruction output |
| 3726 | #endif//ENABLE_FRAME_DUMP | 3727 | #endif//ENABLE_FRAME_DUMP |
| 3727 | 3728 | ||
| @@ -3757,18 +3758,18 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 29 unmodified lines | |||
| 3757 | /* Decide whether need reset for IDR frame based on adjusting prarameters changed */ | 3758 | /* Decide whether need reset for IDR frame based on adjusting prarameters changed */ |
| 3758 | /* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */ | 3759 | /* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */ |
| 3759 | bNeedReset = (pOldParam == NULL) || | 3760 | bNeedReset = (pOldParam == NULL) || |
| 3760 | (pOldParam->iNumTemporalLayer != pNewParam->iNumTemporalLayer) || | 3761 | (pOldParam->iTemporalLayerNum != pNewParam->iTemporalLayerNum) || |
| 3761 | (pOldParam->uiGopSize != pNewParam->uiGopSize) || | 3762 | (pOldParam->uiGopSize != pNewParam->uiGopSize) || |
| 3762 | (pOldParam->iNumDependencyLayer != pNewParam->iNumDependencyLayer) || | 3763 | (pOldParam->iSpatialLayerNum != pNewParam->iSpatialLayerNum) || |
| 3763 | (pOldParam->iDecompStages != pNewParam->iDecompStages) || | 3764 | (pOldParam->iDecompStages != pNewParam->iDecompStages) || |
| 3764 | (pOldParam->iActualPicWidth != pNewParam->iActualPicWidth | 3765 | (pOldParam->iPicWidth != pNewParam->iPicWidth |
| 3765 | || pOldParam->iActualPicHeight != pNewParam->iActualPicHeight) || | 3766 | || pOldParam->iPicHeight != pNewParam->iPicHeight) || |
| 3766 | (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth | 3767 | (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth |
| 3767 | || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) || | 3768 | || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) || |
| 3768 | (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference); | 3769 | (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference); |
| 3769 | if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer | 3770 | if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer |
| 3770 | iIndexD = 0; | 3771 | iIndexD = 0; |
| 3771 | assert (pOldParam->iNumDependencyLayer == pNewParam->iNumDependencyLayer); | 3772 | assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum); |
| 3772 | do { | 3773 | do { |
| 3773 | const SDLayerParam* kpOldDlp = &pOldParam->sDependencyLayers[iIndexD]; | 3774 | const SDLayerParam* kpOldDlp = &pOldParam->sDependencyLayers[iIndexD]; |
| 3774 | const SDLayerParam* kpNewDlp = &pNewParam->sDependencyLayers[iIndexD]; | 3775 | const SDLayerParam* kpNewDlp = &pNewParam->sDependencyLayers[iIndexD]; |
| @@ -3784,8 +3785,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 9 unmodified lines | |||
| 3784 | break; | 3785 | break; |
| 3785 | } | 3786 | } |
| 3786 | 3787 | ||
| 3787 | if (kpOldDlp->sMso.uiSliceMode != kpNewDlp->sMso.uiSliceMode || | 3788 | if (kpOldDlp->sSliceCfg.uiSliceMode != kpNewDlp->sSliceCfg.uiSliceMode || |
| 3788 | kpOldDlp->sMso.sSliceArgument.iSliceNum != kpNewDlp->sMso.sSliceArgument.iSliceNum) { | 3789 | kpOldDlp->sSliceCfg.sSliceArgument.uiSliceNum != kpNewDlp->sSliceCfg.sSliceArgument.uiSliceNum) { |
| 3789 | bNeedReset = true; | 3790 | bNeedReset = true; |
| 3790 | break; | 3791 | break; |
| 3791 | } | 3792 | } |
| @@ -3808,7 +3809,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 16 unmodified lines | |||
| 3808 | } | 3809 | } |
| 3809 | 3810 | ||
| 3810 | ++ iIndexD; | 3811 | ++ iIndexD; |
| 3811 | } while (iIndexD < pOldParam->iNumDependencyLayer); | 3812 | } while (iIndexD < pOldParam->iSpatialLayerNum); |
| 3812 | } | 3813 | } |
| 3813 | 3814 | ||
| 3814 | if (bNeedReset) { | 3815 | if (bNeedReset) { |
| @@ -3863,7 +3864,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 48 unmodified lines | |||
| 3863 | 3864 | ||
| 3864 | /* int32_t term reference control */ | 3865 | /* int32_t term reference control */ |
| 3865 | pOldParam->bEnableLongTermReference = pNewParam->bEnableLongTermReference; | 3866 | pOldParam->bEnableLongTermReference = pNewParam->bEnableLongTermReference; |
| 3866 | pOldParam->uiLtrMarkPeriod = pNewParam->uiLtrMarkPeriod; | 3867 | pOldParam->iLtrMarkPeriod = pNewParam->iLtrMarkPeriod; |
| 3867 | 3868 | ||
| 3868 | // keep below values unchanged as before | 3869 | // keep below values unchanged as before |
| 3869 | pOldParam->bEnableSSEI = pNewParam->bEnableSSEI; | 3870 | pOldParam->bEnableSSEI = pNewParam->bEnableSSEI; |
| @@ -3911,7 +3912,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 41 unmodified lines | |||
| 3911 | sizeof (pOldDlp->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage | 3912 | sizeof (pOldDlp->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage |
| 3912 | 3913 | ||
| 3913 | ++ iIndexD; | 3914 | ++ iIndexD; |
| 3914 | } while (iIndexD < pOldParam->iNumDependencyLayer); | 3915 | } while (iIndexD < pOldParam->iSpatialLayerNum); |
| 3915 | } | 3916 | } |
| 3916 | 3917 | ||
| 3917 | /* Any else initialization/reset for rate control here? */ | 3918 | /* Any else initialization/reset for rate control here? */ |