Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 2 files). Show all
Unified · Split
| @@ -393,9 +393,6 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn · 392 unmodified lines | |||
| 393 | "CWelsH264SVCEncoder::EncodeFrame(), m_uiCountFrameNum= %d,", m_uiCountFrameNum); | 393 | "CWelsH264SVCEncoder::EncodeFrame(), m_uiCountFrameNum= %d,", m_uiCountFrameNum); |
| 394 | #endif//REC_FRAME_COUNT | 394 | #endif//REC_FRAME_COUNT |
| 395 | 395 | ||
| 396 | #ifdef DUMP_SRC_PICTURE | ||
| 397 | DumpSrcPicture (pSrc); | ||
| 398 | #endif // DUMP_SRC_PICTURE | ||
| 399 | return kiEncoderReturn; | 396 | return kiEncoderReturn; |
| 400 | } | 397 | } |
| 401 | 398 | ||
| @@ -461,7 +458,7 @@ int CWelsH264SVCEncoder ::EncodeFrameInternal (const SSourcePicture* pSrcPic, S · 59 unmodified lines | |||
| 461 | } | 458 | } |
| 462 | #endif //OUTPUT_BIT_STREAM | 459 | #endif //OUTPUT_BIT_STREAM |
| 463 | #ifdef DUMP_SRC_PICTURE | 460 | #ifdef DUMP_SRC_PICTURE |
| 464 | DumpSrcPicture (pSrcPicList[0]->pData[0]); | 461 | DumpSrcPicture (pSrcPic, m_pEncContext->pSvcParam->iUsageType); |
| 465 | #endif // DUMP_SRC_PICTURE | 462 | #endif // DUMP_SRC_PICTURE |
| 466 | 463 | ||
| 467 | return cmResultSuccess; | 464 | return cmResultSuccess; |
| @@ -491,7 +488,7 @@ int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) { · 23 unmodified lines | |||
| 491 | void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { | 488 | void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { |
| 492 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 489 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, |
| 493 | "iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;iMaxBitrate= %d;iRCMode= %d;iPaddingFlag= %d;iTemporalLayerNum= %d;iSpatialLayerNum= %d;fFrameRate= %.6ff;uiIntraPeriod= %d;" | 490 | "iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;iMaxBitrate= %d;iRCMode= %d;iPaddingFlag= %d;iTemporalLayerNum= %d;iSpatialLayerNum= %d;fFrameRate= %.6ff;uiIntraPeriod= %d;" |
| 494 | "eSpsPpsIdStrategy = %d;bPrefixNalAddingCtrl = %d;bSimulcastAVC=%d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableSceneChangeDetect = %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;" | 491 | "eSpsPpsIdStrategy = %d;bPrefixNalAddingCtrl = %d;bSimulcastAVC=%d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableSceneChangeDetect = %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d, bIsLosslessLink=%d;" |
| 495 | "iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d (offset(alpha/beta): %d,%d;iMaxQp = %d;iMinQp = %d)", | 492 | "iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d (offset(alpha/beta): %d,%d;iMaxQp = %d;iMinQp = %d)", |
| 496 | pParam->iUsageType, | 493 | pParam->iUsageType, |
| 497 | pParam->iPicWidth, | 494 | pParam->iPicWidth, |
| @@ -514,6 +511,7 @@ void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { · 16 unmodified lines | |||
| 514 | pParam->bEnableFrameSkip, | 511 | pParam->bEnableFrameSkip, |
| 515 | pParam->bEnableLongTermReference, | 512 | pParam->bEnableLongTermReference, |
| 516 | pParam->iLtrMarkPeriod, | 513 | pParam->iLtrMarkPeriod, |
| 514 | pParam->bIsLosslessLink, | ||
| 517 | pParam->iComplexityMode, | 515 | pParam->iComplexityMode, |
| 518 | pParam->iNumRefFrame, | 516 | pParam->iNumRefFrame, |
| 519 | pParam->iEntropyCodingModeFlag, | 517 | pParam->iEntropyCodingModeFlag, |
| @@ -1273,57 +1271,51 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) { · 753 unmodified lines | |||
| 1273 | return 0; | 1271 | return 0; |
| 1274 | } | 1272 | } |
| 1275 | 1273 | ||
| 1276 | void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) { | 1274 | void CWelsH264SVCEncoder::DumpSrcPicture (const SSourcePicture* pSrcPic, const int iUsageType) { |
| 1277 | #ifdef DUMP_SRC_PICTURE | 1275 | #ifdef DUMP_SRC_PICTURE |
| 1278 | FILE* pFile = NULL; | 1276 | FILE* pFile = NULL; |
| 1279 | char strFileName[256] = {0}; | 1277 | char strFileName[256] = {0}; |
| 1280 | const int32_t iDataLength = m_iMaxPicWidth * m_iMaxPicHeight; | 1278 | const int32_t iDataLength = m_iMaxPicWidth * m_iMaxPicHeight; |
| 1281 | 1279 | ||
| 1282 | WelsStrncpy (strFileName, 256, "pic_in_"); // confirmed_safe_unsafe_usage | 1280 | WelsSnprintf (strFileName, sizeof (strFileName), "pic_in_%dx%d.yuv", m_iMaxPicWidth, m_iMaxPicHeight);// confirmed_safe_unsafe_usage |
| 1283 | |||
| 1284 | if (m_iMaxPicWidth == 640) { | ||
| 1285 | WelsStrcat (strFileName, 256, "360p."); // confirmed_safe_unsafe_usage | ||
| 1286 | } else if (m_iMaxPicWidth == 320) { | ||
| 1287 | WelsStrcat (strFileName, 256, "180p."); // confirmed_safe_unsafe_usage | ||
| 1288 | } else if (m_iMaxPicWidth == 160) { | ||
| 1289 | WelsStrcat (strFileName, 256, "90p."); // confirmed_safe_unsafe_usage | ||
| 1290 | } | ||
| 1291 | 1281 | ||
| 1292 | switch (m_iCspInternal) { | 1282 | switch (pSrcPic->iColorFormat) { |
| 1293 | case videoFormatI420: | 1283 | case videoFormatI420: |
| 1294 | case videoFormatYV12: | 1284 | case videoFormatYV12: |
| 1295 | WelsStrcat (strFileName, 256, "yuv"); // confirmed_safe_unsafe_usage | ||
| 1296 | pFile = WelsFopen (strFileName, "ab+"); | 1285 | pFile = WelsFopen (strFileName, "ab+"); |
| 1297 | // WelsLog( &m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "WELS_CSP_I420, m_iCspInternal= 0x%x", m_iCspInternal); | 1286 | |
| 1298 | if (NULL != pFile) { | 1287 | if (NULL != pFile) { |
| 1299 | fwrite (pSrc, sizeof (uint8_t), (iDataLength * 3) >> 1, pFile); | 1288 | fwrite (pSrcPic->pData[0], sizeof (uint8_t), pSrcPic->iStride[0]*m_iMaxPicHeight, pFile); |
| 1289 | fwrite (pSrcPic->pData[1], sizeof (uint8_t), pSrcPic->iStride[1]*(m_iMaxPicHeight >> 1), pFile); | ||
| 1290 | fwrite (pSrcPic->pData[2], sizeof (uint8_t), pSrcPic->iStride[2]*(m_iMaxPicHeight >> 1), pFile); | ||
| 1300 | fflush (pFile); | 1291 | fflush (pFile); |
| 1301 | fclose (pFile); | 1292 | fclose (pFile); |
| 1293 | } else { | ||
| 1294 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "DumpSrcPicture, strFileName %s open failed!", strFileName); | ||
| 1302 | } | 1295 | } |
| 1303 | break; | 1296 | break; |
| 1304 | case videoFormatRGB: | 1297 | case videoFormatRGB: |
| 1305 | WelsStrcat (strFileName, 256, "rgb"); // confirmed_safe_unsafe_usage | 1298 | WelsStrcat (strFileName, 256, ".rgb"); // confirmed_safe_unsafe_usage |
| 1306 | pFile = WelsFopen (strFileName, "ab+"); | 1299 | pFile = WelsFopen (strFileName, "ab+"); |
| 1307 | if (NULL != pFile) { | 1300 | if (NULL != pFile) { |
| 1308 | fwrite (pSrc, sizeof (uint8_t), iDataLength * 3, pFile); | 1301 | fwrite (pSrcPic->pData[0], sizeof (uint8_t), iDataLength * 3, pFile); |
| 1309 | fflush (pFile); | 1302 | fflush (pFile); |
| 1310 | fclose (pFile); | 1303 | fclose (pFile); |
| 1311 | } | 1304 | } |
| 1312 | case videoFormatBGR: | 1305 | case videoFormatBGR: |
| 1313 | WelsStrcat (strFileName, 256, "bgr"); // confirmed_safe_unsafe_usage | 1306 | WelsStrcat (strFileName, 256, ".bgr"); // confirmed_safe_unsafe_usage |
| 1314 | pFile = WelsFopen (strFileName, "ab+"); | 1307 | pFile = WelsFopen (strFileName, "ab+"); |
| 1315 | // WelsLog( &m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "WELS_CSP_BGR, m_iCspInternal= 0x%x", m_iCspInternal); | ||
| 1316 | if (NULL != pFile) { | 1308 | if (NULL != pFile) { |
| 1317 | fwrite (pSrc, sizeof (uint8_t), iDataLength * 3, pFile); | 1309 | fwrite (pSrcPic->pData[0], sizeof (uint8_t), iDataLength * 3, pFile); |
| 1318 | fflush (pFile); | 1310 | fflush (pFile); |
| 1319 | fclose (pFile); | 1311 | fclose (pFile); |
| 1320 | } | 1312 | } |
| 1321 | break; | 1313 | break; |
| 1322 | case videoFormatYUY2: | 1314 | case videoFormatYUY2: |
| 1323 | WelsStrcat (strFileName, 256, "yuy2"); // confirmed_safe_unsafe_usage | 1315 | WelsStrcat (strFileName, 256, ".yuy2"); // confirmed_safe_unsafe_usage |
| 1324 | pFile = WelsFopen (strFileName, "ab+"); | 1316 | pFile = WelsFopen (strFileName, "ab+"); |
| 1325 | if (NULL != pFile) { | 1317 | if (NULL != pFile) { |
| 1326 | fwrite (pSrc, sizeof (uint8_t), (CALC_BI_STRIDE (m_iMaxPicWidth, 16)) * m_iMaxPicHeight, pFile); | 1318 | fwrite (pSrcPic->pData[0], sizeof (uint8_t), (CALC_BI_STRIDE (m_iMaxPicWidth, 16)) * m_iMaxPicHeight, pFile); |
| 1327 | fflush (pFile); | 1319 | fflush (pFile); |
| 1328 | fclose (pFile); | 1320 | fclose (pFile); |
| 1329 | } | 1321 | } |