ref: 1ffcd36c70652b1d265455b97d1ec525e9c4dae6
parent: fa138e866aa2b280ac3c2a0fe6adc62dbc1b5d7f
author: ruil2 <[email protected]>
date: Fri Jun 27 07:34:47 EDT 2014
change void* to explicit type definition
--- a/codec/common/inc/utils.h
+++ b/codec/common/inc/utils.h
@@ -56,10 +56,10 @@
#ifdef __GNUC__
-extern void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) __attribute__ ((__format__ (__printf__, 3,
+extern void WelsLog (SLogContext* pCtx, int32_t iLevel, const char* kpFmt, ...) __attribute__ ((__format__ (__printf__, 3,
4)));
#else
-extern void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...);
+extern void WelsLog (SLogContext* pCtx, int32_t iLevel, const char* kpFmt, ...);
#endif
/*
--- a/codec/common/src/utils.cpp
+++ b/codec/common/src/utils.cpp
@@ -48,8 +48,7 @@
const int32_t kiHeight);
-void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) {
- SLogContext* logCtx = (SLogContext*) pCtx;
+void WelsLog (SLogContext* logCtx, int32_t iLevel, const char* kpFmt, ...) {
va_list vl;
va_start (vl, kpFmt);
logCtx->pfLog (logCtx->pLogCtx, iLevel, kpFmt, vl);
--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -86,7 +86,7 @@
do {
if (WelsTargetMbConstruction (pCtx)) {
- WelsLog (pCtx, WELS_LOG_WARNING, "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d\n",
+ WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d\n",
pCurLayer->iMbX, pCurLayer->iMbY, pCurSlice->eSliceType);
return -1;
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -750,7 +750,7 @@
pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc = uiCode;
//refer to JVT-X201wcm1.doc G.7.4.3.4--2010.4.20
if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc > 6) {
- WelsLog (pCtx, WELS_LOG_WARNING, "disable_inter_layer_deblock_filter_idc (%d) out of range [0, 6]\n",
+ WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "disable_inter_layer_deblock_filter_idc (%d) out of range [0, 6]\n",
pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc);
return ERR_INFO_INVALID_DBLOCKING_IDC;
}
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -527,7 +527,7 @@
iCountNumNals += kiNumOfSlice;
assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER);
if (kiNumOfSlice > MAX_SLICES_NUM) {
- WelsLog (*ppCtx, WELS_LOG_ERROR,
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_ERROR,
"AcquireLayersNals(), num_of_slice(%d) > MAX_SLICES_NUM(%d) per (iDid= %d, qid= %d) settings!\n",
kiNumOfSlice, MAX_SLICES_NUM, iDIndex, 0);
return 1;
@@ -535,7 +535,7 @@
}
if (iCountNumNals - iOrgNumNals > MAX_NAL_UNITS_IN_LAYER) {
- WelsLog (*ppCtx, WELS_LOG_ERROR,
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_ERROR,
"AcquireLayersNals(), num_of_nals(%d) > MAX_NAL_UNITS_IN_LAYER(%d) per (iDid= %d, qid= %d) settings!\n",
(iCountNumNals - iOrgNumNals), MAX_NAL_UNITS_IN_LAYER, iDIndex, 0);
return 1;
@@ -551,7 +551,7 @@
// to check number of layers / nals / slices dependencies, 12/8/2010
if (iCountNumLayers > MAX_LAYER_NUM_OF_FRAME) {
- WelsLog (*ppCtx, WELS_LOG_ERROR, "AcquireLayersNals(), iCountNumLayers(%d) > MAX_LAYER_NUM_OF_FRAME(%d)!",
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_ERROR, "AcquireLayersNals(), iCountNumLayers(%d) > MAX_LAYER_NUM_OF_FRAME(%d)!",
iCountNumLayers, MAX_LAYER_NUM_OF_FRAME);
return 1;
}
@@ -955,7 +955,7 @@
& (pDlayerParam->sSliceCfg),
pPps);
if (iResult) {
- WelsLog (*ppCtx, WELS_LOG_WARNING, "InitDqLayers(), InitSlicePEncCtx failed(%d)!", iResult);
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "InitDqLayers(), InitSlicePEncCtx failed(%d)!", iResult);
FreeMemorySvc (ppCtx);
return 1;
}
@@ -1285,7 +1285,7 @@
int32_t iTargetSpatialBsSize = 0;
if (kiNumDependencyLayers < 1 || kiNumDependencyLayers > MAX_DEPENDENCY_LAYER) {
- WelsLog (*ppCtx, WELS_LOG_WARNING, "RequestMemorySvc() failed due to invalid iNumDependencyLayers(%d)!\n",
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc() failed due to invalid iNumDependencyLayers(%d)!\n",
kiNumDependencyLayers);
FreeMemorySvc (ppCtx);
return 1;
@@ -1292,7 +1292,7 @@
}
if (pParam->uiGopSize == 0 || (pParam->uiIntraPeriod && ((pParam->uiIntraPeriod % pParam->uiGopSize) != 0))) {
- WelsLog (*ppCtx, WELS_LOG_WARNING,
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING,
"RequestMemorySvc() failed due to invalid uiIntraPeriod(%d) (=multipler of uiGopSize(%d)!",
pParam->uiIntraPeriod, pParam->uiGopSize);
FreeMemorySvc (ppCtx);
@@ -1306,7 +1306,7 @@
iResult = AcquireLayersNals (ppCtx, pParam, &iCountLayers, &iCountNals);
if (iResult) {
- WelsLog (*ppCtx, WELS_LOG_WARNING, "RequestMemorySvc(), AcquireLayersNals failed(%d)!", iResult);
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), AcquireLayersNals failed(%d)!", iResult);
FreeMemorySvc (ppCtx);
return 1;
}
@@ -1359,7 +1359,7 @@
// for pSlice bs buffers
if (pParam->iMultipleThreadIdc > 1 && RequestMtResource (ppCtx, pParam, iCountBsLen, iTargetSpatialBsSize)) {
- WelsLog (*ppCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMtResource failed!");
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMtResource failed!");
FreeMemorySvc (ppCtx);
return 1;
}
@@ -1406,7 +1406,7 @@
// stride tables
if (AllocStrideTables (ppCtx, kiNumDependencyLayers)) {
- WelsLog (*ppCtx, WELS_LOG_WARNING, "RequestMemorySvc(), AllocStrideTables failed!");
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), AllocStrideTables failed!");
FreeMemorySvc (ppCtx);
return 1;
}
@@ -1422,7 +1422,7 @@
(*ppCtx)->pVaa = (SVAAFrameInfoExt*)pMa->WelsMallocz (sizeof (SVAAFrameInfoExt), "pVaa");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa), FreeMemorySvc (ppCtx))
if (RequestMemoryVaaScreen ((*ppCtx)->pVaa, pMa, (*ppCtx)->pSvcParam->iMaxNumRefFrame, iCountMaxMbNum << 2)) {
- WelsLog (*ppCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMemoryVaaScreen failed!");
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMemoryVaaScreen failed!");
FreeMemorySvc (ppCtx);
return 1;
}
@@ -1471,13 +1471,13 @@
iResult = InitDqLayers (ppCtx);
if (iResult) {
- WelsLog (*ppCtx, WELS_LOG_WARNING, "RequestMemorySvc(), InitDqLayers failed(%d)!", iResult);
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), InitDqLayers failed(%d)!", iResult);
FreeMemorySvc (ppCtx);
return iResult;
}
if (InitMbListD (ppCtx)) {
- WelsLog (*ppCtx, WELS_LOG_WARNING, "RequestMemorySvc(), InitMbListD failed!");
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), InitMbListD failed!");
FreeMemorySvc (ppCtx);
return 1;
}
@@ -1757,7 +1757,7 @@
#endif//MEMORY_MONITOR
if ((*ppCtx)->pMemAlign != NULL) {
- WelsLog (*ppCtx, WELS_LOG_INFO, "FreeMemorySvc(), verify memory usage (%d bytes) after free..\n",
+ WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_INFO, "FreeMemorySvc(), verify memory usage (%d bytes) after free..\n",
(*ppCtx)->pMemAlign->WelsGetMemoryUsage());
delete (*ppCtx)->pMemAlign;
(*ppCtx)->pMemAlign = NULL;
--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -348,11 +348,11 @@
#ifdef _TEST_TEMP_Rc_
fprintf (fp_vgop, "%d\n", WELS_ROUND ((double)iTotalBits / iFrameInVGop));
#endif
- WelsLog (pEncCtx, WELS_LOG_INFO, "[Rc] VGOPbitrate%d: %d \n", kiDid, iVGopBitrate);
+ WelsLog (&(pEncCtx->sLogCtx), WELS_LOG_INFO, "[Rc] VGOPbitrate%d: %d \n", kiDid, iVGopBitrate);
if (iTotalBits > 0) {
iTid = 0;
while (iTid <= kiHighestTid) {
- WelsLog (pEncCtx, WELS_LOG_INFO, "T%d=%8.3f \n", iTid, (double) (pTOverRc[iTid].iGopBitsDq / iTotalBits));
+ WelsLog (&(pEncCtx->sLogCtx), WELS_LOG_INFO, "T%d=%8.3f \n", iTid, (double) (pTOverRc[iTid].iGopBitsDq / iTotalBits));
++ iTid;
}
}
@@ -756,7 +756,7 @@
void RcTraceFrameBits (sWelsEncCtx* pEncCtx) {
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
- WelsLog (pEncCtx, WELS_LOG_INFO,
+ WelsLog (&(pEncCtx->sLogCtx), WELS_LOG_INFO,
"[Rc] encoding_qp%d, qp = %3d, index = %8d, iTid = %1d, used = %8d, target = %8d, remaingbits = %8d\n",
pEncCtx->uiDependencyId, pWelsSvcRc->iAverageFrameQp, pEncCtx->iFrameIndex, pEncCtx->uiTemporalId,
pWelsSvcRc->iFrameDqBits,
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -211,7 +211,7 @@
iNumMbInEachGom = pWelsSvcRc->iNumberMbGom;
if (iNumMbInEachGom <= 0) {
- WelsLog (pCtx, WELS_LOG_ERROR,
+ WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR,
"[MT] DynamicAdjustSlicing(), invalid iNumMbInEachGom= %d from RC, iDid= %d, iCountNumMb= %d\n", iNumMbInEachGom,
iCurDid, kiCountNumMb);
return;