Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 14 files). Show all
Unified · Split
| @@ -160,7 +160,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 159 unmodified lines | ||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
| 163 | −int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam) { | |
| 163 | +int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingParam) { | |
| 164 | 164 | int8_t i = 0; |
| 165 | 165 | int32_t iIdx = 0; |
| 166 | 166 | |
| @@ -169,37 +169,37 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 2 unmodified lines | ||
| 169 | 169 | return ENC_RETURN_INVALIDINPUT; |
| 170 | 170 | |
| 171 | 171 | if ((pCodingParam->iUsageType != CAMERA_VIDEO_REAL_TIME) && (pCodingParam->iUsageType != SCREEN_CONTENT_REAL_TIME)) { |
| 172 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(),Invalid usage type = %d", pCodingParam->iUsageType); | |
| 172 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(),Invalid usage type = %d", pCodingParam->iUsageType); | |
| 173 | 173 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 174 | 174 | } |
| 175 | 175 | if (pCodingParam->iSpatialLayerNum < 1 || pCodingParam->iSpatialLayerNum > MAX_DEPENDENCY_LAYER) { |
| 176 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), monitor invalid pCodingParam->iSpatialLayerNum: %d!\n", | |
| 176 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), monitor invalid pCodingParam->iSpatialLayerNum: %d!\n", | |
| 177 | 177 | pCodingParam->iSpatialLayerNum); |
| 178 | 178 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | if (pCodingParam->iTemporalLayerNum < 1 || pCodingParam->iTemporalLayerNum > MAX_TEMPORAL_LEVEL) { |
| 182 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), monitor invalid pCodingParam->iTemporalLayerNum: %d!\n", | |
| 182 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), monitor invalid pCodingParam->iTemporalLayerNum: %d!\n", | |
| 183 | 183 | pCodingParam->iTemporalLayerNum); |
| 184 | 184 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (pCodingParam->uiGopSize < 1 || pCodingParam->uiGopSize > MAX_GOP_SIZE) { |
| 188 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), monitor invalid pCodingParam->uiGopSize: %d!\n", | |
| 188 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), monitor invalid pCodingParam->uiGopSize: %d!\n", | |
| 189 | 189 | pCodingParam->uiGopSize); |
| 190 | 190 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
| 194 | 194 | if (pCodingParam->uiIntraPeriod && pCodingParam->uiIntraPeriod < pCodingParam->uiGopSize) { |
| 195 | − WelsLog (pCtx, WELS_LOG_ERROR, | |
| 195 | + WelsLog (pLogCtx, WELS_LOG_ERROR, | |
| 196 | 196 | "ParamValidationExt(), uiIntraPeriod(%d) should be not less than that of uiGopSize(%d) or -1 specified!\n", |
| 197 | 197 | pCodingParam->uiIntraPeriod, pCodingParam->uiGopSize); |
| 198 | 198 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | if (pCodingParam->uiIntraPeriod && (pCodingParam->uiIntraPeriod & (pCodingParam->uiGopSize - 1)) != 0) { |
| 202 | − WelsLog (pCtx, WELS_LOG_ERROR, | |
| 202 | + WelsLog (pLogCtx, WELS_LOG_ERROR, | |
| 203 | 203 | "ParamValidationExt(), uiIntraPeriod(%d) should be multiple of uiGopSize(%d) or -1 specified!\n", |
| 204 | 204 | pCodingParam->uiIntraPeriod, pCodingParam->uiGopSize); |
| 205 | 205 | return ENC_RETURN_UNSUPPORTED_PARA; |
| @@ -227,24 +227,24 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 21 unmodified lines | ||
| 227 | 227 | int32_t iMbNumInFrame = 0; |
| 228 | 228 | uint32_t iMaxSliceNum = MAX_SLICES_NUM; |
| 229 | 229 | if (kiPicWidth <= 0 || kiPicHeight <= 0) { |
| 230 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid %d x %d in dependency layer settings!\n", kiPicWidth, | |
| 230 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid %d x %d in dependency layer settings!\n", kiPicWidth, | |
| 231 | 231 | kiPicHeight); |
| 232 | 232 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 233 | 233 | } |
| 234 | 234 | if ((kiPicWidth & 0x0F) != 0 || (kiPicHeight & 0x0F) != 0) { |
| 235 | − WelsLog (pCtx, WELS_LOG_ERROR, | |
| 235 | + WelsLog (pLogCtx, WELS_LOG_ERROR, | |
| 236 | 236 | "ParamValidationExt(), in layer #%d iWidth x iHeight(%d x %d) both should be multiple of 16, can not support with arbitrary size currently!\n", |
| 237 | 237 | i, kiPicWidth, kiPicHeight); |
| 238 | 238 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | if (pSpatialLayer->sSliceCfg.uiSliceMode >= SM_RESERVED) { |
| 242 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", | |
| 242 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", | |
| 243 | 243 | pSpatialLayer->sSliceCfg.uiSliceMode); |
| 244 | 244 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 245 | 245 | } |
| 246 | 246 | if ((pCodingParam->uiMaxNalSize != 0) && (pSpatialLayer->sSliceCfg.uiSliceMode != SM_DYN_SLICE)) { |
| 247 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!,MaxNalSize = %d\n", | |
| 247 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!,MaxNalSize = %d\n", | |
| 248 | 248 | pSpatialLayer->sSliceCfg.uiSliceMode, pCodingParam->uiMaxNalSize); |
| 249 | 249 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 250 | 250 | } |
| @@ -271,12 +271,12 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 20 unmodified lines | ||
| 271 | 271 | iMaxSliceNum = MAX_SLICES_NUM; |
| 272 | 272 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0 |
| 273 | 273 | || pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { |
| 274 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", | |
| 274 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", | |
| 275 | 275 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum); |
| 276 | 276 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 277 | 277 | } |
| 278 | 278 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum == 1) { |
| 279 | − WelsLog (pCtx, WELS_LOG_DEBUG, | |
| 279 | + WelsLog (pLogCtx, WELS_LOG_DEBUG, | |
| 280 | 280 | "ParamValidationExt(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!\n", |
| 281 | 281 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum); |
| 282 | 282 | pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| @@ -291,7 +291,7 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 8 unmodified lines | ||
| 291 | 291 | } else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame, |
| 292 | 292 | &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings |
| 293 | 293 | //check uiSliceMbNum with current uiSliceNum |
| 294 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | |
| 294 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | |
| 295 | 295 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 296 | 296 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 297 | 297 | } |
| @@ -315,31 +315,31 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 17 unmodified lines | ||
| 315 | 315 | iMbNumInFrame = iMbWidth * iMbHeight; |
| 316 | 316 | iMaxSliceNum = MAX_SLICES_NUM; |
| 317 | 317 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0] <= 0) { |
| 318 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | |
| 318 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | |
| 319 | 319 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 320 | 320 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | if (!CheckRasterMultiSliceSetting (iMbNumInFrame, |
| 324 | 324 | &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings |
| 325 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | |
| 325 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | |
| 326 | 326 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 327 | 327 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 328 | 328 | } |
| 329 | 329 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0 |
| 330 | 330 | || pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings |
| 331 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!\n", | |
| 331 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!\n", | |
| 332 | 332 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum); |
| 333 | 333 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 334 | 334 | } |
| 335 | 335 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum == 1) { |
| 336 | − WelsLog (pCtx, WELS_LOG_ERROR, | |
| 336 | + WelsLog (pLogCtx, WELS_LOG_ERROR, | |
| 337 | 337 | "ParamValidationExt(), pSlice setting for SM_RASTER_SLICE now turn to SM_SINGLE_SLICE!\n"); |
| 338 | 338 | pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE; |
| 339 | 339 | break; |
| 340 | 340 | } |
| 341 | 341 | if ((pCodingParam->iRCMode != RC_OFF_MODE) && pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > 1) { |
| 342 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), WARNING: GOM based RC do not support SM_RASTER_SLICE!\n"); | |
| 342 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), WARNING: GOM based RC do not support SM_RASTER_SLICE!\n"); | |
| 343 | 343 | } |
| 344 | 344 | // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting |
| 345 | 345 | if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) { |
| @@ -356,19 +356,19 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 10 unmodified lines | ||
| 356 | 356 | iMbHeight = (kiPicHeight + 15) >> 4; |
| 357 | 357 | iMaxSliceNum = MAX_SLICES_NUM; |
| 358 | 358 | if (iMbHeight > iMaxSliceNum) { |
| 359 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings more than MAX!\n", iMbHeight); | |
| 359 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings more than MAX!\n", iMbHeight); | |
| 360 | 360 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 361 | 361 | } |
| 362 | 362 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = iMbHeight; |
| 363 | 363 | |
| 364 | 364 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0) { |
| 365 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", | |
| 365 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", | |
| 366 | 366 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum); |
| 367 | 367 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 368 | 368 | } |
| 369 | 369 | if (!CheckRowMbMultiSliceSetting (iMbWidth, |
| 370 | 370 | &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings |
| 371 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | |
| 371 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n", | |
| 372 | 372 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]); |
| 373 | 373 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 374 | 374 | } |
| @@ -378,20 +378,20 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 3 unmodified lines | ||
| 378 | 378 | iMbWidth = (kiPicWidth + 15) >> 4; |
| 379 | 379 | iMbHeight = (kiPicHeight + 15) >> 4; |
| 380 | 380 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint <= 0) { |
| 381 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid iSliceSize (%d) settings!\n", | |
| 381 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid iSliceSize (%d) settings!\n", | |
| 382 | 382 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint); |
| 383 | 383 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | if (pCodingParam->uiMaxNalSize <= NAL_HEADER_ADD_0X30BYTES) { |
| 387 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiMaxNalSize (%d) settings!\n", | |
| 387 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiMaxNalSize (%d) settings!\n", | |
| 388 | 388 | pCodingParam->uiMaxNalSize); |
| 389 | 389 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize - |
| 393 | 393 | NAL_HEADER_ADD_0X30BYTES)) { |
| 394 | − WelsLog (pCtx, WELS_LOG_WARNING, | |
| 394 | + WelsLog (pLogCtx, WELS_LOG_WARNING, | |
| 395 | 395 | "ParamValidationExt(), slice mode = SM_DYN_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d!\n", |
| 396 | 396 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize); |
| 397 | 397 | pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES; |
| @@ -406,7 +406,7 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 8 unmodified lines | ||
| 406 | 406 | } |
| 407 | 407 | break; |
| 408 | 408 | default: { |
| 409 | − WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", | |
| 409 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", | |
| 410 | 410 | pCodingParam->sSpatialLayers[0].sSliceCfg.uiSliceMode); |
| 411 | 411 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 412 | 412 | |
| @@ -415,7 +415,7 @@ int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pCodingParam · 2 unmodified lines | ||
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | − return ParamValidation (pCtx, pCodingParam); | |
| 418 | + return ParamValidation (pLogCtx, pCodingParam); | |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | |
| @@ -2025,7 +2025,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 1603 unmodified lines | ||
| 2025 | 2025 | pCtx->iMaxSliceCount = iSliceNum; |
| 2026 | 2026 | iRet = RequestMemorySvc (&pCtx); |
| 2027 | 2027 | if (iRet != 0) { |
| 2028 | − WelsLog (pCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), RequestMemorySvc failed return %d.\n", iRet); | |
| 2028 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), RequestMemorySvc failed return %d.\n", iRet); | |
| 2029 | 2029 | FreeMemorySvc (&pCtx); |
| 2030 | 2030 | return iRet; |
| 2031 | 2031 | } |
| @@ -2038,18 +2038,18 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 6 unmodified lines | ||
| 2038 | 2038 | pCtx->pVpp = new CWelsPreProcess (pCtx); |
| 2039 | 2039 | if (pCtx->pVpp == NULL) { |
| 2040 | 2040 | iRet = 1; |
| 2041 | − WelsLog (pCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), pOut of memory in case new CWelsPreProcess().\n"); | |
| 2041 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), pOut of memory in case new CWelsPreProcess().\n"); | |
| 2042 | 2042 | FreeMemorySvc (&pCtx); |
| 2043 | 2043 | return iRet; |
| 2044 | 2044 | } |
| 2045 | 2045 | if ((iRet = pCtx->pVpp->AllocSpatialPictures (pCtx, pCtx->pSvcParam)) != 0) { |
| 2046 | − WelsLog (pCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), pVPP alloc spatial pictures failed\n"); | |
| 2046 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), pVPP alloc spatial pictures failed\n"); | |
| 2047 | 2047 | FreeMemorySvc (&pCtx); |
| 2048 | 2048 | return iRet; |
| 2049 | 2049 | } |
| 2050 | 2050 | |
| 2051 | 2051 | #if defined(MEMORY_MONITOR) |
| 2052 | − WelsLog (pCtx, WELS_LOG_INFO, "WelsInitEncoderExt() exit, overall memory usage: %llu bytes\n", | |
| 2052 | + WelsLog (pLogCtx, WELS_LOG_INFO, "WelsInitEncoderExt() exit, overall memory usage: %llu bytes\n", | |
| 2053 | 2053 | static_cast<unsigned long long> (sizeof (sWelsEncCtx) /* requested size from malloc() or new operator */ |
| 2054 | 2054 | + pCtx->pMemAlign->WelsGetMemoryUsage()) /* requested size from CMemoryAlign::WelsMalloc() */ |
| 2055 | 2055 | ); |
| @@ -2057,7 +2057,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 1 unmodified line | ||
| 2057 | 2057 | |
| 2058 | 2058 | *ppCtx = pCtx; |
| 2059 | 2059 | |
| 2060 | − WelsLog (pCtx, WELS_LOG_DEBUG, "WelsInitEncoderExt(), pCtx= 0x%p.\n", (void*)pCtx); | |
| 2060 | + WelsLog (pLogCtx, WELS_LOG_DEBUG, "WelsInitEncoderExt(), pCtx= 0x%p.\n", (void*)pCtx); | |
| 2061 | 2061 | |
| 2062 | 2062 | return 0; |
| 2063 | 2063 | } |
| @@ -2150,7 +2150,7 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 86 unmodified lines | ||
| 2150 | 2150 | if (NULL == ppCtx || NULL == *ppCtx) |
| 2151 | 2151 | return; |
| 2152 | 2152 | |
| 2153 | − WelsLog (*ppCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pCtx= %p, iThreadCount= %d, iMultipleThreadIdc= %d.\n", | |
| 2153 | + WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pCtx= %p, iThreadCount= %d, iMultipleThreadIdc= %d.\n", | |
| 2154 | 2154 | (void*) (*ppCtx), (*ppCtx)->pSvcParam->iCountThreadsNum, (*ppCtx)->pSvcParam->iMultipleThreadIdc); |
| 2155 | 2155 | |
| 2156 | 2156 | #if defined(STAT_OUTPUT) |
| @@ -2168,7 +2168,7 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 11 unmodified lines | ||
| 2168 | 2168 | WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]); |
| 2169 | 2169 | WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]); |
| 2170 | 2170 | res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit |
| 2171 | − WelsLog (*ppCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..\n", iThreadIdx, | |
| 2171 | + WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..\n", iThreadIdx, | |
| 2172 | 2172 | res); |
| 2173 | 2173 | (*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] = 0; |
| 2174 | 2174 | } |
| @@ -2333,7 +2333,7 @@ void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) { · 158 unmodified lines | ||
| 2333 | 2333 | / (pSliceCtx->iMaxSliceNumConstraint)) |
| 2334 | 2334 | ) { |
| 2335 | 2335 | |
| 2336 | − WelsLog (pCtx, | |
| 2336 | + WelsLog (&(pCtx->sLogCtx), | |
| 2337 | 2337 | WELS_LOG_WARNING, |
| 2338 | 2338 | "Set-SliceConstraint(%d) too small for current resolution (MB# %d) under QP/BR!\n", |
| 2339 | 2339 | pSliceCtx->uiSliceSizeConstraint, |
| @@ -2492,7 +2492,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 152 unmodified lines | ||
| 2492 | 2492 | const bool kbHighestSpatialLayer = |
| 2493 | 2493 | (pCtx->pSvcParam->iSpatialLayerNum == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1)); |
| 2494 | 2494 | SWelsFuncPtrList* pFuncList = pCtx->pFuncList; |
| 2495 | − | |
| 2495 | + SLogContext* pLogCtx = &(pCtx->sLogCtx); | |
| 2496 | 2496 | /* function pointers conditional assignment under sWelsEncCtx, layer_mb_enc_rec (in stack) is exclusive */ |
| 2497 | 2497 | if (kbHighestSpatialLayer && pCtx->pSvcParam->iUsageType == CAMERA_VIDEO_REAL_TIME) { |
| 2498 | 2498 | SetFastCodingFunc (pFuncList); |
| @@ -2528,7 +2528,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 29 unmodified lines | ||
| 2528 | 2528 | //ME related func pointers |
| 2529 | 2529 | //ME16x16 |
| 2530 | 2530 | if (!SetMeMethod (ME_DIA_CROSS, pFuncList->pfSearchMethod[BLOCK_16x16])) { |
| 2531 | − WelsLog (pCtx, WELS_LOG_WARNING, "SetMeMethod(BLOCK_16x16) ME_DIA_CROSS unsuccessful, switched to default search\n"); | |
| 2531 | + WelsLog (pLogCtx, WELS_LOG_WARNING, "SetMeMethod(BLOCK_16x16) ME_DIA_CROSS unsuccessful, switched to default search\n"); | |
| 2532 | 2532 | } |
| 2533 | 2533 | //ME8x8 |
| 2534 | 2534 | SFeatureSearchPreparation* pFeatureSearchPreparation = pCurLayer->pFeatureSearchPreparation; |
| @@ -2556,7 +2556,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 21 unmodified lines | ||
| 2556 | 2556 | if (pFeatureSearchPreparation->bFMESwitchFlag && pScreenBlockFeatureStorage->bRefBlockFeatureCalculated |
| 2557 | 2557 | && (!pScreenBlockFeatureStorage->iIs16x16)) { |
| 2558 | 2558 | if (!SetMeMethod (ME_DIA_CROSS_FME, pFuncList->pfSearchMethod[BLOCK_8x8])) { |
| 2559 | − WelsLog (pCtx, WELS_LOG_WARNING, "SetMeMethod(BLOCK_8x8) ME_DIA_CROSS_FME unsuccessful, switched to default search\n"); | |
| 2559 | + WelsLog (pLogCtx, WELS_LOG_WARNING, "SetMeMethod(BLOCK_8x8) ME_DIA_CROSS_FME unsuccessful, switched to default search\n"); | |
| 2560 | 2560 | } |
| 2561 | 2561 | } |
| 2562 | 2562 | |
| @@ -2833,7 +2833,7 @@ int32_t WritePadding (sWelsEncCtx* pCtx, int32_t iLen, int32_t& iSize) { · 270 unmodified lines | ||
| 2833 | 2833 | |
| 2834 | 2834 | if ((pBs->pBufEnd - pBs->pBufPtr) < iLen || iNal >= pCtx->pOut->iCountNals) { |
| 2835 | 2835 | #if GOM_TRACE_FLAG |
| 2836 | − WelsLog (pCtx, WELS_LOG_ERROR, | |
| 2836 | + WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, | |
| 2837 | 2837 | "[RC] paddingcal pBuffer overflow, bufferlen=%lld, paddinglen=%d, iNalIdx= %d, iCountNals= %d\n", |
| 2838 | 2838 | static_cast<long long int> (pBs->pBufEnd - pBs->pBufPtr), iLen, iNal, pCtx->pOut->iCountNals); |
| 2839 | 2839 | #endif |
| @@ -2947,6 +2947,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 107 unmodified lines | ||
| 2947 | 2947 | int8_t iCurDid = 0; |
| 2948 | 2948 | int8_t iCurTid = 0; |
| 2949 | 2949 | bool bAvcBased = false; |
| 2950 | + SLogContext* pLogCtx = &(pCtx->sLogCtx); | |
| 2950 | 2951 | #if defined(ENABLE_PSNR_CALC) |
| 2951 | 2952 | float fSnrY = .0f, fSnrU = .0f, fSnrV = .0f; |
| 2952 | 2953 | #endif//ENABLE_PSNR_CALC |
| @@ -3066,7 +3067,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 113 unmodified lines | ||
| 3066 | 3067 | /* coding each spatial layer, only one sQualityStat layer within spatial support */ |
| 3067 | 3068 | int32_t iSliceCount = 1; |
| 3068 | 3069 | if (iLayerNum >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info writing as follows |
| 3069 | − WelsLog (pCtx, WELS_LOG_ERROR, "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d)!", iLayerNum, | |
| 3070 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d)!", iLayerNum, | |
| 3070 | 3071 | MAX_LAYER_NUM_OF_FRAME); |
| 3071 | 3072 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 3072 | 3073 | } |
| @@ -3106,7 +3107,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 33 unmodified lines | ||
| 3106 | 3107 | if (!pCtx->pFuncList->pBuildRefList (pCtx, pCtx->iPOC, 0)) { |
| 3107 | 3108 | // Force coding IDR as followed |
| 3108 | 3109 | ForceCodingIDR (pCtx); |
| 3109 | − WelsLog (pCtx, WELS_LOG_WARNING, | |
| 3110 | + WelsLog (pLogCtx, WELS_LOG_WARNING, | |
| 3110 | 3111 | "WelsEncoderEncodeExt(), WelsBuildRefList failed for P frames, pCtx->iNumRef0= %d. ForceCodingIDR!\n", |
| 3111 | 3112 | pCtx->iNumRef0); |
| 3112 | 3113 | pFbi->eFrameType = videoFrameTypeIDR; |
| @@ -3179,13 +3180,13 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 66 unmodified lines | ||
| 3179 | 3180 | if ((SM_DYN_SLICE != pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { |
| 3180 | 3181 | iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx); |
| 3181 | 3182 | if (iLayerNum + 1 >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed |
| 3182 | − WelsLog (pCtx, WELS_LOG_ERROR, | |
| 3183 | + WelsLog (pLogCtx, WELS_LOG_ERROR, | |
| 3183 | 3184 | "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!", |
| 3184 | 3185 | iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, pParam->sSliceCfg.uiSliceMode, iSliceCount); |
| 3185 | 3186 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 3186 | 3187 | } |
| 3187 | 3188 | if (iSliceCount <= 1) { |
| 3188 | − WelsLog (pCtx, WELS_LOG_ERROR, | |
| 3189 | + WelsLog (pLogCtx, WELS_LOG_ERROR, | |
| 3189 | 3190 | "WelsEncoderEncodeExt(), iSliceCount(%d) from GetCurrentSliceNum() is untrusted due stack/heap crupted!\n", |
| 3190 | 3191 | iSliceCount); |
| 3191 | 3192 | return ENC_RETURN_UNEXPECTED; |
| @@ -3203,7 +3204,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 11 unmodified lines | ||
| 3203 | 3204 | &pCtx->pSliceThreading->pThreadMasterEvent[0], |
| 3204 | 3205 | pLayerBsInfo, iSliceCount, pCtx->pCurDqLayer->pSliceEncCtx, false); |
| 3205 | 3206 | if (iRet) { |
| 3206 | − WelsLog (pCtx, WELS_LOG_ERROR, | |
| 3207 | + WelsLog (pLogCtx, WELS_LOG_ERROR, | |
| 3207 | 3208 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", |
| 3208 | 3209 | iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); |
| 3209 | 3210 | return ENC_RETURN_UNEXPECTED; |
| @@ -3243,7 +3244,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 33 unmodified lines | ||
| 3243 | 3244 | &pCtx->pSliceThreading->pThreadMasterEvent[0], |
| 3244 | 3245 | pLayerBsInfo, iNumThreadsRunning, pCtx->pCurDqLayer->pSliceEncCtx, false); |
| 3245 | 3246 | if (iRet) { |
| 3246 | − WelsLog (pCtx, WELS_LOG_ERROR, | |
| 3247 | + WelsLog (pLogCtx, WELS_LOG_ERROR, | |
| 3247 | 3248 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", |
| 3248 | 3249 | iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); |
| 3249 | 3250 | return ENC_RETURN_UNEXPECTED; |
| @@ -3290,7 +3291,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 40 unmodified lines | ||
| 3290 | 3291 | &pCtx->pSliceThreading->pThreadMasterEvent[0], |
| 3291 | 3292 | pLayerBsInfo, kiPartitionCnt, pCtx->pCurDqLayer->pSliceEncCtx, true); |
| 3292 | 3293 | if (iRet) { |
| 3293 | − WelsLog (pCtx, WELS_LOG_ERROR, | |
| 3294 | + WelsLog (pLogCtx, WELS_LOG_ERROR, | |
| 3294 | 3295 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", |
| 3295 | 3296 | iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); |
| 3296 | 3297 | return ENC_RETURN_UNEXPECTED; |
| @@ -3370,7 +3371,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 73 unmodified lines | ||
| 3370 | 3371 | if (!pCtx->pFuncList->pUpdateRefList (pCtx)) { |
| 3371 | 3372 | // Force coding IDR as followed |
| 3372 | 3373 | ForceCodingIDR (pCtx); |
| 3373 | − WelsLog (pCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), WelsUpdateRefList failed. ForceCodingIDR!\n"); | |
| 3374 | + WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), WelsUpdateRefList failed. ForceCodingIDR!\n"); | |
| 3374 | 3375 | //the above is to set the next frame to be IDR |
| 3375 | 3376 | pFbi->eFrameType = eFrameType; |
| 3376 | 3377 | return ENC_RETURN_CORRECTED; |
| @@ -3476,7 +3477,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 99 unmodified lines | ||
| 3476 | 3477 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) |
| 3477 | 3478 | |
| 3478 | 3479 | #if GOM_TRACE_FLAG |
| 3479 | − WelsLog (pCtx, WELS_LOG_INFO, "[RC] encoding_qp%d Padding: %d\n", pCtx->uiDependencyId, | |
| 3480 | + WelsLog (pLogCtx, WELS_LOG_INFO, "[RC] encoding_qp%d Padding: %d\n", pCtx->uiDependencyId, | |
| 3480 | 3481 | pCtx->pWelsSvcRc[pCtx->uiDependencyId].iPaddingSize); |
| 3481 | 3482 | #endif |
| 3482 | 3483 | if (iPaddingNalSize <= 0) |
| @@ -3521,7 +3522,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 38 unmodified lines | ||
| 3521 | 3522 | |
| 3522 | 3523 | if (pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx) != 0) { |
| 3523 | 3524 | ForceCodingIDR (pCtx); |
| 3524 | − WelsLog (pCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!\n"); | |
| 3525 | + WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!\n"); | |
| 3525 | 3526 | //the above is to set the next frame IDR |
| 3526 | 3527 | pFbi->eFrameType = eFrameType; |
| 3527 | 3528 | return ENC_RETURN_CORRECTED; |