Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 120 files). Show all
Unified · Split
| @@ -84,7 +84,7 @@ CWelsH264SVCEncoder::CWelsH264SVCEncoder() · 83 unmodified lines | ||
| 84 | 84 | #ifdef OUTPUT_BIT_STREAM |
| 85 | 85 | SWelsTime tTime; |
| 86 | 86 | |
| 87 | − WelsGetTimeOfDay(&tTime); | |
| 87 | + WelsGetTimeOfDay (&tTime); | |
| 88 | 88 | |
| 89 | 89 | iCurUsed = WelsSnprintf (strStreamFileName, iBufferLeft, "enc_bs_0x%p_", (void*)this); |
| 90 | 90 | iCurUsedSize = WelsSnprintf (strLenFileName, iBufferLeftSize, "enc_size_0x%p_", (void*)this); |
| @@ -108,14 +108,14 @@ CWelsH264SVCEncoder::CWelsH264SVCEncoder() · 17 unmodified lines | ||
| 108 | 108 | |
| 109 | 109 | if (iBufferLeft > 0) { |
| 110 | 110 | iCurUsed = WelsSnprintf (&strStreamFileName[iBufferUsed], iBufferLeft, ".%03.3u.264", |
| 111 | − WelsGetMillisecond(&tTime)); | |
| 111 | + WelsGetMillisecond (&tTime)); | |
| 112 | 112 | iBufferUsed += iCurUsed; |
| 113 | 113 | iBufferLeft -= iCurUsed; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | if (iBufferLeftSize > 0) { |
| 117 | 117 | iCurUsedSize = WelsSnprintf (&strLenFileName[iBufferUsedSize], iBufferLeftSize, ".%03.3u.len", |
| 118 | − WelsGetMillisecond(&tTime)); | |
| 118 | + WelsGetMillisecond (&tTime)); | |
| 119 | 119 | iBufferUsedSize += iCurUsedSize; |
| 120 | 120 | iBufferLeftSize -= iCurUsedSize; |
| 121 | 121 | } |
| @@ -186,7 +186,7 @@ void CWelsH264SVCEncoder::InitEncoder (void) { · 64 unmodified lines | ||
| 186 | 186 | /* Interfaces override from ISVCEncoder */ |
| 187 | 187 | |
| 188 | 188 | int CWelsH264SVCEncoder::GetDefaultParams (SEncParamExt* argv) { |
| 189 | − SWelsSvcCodingParam::FillDefault(*argv); | |
| 189 | + SWelsSvcCodingParam::FillDefault (*argv); | |
| 190 | 190 | return cmResultSuccess; |
| 191 | 191 | } |
| 192 | 192 | |
| @@ -209,7 +209,7 @@ int CWelsH264SVCEncoder::Initialize (const SEncParamBase* argv) { · 16 unmodified lines | ||
| 209 | 209 | return cmInitParaError; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | − return InitializeInternal(&sConfig); | |
| 212 | + return InitializeInternal (&sConfig); | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | int CWelsH264SVCEncoder::InitializeExt (const SEncParamExt* argv) { |
| @@ -228,10 +228,10 @@ int CWelsH264SVCEncoder::InitializeExt (const SEncParamExt* argv) { · 12 unmodified lines | ||
| 228 | 228 | return cmInitParaError; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | − return InitializeInternal(&sConfig); | |
| 231 | + return InitializeInternal (&sConfig); | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | −int CWelsH264SVCEncoder::InitializeInternal(SWelsSvcCodingParam* pCfg) { | |
| 234 | +int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) { | |
| 235 | 235 | if (NULL == pCfg) { |
| 236 | 236 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid argv= 0x%p.\n", |
| 237 | 237 | pCfg); |
| @@ -245,7 +245,7 @@ int CWelsH264SVCEncoder::InitializeInternal(SWelsSvcCodingParam* pCfg) { · 7 unmodified lines | ||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | #ifdef REC_FRAME_COUNT |
| 248 | − SWelsSvcCodingParam &sEncodingParam = *pCfg; | |
| 248 | + SWelsSvcCodingParam& sEncodingParam = *pCfg; | |
| 249 | 249 | WelsLog (m_pEncContext, WELS_LOG_INFO, "CWelsH264SVCEncoder::Initialize, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", |
| 250 | 250 | m_uiCountFrameNum, m_iCspInternal); |
| 251 | 251 | WelsLog (m_pEncContext, WELS_LOG_INFO, |
| @@ -346,17 +346,17 @@ int CWelsH264SVCEncoder::InitializeInternal(SWelsSvcCodingParam* pCfg) { · 94 unmodified lines | ||
| 346 | 346 | } |
| 347 | 347 | if (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME) { |
| 348 | 348 | if (pCfg->bEnableLongTermReference) { |
| 349 | − pCfg->iLTRRefNum = WELS_CLIP3(pCfg->iLTRRefNum,1,LONG_TERM_REF_NUM_SCREEN); | |
| 350 | − pCfg->iNumRefFrame = WELS_MAX(1,WELS_LOG2 (pCfg->uiGopSize)) + pCfg->iLTRRefNum; | |
| 349 | + pCfg->iLTRRefNum = WELS_CLIP3 (pCfg->iLTRRefNum, 1, LONG_TERM_REF_NUM_SCREEN); | |
| 350 | + pCfg->iNumRefFrame = WELS_MAX (1, WELS_LOG2 (pCfg->uiGopSize)) + pCfg->iLTRRefNum; | |
| 351 | 351 | } else { |
| 352 | 352 | pCfg->iLTRRefNum = 0; |
| 353 | − pCfg->iNumRefFrame = WELS_MAX(1, pCfg->uiGopSize>>1); | |
| 353 | + pCfg->iNumRefFrame = WELS_MAX (1, pCfg->uiGopSize >> 1); | |
| 354 | 354 | } |
| 355 | − } else { | |
| 356 | − pCfg->iLTRRefNum = pCfg->bEnableLongTermReference ? WELS_CLIP3(pCfg->iLTRRefNum,1,LONG_TERM_REF_NUM) : 0; | |
| 357 | − pCfg->iNumRefFrame = ((pCfg->uiGopSize >> 1) > 1) ? ((pCfg->uiGopSize >> 1) + pCfg->iLTRRefNum) : | |
| 358 | − (MIN_REF_PIC_COUNT + pCfg->iLTRRefNum); | |
| 359 | − pCfg->iNumRefFrame = WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM); | |
| 355 | + } else { | |
| 356 | + pCfg->iLTRRefNum = pCfg->bEnableLongTermReference ? WELS_CLIP3 (pCfg->iLTRRefNum, 1, LONG_TERM_REF_NUM) : 0; | |
| 357 | + pCfg->iNumRefFrame = ((pCfg->uiGopSize >> 1) > 1) ? ((pCfg->uiGopSize >> 1) + pCfg->iLTRRefNum) : | |
| 358 | + (MIN_REF_PIC_COUNT + pCfg->iLTRRefNum); | |
| 359 | + pCfg->iNumRefFrame = WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM); | |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | if (pCfg->iLtrMarkPeriod == 0) { |
| @@ -419,9 +419,9 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn · 56 unmodified lines | ||
| 419 | 419 | return cmInitParaError; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | − const int32_t kiEncoderReturn = EncodeFrameInternal(kpSrcPic, pBsInfo); | |
| 422 | + const int32_t kiEncoderReturn = EncodeFrameInternal (kpSrcPic, pBsInfo); | |
| 423 | 423 | |
| 424 | − if(kiEncoderReturn != cmResultSuccess) | |
| 424 | + if (kiEncoderReturn != cmResultSuccess) | |
| 425 | 425 | return kiEncoderReturn; |
| 426 | 426 | |
| 427 | 427 | #ifdef REC_FRAME_COUNT |
| @@ -437,14 +437,13 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn · 9 unmodified lines | ||
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | |
| 440 | −int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFrameBSInfo* pBsInfo) { | |
| 440 | +int CWelsH264SVCEncoder::EncodeFrameInternal (const SSourcePicture* pSrcPic, SFrameBSInfo* pBsInfo) { | |
| 441 | 441 | const int32_t kiEncoderReturn = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPic); |
| 442 | 442 | |
| 443 | − if(kiEncoderReturn == ENC_RETURN_MEMALLOCERR) { | |
| 443 | + if (kiEncoderReturn == ENC_RETURN_MEMALLOCERR) { | |
| 444 | 444 | WelsUninitEncoderExt (&m_pEncContext); |
| 445 | 445 | return cmMallocMemeError; |
| 446 | − } | |
| 447 | − else if((kiEncoderReturn != ENC_RETURN_SUCCESS)&&(kiEncoderReturn == ENC_RETURN_CORRECTED)){ | |
| 446 | + } else if ((kiEncoderReturn != ENC_RETURN_SUCCESS) && (kiEncoderReturn == ENC_RETURN_CORRECTED)) { | |
| 448 | 447 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from EncodeFrameInternal()!\n", kiEncoderReturn); |
| 449 | 448 | return cmUnkonwReason; |
| 450 | 449 | } |
| @@ -500,7 +499,7 @@ int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFr · 49 unmodified lines | ||
| 500 | 499 | } |
| 501 | 500 | |
| 502 | 501 | int CWelsH264SVCEncoder::EncodeParameterSets (SFrameBSInfo* pBsInfo) { |
| 503 | − return WelsEncoderEncodeParameterSets (m_pEncContext, pBsInfo); | |
| 502 | + return WelsEncoderEncodeParameterSets (m_pEncContext, pBsInfo); | |
| 504 | 503 | } |
| 505 | 504 | |
| 506 | 505 | /* |
| @@ -512,7 +511,7 @@ int CWelsH264SVCEncoder::PauseFrame (const SSourcePicture* kpSrcPic, SFrameBSInf · 5 unmodified lines | ||
| 512 | 511 | ForceIntraFrame (true); |
| 513 | 512 | |
| 514 | 513 | if (EncodeFrameInternal (kpSrcPic, pBsInfo) != videoFrameTypeInvalid) { |
| 515 | − iReturn = 0; | |
| 514 | + iReturn = 0; | |
| 516 | 515 | } |
| 517 | 516 | |
| 518 | 517 | |
| @@ -692,7 +691,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 173 unmodified lines | ||
| 692 | 691 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_FRAME_RATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %f\n", |
| 693 | 692 | m_uiCountFrameNum, m_iCspInternal, iValue); |
| 694 | 693 | #endif//REC_FRAME_COUNT |
| 695 | − if (iValue<=0) { | |
| 694 | + if (iValue <= 0) { | |
| 696 | 695 | return cmInitParaError; |
| 697 | 696 | } |
| 698 | 697 | //adjust to valid range |
| @@ -701,80 +700,84 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 2 unmodified lines | ||
| 701 | 700 | } |
| 702 | 701 | break; |
| 703 | 702 | case ENCODER_OPTION_BITRATE: { // Target bit-rate |
| 704 | − SBitrateInfo*pInfo = (static_cast<SBitrateInfo *>(pOption)); | |
| 703 | + SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption)); | |
| 705 | 704 | int32_t iBitrate = pInfo->iBitrate; |
| 706 | 705 | #ifdef REC_FRAME_COUNT |
| 707 | 706 | WelsLog (m_pEncContext, WELS_LOG_INFO, |
| 708 | − "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d\n", | |
| 709 | − m_uiCountFrameNum, m_iCspInternal, iValue); | |
| 707 | + "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d\n", | |
| 708 | + m_uiCountFrameNum, m_iCspInternal, iValue); | |
| 710 | 709 | #endif//REC_FRAME_COUNT |
| 711 | − if (iBitrate<=0) { | |
| 712 | − WelsLog (m_pEncContext, WELS_LOG_ERROR,"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iBitrate = %d\n",iBitrate); | |
| 710 | + if (iBitrate <= 0) { | |
| 711 | + WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iBitrate = %d\n", | |
| 712 | + iBitrate); | |
| 713 | 713 | return cmInitParaError; |
| 714 | 714 | } |
| 715 | 715 | iBitrate = WELS_CLIP3 (iBitrate, MIN_BIT_RATE, MAX_BIT_RATE); |
| 716 | − switch(pInfo->iLayer){ | |
| 717 | − case SPATIAL_LAYER_ALL: | |
| 718 | − m_pEncContext->pSvcParam->iTargetBitrate = iBitrate; | |
| 719 | − break; | |
| 720 | − case SPATIAL_LAYER_0: | |
| 721 | − m_pEncContext->pSvcParam->sSpatialLayers[0].iSpatialBitrate = iBitrate; | |
| 722 | − break; | |
| 723 | − case SPATIAL_LAYER_1: | |
| 724 | − m_pEncContext->pSvcParam->sSpatialLayers[1].iSpatialBitrate = iBitrate; | |
| 725 | − break; | |
| 726 | − case SPATIAL_LAYER_2: | |
| 727 | − m_pEncContext->pSvcParam->sSpatialLayers[2].iSpatialBitrate = iBitrate; | |
| 728 | − break; | |
| 729 | − case SPATIAL_LAYER_3: | |
| 730 | − m_pEncContext->pSvcParam->sSpatialLayers[3].iSpatialBitrate = iBitrate; | |
| 731 | − break; | |
| 732 | − default: | |
| 733 | − WelsLog (m_pEncContext, WELS_LOG_ERROR,"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iLayer = %d\n",pInfo->iLayer); | |
| 734 | − return cmInitParaError; | |
| 735 | − break; | |
| 736 | − } | |
| 716 | + switch (pInfo->iLayer) { | |
| 717 | + case SPATIAL_LAYER_ALL: | |
| 718 | + m_pEncContext->pSvcParam->iTargetBitrate = iBitrate; | |
| 719 | + break; | |
| 720 | + case SPATIAL_LAYER_0: | |
| 721 | + m_pEncContext->pSvcParam->sSpatialLayers[0].iSpatialBitrate = iBitrate; | |
| 722 | + break; | |
| 723 | + case SPATIAL_LAYER_1: | |
| 724 | + m_pEncContext->pSvcParam->sSpatialLayers[1].iSpatialBitrate = iBitrate; | |
| 725 | + break; | |
| 726 | + case SPATIAL_LAYER_2: | |
| 727 | + m_pEncContext->pSvcParam->sSpatialLayers[2].iSpatialBitrate = iBitrate; | |
| 728 | + break; | |
| 729 | + case SPATIAL_LAYER_3: | |
| 730 | + m_pEncContext->pSvcParam->sSpatialLayers[3].iSpatialBitrate = iBitrate; | |
| 731 | + break; | |
| 732 | + default: | |
| 733 | + WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iLayer = %d\n", | |
| 734 | + pInfo->iLayer); | |
| 735 | + return cmInitParaError; | |
| 736 | + break; | |
| 737 | + } | |
| 737 | 738 | //adjust to valid range |
| 738 | − WelsEncoderApplyBitRate (m_pEncContext->pSvcParam,pInfo->iLayer); | |
| 739 | + WelsEncoderApplyBitRate (m_pEncContext->pSvcParam, pInfo->iLayer); | |
| 739 | 740 | } |
| 740 | 741 | break; |
| 741 | 742 | case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate |
| 742 | − SBitrateInfo*pInfo = (static_cast<SBitrateInfo *>(pOption)); | |
| 743 | + SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption)); | |
| 743 | 744 | int32_t iBitrate = pInfo->iBitrate; |
| 744 | 745 | |
| 745 | 746 | #ifdef REC_FRAME_COUNT |
| 746 | 747 | WelsLog (m_pEncContext, WELS_LOG_INFO, |
| 747 | − "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d\n", | |
| 748 | − m_uiCountFrameNum, m_iCspInternal, iValue); | |
| 748 | + "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d\n", | |
| 749 | + m_uiCountFrameNum, m_iCspInternal, iValue); | |
| 749 | 750 | #endif//REC_FRAME_COUNT |
| 750 | − if (iBitrate<=0) { | |
| 751 | − WelsLog (m_pEncContext, WELS_LOG_ERROR,"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iBitrate = %d\n",iBitrate); | |
| 752 | − return cmInitParaError; | |
| 753 | − } | |
| 754 | − iBitrate = WELS_CLIP3 (iBitrate, MIN_BIT_RATE, MAX_BIT_RATE); | |
| 755 | − switch(pInfo->iLayer){ | |
| 756 | − case SPATIAL_LAYER_ALL: | |
| 757 | − m_pEncContext->pSvcParam->iMaxBitrate = iBitrate; | |
| 758 | − break; | |
| 759 | − case SPATIAL_LAYER_0: | |
| 760 | − m_pEncContext->pSvcParam->sSpatialLayers[0].iMaxSpatialBitrate = iBitrate; | |
| 761 | − break; | |
| 762 | − case SPATIAL_LAYER_1: | |
| 763 | − m_pEncContext->pSvcParam->sSpatialLayers[1].iMaxSpatialBitrate = iBitrate; | |
| 764 | − break; | |
| 765 | − case SPATIAL_LAYER_2: | |
| 766 | − m_pEncContext->pSvcParam->sSpatialLayers[2].iMaxSpatialBitrate = iBitrate; | |
| 767 | − break; | |
| 768 | − case SPATIAL_LAYER_3: | |
| 769 | − m_pEncContext->pSvcParam->sSpatialLayers[3].iMaxSpatialBitrate = iBitrate; | |
| 770 | − break; | |
| 771 | − default: | |
| 772 | − WelsLog (m_pEncContext, WELS_LOG_ERROR,"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iLayer = %d\n",pInfo->iLayer); | |
| 773 | − return cmInitParaError; | |
| 774 | − break; | |
| 775 | − } | |
| 776 | − //adjust to valid range | |
| 777 | − WelsEncoderApplyBitRate (m_pEncContext->pSvcParam,pInfo->iLayer); | |
| 751 | + if (iBitrate <= 0) { | |
| 752 | + WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iBitrate = %d\n", | |
| 753 | + iBitrate); | |
| 754 | + return cmInitParaError; | |
| 755 | + } | |
| 756 | + iBitrate = WELS_CLIP3 (iBitrate, MIN_BIT_RATE, MAX_BIT_RATE); | |
| 757 | + switch (pInfo->iLayer) { | |
| 758 | + case SPATIAL_LAYER_ALL: | |
| 759 | + m_pEncContext->pSvcParam->iMaxBitrate = iBitrate; | |
| 760 | + break; | |
| 761 | + case SPATIAL_LAYER_0: | |
| 762 | + m_pEncContext->pSvcParam->sSpatialLayers[0].iMaxSpatialBitrate = iBitrate; | |
| 763 | + break; | |
| 764 | + case SPATIAL_LAYER_1: | |
| 765 | + m_pEncContext->pSvcParam->sSpatialLayers[1].iMaxSpatialBitrate = iBitrate; | |
| 766 | + break; | |
| 767 | + case SPATIAL_LAYER_2: | |
| 768 | + m_pEncContext->pSvcParam->sSpatialLayers[2].iMaxSpatialBitrate = iBitrate; | |
| 769 | + break; | |
| 770 | + case SPATIAL_LAYER_3: | |
| 771 | + m_pEncContext->pSvcParam->sSpatialLayers[3].iMaxSpatialBitrate = iBitrate; | |
| 772 | + break; | |
| 773 | + default: | |
| 774 | + WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iLayer = %d\n", | |
| 775 | + pInfo->iLayer); | |
| 776 | + return cmInitParaError; | |
| 777 | + break; | |
| 778 | + } | |
| 779 | + //adjust to valid range | |
| 780 | + WelsEncoderApplyBitRate (m_pEncContext->pSvcParam, pInfo->iLayer); | |
| 778 | 781 | } |
| 779 | 782 | break; |
| 780 | 783 | case ENCODER_OPTION_RC_MODE: { // 0:quality mode;1:bit-rate mode;2:bitrate limited mode |
| @@ -838,20 +841,21 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 57 unmodified lines | ||
| 838 | 841 | } |
| 839 | 842 | } |
| 840 | 843 | break; |
| 841 | − case ENCODER_OPTION_DUMP_FILE:{ | |
| 844 | + case ENCODER_OPTION_DUMP_FILE: { | |
| 842 | 845 | #ifdef ENABLE_FRAME_DUMP |
| 843 | − if(m_pEncContext->pSvcParam!=NULL){ | |
| 844 | − SDumpLayer*pDump = (static_cast<SDumpLayer *>(pOption)); | |
| 845 | − WelsStrncpy(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName, sizeof(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName),pDump->pFileName); | |
| 846 | + if (m_pEncContext->pSvcParam != NULL) { | |
| 847 | + SDumpLayer* pDump = (static_cast<SDumpLayer*> (pOption)); | |
| 848 | + WelsStrncpy (m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName, | |
| 849 | + sizeof (m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName), pDump->pFileName); | |
| 846 | 850 | } |
| 847 | 851 | #endif |
| 848 | 852 | } |
| 849 | 853 | break; |
| 850 | − case ENCODER_OPTION_TRACE_LEVEL:{ | |
| 851 | − if(m_pWelsTrace){ | |
| 852 | − uint32_t level = *((uint32_t*)pOption); | |
| 853 | − m_pWelsTrace->SetTraceLevel(level); | |
| 854 | − } | |
| 854 | + case ENCODER_OPTION_TRACE_LEVEL: { | |
| 855 | + if (m_pWelsTrace) { | |
| 856 | + uint32_t level = * ((uint32_t*)pOption); | |
| 857 | + m_pWelsTrace->SetTraceLevel (level); | |
| 858 | + } | |
| 855 | 859 | } |
| 856 | 860 | break; |
| 857 | 861 | default: |
| @@ -908,7 +912,7 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) { · 50 unmodified lines | ||
| 908 | 912 | "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", |
| 909 | 913 | m_uiCountFrameNum, m_iCspInternal); |
| 910 | 914 | #endif//REC_FRAME_COUNT |
| 911 | − m_pEncContext->pSvcParam->GetBaseParams((SEncParamBase*) pOption); | |
| 915 | + m_pEncContext->pSvcParam->GetBaseParams ((SEncParamBase*) pOption); | |
| 912 | 916 | } |
| 913 | 917 | break; |
| 914 | 918 | |
| @@ -927,29 +931,32 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) { · 12 unmodified lines | ||
| 927 | 931 | "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", |
| 928 | 932 | m_uiCountFrameNum, m_iCspInternal); |
| 929 | 933 | #endif//REC_FRAME_COUNT |
| 930 | − SBitrateInfo*pInfo = (static_cast<SBitrateInfo *>(pOption)); | |
| 931 | − if((pInfo->iLayer!=SPATIAL_LAYER_ALL)&&(pInfo->iLayer!=SPATIAL_LAYER_0)&&(pInfo->iLayer!=SPATIAL_LAYER_1)&&(pInfo->iLayer!=SPATIAL_LAYER_2)&&(pInfo->iLayer!=SPATIAL_LAYER_3)) | |
| 932 | − return cmInitParaError; | |
| 933 | − if(pInfo->iLayer == SPATIAL_LAYER_ALL){ | |
| 934 | + SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption)); | |
| 935 | + if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1) | |
| 936 | + && (pInfo->iLayer != SPATIAL_LAYER_2) && (pInfo->iLayer != SPATIAL_LAYER_3)) | |
| 937 | + return cmInitParaError; | |
| 938 | + if (pInfo->iLayer == SPATIAL_LAYER_ALL) { | |
| 934 | 939 | pInfo->iBitrate = m_pEncContext->pSvcParam->iTargetBitrate; |
| 935 | − }else{ | |
| 940 | + } else { | |
| 936 | 941 | pInfo->iBitrate = m_pEncContext->pSvcParam->sSpatialLayers[pInfo->iLayer].iSpatialBitrate; |
| 937 | − } | |
| 942 | + } | |
| 938 | 943 | } |
| 939 | 944 | break; |
| 940 | 945 | case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate |
| 941 | 946 | #ifdef REC_FRAME_COUNT |
| 942 | − WelsLog (m_pEncContext, WELS_LOG_INFO,"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_MAX_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", | |
| 943 | − m_uiCountFrameNum, m_iCspInternal); | |
| 947 | + WelsLog (m_pEncContext, WELS_LOG_INFO, | |
| 948 | + "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_MAX_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", | |
| 949 | + m_uiCountFrameNum, m_iCspInternal); | |
| 944 | 950 | #endif//REC_FRAME_COUNT |
| 945 | − SBitrateInfo*pInfo = (static_cast<SBitrateInfo *>(pOption)); | |
| 946 | − if((pInfo->iLayer!=SPATIAL_LAYER_ALL)&&(pInfo->iLayer!=SPATIAL_LAYER_0)&&(pInfo->iLayer!=SPATIAL_LAYER_1)&&(pInfo->iLayer!=SPATIAL_LAYER_2)&&(pInfo->iLayer!=SPATIAL_LAYER_3)) | |
| 947 | − return cmInitParaError; | |
| 948 | − if(pInfo->iLayer == SPATIAL_LAYER_ALL){ | |
| 951 | + SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption)); | |
| 952 | + if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1) | |
| 953 | + && (pInfo->iLayer != SPATIAL_LAYER_2) && (pInfo->iLayer != SPATIAL_LAYER_3)) | |
| 954 | + return cmInitParaError; | |
| 955 | + if (pInfo->iLayer == SPATIAL_LAYER_ALL) { | |
| 949 | 956 | pInfo->iBitrate = m_pEncContext->pSvcParam->iMaxBitrate; |
| 950 | − }else{ | |
| 951 | − pInfo->iBitrate = m_pEncContext->pSvcParam->sSpatialLayers[pInfo->iLayer].iMaxSpatialBitrate; | |
| 952 | − } | |
| 957 | + } else { | |
| 958 | + pInfo->iBitrate = m_pEncContext->pSvcParam->sSpatialLayers[pInfo->iLayer].iMaxSpatialBitrate; | |
| 959 | + } | |
| 953 | 960 | } |
| 954 | 961 | break; |
| 955 | 962 | default: |