This avoids ifdefs at each place the macro is used.
Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 5 files). Show all
Unified · Split
| @@ -214,20 +214,8 @@ CWelsH264SVCEncoder::CWelsH264SVCEncoder() · 213 unmodified lines | ||
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | −#if defined(__GNUC__) | |
| 218 | − m_pFileBs = FOPEN (strStreamFileName, "wb"); | |
| 219 | − m_pFileBsSize = FOPEN (strLenFileName, "wb"); | |
| 220 | −#else | |
| 221 | −#if defined(_MSC_VER) | |
| 222 | −#if _MSC_VER>=1500 | |
| 223 | − FOPEN (&m_pFileBs, strStreamFileName, "wb"); | |
| 224 | − FOPEN (&m_pFileBsSize, strLenFileName, "wb"); | |
| 225 | −#else | |
| 226 | − m_pFileBs = FOPEN (strStreamFileName, "wb"); | |
| 227 | − m_pFileBsSize = FOPEN (strLenFileName, "wb"); | |
| 228 | −#endif//_MSC_VER>=1500 | |
| 229 | −#endif//_MSC_VER | |
| 230 | −#endif//__GNUC__ | |
| 217 | + m_pFileBs = WelsFopen (strStreamFileName, "wb"); | |
| 218 | + m_pFileBsSize = WelsFopen (strLenFileName, "wb"); | |
| 231 | 219 | |
| 232 | 220 | m_bSwitch = FALSE; |
| 233 | 221 | m_iSwitchTimes = 0; |
| @@ -697,10 +685,10 @@ int CWelsH264SVCEncoder::EncodeFrame2 (const SSourcePicture** pSrcPicList, int · 463 unmodified lines | ||
| 697 | 685 | |
| 698 | 686 | int32_t iLen = SNPRINTF (strStreamFileName, 128, "%sadj%d_w%d.264", m_pEncContext->sTracePath, m_iSwitchTimes, |
| 699 | 687 | m_pEncContext->pSvcParam->iActualPicWidth); |
| 700 | − m_pFileBs = FOPEN (strStreamFileName, "wb"); | |
| 688 | + m_pFileBs = WelsFopen (strStreamFileName, "wb"); | |
| 701 | 689 | SNPRINTF (strStreamFileName, 128, "%sadj%d_w%d_size.iLen", m_pEncContext->sTracePath, m_iSwitchTimes, |
| 702 | 690 | m_pEncContext->pSvcParam->iActualPicWidth); |
| 703 | − m_pFileBsSize = FOPEN (strStreamFileName, "wb"); | |
| 691 | + m_pFileBsSize = WelsFopen (strStreamFileName, "wb"); | |
| 704 | 692 | |
| 705 | 693 | #else//__GNUC__ |
| 706 | 694 | |
| @@ -708,16 +696,16 @@ int CWelsH264SVCEncoder::EncodeFrame2 (const SSourcePicture** pSrcPicList, int · 1 unmodified line | ||
| 708 | 696 | #if _MSC_VER>=1500 |
| 709 | 697 | int32_t iLen = SNPRINTF (strStreamFileName, 128, 128, "adj%d_w%d.264", m_iSwitchTimes, |
| 710 | 698 | m_pEncContext->pSvcParam->iActualPicWidth); |
| 711 | − FOPEN (&m_pFileBs, strStreamFileName, "wb"); | |
| 699 | + m_pFileBs = WelsFopen (strStreamFileName, "wb"); | |
| 712 | 700 | SNPRINTF (strStreamFileName, 128, 128, "adj%d_w%d_size.iLen", m_iSwitchTimes, |
| 713 | 701 | m_pEncContext->pSvcParam->iActualPicWidth); |
| 714 | − FOPEN (&m_pFileBsSize, strStreamFileName, "wb"); | |
| 702 | + m_pFileBsSize = WelsFopen (strStreamFileName, "wb"); | |
| 715 | 703 | #else |
| 716 | 704 | int32_t iLen = SNPRINTF (strStreamFileName, 128, "adj%d_w%d.264", m_iSwitchTimes, |
| 717 | 705 | m_pEncContext->pSvcParam->iActualPicWidth); |
| 718 | − m_pFileBs = FOPEN (strStreamFileName, "wb"); | |
| 706 | + m_pFileBs = WelsFopen (strStreamFileName, "wb"); | |
| 719 | 707 | SNPRINTF (strStreamFileName, 128, "adj%d_w%d_size.iLen", m_iSwitchTimes, m_pEncContext->pSvcParam->iActualPicWidth); |
| 720 | − m_pFileBsSize = FOPEN (strStreamFileName, "wb"); | |
| 708 | + m_pFileBsSize = WelsFopen (strStreamFileName, "wb"); | |
| 721 | 709 | #endif//_MSC_VER>=1500 |
| 722 | 710 | #endif//_MSC_VER |
| 723 | 711 | |
| @@ -1145,17 +1133,7 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) { · 421 unmodified lines | ||
| 1145 | 1133 | case videoFormatI420: |
| 1146 | 1134 | case videoFormatYV12: |
| 1147 | 1135 | STRCAT (strFileName, 256, "yuv"); // confirmed_safe_unsafe_usage |
| 1148 | −#if defined(__GNUC__) | |
| 1149 | − pFile = FOPEN (strFileName, "ab+"); | |
| 1150 | −#else | |
| 1151 | −#if defined(_MSC_VER) | |
| 1152 | −#if _MSC_VER>=1500 | |
| 1153 | − FOPEN (&pFile, strFileName, "ab+"); | |
| 1154 | −#else | |
| 1155 | − pFile = FOPEN (strFileName, "ab+"); | |
| 1156 | −#endif//_MSC_VER>=1500 | |
| 1157 | −#endif//_MSC_VER | |
| 1158 | −#endif//__GNUC__ | |
| 1136 | + pFile = WelsFopen (strFileName, "ab+"); | |
| 1159 | 1137 | // WelsLog( m_pEncContext, WELS_LOG_INFO, "WELS_CSP_I420, m_iCspInternal= 0x%x\n", m_iCspInternal); |
| 1160 | 1138 | if (NULL != pFile) { |
| 1161 | 1139 | fwrite (pSrc, sizeof (uint8_t), (iDataLength * 3) >> 1, pFile); |
| @@ -1165,17 +1143,7 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) { · 3 unmodified lines | ||
| 1165 | 1143 | break; |
| 1166 | 1144 | case videoFormatRGB: |
| 1167 | 1145 | STRCAT (strFileName, 256, "rgb"); // confirmed_safe_unsafe_usage |
| 1168 | −#if defined(__GNUC__) | |
| 1169 | − pFile = FOPEN (strFileName, "ab+"); | |
| 1170 | −#else | |
| 1171 | −#if defined(_MSC_VER) | |
| 1172 | −#if _MSC_VER>=1500 | |
| 1173 | − FOPEN (&pFile, strFileName, "ab+"); | |
| 1174 | −#else | |
| 1175 | − pFile = FOPEN (strFileName, "ab+"); | |
| 1176 | −#endif//_MSC_VER>=1500 | |
| 1177 | −#endif//_MSC_VER | |
| 1178 | −#endif//__GNUC__ | |
| 1146 | + pFile = WelsFopen (strFileName, "ab+"); | |
| 1179 | 1147 | if (NULL != pFile) { |
| 1180 | 1148 | fwrite (pSrc, sizeof (uint8_t), iDataLength * 3, pFile); |
| 1181 | 1149 | fflush (pFile); |
| @@ -1183,17 +1151,7 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) { · 1 unmodified line | ||
| 1183 | 1151 | } |
| 1184 | 1152 | case videoFormatBGR: |
| 1185 | 1153 | STRCAT (strFileName, 256, "bgr"); // confirmed_safe_unsafe_usage |
| 1186 | −#if defined(__GNUC__) | |
| 1187 | − pFile = FOPEN (strFileName, "ab+"); | |
| 1188 | −#else | |
| 1189 | −#if defined(_MSC_VER) | |
| 1190 | −#if _MSC_VER>=1500 | |
| 1191 | − FOPEN (&pFile, strFileName, "ab+"); | |
| 1192 | −#else | |
| 1193 | − pFile = FOPEN (strFileName, "ab+"); | |
| 1194 | −#endif//_MSC_VER>=1500 | |
| 1195 | −#endif//_MSC_VER | |
| 1196 | −#endif//__GNUC__ | |
| 1154 | + pFile = WelsFopen (strFileName, "ab+"); | |
| 1197 | 1155 | // WelsLog( m_pEncContext, WELS_LOG_INFO, "WELS_CSP_BGR, m_iCspInternal= 0x%x\n", m_iCspInternal); |
| 1198 | 1156 | if (NULL != pFile) { |
| 1199 | 1157 | fwrite (pSrc, sizeof (uint8_t), iDataLength * 3, pFile); |
| @@ -1203,17 +1161,7 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) { · 3 unmodified lines | ||
| 1203 | 1161 | break; |
| 1204 | 1162 | case videoFormatYUY2: |
| 1205 | 1163 | STRCAT (strFileName, 256, "yuy2"); // confirmed_safe_unsafe_usage |
| 1206 | −#if defined(__GNUC__) | |
| 1207 | − pFile = FOPEN (strFileName, "ab+"); | |
| 1208 | −#else | |
| 1209 | −#if defined(_MSC_VER) | |
| 1210 | −#if _MSC_VER>=1500 | |
| 1211 | − FOPEN (&pFile, strFileName, "ab+"); | |
| 1212 | −#else | |
| 1213 | − pFile = FOPEN (strFileName, "ab+"); | |
| 1214 | −#endif//_MSC_VER>=1500 | |
| 1215 | −#endif//_MSC_VER | |
| 1216 | −#endif//__GNUC__ | |
| 1164 | + pFile = WelsFopen (strFileName, "ab+"); | |
| 1217 | 1165 | if (NULL != pFile) { |
| 1218 | 1166 | fwrite (pSrc, sizeof (uint8_t), (CALC_BI_STRIDE (m_iMaxPicWidth, 16)) * m_iMaxPicHeight, pFile); |
| 1219 | 1167 | fflush (pFile); |