| @@ -363,10 +363,13 @@ EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum · 362 unmodified lines |
| 363 | 363 | * \brief Dump reconstruction for dependency layer |
| 364 | 364 | */ |
| 365 | 365 | |
| 366 | | −extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend) { |
| 366 | +extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend, SDqLayer* pDqLayer) { |
| 367 | 367 | WelsFileHandle* pDumpRecFile = NULL; |
| 368 | 368 | int32_t iWrittenSize = 0; |
| 369 | 369 | const char* openMode = bAppend ? "ab" : "wb"; |
| 370 | + SWelsSPS* pSpsTmp = (kiDid> BASE_DEPENDENCY_ID)? &(pDqLayer->sLayerInfo.pSubsetSpsP->pSps) : pDqLayer->sLayerInfo.pSpsP; |
| 371 | + bool bFrameCroppingFlag = pSpsTmp->bFrameCroppingFlag; |
| 372 | + SCropOffset* pFrameCrop = &pSpsTmp->sFrameCrop; |
| 370 | 373 | |
| 371 | 374 | if (NULL == pCurPicture || NULL == kpFileName || kiDid >= MAX_DEPENDENCY_LAYER) |
| 372 | 375 | return; |
| @@ -385,13 +388,14 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName · 12 unmodified lines |
| 385 | 388 | int32_t i = 0; |
| 386 | 389 | int32_t j = 0; |
| 387 | 390 | const int32_t kiStrideY = pCurPicture->iLineSize[0]; |
| 388 | | − const int32_t kiLumaWidth = pCurPicture->iWidthInPixel; |
| 389 | | − const int32_t kiLumaHeight = pCurPicture->iHeightInPixel; |
| 391 | + const int32_t kiLumaWidth = bFrameCroppingFlag?(pCurPicture->iWidthInPixel-(( pFrameCrop->iCropLeft + pFrameCrop->iCropRight ) << 1 )) : pCurPicture->iWidthInPixel; |
| 392 | + const int32_t kiLumaHeight = bFrameCroppingFlag?(pCurPicture->iHeightInPixel-(( pFrameCrop->iCropTop + pFrameCrop->iCropBottom ) << 1 )) : pCurPicture->iHeightInPixel; |
| 390 | 393 | const int32_t kiChromaWidth = kiLumaWidth >> 1; |
| 391 | 394 | const int32_t kiChromaHeight = kiLumaHeight >> 1; |
| 392 | | − |
| 395 | + uint8_t* pSrc = NULL; |
| 396 | + pSrc = bFrameCroppingFlag ? (pCurPicture->pData[0] + kiStrideY * ( pFrameCrop->iCropTop << 1 ) + ( pFrameCrop->iCropLeft << 1 )) : pCurPicture->pData[0]; |
| 393 | 397 | for (j = 0; j < kiLumaHeight; ++ j) { |
| 394 | | − iWrittenSize = WelsFwrite (&pCurPicture->pData[0][j * kiStrideY], 1, kiLumaWidth, pDumpRecFile); |
| 398 | + iWrittenSize = WelsFwrite (pSrc + j * kiStrideY, 1, kiLumaWidth, pDumpRecFile); |
| 395 | 399 | assert (iWrittenSize == kiLumaWidth); |
| 396 | 400 | if (iWrittenSize < kiLumaWidth) { |
| 397 | 401 | assert (0); // make no sense for us if writing failed |
| @@ -401,8 +405,9 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName · 3 unmodified lines |
| 401 | 405 | } |
| 402 | 406 | for (i = 1; i < I420_PLANES; ++ i) { |
| 403 | 407 | const int32_t kiStrideUV = pCurPicture->iLineSize[i]; |
| 408 | + pSrc = bFrameCroppingFlag ? (pCurPicture->pData[i] + kiStrideUV * pFrameCrop->iCropTop + pFrameCrop->iCropLeft) : pCurPicture->pData[i]; |
| 404 | 409 | for (j = 0; j < kiChromaHeight; ++ j) { |
| 405 | | − iWrittenSize = WelsFwrite (&pCurPicture->pData[i][j * kiStrideUV], 1, kiChromaWidth, pDumpRecFile); |
| 410 | + iWrittenSize = WelsFwrite (pSrc + j * kiStrideUV, 1, kiChromaWidth, pDumpRecFile); |
| 406 | 411 | assert (iWrittenSize == kiChromaWidth); |
| 407 | 412 | if (iWrittenSize < kiChromaWidth) { |
| 408 | 413 | assert (0); // make no sense for us if writing failed |
| @@ -420,8 +425,12 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName · 11 unmodified lines |
| 420 | 425 | * \brief Dump the reconstruction pictures |
| 421 | 426 | */ |
| 422 | 427 | |
| 423 | | −void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, bool bAppend) { |
| 428 | +void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend, SDqLayer* pDqLayer) { |
| 424 | 429 | WelsFileHandle* pDumpRecFile = NULL; |
| 430 | + SWelsSPS* pSpsTmp = (kiDid> BASE_DEPENDENCY_ID)? &(pDqLayer->sLayerInfo.pSubsetSpsP->pSps) : pDqLayer->sLayerInfo.pSpsP; |
| 431 | + bool bFrameCroppingFlag = pSpsTmp->bFrameCroppingFlag; |
| 432 | + SCropOffset* pFrameCrop = &pSpsTmp->sFrameCrop; |
| 433 | + |
| 425 | 434 | int32_t iWrittenSize = 0; |
| 426 | 435 | const char* openMode = bAppend ? "ab" : "wb"; |
| 427 | 436 | |
| @@ -440,13 +449,14 @@ void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, bool bAppend) · 12 unmodified lines |
| 440 | 449 | int32_t i = 0; |
| 441 | 450 | int32_t j = 0; |
| 442 | 451 | const int32_t kiStrideY = pCurPicture->iLineSize[0]; |
| 443 | | − const int32_t kiLumaWidth = pCurPicture->iWidthInPixel; |
| 444 | | − const int32_t kiLumaHeight = pCurPicture->iHeightInPixel; |
| 452 | + const int32_t kiLumaWidth = bFrameCroppingFlag ? (pCurPicture->iWidthInPixel-(( pFrameCrop->iCropLeft + pFrameCrop->iCropRight ) << 1 )) : pCurPicture->iWidthInPixel; |
| 453 | + const int32_t kiLumaHeight = bFrameCroppingFlag ? (pCurPicture->iHeightInPixel-(( pFrameCrop->iCropTop + pFrameCrop->iCropBottom ) << 1 )) : pCurPicture->iHeightInPixel; |
| 445 | 454 | const int32_t kiChromaWidth = kiLumaWidth >> 1; |
| 446 | 455 | const int32_t kiChromaHeight = kiLumaHeight >> 1; |
| 447 | | − |
| 456 | + uint8_t* pSrc = NULL; |
| 457 | + pSrc = bFrameCroppingFlag ? (pCurPicture->pData[0] + kiStrideY * ( pFrameCrop->iCropTop << 1 ) + ( pFrameCrop->iCropLeft << 1 )) : pCurPicture->pData[0]; |
| 448 | 458 | for (j = 0; j < kiLumaHeight; ++ j) { |
| 449 | | − iWrittenSize = WelsFwrite (&pCurPicture->pData[0][j * kiStrideY], 1, kiLumaWidth, pDumpRecFile); |
| 459 | + iWrittenSize = WelsFwrite (pSrc + j * kiStrideY, 1, kiLumaWidth, pDumpRecFile); |
| 450 | 460 | assert (iWrittenSize == kiLumaWidth); |
| 451 | 461 | if (iWrittenSize < kiLumaWidth) { |
| 452 | 462 | assert (0); // make no sense for us if writing failed |
| @@ -456,8 +466,9 @@ void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, bool bAppend) · 3 unmodified lines |
| 456 | 466 | } |
| 457 | 467 | for (i = 1; i < I420_PLANES; ++ i) { |
| 458 | 468 | const int32_t kiStrideUV = pCurPicture->iLineSize[i]; |
| 469 | + pSrc = bFrameCroppingFlag ? (pCurPicture->pData[i] + kiStrideUV * pFrameCrop->iCropTop + pFrameCrop->iCropLeft) : pCurPicture->pData[i]; |
| 459 | 470 | for (j = 0; j < kiChromaHeight; ++ j) { |
| 460 | | − iWrittenSize = WelsFwrite (&pCurPicture->pData[i][j * kiStrideUV], 1, kiChromaWidth, pDumpRecFile); |
| 471 | + iWrittenSize = WelsFwrite (pSrc + j * kiStrideUV, 1, kiChromaWidth, pDumpRecFile); |
| 461 | 472 | assert (iWrittenSize == kiChromaWidth); |
| 462 | 473 | if (iWrittenSize < kiChromaWidth) { |
| 463 | 474 | assert (0); // make no sense for us if writing failed |