History

Convert tabs to spaces before comments

Martin Storsjö committed 11 years ago

Commit 78e0ec61 parent 3052b7a57 files · +278 −278Browse files

Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 57 files). Show all

Unified · Split

codec/encoder/plus/src/welsEncoderExt.cpp+27−27
@@ -38,7 +38,7 @@ · 37 unmodified lines
38#include "utils.h"38#include "utils.h"
39#include "macros.h"39#include "macros.h"
40#include "version.h"40#include "version.h"
41#include "crt_util_safe_x.h" // Safe CRT routines like util for cross platforms41#include "crt_util_safe_x.h" // Safe CRT routines like util for cross platforms
42#include "ref_list_mgr_svc.h"42#include "ref_list_mgr_svc.h"
43#include "codec_ver.h"43#include "codec_ver.h"
44 44
@@ -654,12 +654,12 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 609 unmodified lines
654 }654 }
655 655
656 switch (eOptionId) {656 switch (eOptionId) {
657 case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag657 case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag
658 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,658 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
659 "ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.");659 "ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.");
660 }660 }
661 break;661 break;
662 case ENCODER_OPTION_DATAFORMAT: { // Input color space662 case ENCODER_OPTION_DATAFORMAT: { // Input color space
663 int32_t iValue = * ((int32_t*)pOption);663 int32_t iValue = * ((int32_t*)pOption);
664 int32_t iColorspace = iValue;664 int32_t iColorspace = iValue;
665 if (iColorspace == 0) {665 if (iColorspace == 0) {
@@ -689,7 +689,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 23 unmodified lines
689 int32_t iTargetWidth = 0;689 int32_t iTargetWidth = 0;
690 int32_t iTargetHeight = 0;690 int32_t iTargetHeight = 0;
691 691
692 memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage692 memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage
693 if (sConfig.ParamBaseTranscode (sEncodingParam)) {693 if (sConfig.ParamBaseTranscode (sEncodingParam)) {
694 return cmInitParaError;694 return cmInitParaError;
695 }695 }
@@ -721,7 +721,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 25 unmodified lines
721 int32_t iTargetWidth = 0;721 int32_t iTargetWidth = 0;
722 int32_t iTargetHeight = 0;722 int32_t iTargetHeight = 0;
723 723
724 memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage724 memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage
725 TraceParamInfo (&sEncodingParam);725 TraceParamInfo (&sEncodingParam);
726#ifdef OUTPUT_BIT_STREAM726#ifdef OUTPUT_BIT_STREAM
727 if (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth !=727 if (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth !=
@@ -731,7 +731,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 3 unmodified lines
731 }731 }
732#endif//OUTPUT_BIT_STREAM732#endif//OUTPUT_BIT_STREAM
733 if (sEncodingParam.iSpatialLayerNum < 1733 if (sEncodingParam.iSpatialLayerNum < 1
734 || sEncodingParam.iSpatialLayerNum > MAX_SPATIAL_LAYER_NUM) { // verify number of spatial layer734 || sEncodingParam.iSpatialLayerNum > MAX_SPATIAL_LAYER_NUM) { // verify number of spatial layer
735 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,735 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
736 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!",736 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!",
737 sEncodingParam.iSpatialLayerNum);737 sEncodingParam.iSpatialLayerNum);
@@ -782,7 +782,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 44 unmodified lines
782 m_pEncContext->pSvcParam->fMaxFrameRate);782 m_pEncContext->pSvcParam->fMaxFrameRate);
783 }783 }
784 break;784 break;
785 case ENCODER_OPTION_BITRATE: { // Target bit-rate785 case ENCODER_OPTION_BITRATE: { // Target bit-rate
786 SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));786 SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
787 int32_t iBitrate = pInfo->iBitrate;787 int32_t iBitrate = pInfo->iBitrate;
788 if (iBitrate <= 0) {788 if (iBitrate <= 0) {
@@ -828,7 +828,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 39 unmodified lines
828 828
829 }829 }
830 break;830 break;
831 case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate831 case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate
832 SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));832 SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
833 int32_t iBitrate = pInfo->iBitrate;833 int32_t iBitrate = pInfo->iBitrate;
834 if (iBitrate <= 0) {834 if (iBitrate <= 0) {
@@ -873,7 +873,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 38 unmodified lines
873 }873 }
874 }874 }
875 break;875 break;
876 case ENCODER_OPTION_RC_MODE: { // 0:quality mode;1:bit-rate mode;2:bitrate limited mode876 case ENCODER_OPTION_RC_MODE: { // 0:quality mode;1:bit-rate mode;2:bitrate limited mode
877 int32_t iValue = * ((int32_t*)pOption);877 int32_t iValue = * ((int32_t*)pOption);
878 m_pEncContext->pSvcParam->iRCMode = (RC_MODES) iValue;878 m_pEncContext->pSvcParam->iRCMode = (RC_MODES) iValue;
879 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,879 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
@@ -881,7 +881,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 1 unmodified line
881 iValue);881 iValue);
882 }882 }
883 break;883 break;
884 case ENCODER_PADDING_PADDING: { // 0:disable padding;1:padding884 case ENCODER_PADDING_PADDING: { // 0:disable padding;1:padding
885 int32_t iValue = * ((int32_t*)pOption);885 int32_t iValue = * ((int32_t*)pOption);
886 m_pEncContext->pSvcParam->iPaddingFlag = iValue;886 m_pEncContext->pSvcParam->iPaddingFlag = iValue;
887 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,887 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
@@ -1106,45 +1106,45 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) { · 218 unmodified lines
1106 }1106 }
1107 1107
1108 switch (eOptionId) {1108 switch (eOptionId) {
1109 case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag1109 case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag
1110 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,1110 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
1111 "ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.");1111 "ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.");
1112 }1112 }
1113 break;1113 break;
1114 case ENCODER_OPTION_DATAFORMAT: { // Input color space1114 case ENCODER_OPTION_DATAFORMAT: { // Input color space
1115 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,1115 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
1116 "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_DATAFORMAT, m_iCspInternal= 0x%x", m_iCspInternal);1116 "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_DATAFORMAT, m_iCspInternal= 0x%x", m_iCspInternal);
1117 * ((int32_t*)pOption) = m_iCspInternal;1117 * ((int32_t*)pOption) = m_iCspInternal;
1118 }1118 }
1119 break;1119 break;
1120 case ENCODER_OPTION_IDR_INTERVAL: { // IDR Interval1120 case ENCODER_OPTION_IDR_INTERVAL: { // IDR Interval
1121 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,1121 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
1122 "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_IDR_INTERVAL, uiIntraPeriod= %d",1122 "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_IDR_INTERVAL, uiIntraPeriod= %d",
1123 m_pEncContext->pSvcParam->uiIntraPeriod);1123 m_pEncContext->pSvcParam->uiIntraPeriod);
1124 * ((int32_t*)pOption) = m_pEncContext->pSvcParam->uiIntraPeriod;1124 * ((int32_t*)pOption) = m_pEncContext->pSvcParam->uiIntraPeriod;
1125 }1125 }
1126 break;1126 break;
1127 case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter1127 case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter
1128 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,1128 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
1129 "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT");1129 "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT");
1130 memcpy (pOption, m_pEncContext->pSvcParam, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage1130 memcpy (pOption, m_pEncContext->pSvcParam, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage
1131 }1131 }
1132 break;1132 break;
1133 case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: { // SVC Encoding Parameter1133 case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: { // SVC Encoding Parameter
1134 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,1134 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
1135 "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE");1135 "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE");
1136 m_pEncContext->pSvcParam->GetBaseParams ((SEncParamBase*) pOption);1136 m_pEncContext->pSvcParam->GetBaseParams ((SEncParamBase*) pOption);
1137 }1137 }
1138 break;1138 break;
1139 1139
1140 case ENCODER_OPTION_FRAME_RATE: { // Maximal input frame rate1140 case ENCODER_OPTION_FRAME_RATE: { // Maximal input frame rate
1141 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,1141 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
1142 "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_FRAME_RATE, fMaxFrameRate = %.6ff",1142 "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_FRAME_RATE, fMaxFrameRate = %.6ff",
1143 m_pEncContext->pSvcParam->fMaxFrameRate);1143 m_pEncContext->pSvcParam->fMaxFrameRate);
1144 * ((float*)pOption) = m_pEncContext->pSvcParam->fMaxFrameRate;1144 * ((float*)pOption) = m_pEncContext->pSvcParam->fMaxFrameRate;
1145 }1145 }
1146 break;1146 break;
1147 case ENCODER_OPTION_BITRATE: { // Target bit-rate1147 case ENCODER_OPTION_BITRATE: { // Target bit-rate
1148 1148
1149 SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));1149 SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
1150 if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1)1150 if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1)
@@ -1160,7 +1160,7 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) { · 9 unmodified lines
1160 pInfo->iLayer, pInfo->iBitrate);1160 pInfo->iLayer, pInfo->iBitrate);
1161 }1161 }
1162 break;1162 break;
1163 case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate1163 case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate
1164 SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));1164 SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
1165 if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1)1165 if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1)
1166 && (pInfo->iLayer != SPATIAL_LAYER_2) && (pInfo->iLayer != SPATIAL_LAYER_3))1166 && (pInfo->iLayer != SPATIAL_LAYER_2) && (pInfo->iLayer != SPATIAL_LAYER_3))
@@ -1216,20 +1216,20 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) { · 49 unmodified lines
1216 char strFileName[256] = {0};1216 char strFileName[256] = {0};
1217 const int32_t iDataLength = m_iMaxPicWidth * m_iMaxPicHeight;1217 const int32_t iDataLength = m_iMaxPicWidth * m_iMaxPicHeight;
1218 1218
1219 WelsStrncpy (strFileName, 256, "pic_in_"); // confirmed_safe_unsafe_usage1219 WelsStrncpy (strFileName, 256, "pic_in_"); // confirmed_safe_unsafe_usage
1220 1220
1221 if (m_iMaxPicWidth == 640) {1221 if (m_iMaxPicWidth == 640) {
1222 WelsStrcat (strFileName, 256, "360p."); // confirmed_safe_unsafe_usage1222 WelsStrcat (strFileName, 256, "360p."); // confirmed_safe_unsafe_usage
1223 } else if (m_iMaxPicWidth == 320) {1223 } else if (m_iMaxPicWidth == 320) {
1224 WelsStrcat (strFileName, 256, "180p."); // confirmed_safe_unsafe_usage1224 WelsStrcat (strFileName, 256, "180p."); // confirmed_safe_unsafe_usage
1225 } else if (m_iMaxPicWidth == 160) {1225 } else if (m_iMaxPicWidth == 160) {
1226 WelsStrcat (strFileName, 256, "90p."); // confirmed_safe_unsafe_usage1226 WelsStrcat (strFileName, 256, "90p."); // confirmed_safe_unsafe_usage
1227 }1227 }
1228 1228
1229 switch (m_iCspInternal) {1229 switch (m_iCspInternal) {
1230 case videoFormatI420:1230 case videoFormatI420:
1231 case videoFormatYV12:1231 case videoFormatYV12:
1232 WelsStrcat (strFileName, 256, "yuv"); // confirmed_safe_unsafe_usage1232 WelsStrcat (strFileName, 256, "yuv"); // confirmed_safe_unsafe_usage
1233 pFile = WelsFopen (strFileName, "ab+");1233 pFile = WelsFopen (strFileName, "ab+");
1234 // WelsLog( &m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "WELS_CSP_I420, m_iCspInternal= 0x%x", m_iCspInternal);1234 // WelsLog( &m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "WELS_CSP_I420, m_iCspInternal= 0x%x", m_iCspInternal);
1235 if (NULL != pFile) {1235 if (NULL != pFile) {
@@ -1239,7 +1239,7 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) { · 3 unmodified lines
1239 }1239 }
1240 break;1240 break;
1241 case videoFormatRGB:1241 case videoFormatRGB:
1242 WelsStrcat (strFileName, 256, "rgb"); // confirmed_safe_unsafe_usage1242 WelsStrcat (strFileName, 256, "rgb"); // confirmed_safe_unsafe_usage
1243 pFile = WelsFopen (strFileName, "ab+");1243 pFile = WelsFopen (strFileName, "ab+");
1244 if (NULL != pFile) {1244 if (NULL != pFile) {
1245 fwrite (pSrc, sizeof (uint8_t), iDataLength * 3, pFile);1245 fwrite (pSrc, sizeof (uint8_t), iDataLength * 3, pFile);
@@ -1247,7 +1247,7 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) { · 1 unmodified line
1247 fclose (pFile);1247 fclose (pFile);
1248 }1248 }
1249 case videoFormatBGR:1249 case videoFormatBGR:
1250 WelsStrcat (strFileName, 256, "bgr"); // confirmed_safe_unsafe_usage1250 WelsStrcat (strFileName, 256, "bgr"); // confirmed_safe_unsafe_usage
1251 pFile = WelsFopen (strFileName, "ab+");1251 pFile = WelsFopen (strFileName, "ab+");
1252 // WelsLog( &m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "WELS_CSP_BGR, m_iCspInternal= 0x%x", m_iCspInternal);1252 // WelsLog( &m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "WELS_CSP_BGR, m_iCspInternal= 0x%x", m_iCspInternal);
1253 if (NULL != pFile) {1253 if (NULL != pFile) {
@@ -1257,7 +1257,7 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) { · 3 unmodified lines
1257 }1257 }
1258 break;1258 break;
1259 case videoFormatYUY2:1259 case videoFormatYUY2:
1260 WelsStrcat (strFileName, 256, "yuy2"); // confirmed_safe_unsafe_usage1260 WelsStrcat (strFileName, 256, "yuy2"); // confirmed_safe_unsafe_usage
1261 pFile = WelsFopen (strFileName, "ab+");1261 pFile = WelsFopen (strFileName, "ab+");
1262 if (NULL != pFile) {1262 if (NULL != pFile) {
1263 fwrite (pSrc, sizeof (uint8_t), (CALC_BI_STRIDE (m_iMaxPicWidth, 16)) * m_iMaxPicHeight, pFile);1263 fwrite (pSrc, sizeof (uint8_t), (CALC_BI_STRIDE (m_iMaxPicWidth, 16)) * m_iMaxPicHeight, pFile);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t