astyle all files

This commit is contained in:
huili2
2014-05-05 19:30:21 -07:00
parent 0c246861b7
commit 5ed24f216b
120 changed files with 3913 additions and 3832 deletions

View File

@@ -252,7 +252,8 @@ typedef enum {
// TODO: Refine the parameters definition.
// SVC Encoding Parameters
typedef struct TagEncParamBase {
EUsageType iUsageType; //application type;// CAMERA_VIDEO_REAL_TIME: //camera video signal; SCREEN_CONTENT_REAL_TIME: screen content signal;
EUsageType
iUsageType; //application type;// CAMERA_VIDEO_REAL_TIME: //camera video signal; SCREEN_CONTENT_REAL_TIME: screen content signal;
int iInputCsp; // color space of input sequence
int iPicWidth; // width of picture in samples
@@ -264,9 +265,9 @@ typedef struct TagEncParamBase{
} SEncParamBase, *PEncParamBase;
typedef struct TagEncParamExt
{
EUsageType iUsageType; //application type;// CAMERA_VIDEO_REAL_TIME: //camera video signal; SCREEN_CONTENT_REAL_TIME: screen content signal;
typedef struct TagEncParamExt {
EUsageType
iUsageType; //application type;// CAMERA_VIDEO_REAL_TIME: //camera video signal; SCREEN_CONTENT_REAL_TIME: screen content signal;
int iInputCsp; // color space of input sequence
int iPicWidth; // width of picture in samples
@@ -301,7 +302,8 @@ typedef struct TagEncParamExt
unsigned int iLtrMarkPeriod;
/* multi-thread settings*/
unsigned short iMultipleThreadIdc; // 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
unsigned short
iMultipleThreadIdc; // 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
/* Deblocking loop filter */
int iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries

View File

@@ -41,10 +41,12 @@ void DeblockLumaEq4V_neon(uint8_t* pPixY, int32_t iStride, int32_t iAlpha, int32
void DeblockLumaLt4H_neon (uint8_t* pPixY, int32_t iStride, int32_t iAlpha, int32_t iBeta, int8_t* pTc);
void DeblockLumaEq4H_neon (uint8_t* pPixY, int32_t iStride, int32_t iAlpha, int32_t iBeta);
void DeblockChromaLt4V_neon(uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta, int8_t* pTC);
void DeblockChromaLt4V_neon (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta,
int8_t* pTC);
void DeblockChromaEq4V_neon (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta);
void DeblockChromaLt4H_neon(uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta, int8_t* pTC);
void DeblockChromaLt4H_neon (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta,
int8_t* pTC);
void DeblockChromaEq4H_neon (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta);
#endif

View File

@@ -67,7 +67,8 @@ void ExpandPictureChroma_neon(uint8_t *pDst, const int32_t kiStride, const int32
#endif
#if defined(HAVE_NEON_AARCH64)
void ExpandPictureLuma_AArch64_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
void ExpandPictureChroma_AArch64_neon(uint8_t *pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
void ExpandPictureChroma_AArch64_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW,
const int32_t kiPicH);
#endif
#if defined(__cplusplus)
}

View File

@@ -209,8 +209,7 @@ void WelsCPURestore (const uint32_t kuiCPU) {
#elif defined(HAVE_NEON) //For supporting both android platform and iOS platform
#if defined(ANDROID_NDK)
uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors)
{
uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors) {
uint32_t uiCPU = 0;
AndroidCpuFamily cpuFamily = ANDROID_CPU_FAMILY_UNKNOWN;
uint64_t uiFeatures = 0;
@@ -236,8 +235,7 @@ uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors)
}
#elif defined(__APPLE__)
uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors)
{
uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors) {
uint32_t uiCPU = 0;
#if defined(__ARM_NEON__)

View File

@@ -104,8 +104,7 @@ static void SigIntHandler (int a) {
}
static int g_LevelSetting = 0;
int ParseLayerConfig( CReadConfig & cRdLayerCfg, const int iLayer, SEncParamExt& pSvcParam,SFilesSet& sFileSet)
{
int ParseLayerConfig (CReadConfig& cRdLayerCfg, const int iLayer, SEncParamExt& pSvcParam, SFilesSet& sFileSet) {
if (!cRdLayerCfg.ExistFile()) {
fprintf (stderr, "Unabled to open layer #%d configuration file: %s.\n", iLayer, cRdLayerCfg.GetFileName().c_str());
return 1;
@@ -302,8 +301,7 @@ int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSv
for (int8_t iLayer = 0; iLayer < kiActualLayerNum; ++ iLayer) {
CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);
if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam,sFileSet ))
{
if (-1 == ParseLayerConfig (cRdLayerCfg, iLayer, pSvcParam, sFileSet)) {
iRet = 1;
break;
}
@@ -489,21 +487,18 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
for (int8_t iLayer = 0; iLayer < pSvcParam.iSpatialLayerNum; ++ iLayer) {
CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);
if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam,sFileSet ))
{
if (-1 == ParseLayerConfig (cRdLayerCfg, iLayer, pSvcParam, sFileSet)) {
return 1;
}
}
}
else if (!strcmp (pCommand, "-drec") && (n + 1 < argc)) {
} else if (!strcmp (pCommand, "-drec") && (n + 1 < argc)) {
unsigned int iLayer = atoi (argv[n++]);
const unsigned int iLen = strlen (argv[n]);
if (iLen >= sizeof (sFileSet.sRecFileName[iLayer]))
return 1;
sFileSet.sRecFileName[iLayer][iLen] = '\0';
strncpy (sFileSet.sRecFileName[iLayer], argv[n++], iLen); // confirmed_safe_unsafe_usage
}
else if (!strcmp (pCommand, "-dw") && (n + 1 < argc)) {
} else if (!strcmp (pCommand, "-dw") && (n + 1 < argc)) {
unsigned int iLayer = atoi (argv[n++]);
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
pDLayer->iVideoWidth = atoi (argv[n++]);

View File

@@ -92,7 +92,8 @@ int32_t ParseRefBasePicMarking (PBitStringAux pBs, PRefBasePicMarking pRefBasePi
int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs);
bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal, const PSps kpSps);
bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal,
const PSps kpSps);
bool CheckAccessUnitBoundaryExt (PNalUnitHeaderExt pLastNalHdrExt, PNalUnitHeaderExt pCurNalHeaderExt,
PSliceHeader pLastSliceHeader, PSliceHeader pCurSliceHeader);
/*!

View File

@@ -399,7 +399,8 @@ bool CheckAccessUnitBoundaryExt (PNalUnitHeaderExt pLastNalHdrExt, PNalUnitHeade
}
bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal, const PSps kpSps) {
bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal,
const PSps kpSps) {
const PNalUnitHeaderExt kpLastNalHeaderExt = &kpLastNal->sNalHeaderExt;
const PNalUnitHeaderExt kpCurNalHeaderExt = &kpCurNal->sNalHeaderExt;
const SSliceHeader* kpLastSliceHeader = &kpLastNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader;
@@ -411,7 +412,8 @@ bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal,
}
if (kpLastSliceHeader->iFrameNum != kpCurSliceHeader->iFrameNum)
return true;
if (pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL && pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps) {
if (pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL
&& pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps) {
pCtx->bNextNewSeqBegin = true;
return true; // the active sps changed, new sequence begins, so the current au is ready
}
@@ -423,7 +425,8 @@ bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal,
if (kpLastNalHeaderExt->uiDependencyId > kpCurNalHeaderExt->uiDependencyId)
return true;
// Subclause 7.4.1.2.4
if (kpLastNalHeaderExt->uiDependencyId == kpCurNalHeaderExt->uiDependencyId && kpLastSliceHeader->iPpsId != kpCurSliceHeader->iPpsId)
if (kpLastNalHeaderExt->uiDependencyId == kpCurNalHeaderExt->uiDependencyId
&& kpLastSliceHeader->iPpsId != kpCurSliceHeader->iPpsId)
return true;
if (kpLastSliceHeader->bFieldPicFlag != kpCurSliceHeader->bFieldPicFlag)
return true;

View File

@@ -720,8 +720,7 @@ void DeblockingInit (SDeblockingFunc* pFunc, int32_t iCpu) {
#endif
#if defined(HAVE_NEON)
if ( iCpu & WELS_CPU_NEON )
{
if (iCpu & WELS_CPU_NEON) {
pFunc->pfLumaDeblockingLT4Ver = DeblockLumaLt4V_neon;
pFunc->pfLumaDeblockingEQ4Ver = DeblockLumaEq4V_neon;
pFunc->pfLumaDeblockingLT4Hor = DeblockLumaLt4H_neon;

View File

@@ -970,7 +970,8 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
pCtx->sMb.pInterPredictionDoneFlag[i] = (int8_t*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (
int8_t), "pCtx->sMb.pInterPredictionDoneFlag[]");
pCtx->sMb.pMbCorrectlyDecodedFlag[i] = (bool*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (bool), "pCtx->sMb.pMbCorrectlyDecodedFlag[]");
pCtx->sMb.pMbCorrectlyDecodedFlag[i] = (bool*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (bool),
"pCtx->sMb.pMbCorrectlyDecodedFlag[]");
// check memory block valid due above allocated..
WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY,
@@ -1493,7 +1494,8 @@ static bool CheckNewSeqBeginAndUpdateActiveLayerSps(PWelsDecoderContext pCtx) {
for (unsigned int i = pCurAu->uiStartPos; i <= pCurAu->uiEndPos; i++) {
uint32_t uiDid = pCurAu->pNalUnitsList[i]->sNalHeaderExt.uiDependencyId;
pTmpLayerSps[uiDid] = pCurAu->pNalUnitsList[i]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps;
if ((pCurAu->pNalUnitsList[i]->sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR) || (pCurAu->pNalUnitsList[i]->sNalHeaderExt.bIdrFlag))
if ((pCurAu->pNalUnitsList[i]->sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR)
|| (pCurAu->pNalUnitsList[i]->sNalHeaderExt.bIdrFlag))
bNewSeq = true;
}
int iMaxActiveLayer = 0, iMaxCurrentLayer = 0;
@@ -1509,7 +1511,8 @@ static bool CheckNewSeqBeginAndUpdateActiveLayerSps(PWelsDecoderContext pCtx) {
break;
}
}
if ((iMaxCurrentLayer != iMaxActiveLayer) || (pTmpLayerSps[iMaxCurrentLayer] != pCtx->pActiveLayerSps[iMaxActiveLayer])) {
if ((iMaxCurrentLayer != iMaxActiveLayer)
|| (pTmpLayerSps[iMaxCurrentLayer] != pCtx->pActiveLayerSps[iMaxActiveLayer])) {
bNewSeq = true;
}
// fill active sps if the current sps is not null while active layer is null
@@ -1535,7 +1538,8 @@ static void WriteBackActiveParameters(PWelsDecoderContext pCtx) {
pCtx->bNewSeqBegin = true;
}
if (pCtx->iOverwriteFlags & OVERWRITE_SUBSETSPS) {
memcpy(&pCtx->sSubsetSpsBuffer[pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT].sSps.iSpsId], &pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], sizeof(SSubsetSps));
memcpy (&pCtx->sSubsetSpsBuffer[pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT].sSps.iSpsId],
&pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], sizeof (SSubsetSps));
pCtx->bNewSeqBegin = true;
}
pCtx->iOverwriteFlags = OVERWRITE_NONE;

View File

@@ -110,7 +110,8 @@ void WelsResetRefPic (PWelsDecoderContext pCtx) {
int32_t WelsInitRefList (PWelsDecoderContext pCtx, int32_t iPoc) {
int32_t i, iCount = 0;
if ((pCtx->sRefPic.uiShortRefCount[LIST_0] + pCtx->sRefPic.uiLongRefCount[LIST_0] <= 0) && (pCtx->eSliceType != I_SLICE && pCtx->eSliceType != SI_SLICE)) {
if ((pCtx->sRefPic.uiShortRefCount[LIST_0] + pCtx->sRefPic.uiLongRefCount[LIST_0] <= 0) && (pCtx->eSliceType != I_SLICE
&& pCtx->eSliceType != SI_SLICE)) {
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { //IDR lost!, recover it for future decoding with data all set to 0
PPicture pRef = PrefetchPic (pCtx->pPicBuff[0]);
if (pRef != NULL) {
@@ -561,7 +562,8 @@ static int32_t RemainOneBufferInDpbForEC (PWelsDecoderContext pCtx) {
uiLongTermFrameIdx++;
}
}
if (pRefPic->uiShortRefCount[0] + pRefPic->uiLongRefCount[0] >= pCtx->pSps->iNumRefFrames) { //fail to remain one empty buffer in DPB
if (pRefPic->uiShortRefCount[0] + pRefPic->uiLongRefCount[0] >=
pCtx->pSps->iNumRefFrames) { //fail to remain one empty buffer in DPB
WelsLog (pCtx, WELS_LOG_WARNING, "RemainOneBufferInDpbForEC(): empty one DPB failed for EC!\n");
iRet = ERR_INFO_REF_COUNT_OVERFLOW;
}

View File

@@ -66,7 +66,8 @@ extern "C" {
#endif//__cplusplus
#if defined(HAVE_NEON)
void WelsNonZeroCount_neon (int8_t* pNonZeroCount);
void DeblockingBSCalcEnc_neon(int8_t *pNzc, SMVUnitXY *pMv, int32_t iBoundryFlag, int32_t iMbStride, uint8_t (*pBS)[4][4]);
void DeblockingBSCalcEnc_neon (int8_t* pNzc, SMVUnitXY* pMv, int32_t iBoundryFlag, int32_t iMbStride,
uint8_t (*pBS)[4][4]);
#endif
#if defined(__cplusplus)
}

View File

@@ -77,7 +77,8 @@ void WelsDequantIHadamard4x4_neon(int16_t* pRes, const uint16_t kuiMF);
void WelsIDctT4Rec_neon (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride, int16_t* pDct);
void WelsIDctFourT4Rec_neon (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride, int16_t* pDct);
void WelsIDctRecI16x16Dc_neon(uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride, int16_t* pDctDc);
void WelsIDctRecI16x16Dc_neon (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride,
int16_t* pDctDc);
#endif
#if defined(__cplusplus)

View File

@@ -61,7 +61,8 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx);
* \brief allocate or reallocate the output bs buffer
* \return: successful - 0; otherwise none 0 for failed
*/
int32_t AllocateBsOutputBuffer(CMemoryAlign*pMa, const int32_t iNeededLen, int32_t iOrigLen, const char* kpTag, uint8_t*& pOutputBuffer );
int32_t AllocateBsOutputBuffer (CMemoryAlign* pMa, const int32_t iNeededLen, int32_t iOrigLen, const char* kpTag,
uint8_t*& pOutputBuffer);
//TODO: to finish this function and call it
/*!

View File

@@ -79,7 +79,8 @@ WELS_EVENT pReadySliceCodingEvent[MAX_THREADS_NUM]; // events for slice codi
WELS_EVENT pUpdateMbListEvent[MAX_THREADS_NUM]; // signal to update mb list neighbor for various slices
WELS_EVENT pFinUpdateMbListEvent[MAX_THREADS_NUM]; // signal to indicate finish updating mb list
WELS_EVENT pExitEncodeEvent[MAX_THREADS_NUM]; // event for exit encoding event
WELS_EVENT pThreadMasterEvent[MAX_THREADS_NUM]; // event for indicating that some event has been signalled to the thread
WELS_EVENT
pThreadMasterEvent[MAX_THREADS_NUM]; // event for indicating that some event has been signalled to the thread
WELS_MUTEX mutexSliceNumUpdate; // for dynamic slicing mode MT

View File

@@ -129,7 +129,8 @@ void WelsUnloadNalForSlice (SWelsSliceBs* pSliceBs);
* \param pRawNal pRawNal NAL pData
* \return ERR_CODE
*/
int32_t WelsEncodeNal (SWelsNalRaw* pRawNal, void* pNalHeaderExt, const int32_t kiDstBufferLen, void* pDst, int32_t* pDstLen);
int32_t WelsEncodeNal (SWelsNalRaw* pRawNal, void* pNalHeaderExt, const int32_t kiDstBufferLen, void* pDst,
int32_t* pDstLen);
/*!
* \brief write prefix nal

View File

@@ -125,7 +125,8 @@ char* pCurPath; // record current lib path such as:/pData/pData/com.wels.e
bool bDeblockingParallelFlag; // deblocking filter parallelization control flag
short iCountThreadsNum; // # derived from disable_multiple_slice_idc (=0 or >1) means;
short
iCountThreadsNum; // # derived from disable_multiple_slice_idc (=0 or >1) means;
int8_t iDecompStages; // GOP size dependency
@@ -352,7 +353,8 @@ int32_t ParamTranscode (const SEncParamExt& pCodingParam) {
/* Layer definition */
iSpatialLayerNum = (int8_t)WELS_CLIP3 (pCodingParam.iSpatialLayerNum, 1,
MAX_DEPENDENCY_LAYER); // number of dependency(Spatial/CGS) layers used to be encoded
iTemporalLayerNum = (int8_t)WELS_CLIP3(pCodingParam.iTemporalLayerNum, 1, MAX_TEMPORAL_LEVEL);// number of temporal layer specified
iTemporalLayerNum = (int8_t)WELS_CLIP3 (pCodingParam.iTemporalLayerNum, 1,
MAX_TEMPORAL_LEVEL); // number of temporal layer specified
uiGopSize = 1 << (iTemporalLayerNum - 1); // Override GOP size based temporal layer
iDecompStages = iTemporalLayerNum - 1; // WELS_LOG2( uiGopSize );// GOP size dependency
@@ -393,8 +395,10 @@ int32_t ParamTranscode (const SEncParamExt& pCodingParam) {
uint8_t uiProfileIdc = PRO_BASELINE;
int8_t iIdxSpatial = 0;
while (iIdxSpatial < iSpatialLayerNum) {
pDlp->uiProfileIdc = (pCodingParam.sSpatialLayers[iIdxSpatial].uiProfileIdc == PRO_UNKNOWN)?uiProfileIdc:pCodingParam.sSpatialLayers[iIdxSpatial].uiProfileIdc;
pDlp->uiLevelIdc = (pCodingParam.sSpatialLayers[iIdxSpatial].uiLevelIdc == LEVEL_UNKNOWN)?LEVEL_5_0:pCodingParam.sSpatialLayers[iIdxSpatial].uiLevelIdc;
pDlp->uiProfileIdc = (pCodingParam.sSpatialLayers[iIdxSpatial].uiProfileIdc == PRO_UNKNOWN) ? uiProfileIdc :
pCodingParam.sSpatialLayers[iIdxSpatial].uiProfileIdc;
pDlp->uiLevelIdc = (pCodingParam.sSpatialLayers[iIdxSpatial].uiLevelIdc == LEVEL_UNKNOWN) ? LEVEL_5_0 :
pCodingParam.sSpatialLayers[iIdxSpatial].uiLevelIdc;
float fLayerFrameRate = WELS_CLIP3 (pCodingParam.sSpatialLayers[iIdxSpatial].fFrameRate,
MIN_FRAME_RATE, fParamMaxFrameRate);

View File

@@ -40,8 +40,7 @@
namespace WelsSVCEnc {
#define LIST_SIZE 0x10000 //(256*256)
typedef struct TagScreenBlockFeatureStorage
{
typedef struct TagScreenBlockFeatureStorage {
//Input
uint16_t* pFeatureOfBlockPointer; // Pointer to pFeatureOfBlock
int32_t iIs16x16; //Feature block size
@@ -49,7 +48,8 @@ typedef struct TagScreenBlockFeatureStorage
//Modify
uint32_t* pTimesOfFeatureValue; // times of every value in Feature
uint16_t** pLocationOfFeature; // uint16_t *pLocationOfFeature[LIST_SIZE], pLocationOfFeature[i] saves all the location(x,y) whose Feature = i;
uint16_t**
pLocationOfFeature; // uint16_t *pLocationOfFeature[LIST_SIZE], pLocationOfFeature[i] saves all the location(x,y) whose Feature = i;
uint16_t* pLocationPointer; // buffer of position array
int32_t iActualListSize; // actual list size
uint32_t uiSadCostThreshold[BLOCK_SIZE_ALL];

View File

@@ -52,7 +52,8 @@ namespace WelsSVCEnc {
* \pram iNeedFeatureStorage need storage for FME
* \return successful if effective picture pointer returned, otherwise failed with NULL
*/
SPicture* AllocPicture (CMemoryAlign* pMa, const int32_t kiWidth, const int32_t kiHeight, bool bNeedMbInfo, int32_t iNeedFeatureStorage);
SPicture* AllocPicture (CMemoryAlign* pMa, const int32_t kiWidth, const int32_t kiHeight, bool bNeedMbInfo,
int32_t iNeedFeatureStorage);
/*!
* \brief free picture pData planes

View File

@@ -47,7 +47,8 @@ int32_t WelsSampleSatd8x8_c (uint8_t*, int32_t, uint8_t*, int32_t);
//int32_t WelsSampleSatd4x8( uint8_t *, int32_t, uint8_t *, int32_t );
int32_t WelsSampleSatd4x4_c (uint8_t*, int32_t, uint8_t*, int32_t);
int32_t WelsSampleSatdIntra4x4Combined3_c (uint8_t*, int32_t, uint8_t*, int32_t, uint8_t*, int32_t*, int32_t, int32_t, int32_t);
int32_t WelsSampleSatdIntra4x4Combined3_c (uint8_t*, int32_t, uint8_t*, int32_t, uint8_t*, int32_t*, int32_t, int32_t,
int32_t);
int32_t WelsSampleSatdIntra16x16Combined3_c (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*);
int32_t WelsSampleSadIntra16x16Combined3_c (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*);
int32_t WelsSampleSatdIntra8x8Combined3_c (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*,
@@ -92,9 +93,12 @@ int32_t WelsSampleSatd4x4_neon (uint8_t*, int32_t, uint8_t*, int32_t);
int32_t WelsIntra16x16Combined3Satd_neon (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*);
int32_t WelsIntra16x16Combined3Sad_neon (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*);
int32_t WelsIntra8x8Combined3Satd_neon (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*, uint8_t*, uint8_t*);
int32_t WelsIntra8x8Combined3Sad_neon (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*, uint8_t*, uint8_t*);
int32_t WelsIntra4x4Combined3Satd_neon (uint8_t*, int32_t, uint8_t*, int32_t, uint8_t*, int32_t*, int32_t, int32_t, int32_t);
int32_t WelsIntra8x8Combined3Satd_neon (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*, uint8_t*,
uint8_t*);
int32_t WelsIntra8x8Combined3Sad_neon (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*, uint8_t*,
uint8_t*);
int32_t WelsIntra4x4Combined3Satd_neon (uint8_t*, int32_t, uint8_t*, int32_t, uint8_t*, int32_t*, int32_t, int32_t,
int32_t);
#endif

View File

@@ -70,7 +70,8 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam, con
void ReleaseMtResource (sWelsEncCtx** ppCtx);
int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32_t kiSliceCount);
int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFrameBsBuffer, const int32_t iSliceIdx, int32_t& iSliceSize);
int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFrameBsBuffer, const int32_t iSliceIdx,
int32_t& iSliceSize);
#if !defined(_WIN32)
WELS_THREAD_ROUTINE_TYPE UpdateMbListThreadProc (void* arg);
@@ -80,7 +81,8 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg);
int32_t CreateSliceThreads (sWelsEncCtx* pCtx);
int32_t FiredSliceThreads (SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList, WELS_EVENT* pMasterEventsList, SLayerBSInfo* pLayerBsInfo,
int32_t FiredSliceThreads (SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList, WELS_EVENT* pMasterEventsList,
SLayerBSInfo* pLayerBsInfo,
const uint32_t kuiNumThreads/*, int32_t *iLayerNum*/, SSliceCtx* pSliceCtx, const bool kbIsDynamicSlicingMode);
int32_t DynamicDetectCpuCores();

View File

@@ -73,7 +73,8 @@ typedef struct TagWelsME {
/* input */
uint16_t* pMvdCost;
union SadPredISatdUnit uSadPredISatd; //reuse the sad_pred as a temp pData
uint32_t uiSadCost; //used by ME and RC //max SAD should be max_delta*size+lambda*mvdsize = 255*256+91*33*2 = 65280 + 6006 = 71286 > (2^16)-1 = 65535
uint32_t
uiSadCost; //used by ME and RC //max SAD should be max_delta*size+lambda*mvdsize = 255*256+91*33*2 = 65280 + 6006 = 71286 > (2^16)-1 = 65535
uint32_t uiSatdCost; /* satd + lm * nbits */
uint32_t uiSadCostThreshold;
int32_t iCurMeBlockPixX;
@@ -179,13 +180,15 @@ bool WelsMotionEstimateInitialPoint (SWelsFuncPtrList* pFuncList, SWelsME* pMe,
*
* \return NONE
*/
void WelsDiamondSearch (SWelsFuncPtrList* pFuncList, void* pLpme, void* pLpslice, const int32_t kiEncStride, const int32_t kiRefStride);
void WelsDiamondSearch (SWelsFuncPtrList* pFuncList, void* pLpme, void* pLpslice, const int32_t kiEncStride,
const int32_t kiRefStride);
bool WelsMeSadCostSelect (int32_t* pSadCost, const uint16_t* kpMvdCost, int32_t* pBestCost, const int32_t kiDx,
const int32_t kiDy, int32_t* pIx, int32_t* pIy);
void CalculateSatdCost (PSampleSadSatdCostFunc pSatd, void* vpMe, const int32_t kiEncStride, const int32_t kiRefStride);
void NotCalculateSatdCost( PSampleSadSatdCostFunc pSatd, void * vpMe, const int32_t kiEncStride, const int32_t kiRefStride );
void NotCalculateSatdCost (PSampleSadSatdCostFunc pSatd, void* vpMe, const int32_t kiEncStride,
const int32_t kiRefStride);
bool CheckDirectionalMv (PSampleSadSatdCostFunc pSad, void* vpMe,
const SMVUnitXY ksMinMv, const SMVUnitXY ksMaxMv, const int32_t kiEncStride, const int32_t kiRefStride,
int32_t& iBestSadCost);
@@ -230,14 +233,18 @@ void WelsMotionCrossSearch(SWelsFuncPtrList *pFuncList, SDqLayer* pCurLayer, SW
int32_t SumOf8x8SingleBlock_c (uint8_t* pRef, const int32_t kiRefStride);
int32_t SumOf16x16SingleBlock_c (uint8_t* pRef, const int32_t kiRefStride);
void SumOf8x8BlockOfFrame_c(uint8_t *pRefPicture, const int32_t kiWidth, const int32_t kiHeight, const int32_t kiRefStride,
void SumOf8x8BlockOfFrame_c (uint8_t* pRefPicture, const int32_t kiWidth, const int32_t kiHeight,
const int32_t kiRefStride,
uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[]);
void SumOf16x16BlockOfFrame_c(uint8_t *pRefPicture, const int32_t kiWidth, const int32_t kiHeight, const int32_t kiRefStride,
void SumOf16x16BlockOfFrame_c (uint8_t* pRefPicture, const int32_t kiWidth, const int32_t kiHeight,
const int32_t kiRefStride,
uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[]);
int32_t RequestScreenBlockFeatureStorage( CMemoryAlign *pMa, const int32_t kiFrameWidth, const int32_t kiFrameHeight, const int32_t iNeedFeatureStorage,
int32_t RequestScreenBlockFeatureStorage (CMemoryAlign* pMa, const int32_t kiFrameWidth, const int32_t kiFrameHeight,
const int32_t iNeedFeatureStorage,
SScreenBlockFeatureStorage* pScreenBlockFeatureStorage);
int32_t ReleaseScreenBlockFeatureStorage (CMemoryAlign* pMa, SScreenBlockFeatureStorage* pScreenBlockFeatureStorage);
int32_t RequestFeatureSearchPreparation( CMemoryAlign *pMa, const int32_t kiFrameWidth, const int32_t kiFrameHeight, const int32_t iNeedFeatureStorage,
int32_t RequestFeatureSearchPreparation (CMemoryAlign* pMa, const int32_t kiFrameWidth, const int32_t kiFrameHeight,
const int32_t iNeedFeatureStorage,
SFeatureSearchPreparation* pFeatureSearchPreparation);
int32_t ReleaseFeatureSearchPreparation (CMemoryAlign* pMa, uint16_t*& pFeatureOfBlock);
@@ -250,7 +257,8 @@ void UpdateFMESwitch(SDqLayer* pCurLayer);
void UpdateFMESwitchNull (SDqLayer* pCurLayer);
//inline functions
inline void SetMvWithinIntegerMvRange( const int32_t kiMbWidth, const int32_t kiMbHeight, const int32_t kiMbX, const int32_t kiMbY,
inline void SetMvWithinIntegerMvRange (const int32_t kiMbWidth, const int32_t kiMbHeight, const int32_t kiMbX,
const int32_t kiMbY,
const int32_t kiMaxMvRange,
SMVUnitXY* pMvMin, SMVUnitXY* pMvMax) {
pMvMin->iMvX = WELS_MAX (-1 * ((kiMbX + 1) << 4) + INTPEL_NEEDED_MARGIN, -1 * kiMaxMvRange);

View File

@@ -96,7 +96,8 @@ typedef void (*PChromaDeblockingLT4Func) (uint8_t* iSampleCb, uint8_t* iSampleCr
int32_t iBeta, int8_t* iTc);
typedef void (*PChromaDeblockingEQ4Func) (uint8_t* iSampleCb, uint8_t* iSampleCr, int32_t iStride, int32_t iAlpha,
int32_t iBeta);
typedef void (*PDeblockingBSCalc) (SWelsFuncPtrList* pFunc, SMB* pCurMb, uint8_t uiBS[2][4][4], Mb_Type uiCurMbType, int32_t iMbStride, int32_t iLeftFlag, int32_t iTopFlag);
typedef void (*PDeblockingBSCalc) (SWelsFuncPtrList* pFunc, SMB* pCurMb, uint8_t uiBS[2][4][4], Mb_Type uiCurMbType,
int32_t iMbStride, int32_t iLeftFlag, int32_t iTopFlag);
typedef struct tagDeblockingFunc {
PLumaDeblockingLT4Func pfLumaDeblockingLT4Ver;
@@ -145,8 +146,10 @@ typedef int32_t (*PIntraPred8x8Combined3Func) (uint8_t*, int32_t, uint8_t*, int3
typedef uint32_t (*PSampleSadHor8Func) (uint8_t*, int32_t, uint8_t*, int32_t, uint16_t*, int32_t*);
typedef void (*PMotionSearchFunc) (SWelsFuncPtrList* pFuncList, void* pCurDqLayer, void* pMe,
void* pSlice);
typedef void (*PSearchMethodFunc) (SWelsFuncPtrList* pFuncList, void* pMe, void* pSlice, const int32_t kiEncStride, const int32_t kiRefStride);
typedef void (*PCalculateSatdFunc) ( PSampleSadSatdCostFunc pSatd, void * vpMe, const int32_t kiEncStride, const int32_t kiRefStride );
typedef void (*PSearchMethodFunc) (SWelsFuncPtrList* pFuncList, void* pMe, void* pSlice, const int32_t kiEncStride,
const int32_t kiRefStride);
typedef void (*PCalculateSatdFunc) (PSampleSadSatdCostFunc pSatd, void* vpMe, const int32_t kiEncStride,
const int32_t kiRefStride);
typedef bool (*PCheckDirectionalMv) (PSampleSadSatdCostFunc pSad, void* vpMe,
const SMVUnitXY ksMinMv, const SMVUnitXY ksMaxMv, const int32_t kiEncStride, const int32_t kiRefStride,
int32_t& iBestSadCost);
@@ -155,7 +158,8 @@ typedef void (*PLineFullSearchFunc) ( SWelsFuncPtrList *pFuncList, SWelsME *pMe,
const int32_t kiEncStride, const int32_t kiRefStride,
const int32_t kiMinPos, const int32_t kiMaxPos,
const bool bVerticalSearch);
typedef void (*PCalculateBlockFeatureOfFrame)(uint8_t *pRef, const int32_t kiWidth, const int32_t kiHeight, const int32_t kiRefStride,
typedef void (*PCalculateBlockFeatureOfFrame) (uint8_t* pRef, const int32_t kiWidth, const int32_t kiHeight,
const int32_t kiRefStride,
uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[]);
typedef int32_t (*PCalculateSingleBlockFeature) (uint8_t* pRef, const int32_t kiRefStride);
typedef void (*PUpdateFMESwitch) (SDqLayer* pCurLayer);

View File

@@ -102,8 +102,7 @@ typedef struct {
bool bIdrPeriodFlag;
} SVAAFrameInfo;
typedef struct SVAAFrameInfoExt_t: public SVAAFrameInfo
{
typedef struct SVAAFrameInfoExt_t: public SVAAFrameInfo {
SComplexityAnalysisScreenParam sComplexityScreenParam;
SScrollDetectionResult sScrollDetectInfo;
//TOP3_BEST_REF_NO_TID
@@ -125,7 +124,8 @@ class CWelsPreProcess {
void FreeSpatialPictures (sWelsEncCtx* pCtx);
int32_t BuildSpatialPicList (sWelsEncCtx* pEncCtx, const SSourcePicture* kpSrcPic);
int32_t AnalyzeSpatialPic (sWelsEncCtx* pEncCtx, const int32_t kiDIdx);
int32_t UpdateSpatialPictures(sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* pParam, const int8_t iCurTid, const int32_t d_idx);
int32_t UpdateSpatialPictures (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* pParam, const int8_t iCurTid,
const int32_t d_idx);
int32_t GetRefCandidateLtrIndex (int32_t iRefIdx);
void AnalyzePictureComplexity (sWelsEncCtx* pCtx, SPicture* pCurPicture, SPicture* pRefPicture,
const int32_t kiDependencyId, const bool kbCalculateBGD);
@@ -161,9 +161,11 @@ class CWelsPreProcess {
void GetAvailableRefList (SPicture** pSrcPicList, uint8_t iCurTid, const int32_t iClosestLtrFrameNum,
SRefInfoParam* pAvailableRefList, int32_t& iAvailableRefNum, int32_t& iAvailableSceneRefNum);
void InitRefJudgement (SRefJudgement* pRefJudgement);
bool JudgeBestRef(SPicture* pRefPic,const SRefJudgement& sRefJudgement, const int32_t iFrameComplexity, const bool bIsClosestLtrFrame);
bool JudgeBestRef (SPicture* pRefPic, const SRefJudgement& sRefJudgement, const int32_t iFrameComplexity,
const bool bIsClosestLtrFrame);
void SaveBestRefToJudgement (const int32_t iRefPictureAvQP, const int32_t iComplexity, SRefJudgement* pRefJudgement);
void SaveBestRefToLocal(SRefInfoParam *pRefPicInfo,const SSceneChangeResult& sSceneChangeResult, SRefInfoParam* pRefSaved);
void SaveBestRefToLocal (SRefInfoParam* pRefPicInfo, const SSceneChangeResult& sSceneChangeResult,
SRefInfoParam* pRefSaved);
void SaveBestRefToVaa (SRefInfoParam& sRefSaved, SRefInfoParam* pVaaBestRef);
private:

View File

@@ -39,15 +39,19 @@ namespace WelsSVCEnc {
#ifdef X86_ASM
extern "C"
{
void TransposeMatrixBlocksx16_sse2( void *pDst, const int32_t kiDstStride, void *pSrc, const int32_t kiSrcStride, const int32_t kiBlocksNum );
void TransposeMatrixBlocksx16_sse2 (void* pDst, const int32_t kiDstStride, void* pSrc, const int32_t kiSrcStride,
const int32_t kiBlocksNum);
void TransposeMatrixBlock16x16_sse2 (void* pDst, const int32_t kiDstStride, void* pSrc, const int32_t kiSrcStride);
void TransposeMatrixBlocksx8_mmx( void *pDst, const int32_t kiDstStride, void *pSrc, const int32_t kiSrcStride, const int32_t kiBlocksNum );
void TransposeMatrixBlocksx8_mmx (void* pDst, const int32_t kiDstStride, void* pSrc, const int32_t kiSrcStride,
const int32_t kiBlocksNum);
void TransposeMatrixBlock8x8_mmx (void* pDst, const int32_t kiDstStride, void* pSrc, const int32_t kiSrcStride);
}
#endif
typedef void (*PTransposeMatrixBlockFunc)( void *pDst, const int32_t kiDstStride, void *pSrc, const int32_t kiSrcStride );
typedef void (*PTransposeMatrixBlocksFunc)( void *pDst, const int32_t kiDstStride, void *pSrc, const int32_t kiSrcStride, const int32_t kiBlocksNum );
typedef void (*PTransposeMatrixBlockFunc) (void* pDst, const int32_t kiDstStride, void* pSrc,
const int32_t kiSrcStride);
typedef void (*PTransposeMatrixBlocksFunc) (void* pDst, const int32_t kiDstStride, void* pSrc,
const int32_t kiSrcStride, const int32_t kiBlocksNum);
}// end of namespace declaration

View File

@@ -733,7 +733,8 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) {
pRefList = (SRefList*)pMa->WelsMallocz (sizeof (SRefList), "pRefList");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pRefList), FreeMemorySvc (ppCtx))
do {
pRefList->pRef[i] = AllocPicture (pMa, kiWidth, kiHeight, true, (iDlayerIndex == iDlayerCount-1)?kiNeedFeatureStorage:0); // to use actual size of current layer
pRefList->pRef[i] = AllocPicture (pMa, kiWidth, kiHeight, true,
(iDlayerIndex == iDlayerCount - 1) ? kiNeedFeatureStorage : 0); // to use actual size of current layer
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pRefList->pRef[i]), FreeMemorySvc (ppCtx))
++ i;
} while (i < 1 + iNumRef);
@@ -831,11 +832,12 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) {
}
//
if (kiNeedFeatureStorage && iDlayerIndex==iDlayerCount-1)
{
pDqLayer->pFeatureSearchPreparation = static_cast<SFeatureSearchPreparation*> (pMa->WelsMallocz (sizeof (SFeatureSearchPreparation), "pFeatureSearchPreparation"));
if (kiNeedFeatureStorage && iDlayerIndex == iDlayerCount - 1) {
pDqLayer->pFeatureSearchPreparation = static_cast<SFeatureSearchPreparation*> (pMa->WelsMallocz (sizeof (
SFeatureSearchPreparation), "pFeatureSearchPreparation"));
WELS_VERIFY_RETURN_PROC_IF (1, NULL == pDqLayer->pFeatureSearchPreparation, FreeMemorySvc (ppCtx));
int32_t iReturn = RequestFeatureSearchPreparation(pMa, pDlayer->iFrameWidth, pDlayer->iFrameHeight, kiNeedFeatureStorage,
int32_t iReturn = RequestFeatureSearchPreparation (pMa, pDlayer->iFrameWidth, pDlayer->iFrameHeight,
kiNeedFeatureStorage,
pDqLayer->pFeatureSearchPreparation);
WELS_VERIFY_RETURN_PROC_IF (1, ENC_RETURN_SUCCESS != iReturn, FreeMemorySvc (ppCtx));
} else {
@@ -2468,7 +2470,8 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) {
if (pFeatureSearchPreparation->bFMESwitchFlag
&& !pScreenBlockFeatureStorage->bRefBlockFeatureCalculated) {
//TODO: use ORIGIN of reference when preprocessing is ready
PerformFMEPreprocess( pFuncList, pCurLayer->pRefPic,pFeatureSearchPreparation->pFeatureOfBlock,pScreenBlockFeatureStorage);
PerformFMEPreprocess (pFuncList, pCurLayer->pRefPic, pFeatureSearchPreparation->pFeatureOfBlock,
pScreenBlockFeatureStorage);
}
//assign ME pointer
@@ -3012,7 +3015,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
DumpRef (pCtx);
#endif
if ((pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) && (pSvcParam->iRCMode != RC_OFF_MODE))
pCtx->pVpp->AnalyzePictureComplexity(pCtx,pCtx->pEncPic,((pCtx->eSliceType == P_SLICE)&&(pCtx->iNumRef0>0))?pCtx->pRefList0[0]:NULL,
pCtx->pVpp->AnalyzePictureComplexity (pCtx, pCtx->pEncPic, ((pCtx->eSliceType == P_SLICE)
&& (pCtx->iNumRef0 > 0)) ? pCtx->pRefList0[0] : NULL,
iCurDid, pSvcParam->bEnableBackgroundDetection);
WelsUpdateRefSyntax (pCtx, pCtx->iPOC,

View File

@@ -120,7 +120,8 @@ void WelsUnloadNalForSlice (SWelsSliceBs* pSliceBsIn) {
*/
//TODO 1: refactor the calling of this func in multi-thread
//TODO 2: complete the realloc&copy
int32_t WelsEncodeNal (SWelsNalRaw* pRawNal, void* pNalHeaderExt, const int32_t kiDstBufferLen, void* pDst, int32_t* pDstLen) {
int32_t WelsEncodeNal (SWelsNalRaw* pRawNal, void* pNalHeaderExt, const int32_t kiDstBufferLen, void* pDst,
int32_t* pDstLen) {
const bool kbNALExt = pRawNal->sNalExt.sNalHeader.eNalUnitType == NAL_UNIT_PREFIX
|| pRawNal->sNalExt.sNalHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_EXT;
int32_t iAssumedNeededLength = NAL_HEADER_SIZE + (kbNALExt ? 3 : 0) + pRawNal->iPayloadSize + 1;

View File

@@ -110,7 +110,8 @@ SPicture* AllocPicture (CMemoryAlign* pMa, const int32_t kiWidth , const int32_t
}
if (iNeedFeatureStorage) {
pPic->pScreenBlockFeatureStorage = static_cast<SScreenBlockFeatureStorage*> (pMa->WelsMallocz (sizeof (SScreenBlockFeatureStorage), "pScreenBlockFeatureStorage"));
pPic->pScreenBlockFeatureStorage = static_cast<SScreenBlockFeatureStorage*> (pMa->WelsMallocz (sizeof (
SScreenBlockFeatureStorage), "pScreenBlockFeatureStorage"));
int32_t iReturn = RequestScreenBlockFeatureStorage (pMa, kiWidth, kiHeight, iNeedFeatureStorage,
pPic->pScreenBlockFeatureStorage);
WELS_VERIFY_RETURN_PROC_IF (NULL, ENC_RETURN_SUCCESS != iReturn, FreePicture (pMa, &pPic));

View File

@@ -429,9 +429,7 @@ void RcCalculatePictureQp (sWelsEncCtx* pEncCtx) {
if (0 == pTOverRc->iPFrameNum) {
iLumaQp = pWelsSvcRc->iInitialQp;
}
else if (pWelsSvcRc->iCurrentBitsLevel==BITS_EXCEEDED)
{
} else if (pWelsSvcRc->iCurrentBitsLevel == BITS_EXCEEDED) {
iLumaQp = MAX_LOW_BR_QP;
//limit QP
int32_t iLastIdxCodecInVGop = pWelsSvcRc->iFrameCodedInVGop - 1;
@@ -459,8 +457,7 @@ void RcCalculatePictureQp (sWelsEncCtx* pEncCtx) {
pEncCtx->iGlobalQp = iLumaQp;
return;
}
else {
} else {
double dCmplxRatio = (double)pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity / pTOverRc->iFrameCmplxMean;
dCmplxRatio = WELS_CLIP3 (dCmplxRatio, 1.0 - FRAME_CMPLX_RATIO_RANGE, 1.0 + FRAME_CMPLX_RATIO_RANGE);
@@ -531,12 +528,9 @@ void RcDecideTargetBits (sWelsEncCtx* pEncCtx) {
} else {
pWelsSvcRc->iTargetBits = (int32_t) (pWelsSvcRc->iRemainingBits * pTOverRc->dTlayerWeight /
pWelsSvcRc->dRemainingWeights);
if ((pWelsSvcRc->iTargetBits <= 0) && (pEncCtx->pSvcParam->iRCMode == RC_LOW_BW_MODE))
{
if ((pWelsSvcRc->iTargetBits <= 0) && (pEncCtx->pSvcParam->iRCMode == RC_LOW_BW_MODE)) {
pWelsSvcRc->iCurrentBitsLevel = BITS_EXCEEDED;
}
else if ((pWelsSvcRc->iTargetBits <= pTOverRc->iMinBitsTl) && (pEncCtx->pSvcParam->iRCMode == RC_LOW_BW_MODE))
{
} else if ((pWelsSvcRc->iTargetBits <= pTOverRc->iMinBitsTl) && (pEncCtx->pSvcParam->iRCMode == RC_LOW_BW_MODE)) {
pWelsSvcRc->iCurrentBitsLevel = BITS_LIMITED;
}
pWelsSvcRc->iTargetBits = WELS_CLIP3 (pWelsSvcRc->iTargetBits, pTOverRc->iMinBitsTl, pTOverRc->iMaxBitsTl);

View File

@@ -691,7 +691,8 @@ static int32_t UpdateSrcPicList (sWelsEncCtx* pCtx) {
}
PrefetchNextBuffer (pCtx);
for (int32_t i = 0; i < MAX_REF_PIC_COUNT; ++i) {
if (NULL == pLongRefSrcList[i + 1] || (NULL != pLongRefList[i] && pLongRefList[i]->bUsedAsRef&& pLongRefList[i]->bIsLongRef)) {
if (NULL == pLongRefSrcList[i + 1] || (NULL != pLongRefList[i] && pLongRefList[i]->bUsedAsRef
&& pLongRefList[i]->bIsLongRef)) {
continue;
} else {
SetUnref (pLongRefSrcList[i + 1]);
@@ -772,7 +773,8 @@ bool WelsBuildRefListScreen (void* pEncCtx, const int32_t iPOC, int32_t iBestLtr
"WelsBuildRefListScreen(), ref !current iFrameNum = %d, ref iFrameNum = %d,LTR number = %d,iNumRef = %d ref is Scene LTR = %d\n",
pCtx->iFrameNum, pCtx->pRefList0[pCtx->iNumRef0 - 1]->iFrameNum, pRefList->uiLongRefCount, iNumRef,
pRefPic->bIsSceneLTR);
WelsLog (pCtx, WELS_LOG_INFO, "WelsBuildRefListScreen pCtx->uiTemporalId = %d,pRef->iFrameNum = %d,pRef->uiTemporalId = %d\n",
WelsLog (pCtx, WELS_LOG_INFO,
"WelsBuildRefListScreen pCtx->uiTemporalId = %d,pRef->iFrameNum = %d,pRef->uiTemporalId = %d\n",
pCtx->uiTemporalId, pRefPic->iFrameNum, pRefPic->uiTemporalId);
}
}

View File

@@ -132,7 +132,8 @@ void CalcSliceComplexRatio (void* pRatio, SSliceCtx* pSliceCtx, uint32_t* pSlice
while (iSliceIdx < kiSliceCount) {
fAvI[iSliceIdx] = 1.0f * pCountMbInSlice[iSliceIdx] / pSliceTime[iSliceIdx];
MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, "[MT] CalcSliceComplexRatio(), pSliceConsumeTime[%d]= %d us, slice_run= %d\n", iSliceIdx,
MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, "[MT] CalcSliceComplexRatio(), pSliceConsumeTime[%d]= %d us, slice_run= %d\n",
iSliceIdx,
pSliceTime[iSliceIdx], pCountMbInSlice[iSliceIdx]);
fSumAv += fAvI[iSliceIdx];
@@ -156,7 +157,8 @@ int32_t NeedDynamicAdjust (void* pConsumeTime, const int32_t iSliceNum) {
iSliceIdx += 2;
}
if (uiTotalConsume == 0) {
MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, "[MT] NeedDynamicAdjust(), herein do no adjust due first picture, iCountSliceNum= %d\n",
MT_TRACE_LOG (NULL, WELS_LOG_DEBUG,
"[MT] NeedDynamicAdjust(), herein do no adjust due first picture, iCountSliceNum= %d\n",
iSliceNum);
return false;
}
@@ -322,7 +324,8 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
while (iIdx < iNumSpatialLayers) {
SSliceConfig* pMso = &pPara->sDependencyLayers[iIdx].sSliceCfg;
const int32_t kiSliceNum = pMso->sSliceArgument.uiSliceNum;
if (((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE)||(pMso->uiSliceMode == SM_AUTO_SLICE)) && pPara->iMultipleThreadIdc > 1
if (((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pMso->uiSliceMode == SM_AUTO_SLICE))
&& pPara->iMultipleThreadIdc > 1
&& pPara->iMultipleThreadIdc >= kiSliceNum) {
pSmt->pSliceConsumeTime[iIdx] = (uint32_t*)pMa->WelsMallocz (kiSliceNum * sizeof (uint32_t), "pSliceConsumeTime[]");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceConsumeTime[iIdx]), FreeMemorySvc (ppCtx))
@@ -371,7 +374,8 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno);
WelsSnprintf (name, SEM_NAME_MAX, "fu%d%s", iIdx, pSmt->eventNamespace);
err = WelsEventOpen (&pSmt->pFinUpdateMbListEvent[iIdx], name);
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno);
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err,
errno);
WelsSnprintf (name, SEM_NAME_MAX, "sc%d%s", iIdx, pSmt->eventNamespace);
err = WelsEventOpen (&pSmt->pSliceCodedEvent[iIdx], name);
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno);
@@ -418,7 +422,8 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
iReturn = WelsMutexInit (& (*ppCtx)->mutexEncoderError);
WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "RequestMtResource(), iThreadNum=%d, iCountSliceNum= %d\n", pPara->iCountThreadsNum,
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "RequestMtResource(), iThreadNum=%d, iCountSliceNum= %d\n",
pPara->iCountThreadsNum,
iMaxSliceNum);
return 0;
@@ -595,7 +600,8 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32
return iLayerSize;
}
int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFrameBsBuffer, const int32_t iSliceIdx, int32_t& iSliceSize) {
int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFrameBsBuffer, const int32_t iSliceIdx,
int32_t& iSliceSize) {
SWelsSliceBs* pSliceBs = &pCtx->pSliceBs[iSliceIdx];
SNalUnitHeaderExt* pNalHdrExt = &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt;
uint8_t* pDst = pFrameBsBuffer;
@@ -610,7 +616,8 @@ int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFr
while (iNalIdx < kiNalCnt) {
iNalSize = 0;
iReturn = WelsEncodeNal (&pSliceBs->sNalList[iNalIdx], pNalHdrExt, pCtx->iFrameBsSize-kiWrittenLength-iSliceSize, pDst, &iNalSize);
iReturn = WelsEncodeNal (&pSliceBs->sNalList[iNalIdx], pNalHdrExt, pCtx->iFrameBsSize - kiWrittenLength - iSliceSize,
pDst, &iNalSize);
WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
iSliceSize += iNalSize;
pDst += iNalSize;
@@ -653,7 +660,8 @@ int32_t WriteSliceBs (sWelsEncCtx* pCtx, uint8_t* pSliceBsBuf, const int32_t iSl
while (iNalIdx < kiNalCnt) {
iNalSize = 0;
iReturn = WelsEncodeNal (&pSliceBs->sNalList[iNalIdx], pNalHdrExt, pSliceBs->uiSize-kiWrittenLength-iSliceSize, pDst, &iNalSize);
iReturn = WelsEncodeNal (&pSliceBs->sNalList[iNalIdx], pNalHdrExt, pSliceBs->uiSize - kiWrittenLength - iSliceSize,
pDst, &iNalSize);
WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
pNalLen[iNalIdx] = iNalSize;
iSliceSize += iNalSize;
@@ -702,7 +710,8 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
"[MT] CodingSliceThreadProc(), try to call WelsMultipleEventsWaitSingleBlocking(pEventsList= %p %p %p), pEncPEncCtx= %p!\n",
pEventsList[0], pEventsList[1], pEventsList[1], (void*)pEncPEncCtx);
iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount,
&pEventsList[0], &pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled
&pEventsList[0],
&pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled
if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited
SLayerBSInfo* pLbi = pPrivateData->pLayerBs;
const int32_t kiCurDid = pEncPEncCtx->uiDependencyId;
@@ -722,7 +731,8 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx];
pSliceBs = &pEncPEncCtx->pSliceBs[iSliceIdx];
bDsaFlag = (((pParamD->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)||(pParamD->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) &&
bDsaFlag = (((pParamD->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
|| (pParamD->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) &&
pCodingParam->iMultipleThreadIdc > 1 &&
pCodingParam->iMultipleThreadIdc >= pParamD->sSliceCfg.sSliceArgument.uiSliceNum);
if (bDsaFlag)
@@ -767,8 +777,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
break;
}
pEncPEncCtx->iPosBsBuffer += iSliceSize;
} else
{
} else {
iReturn = WriteSliceBs (pEncPEncCtx, pSliceBs->pBs, iSliceIdx, iSliceSize);
if (ENC_RETURN_SUCCESS != iReturn) {
uiThrdRet = iReturn;
@@ -869,14 +878,14 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
if (0 == kiPartitionId) {
if (0 == iSliceIdx)
pLbi->pBsBuf = pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer;
iReturn = WriteSliceToFrameBs (pEncPEncCtx, pLbi, pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer, iSliceIdx, iSliceSize);
iReturn = WriteSliceToFrameBs (pEncPEncCtx, pLbi, pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer, iSliceIdx,
iSliceSize);
if (ENC_RETURN_SUCCESS != iReturn) {
uiThrdRet = iReturn;
break;
}
pEncPEncCtx->iPosBsBuffer += iSliceSize;
} else
{
} else {
iSliceSize = WriteSliceBs (pEncPEncCtx, pSliceBs->pBs, iSliceIdx, iSliceSize);
if (ENC_RETURN_SUCCESS != iReturn) {
uiThrdRet = iReturn;
@@ -918,20 +927,17 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice
WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent);
}
}
else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal
} else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal
uiThrdRet = 0;
break;
}
else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 2 == iWaitRet) { // update pMb list singal
} else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 2 == iWaitRet) { // update pMb list singal
iSliceIdx =
iEventIdx; // pPrivateData->iSliceIndex; old threads can not be terminated, pPrivateData is not correct for applicable
pCurDq = pEncPEncCtx->pCurDqLayer;
UpdateMbListNeighborParallel (pCurDq->pSliceEncCtx, pCurDq->sMbDataP, iSliceIdx);
WelsEventSignal (
&pEncPEncCtx->pSliceThreading->pFinUpdateMbListEvent[iEventIdx]); // mean finished update pMb list for this pSlice
}
else { // WELS_THREAD_ERROR_WAIT_TIMEOUT, or WELS_THREAD_ERROR_WAIT_FAILED
} else { // WELS_THREAD_ERROR_WAIT_TIMEOUT, or WELS_THREAD_ERROR_WAIT_FAILED
WelsLog (pEncPEncCtx, WELS_LOG_WARNING,
"[MT] CodingSliceThreadProc(), waiting pReadySliceCodingEvent[%d] failed(%d) and thread%d terminated!\n", iEventIdx,
iWaitRet, iThreadIdx);
@@ -962,9 +968,9 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) {
return 0;
}
int32_t FiredSliceThreads (SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList, WELS_EVENT* pMasterEventsList, SLayerBSInfo* pLbi,
const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const bool bIsDynamicSlicingMode)
{
int32_t FiredSliceThreads (SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList, WELS_EVENT* pMasterEventsList,
SLayerBSInfo* pLbi,
const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const bool bIsDynamicSlicingMode) {
int32_t iEndMbIdx = 0;
int32_t iIdx = 0;
const int32_t kiEventCnt = uiNumThreads;

View File

@@ -358,7 +358,8 @@ void WelsMdInterInit (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb, const i
ST32 (&pCurMb->sP16x16Mv, 0);
ST32 (&pCurLayer->pDecPic->sMvList[kiMbXY], 0);
SetMvWithinIntegerMvRange( kiMbWidth, kiMbHeight, kiMbX, kiMbY, CAMERA_STARTMV_RANGE, &(pSlice->sMvStartMin), &(pSlice->sMvStartMax));
SetMvWithinIntegerMvRange (kiMbWidth, kiMbHeight, kiMbX, kiMbY, CAMERA_STARTMV_RANGE, & (pSlice->sMvStartMin),
& (pSlice->sMvStartMax));
}
int32_t WelsMdI16x16 (SWelsFuncPtrList* pFunc, SDqLayer* pCurDqLayer, SMbCache* pMbCache, int32_t iLambda) {
@@ -970,8 +971,7 @@ void WelsMdIntraMb (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb, SMbCach
}
static inline void InitMe (const SWelsMD& sWelsMd, const int32_t iBlockSize, uint8_t* pEnc, uint8_t* pRef,
SWelsME& sWelsMe )
{
SWelsME& sWelsMe) {
sWelsMe.iCurMeBlockPixX = sWelsMd.iMbPixX;
sWelsMe.iCurMeBlockPixY = sWelsMd.iMbPixY;
sWelsMe.uiBlockSize = iBlockSize;

View File

@@ -693,7 +693,8 @@ int32_t WelsCodeOneSlice (sWelsEncCtx* pEncCtx, const int32_t kiSliceIdx, const
SNalUnitHeaderExt* pNalHeadExt = &pCurLayer->sLayerInfo.sNalHeaderExt;
SSlice* pCurSlice = &pCurLayer->sLayerInfo.pSliceInLayer[kiSliceIdx];
SBitStringAux* pBs = pCurSlice->pSliceBsa;
const int32_t kiDynamicSliceFlag = (pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId].sSliceCfg.uiSliceMode ==
const int32_t kiDynamicSliceFlag = (pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId].sSliceCfg.uiSliceMode
==
SM_DYN_SLICE);
assert (kiSliceIdx == pCurSlice->uiSliceIdx);
@@ -903,8 +904,8 @@ bool DynSlcJudgeSliceBoundaryStepBack (void* pCtx, void* pSlice, SSliceCtx* pSli
///////////////
// pMb loop
///////////////
inline void WelsInitInterMDStruc(const SMB* pCurMb, uint16_t *pMvdCostTableInter, const int32_t kiMvdInterTableStride, SWelsMD* pMd )
{
inline void WelsInitInterMDStruc (const SMB* pCurMb, uint16_t* pMvdCostTableInter, const int32_t kiMvdInterTableStride,
SWelsMD* pMd) {
pMd->iLambda = g_kiQpCostTable[pCurMb->uiLumaQp];
pMd->pMvdCost = &pMvdCostTableInter[pCurMb->uiLumaQp * kiMvdInterTableStride];
pMd-> iMbPixX = (pCurMb->iMbX << 4);

View File

@@ -166,7 +166,8 @@ bool WelsMdInterJudgeScrollingPskip(void* pEncCtx, void* pWelsMd, SSlice* slice,
//TBD
return false;
}
bool WelsMdInterJudgeScrollingPskipFalse(void* pEncCtx, void* pWelsMd, SSlice* slice, SMB* pCurMb, SMbCache* pMbCache) {
bool WelsMdInterJudgeScrollingPskipFalse (void* pEncCtx, void* pWelsMd, SSlice* slice, SMB* pCurMb,
SMbCache* pMbCache) {
return false;
}

View File

@@ -57,7 +57,8 @@ const int32_t QStepx16ByQp[52] = { /* save QStep<<4 for int32_t */
2560, 2816, 3328, 3584 /* 48~51 */
};
static inline void UpdateMeResults( const SMVUnitXY ksBestMv, const uint32_t kiBestSadCost, uint8_t* pRef, SWelsME * pMe ) {
static inline void UpdateMeResults (const SMVUnitXY ksBestMv, const uint32_t kiBestSadCost, uint8_t* pRef,
SWelsME* pMe) {
pMe->sMv = ksBestMv;
pMe->pRefMb = pRef;
pMe->uiSadCost = kiBestSadCost;
@@ -124,7 +125,8 @@ void WelsMotionEstimateSearch (SWelsFuncPtrList* pFuncList, void* pLplayer, void
MeEndIntepelSearch (pMe);
}
pFuncList->pfCalculateSatd( pFuncList->sSampleDealingFuncs.pfSampleSatd[pMe->uiBlockSize], pMe, kiStrideEnc, kiStrideRef );
pFuncList->pfCalculateSatd (pFuncList->sSampleDealingFuncs.pfSampleSatd[pMe->uiBlockSize], pMe, kiStrideEnc,
kiStrideRef);
}
/*!
@@ -327,8 +329,7 @@ bool CheckDirectionalMvFalse(PSampleSadSatdCostFunc pSad, void * vpMe,
// Cross Search Basics
/////////////////////////
#if defined (X86_ASM)
void CalcMvdCostx8_c( uint16_t *pMvdCost, const int32_t kiStartMv, uint16_t* pMvdTable, const uint16_t kiFixedCost )
{
void CalcMvdCostx8_c (uint16_t* pMvdCost, const int32_t kiStartMv, uint16_t* pMvdTable, const uint16_t kiFixedCost) {
uint16_t* pBaseCost = pMvdCost;
const int32_t kiOffset = (kiStartMv << 2);
uint16_t* pMvd = pMvdTable + kiOffset;
@@ -349,8 +350,10 @@ void VerticalFullSearchUsingSSE41( SWelsFuncPtrList *pFuncList, SWelsME *pMe,
const int32_t kiEdgeBlocks = kIsBlock16x16 ? 16 : 8;
PSampleSadHor8Func pSampleSadHor8 = pFuncList->pfSampleSadHor8[kIsBlock16x16];
PSampleSadSatdCostFunc pSad = pFuncList->sSampleDealingFuncs.pfSampleSad[pMe->uiBlockSize];
PTransposeMatrixBlockFunc TransposeMatrixBlock = kIsBlock16x16 ? TransposeMatrixBlock16x16_sse2 : TransposeMatrixBlock8x8_mmx;
PTransposeMatrixBlocksFunc TransposeMatrixBlocks= kIsBlock16x16 ? TransposeMatrixBlocksx16_sse2 : TransposeMatrixBlocksx8_mmx;
PTransposeMatrixBlockFunc TransposeMatrixBlock = kIsBlock16x16 ? TransposeMatrixBlock16x16_sse2 :
TransposeMatrixBlock8x8_mmx;
PTransposeMatrixBlocksFunc TransposeMatrixBlocks = kIsBlock16x16 ? TransposeMatrixBlocksx16_sse2 :
TransposeMatrixBlocksx8_mmx;
const int32_t kiDiff = kiMaxPos - kiMinPos;
const int32_t kiRowNum = WELS_ALIGN ((kiDiff - kiEdgeBlocks + 1), kiEdgeBlocks);
@@ -410,8 +413,7 @@ void HorizontalFullSearchUsingSSE41( SWelsFuncPtrList *pFuncList, SWelsME *pMe,
uint16_t* pMvdTable, const int32_t kiFixedMvd,
const int32_t kiEncStride, const int32_t kiRefStride,
const int32_t kiMinPos, const int32_t kiMaxPos,
const bool bVerticalSearch )
{
const bool bVerticalSearch) {
uint8_t* kpEncMb = pMe->pEncMb;
const int32_t kiCurMeBlockPix = pMe->iCurMeBlockPixX;
uint8_t* pRef = &pMe->pColoRefMb[kiMinPos - kiCurMeBlockPix];
@@ -525,7 +527,8 @@ void WelsMotionCrossSearch(SWelsFuncPtrList *pFuncList, SWelsME * pMe,
// Feature Search Basics
/////////////////////////
//memory related
int32_t RequestFeatureSearchPreparation( CMemoryAlign *pMa, const int32_t kiFrameWidth, const int32_t kiFrameHeight, const int32_t iNeedFeatureStorage,
int32_t RequestFeatureSearchPreparation (CMemoryAlign* pMa, const int32_t kiFrameWidth, const int32_t kiFrameHeight,
const int32_t iNeedFeatureStorage,
SFeatureSearchPreparation* pFeatureSearchPreparation) {
const int32_t kiFeatureStrategyIndex = iNeedFeatureStorage >> 16;
const bool bFme8x8 = ((iNeedFeatureStorage & 0x0000FF & ME_FME) == ME_FME);
@@ -559,7 +562,8 @@ int32_t ReleaseFeatureSearchPreparation( CMemoryAlign *pMa, uint16_t*& pFeatureO
return ENC_RETURN_UNEXPECTED;
}
int32_t RequestScreenBlockFeatureStorage( CMemoryAlign *pMa, const int32_t kiFrameWidth, const int32_t kiFrameHeight, const int32_t iNeedFeatureStorage,
int32_t RequestScreenBlockFeatureStorage (CMemoryAlign* pMa, const int32_t kiFrameWidth, const int32_t kiFrameHeight,
const int32_t iNeedFeatureStorage,
SScreenBlockFeatureStorage* pScreenBlockFeatureStorage) {
const int32_t kiFeatureStrategyIndex = iNeedFeatureStorage >> 16;
@@ -573,15 +577,19 @@ int32_t RequestScreenBlockFeatureStorage( CMemoryAlign *pMa, const int32_t kiFra
const bool bIsBlock8x8 = (kiMe8x8FME == ME_FME);
const int32_t kiMarginSize = bIsBlock8x8 ? 8 : 16;
const int32_t kiFrameSize = (kiFrameWidth - kiMarginSize) * (kiFrameHeight - kiMarginSize);
const int32_t kiListSize = (0==kiFeatureStrategyIndex)?(bIsBlock8x8 ? LIST_SIZE_SUM_8x8 : LIST_SIZE_SUM_16x16):256;
const int32_t kiListSize = (0 == kiFeatureStrategyIndex) ? (bIsBlock8x8 ? LIST_SIZE_SUM_8x8 : LIST_SIZE_SUM_16x16) :
256;
pScreenBlockFeatureStorage->pTimesOfFeatureValue = (uint32_t*)pMa->WelsMalloc(kiListSize*sizeof(uint32_t),"pScreenBlockFeatureStorage->pTimesOfFeatureValue");
pScreenBlockFeatureStorage->pTimesOfFeatureValue = (uint32_t*)pMa->WelsMalloc (kiListSize * sizeof (uint32_t),
"pScreenBlockFeatureStorage->pTimesOfFeatureValue");
WELS_VERIFY_RETURN_IF (ENC_RETURN_MEMALLOCERR, NULL == pScreenBlockFeatureStorage->pTimesOfFeatureValue)
pScreenBlockFeatureStorage->pLocationOfFeature = (uint16_t**)pMa->WelsMalloc(kiListSize*sizeof(uint16_t*),"pScreenBlockFeatureStorage->pLocationOfFeature");
pScreenBlockFeatureStorage->pLocationOfFeature = (uint16_t**)pMa->WelsMalloc (kiListSize * sizeof (uint16_t*),
"pScreenBlockFeatureStorage->pLocationOfFeature");
WELS_VERIFY_RETURN_IF (ENC_RETURN_MEMALLOCERR, NULL == pScreenBlockFeatureStorage->pLocationOfFeature)
pScreenBlockFeatureStorage->pLocationPointer = (uint16_t*)pMa->WelsMalloc(2*kiFrameSize*sizeof(uint16_t), "pScreenBlockFeatureStorage->pLocationPointer");
pScreenBlockFeatureStorage->pLocationPointer = (uint16_t*)pMa->WelsMalloc (2 * kiFrameSize * sizeof (uint16_t),
"pScreenBlockFeatureStorage->pLocationPointer");
WELS_VERIFY_RETURN_IF (ENC_RETURN_MEMALLOCERR, NULL == pScreenBlockFeatureStorage->pLocationPointer)
pScreenBlockFeatureStorage->pFeatureOfBlockPointer = NULL;
@@ -637,9 +645,9 @@ int32_t SumOf16x16SingleBlock_c(uint8_t* pRef, const int32_t kiRefStride) {
return iSum;
}
void SumOf8x8BlockOfFrame_c(uint8_t *pRefPicture, const int32_t kiWidth, const int32_t kiHeight, const int32_t kiRefStride,
uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[])
{
void SumOf8x8BlockOfFrame_c (uint8_t* pRefPicture, const int32_t kiWidth, const int32_t kiHeight,
const int32_t kiRefStride,
uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[]) {
int32_t x, y;
uint8_t* pRef;
uint16_t* pBuffer;
@@ -656,9 +664,10 @@ void SumOf8x8BlockOfFrame_c(uint8_t *pRefPicture, const int32_t kiWidth, const i
}
}
void SumOf16x16BlockOfFrame_c(uint8_t *pRefPicture, const int32_t kiWidth, const int32_t kiHeight, const int32_t kiRefStride,
uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[])
{//TODO: this is similar to SumOf8x8BlockOfFrame_c expect the calling of single block func, refactor-able?
void SumOf16x16BlockOfFrame_c (uint8_t* pRefPicture, const int32_t kiWidth, const int32_t kiHeight,
const int32_t kiRefStride,
uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[]) {
//TODO: this is similar to SumOf8x8BlockOfFrame_c expect the calling of single block func, refactor-able?
int32_t x, y;
uint8_t* pRef;
uint16_t* pBuffer;
@@ -718,7 +727,8 @@ void CalculateFeatureOfBlock( SWelsFuncPtrList *pFunc, SPicture* pRef,
uint16_t* pFeatureValuePointerList[WELS_MAX (LIST_SIZE_SUM_16x16, LIST_SIZE_MSE_16x16)] = {0};
memset (pTimesOfFeatureValue, 0, sizeof (int32_t)*kiActualListSize);
(pFunc->pfCalculateBlockFeatureOfFrame[iIs16x16])(pRefData,iWidth, kiHeight, iRefStride, pFeatureOfBlock, pTimesOfFeatureValue);
(pFunc->pfCalculateBlockFeatureOfFrame[iIs16x16]) (pRefData, iWidth, kiHeight, iRefStride, pFeatureOfBlock,
pTimesOfFeatureValue);
//assign pLocationOfFeature pointer
InitializeHashforFeature_c (pTimesOfFeatureValue, pBuf, kiActualListSize,
@@ -729,8 +739,7 @@ void CalculateFeatureOfBlock( SWelsFuncPtrList *pFunc, SPicture* pRef,
}
void PerformFMEPreprocess (SWelsFuncPtrList* pFunc, SPicture* pRef, uint16_t* pFeatureOfBlock,
SScreenBlockFeatureStorage* pScreenBlockFeatureStorage)
{
SScreenBlockFeatureStorage* pScreenBlockFeatureStorage) {
pScreenBlockFeatureStorage->pFeatureOfBlockPointer = pFeatureOfBlock;
CalculateFeatureOfBlock (pFunc, pRef, pScreenBlockFeatureStorage);
pScreenBlockFeatureStorage->bRefBlockFeatureCalculated = true;
@@ -750,7 +759,8 @@ void SetFeatureSearchIn( SWelsFuncPtrList *pFunc, const SWelsME& sMe,
const int32_t kiEncStride, const int32_t kiRefStride,
SFeatureSearchIn* pFeatureSearchIn) {
pFeatureSearchIn->pSad = pFunc->sSampleDealingFuncs.pfSampleSad[sMe.uiBlockSize];
pFeatureSearchIn->iFeatureOfCurrent=pFunc->pfCalculateSingleBlockFeature[BLOCK_16x16==sMe.uiBlockSize](sMe.pEncMb, kiEncStride);
pFeatureSearchIn->iFeatureOfCurrent = pFunc->pfCalculateSingleBlockFeature[BLOCK_16x16 == sMe.uiBlockSize] (sMe.pEncMb,
kiEncStride);
pFeatureSearchIn->pEnc = sMe.pEncMb;
pFeatureSearchIn->pColoRef = sMe.pColoRefMb;
@@ -773,13 +783,15 @@ void SetFeatureSearchIn( SWelsFuncPtrList *pFunc, const SWelsME& sMe,
pFeatureSearchIn->iMaxQpelX = pFeatureSearchIn->iCurPixXQpel + ((pSlice->sMvStartMax.iMvX) << 2);
pFeatureSearchIn->iMaxQpelY = pFeatureSearchIn->iCurPixYQpel + ((pSlice->sMvStartMax.iMvY) << 2);
}
void SaveFeatureSearchOut( const SMVUnitXY sBestMv, const uint32_t uiBestSadCost, uint8_t* pRef, SFeatureSearchOut* pFeatureSearchOut) {
void SaveFeatureSearchOut (const SMVUnitXY sBestMv, const uint32_t uiBestSadCost, uint8_t* pRef,
SFeatureSearchOut* pFeatureSearchOut) {
pFeatureSearchOut->sBestMv = sBestMv;
pFeatureSearchOut->uiBestSadCost = uiBestSadCost;
pFeatureSearchOut->pBestRef = pRef;
}
bool FeatureSearchOne( SFeatureSearchIn &sFeatureSearchIn, const int32_t iFeatureDifference, const uint32_t kuiExpectedSearchTimes,
bool FeatureSearchOne (SFeatureSearchIn& sFeatureSearchIn, const int32_t iFeatureDifference,
const uint32_t kuiExpectedSearchTimes,
SFeatureSearchOut* pFeatureSearchOut) {
const int32_t iFeatureOfRef = (sFeatureSearchIn.iFeatureOfCurrent + iFeatureDifference);
if (iFeatureOfRef < 0 || iFeatureOfRef >= LIST_SIZE)
@@ -905,7 +917,8 @@ void UpdateFMESwitchNull(SDqLayer* pCurLayer) {
/////////////////////////
// Search function options
/////////////////////////
void WelsDiamondCrossSearch(SWelsFuncPtrList *pFunc, void* vpMe, void* vpSlice, const int32_t kiEncStride, const int32_t kiRefStride) {
void WelsDiamondCrossSearch (SWelsFuncPtrList* pFunc, void* vpMe, void* vpSlice, const int32_t kiEncStride,
const int32_t kiRefStride) {
SWelsME* pMe = static_cast<SWelsME*> (vpMe);
SSlice* pSlice = static_cast<SSlice*> (vpSlice);
@@ -919,7 +932,8 @@ void WelsDiamondCrossSearch(SWelsFuncPtrList *pFunc, void* vpMe, void* vpSlice,
WelsMotionCrossSearch (pFunc, pMe, pSlice, kiEncStride, kiRefStride);
}
}
void WelsDiamondCrossFeatureSearch(SWelsFuncPtrList *pFunc, void* vpMe, void* vpSlice, const int32_t kiEncStride, const int32_t kiRefStride) {
void WelsDiamondCrossFeatureSearch (SWelsFuncPtrList* pFunc, void* vpMe, void* vpSlice, const int32_t kiEncStride,
const int32_t kiRefStride) {
SWelsME* pMe = static_cast<SWelsME*> (vpMe);
SSlice* pSlice = static_cast<SSlice*> (vpSlice);

View File

@@ -208,8 +208,7 @@ void WelsSpatialWriteSubMbPred (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurM
}
}
int32_t CheckBitstreamBuffer(const uint8_t kuiSliceIdx, sWelsEncCtx* pEncCtx, SBitStringAux* pBs)
{
int32_t CheckBitstreamBuffer (const uint8_t kuiSliceIdx, sWelsEncCtx* pEncCtx, SBitStringAux* pBs) {
const int32_t iLeftLength = pBs->pBufEnd - pBs->pBufPtr - 1;
assert (iLeftLength > 0);

View File

@@ -1047,7 +1047,8 @@ ESceneChangeIdc CWelsPreProcess::DetectSceneChangeScreen (sWelsEncCtx* pCtx, SPi
iVaaFrameSceneChangeIdc = SIMILAR_SCENE;
}
WelsLog(pCtx,WELS_LOG_INFO,"iVaaFrameSceneChangeIdc = %d,codingIdx = %d\n",iVaaFrameSceneChangeIdc,pCtx->iCodingIndex);
WelsLog (pCtx, WELS_LOG_INFO, "iVaaFrameSceneChangeIdc = %d,codingIdx = %d\n", iVaaFrameSceneChangeIdc,
pCtx->iCodingIndex);
SaveBestRefToVaa (sLtrSaved, & (pVaaExt->sVaaStrBestRefCandidate[0]));

View File

@@ -443,8 +443,7 @@ int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFr
if (kiEncoderReturn == ENC_RETURN_MEMALLOCERR) {
WelsUninitEncoderExt (&m_pEncContext);
return cmMallocMemeError;
}
else if((kiEncoderReturn != ENC_RETURN_SUCCESS)&&(kiEncoderReturn == ENC_RETURN_CORRECTED)){
} else if ((kiEncoderReturn != ENC_RETURN_SUCCESS) && (kiEncoderReturn == ENC_RETURN_CORRECTED)) {
WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from EncodeFrameInternal()!\n", kiEncoderReturn);
return cmUnkonwReason;
}
@@ -709,7 +708,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
m_uiCountFrameNum, m_iCspInternal, iValue);
#endif//REC_FRAME_COUNT
if (iBitrate <= 0) {
WelsLog (m_pEncContext, WELS_LOG_ERROR,"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iBitrate = %d\n",iBitrate);
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iBitrate = %d\n",
iBitrate);
return cmInitParaError;
}
iBitrate = WELS_CLIP3 (iBitrate, MIN_BIT_RATE, MAX_BIT_RATE);
@@ -730,7 +730,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
m_pEncContext->pSvcParam->sSpatialLayers[3].iSpatialBitrate = iBitrate;
break;
default:
WelsLog (m_pEncContext, WELS_LOG_ERROR,"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iLayer = %d\n",pInfo->iLayer);
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iLayer = %d\n",
pInfo->iLayer);
return cmInitParaError;
break;
}
@@ -748,7 +749,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
m_uiCountFrameNum, m_iCspInternal, iValue);
#endif//REC_FRAME_COUNT
if (iBitrate <= 0) {
WelsLog (m_pEncContext, WELS_LOG_ERROR,"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iBitrate = %d\n",iBitrate);
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iBitrate = %d\n",
iBitrate);
return cmInitParaError;
}
iBitrate = WELS_CLIP3 (iBitrate, MIN_BIT_RATE, MAX_BIT_RATE);
@@ -769,7 +771,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
m_pEncContext->pSvcParam->sSpatialLayers[3].iMaxSpatialBitrate = iBitrate;
break;
default:
WelsLog (m_pEncContext, WELS_LOG_ERROR,"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iLayer = %d\n",pInfo->iLayer);
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iLayer = %d\n",
pInfo->iLayer);
return cmInitParaError;
break;
}
@@ -842,7 +845,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
#ifdef ENABLE_FRAME_DUMP
if (m_pEncContext->pSvcParam != NULL) {
SDumpLayer* pDump = (static_cast<SDumpLayer*> (pOption));
WelsStrncpy(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName, sizeof(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName),pDump->pFileName);
WelsStrncpy (m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName,
sizeof (m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName), pDump->pFileName);
}
#endif
}
@@ -928,7 +932,8 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) {
m_uiCountFrameNum, m_iCspInternal);
#endif//REC_FRAME_COUNT
SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
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))
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))
return cmInitParaError;
if (pInfo->iLayer == SPATIAL_LAYER_ALL) {
pInfo->iBitrate = m_pEncContext->pSvcParam->iTargetBitrate;
@@ -939,11 +944,13 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) {
break;
case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate
#ifdef REC_FRAME_COUNT
WelsLog (m_pEncContext, WELS_LOG_INFO,"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_MAX_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n",
WelsLog (m_pEncContext, WELS_LOG_INFO,
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_MAX_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n",
m_uiCountFrameNum, m_iCspInternal);
#endif//REC_FRAME_COUNT
SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
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))
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))
return cmInitParaError;
if (pInfo->iLayer == SPATIAL_LAYER_ALL) {
pInfo->iBitrate = m_pEncContext->pSvcParam->iMaxBitrate;

View File

@@ -216,8 +216,7 @@ typedef enum {
GOM_VAR = -2
} EComplexityAnalysisMode;
typedef struct
{
typedef struct {
int iScrollMvX;
int iScrollMvY;
bool bScrollDetectFlag; // 0:false ; 1:ltr; 2: scene change
@@ -235,8 +234,7 @@ typedef struct {
SVAACalcResult* pCalcResult;
} SComplexityAnalysisParam;
typedef struct
{
typedef struct {
int iMbRowInGom;
int* pGomComplexity;
int iGomNumInFrame;

View File

@@ -82,8 +82,7 @@ class CComplexityAnalysis : public IStrategy {
//for screen content
class CComplexityAnalysisScreen : public IStrategy
{
class CComplexityAnalysisScreen : public IStrategy {
public:
CComplexityAnalysisScreen (int32_t cpu_flag);
~CComplexityAnalysisScreen();

View File

@@ -112,7 +112,8 @@ HalveDownsampleFunc DyadicBilinearDownsamplerWidthx32_neon;
GeneralDownsampleFunc GeneralBilinearAccurateDownsamplerWrap_neon;
void GeneralBilinearAccurateDownsampler_neon( uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, const int32_t kiDstHeight,
void GeneralBilinearAccurateDownsampler_neon (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth,
const int32_t kiDstHeight,
uint8_t* pSrc, const int32_t kiSrcStride, const uint32_t kuiScaleX, const uint32_t kuiScaleY);
WELSVP_EXTERN_C_END

View File

@@ -230,13 +230,15 @@ void GeneralBilinearAccurateDownsampler_c (uint8_t* pDst, const int32_t kiDstStr
#endif //X86_ASM
#ifdef HAVE_NEON
void GeneralBilinearAccurateDownsamplerWrap_neon(uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, const int32_t kiDstHeight,
void GeneralBilinearAccurateDownsamplerWrap_neon (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth,
const int32_t kiDstHeight,
uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) {
const int32_t kiScaleBit = 15;
const uint32_t kuiScale = (1 << kiScaleBit);
uint32_t uiScalex = (uint32_t) ((float)kiSrcWidth / (float)kiDstWidth * kuiScale);
uint32_t uiScaley = (uint32_t) ((float)kiSrcHeight / (float)kiDstHeight * kuiScale);
GeneralBilinearAccurateDownsampler_neon(pDst, kiDstStride, kiDstWidth, kiDstHeight, pSrc, kiSrcStride, uiScalex, uiScaley);
GeneralBilinearAccurateDownsampler_neon (pDst, kiDstStride, kiDstWidth, kiDstHeight, pSrc, kiSrcStride, uiScalex,
uiScaley);
}
#endif
WELSVP_NAMESPACE_END

View File

@@ -83,7 +83,8 @@ protected:
class CSceneChangeDetectorScreen : public CSceneChangeDetectorVideo {
public:
CSceneChangeDetectorScreen(SSceneChangeResult & sParam, int32_t iCpuFlag) : CSceneChangeDetectorVideo(sParam, iCpuFlag) {
CSceneChangeDetectorScreen (SSceneChangeResult& sParam, int32_t iCpuFlag) : CSceneChangeDetectorVideo (sParam,
iCpuFlag) {
}
virtual ~CSceneChangeDetectorScreen() {
}
@@ -117,8 +118,10 @@ class CSceneChangeDetection : public IStrategy {
int32_t iBlock8x8Width = iWidth >> 3;
int32_t iBlock8x8Height = iHeight >> 3;
int32_t iBlock8x8Num = iBlock8x8Width * iBlock8x8Height;
int32_t iSceneChangeThresholdLarge = WelsStaticCast (int32_t, SCENE_CHANGE_MOTION_RATIO_LARGE * iBlock8x8Num + 0.5f + PESN);
int32_t iSceneChangeThresholdMedium = WelsStaticCast(int32_t, SCENE_CHANGE_MOTION_RATIO_MEDIUM * iBlock8x8Num + 0.5f + PESN);
int32_t iSceneChangeThresholdLarge = WelsStaticCast (int32_t,
SCENE_CHANGE_MOTION_RATIO_LARGE * iBlock8x8Num + 0.5f + PESN);
int32_t iSceneChangeThresholdMedium = WelsStaticCast (int32_t,
SCENE_CHANGE_MOTION_RATIO_MEDIUM * iBlock8x8Num + 0.5f + PESN);
uint8_t* pRefY = NULL, *pCurY = NULL;
int32_t iRefStride = 0, iCurStride = 0;
int32_t iRefRowStride = 0, iCurRowStride = 0;

View File

@@ -39,7 +39,8 @@ WELSVP_NAMESPACE_BEGIN
EResult CScrollDetection::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap) {
if (pRefPixMap->pPixel[0] == NULL || pSrcPixMap->pPixel[0] == NULL ||
pRefPixMap->sRect.iRectWidth != pSrcPixMap->sRect.iRectWidth || pRefPixMap->sRect.iRectHeight != pSrcPixMap->sRect.iRectHeight){
pRefPixMap->sRect.iRectWidth != pSrcPixMap->sRect.iRectWidth
|| pRefPixMap->sRect.iRectHeight != pSrcPixMap->sRect.iRectHeight) {
return RET_INVALIDPARAM;
}

View File

@@ -95,8 +95,7 @@ int32_t SelectTestLine(uint8_t* pY, int32_t iWidth, int32_t iHeight, int32_t iPi
* compare pixel line between previous and current one
* return: 0 for totally equal, otherwise 1
*/
int32_t CompareLine(uint8_t *pYSrc, uint8_t *pYRef, const int32_t kiWidth)
{
int32_t CompareLine (uint8_t* pYSrc, uint8_t* pYRef, const int32_t kiWidth) {
int32_t iCmp = 1;
if (* ((int32_t*)pYSrc) != * ((int32_t*)pYRef)) return 1;
@@ -163,8 +162,7 @@ void ScrollDetectionCore(SPixMap* pSrcPixMap, SPixMap* pRefPixMap, int32_t iWidt
iSearchPos = iTestPos - iOffsetAbs - 1;
if (iSearchPos >= iMinHeight) {
pYTmp = pYRef + iSearchPos * iYStride + iOffsetX;
if (!CompareLine(pYLine, pYTmp, iWidth))
{
if (!CompareLine (pYLine, pYTmp, iWidth)) {
uint8_t* pYUpper, *pYLineUpper;
int32_t iCheckedLines;
int32_t iUpOffset = WELS_MIN (iSearchPos - iMinHeight, CHECK_OFFSET);
@@ -191,8 +189,7 @@ void ScrollDetectionCore(SPixMap* pSrcPixMap, SPixMap* pRefPixMap, int32_t iWidt
if (!bScrollDetected) {
sScrollDetectionParam.bScrollDetectFlag = 0;
}
else{
} else {
sScrollDetectionParam.bScrollDetectFlag = 1;
sScrollDetectionParam.iScrollMvY = iSearchPos - iTestPos; // pre_pos - cur_pos, change to mv
sScrollDetectionParam.iScrollMvX = 0;

View File

@@ -34,7 +34,8 @@
WELSVP_NAMESPACE_BEGIN
void VAACalcSadSsd_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
void VAACalcSadSsd_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
int32_t iPicStride,
int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* psqsum16x16, int32_t* psqdiff16x16) {
const uint8_t* tmp_ref = pRefData;
const uint8_t* tmp_cur = pCurData;
@@ -145,7 +146,8 @@ void VAACalcSadSsd_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t
tmp_cur += step;
}
}
void VAACalcSadVar_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
void VAACalcSadVar_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
int32_t iPicStride,
int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* psqsum16x16) {
const uint8_t* tmp_ref = pRefData;
const uint8_t* tmp_cur = pCurData;
@@ -249,7 +251,8 @@ void VAACalcSadVar_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t
}
void VAACalcSad_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
void VAACalcSad_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
int32_t iPicStride,
int32_t* pFrameSad, int32_t* pSad8x8) {
const uint8_t* tmp_ref = pRefData;
const uint8_t* tmp_cur = pCurData;
@@ -480,7 +483,8 @@ void VAACalcSadSsdBgd_c (const uint8_t* pCurData, const uint8_t* pRefData, int32
}
}
void VAACalcSadBgd_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight, int32_t iPicStride,
void VAACalcSadBgd_c (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
int32_t iPicStride,
int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSd8x8, uint8_t* pMad8x8) {
const uint8_t* tmp_ref = pRefData;
const uint8_t* tmp_cur = pCurData;

View File

@@ -49,11 +49,13 @@
WELSVP_NAMESPACE_BEGIN
typedef void (VAACalcSadBgdFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
typedef void (VAACalcSadBgdFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth,
int32_t iPicHeight,
int32_t iPicStride,
int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSd8x8, uint8_t* pMad8x8);
typedef void (VAACalcSadSsdBgdFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
typedef void (VAACalcSadSsdBgdFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth,
int32_t iPicHeight,
int32_t iPicStride,
int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* pSumSquare16x16,
int32_t* pSsd16x16, int32_t* pSd8x8, uint8_t* pMad8x8);
@@ -62,11 +64,13 @@ typedef void (VAACalcSadFunc) (const uint8_t* pCurData, const uint8_t* pRefData,
int32_t iPicStride,
int32_t* pFrameSad, int32_t* pSad8x8);
typedef void (VAACalcSadVarFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
typedef void (VAACalcSadVarFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth,
int32_t iPicHeight,
int32_t iPicStride,
int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* pSumSquare16x16);
typedef void (VAACalcSadSsdFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth, int32_t iPicHeight,
typedef void (VAACalcSadSsdFunc) (const uint8_t* pCurData, const uint8_t* pRefData, int32_t iPicWidth,
int32_t iPicHeight,
int32_t iPicStride,
int32_t* pFrameSad, int32_t* pSad8x8, int32_t* pSum16x16, int32_t* pSumSquare16x16, int32_t* pSsd16x16);