History

Merge branch 'master' of https://github.com/cisco/openh264 into enc_quant

ruil2 committed 12 years ago

Commit 00a2a9f2 parents e0b92bb d34365516 files · +69 −77Browse files

Unified · Split

16 files
  1. codec/api/svc/codec_app_def.h +3 −3
  2. codec/console/enc/src/welsenc.cpp +1 −1
  3. codec/decoder/core/inc/au_parser.h +2 −0
  4. codec/decoder/core/inc/wels_const.h +1 −1
  5. codec/decoder/core/src/au_parser.cpp +12 −2
  6. codec/encoder/core/inc/nal_encap.h +1 −0
  7. codec/encoder/core/inc/svc_motion_estimate.h +8 −0
  8. codec/encoder/core/src/encoder_ext.cpp +31 −37
  9. codec/encoder/core/src/slice_multi_threading.cpp +3 −3
  10. codec/encoder/core/src/svc_base_layer_md.cpp +0 −3
  11. codec/encoder/core/src/svc_mode_decision.cpp +0 −6
  12. codec/encoder/plus/src/welsEncoderExt.cpp +1 −1
  13. codec/processing/src/scrolldetection/ScrollDetection.h +0 −5
  14. test/api/decode_encode_test.cpp +1 −1
  15. test/api/encoder_test.cpp +1 −1
  16. test/encoder/EncUT_MotionEstimate.cpp +4 −13
codec/api/svc/codec_app_def.h+3−3
@@ -87,9 +87,9 @@ typedef enum { · 86 unmodified lines
8787 ENCOCER_LTR_MARKING_PERIOD,
8888 ENCODER_OPTION_LTR,
8989
90− ENCODER_OPTION_ENABLE_SSEI, //disable SSEI: true--disable ssei; false--enable ssei
90+ ENCODER_OPTION_ENABLE_SSEI, //enable SSEI: true--enable ssei; false--disable ssei
9191 ENCODER_OPTION_ENABLE_PREFIX_NAL_ADDING, //enable prefix: true--enable prefix; false--disable prefix
92− ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, //disable pSps/pPps id addition: true--disable pSps/pPps id; false--enable pSps/pPps id addistion
92+ ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, //enable pSps/pPps id addition: true--enable pSps/pPps id; false--disable pSps/pPps id addistion
9393
9494 ENCODER_OPTION_CURRENT_PATH,
9595 ENCODER_OPTION_DUMP_FILE,
@@ -347,7 +347,7 @@ typedef struct { · 251 unmodified lines
347347 unsigned char uiLayerType;
348348
349349 int iNalCount; // Count number of NAL coded already
350− int iNalLengthInByte[MAX_NAL_UNITS_IN_LAYER]; // Length of NAL size in byte from 0 to iNalCount-1
350+ int* pNalLengthInByte; // Length of NAL size in byte from 0 to iNalCount-1
351351 unsigned char* pBsBuf; // Buffer of bitstream contained
352352 } SLayerBSInfo, *PLayerBSInfo;
353353
codec/console/enc/src/welsenc.cpp+1−1
@@ -782,7 +782,7 @@ int ProcessEncoding(ISVCEncoder* pPtrEnc, int argc, char** argv,bool bConfigFile · 781 unmodified lines
782782 int iLayerSize = 0;
783783 int iNalIdx = pLayerBsInfo->iNalCount - 1;
784784 do {
785− iLayerSize += pLayerBsInfo->iNalLengthInByte[iNalIdx];
785+ iLayerSize += pLayerBsInfo->pNalLengthInByte[iNalIdx];
786786 -- iNalIdx;
787787 } while (iNalIdx >= 0);
788788 #if defined(COMPARE_DATA)
codec/decoder/core/inc/au_parser.h+2−0
@@ -96,6 +96,8 @@ bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, · 95 unmodified lines
9696 const PSps kpSps);
9797 bool CheckAccessUnitBoundaryExt (PNalUnitHeaderExt pLastNalHdrExt, PNalUnitHeaderExt pCurNalHeaderExt,
9898 PSliceHeader pLastSliceHeader, PSliceHeader pCurSliceHeader);
99+bool CheckNextAuNewSeq (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PSps kpSps);
100+
99101 /*!
100102 *************************************************************************************
101103 * \brief to parse Sequence Parameter Set (SPS)
codec/decoder/core/inc/wels_const.h+1−1
@@ -93,7 +93,7 @@ · 92 unmodified lines
9393
9494 #define MAX_NAL_UNIT_NUM_IN_AU 32 // predefined maximal number of NAL Units in an access unit
9595 #define MAX_ACCESS_UNIT_CAPACITY 1048576 // Maximal AU capacity in bytes: (1<<20) = 1024 KB predefined
96−#define BS_BUFFER_SIZE (MAX_ACCESS_UNIT_CAPACITY + MAX_ACCESS_UNIT_CAPACITY) //for delay case, save two AU at most
96+#define BS_BUFFER_SIZE (MAX_ACCESS_UNIT_CAPACITY * 3) //for delay case, keep three AU size to prevent buffer overwrite
9797 #define MAX_MACROBLOCK_CAPACITY 5000 //Maximal legal MB capacity, 15000 bits is enough
9898
9999 #endif//WELS_CONSTANCE_H__
codec/decoder/core/src/au_parser.cpp+12−2
@@ -331,7 +331,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 330 unmodified lines
331331 pCurAu->pNalUnitsList[uiAvailNalNum - 1]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps)) {
332332 pCurAu->uiEndPos = uiAvailNalNum - 2;
333333 pCtx->bAuReadyFlag = true;
334−
334+ pCtx->bNextNewSeqBegin = CheckNextAuNewSeq (pCtx, pCurNal, pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps);
335335
336336 }
337337 }
@@ -411,7 +411,6 @@ bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, · 73 unmodified lines
411411 const SSliceHeader* kpCurSliceHeader = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader;
412412 if (pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL
413413 && pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps) {
414− pCtx->bNextNewSeqBegin = true;
415414 return true; // the active sps changed, new sequence begins, so the current au is ready
416415 }
417416
@@ -460,6 +459,17 @@ bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, · 42 unmodified lines
460459 return false;
461460 }
462461
462+bool CheckNextAuNewSeq (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PSps kpSps) {
463+ const PNalUnitHeaderExt kpCurNalHeaderExt = &kpCurNal->sNalHeaderExt;
464+ if (pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL
465+ && pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps)
466+ return true;
467+ if (kpCurNalHeaderExt->bIdrFlag)
468+ return true;
469+
470+ return false;
471+}
472+
463473 /*!
464474 *************************************************************************************
465475 * \brief to parse NON VCL NAL Units
codec/encoder/core/inc/nal_encap.h+1−0
@@ -71,6 +71,7 @@ typedef struct TagWelsEncoderOutput { · 70 unmodified lines
7171
7272 // SWelsNalRaw raw_nals[MAX_DEPENDENCY_LAYER*2+MAX_DEPENDENCY_LAYER*MAX_QUALITY_LEVEL]; // AVC: max up to SPS+PPS+max_slice_idc (2 + 8) for FMO;
7373 SWelsNalRaw* sNalList; // nal list, adaptive for AVC/SVC in case single slice, multiple slices or fmo
74+ int32_t* pNalLen;
7475 int32_t iCountNals; // count number of NAL in list
7576 // SVC: num_sps (MAX_D) + num_pps (MAX_D) + num_vcl (MAX_D * MAX_Q)
7677 int32_t iNalIndex; // coding NAL currently, 0 based
codec/encoder/core/inc/svc_motion_estimate.h+8−0
@@ -256,8 +256,16 @@ int32_t ReleaseFeatureSearchPreparation (CMemoryAlign* pMa, uint16_t*& pFeatureO · 255 unmodified lines
256256 #define FMESWITCH_DEFAULT_GOODFRAME_NUM (2)
257257 #define FME_DEFAULT_FEATURE_INDEX (0)
258258
259+
259260 void PerformFMEPreprocess (SWelsFuncPtrList* pFunc, SPicture* pRef, uint16_t* pFeatureOfBlock,
260261 SScreenBlockFeatureStorage* pScreenBlockFeatureStorage);
262+bool SetFeatureSearchIn (SWelsFuncPtrList* pFunc, const SWelsME& sMe,
263+ const SSlice* pSlice, SScreenBlockFeatureStorage* pRefFeatureStorage,
264+ const int32_t kiEncStride, const int32_t kiRefStride,
265+ SFeatureSearchIn* pFeatureSearchIn);
266+void MotionEstimateFeatureFullSearch (SFeatureSearchIn& sFeatureSearchIn,
267+ const uint32_t kuiMaxSearchPoint,
268+ SWelsME* pMe);
261269 void UpdateFMESwitch (SDqLayer* pCurLayer);
262270 void UpdateFMESwitchNull (SDqLayer* pCurLayer);
263271
codec/encoder/core/src/encoder_ext.cpp+31−37
@@ -80,7 +80,7 @@ int32_t ParamValidation (SWelsSvcCodingParam* pCfg) { · 79 unmodified lines
8080 assert (pCfg != NULL);
8181
8282 if ((pCfg->iUsageType != CAMERA_VIDEO_REAL_TIME) && (pCfg->iUsageType != SCREEN_CONTENT_REAL_TIME)) {
83− WelsLog (NULL, WELS_LOG_ERROR, "ParamValidation(),Invalid usage type = %d", pCfg->iUsageType);
83+ WelsLog (NULL, WELS_LOG_ERROR, "ParamValidation(),Invalid usage type = %d\n", pCfg->iUsageType);
8484 return ENC_RETURN_UNSUPPORTED_PARA;
8585 }
8686 for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
@@ -113,15 +113,16 @@ int32_t ParamValidation (SWelsSvcCodingParam* pCfg) { · 26 unmodified lines
113113 }
114114
115115 //bitrate setting validation
116− if (pCfg->iRCMode != RC_OFF_MODE){
116+ if (pCfg->iRCMode != RC_OFF_MODE) {
117117 int32_t iTotalBitrate = 0;
118118 for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
119119 SDLayerParam* fDlp = &pCfg->sDependencyLayers[i];
120120 iTotalBitrate += fDlp->iSpatialBitrate;
121121 }
122− if(iTotalBitrate > pCfg->iTargetBitrate){
123− WelsLog(NULL, WELS_LOG_ERROR,"Invalid setttings in bitrate. the sum of each layer bitrate(%d) is larger than total bitrate setting(%d)\n",
124− iTotalBitrate,pCfg->iTargetBitrate);
122+ if (iTotalBitrate > pCfg->iTargetBitrate) {
123+ WelsLog (NULL, WELS_LOG_ERROR,
124+ "Invalid setttings in bitrate. the sum of each layer bitrate(%d) is larger than total bitrate setting(%d)\n",
125+ iTotalBitrate, pCfg->iTargetBitrate);
125126 }
126127 }
127128
@@ -1303,6 +1304,8 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 1175 unmodified lines
13031304 (*ppCtx)->pOut->uiSize = iCountBsLen;
13041305 (*ppCtx)->pOut->sNalList = (SWelsNalRaw*)pMa->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList");
13051306 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->sNalList), FreeMemorySvc (ppCtx))
1307+ (*ppCtx)->pOut->pNalLen = (int32_t*)pMa->WelsMallocz(iCountNals * sizeof (int32_t), "pOut->pNalLen");
1308+ WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pNalLen), FreeMemorySvc(ppCtx))
13061309 (*ppCtx)->pOut->iCountNals = iCountNals;
13071310 (*ppCtx)->pOut->iNalIndex = 0;
13081311
@@ -1497,6 +1500,11 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 188 unmodified lines
14971500 pMa->WelsFree (pCtx->pOut->sNalList, "pOut->sNalList");
14981501 pCtx->pOut->sNalList = NULL;
14991502 }
1503+ // NALs len
1504+ if (NULL != pCtx->pOut->pNalLen) {
1505+ pMa->WelsFree (pCtx->pOut->pNalLen, "pOut->pNalLen");
1506+ pCtx->pOut->pNalLen = NULL;
1507+ }
15001508 pMa->WelsFree (pCtx->pOut, "SWelsEncoderOutput");
15011509 pCtx->pOut = NULL;
15021510 }
@@ -2443,14 +2451,8 @@ bool SetMeMethod (const uint8_t uiMethod, PSearchMethodFunc& pSearchMethodFunc) · 940 unmodified lines
24432451 pSearchMethodFunc = WelsDiamondCrossFeatureSearch;
24442452 break;
24452453 case ME_FULL:
2446−#ifdef HAVE_MMX
2447− // make sure your cpu can support x86 sse4.1 instruction set if try it
2448− //pSearchMethodFunc = WelsFullSearch;
2449−#else
24502454 pSearchMethodFunc = WelsDiamondSearch;
24512455 return false;
2452−#endif//HAVE_MMX
2453− break;
24542456 default:
24552457 pSearchMethodFunc = WelsDiamondSearch;
24562458 return false;
@@ -2772,7 +2774,6 @@ static inline int32_t AddPrefixNal (sWelsEncCtx* pCtx, · 315 unmodified lines
27722774 iPayloadSize = pNalLen[*pNalIdxInLayer];
27732775
27742776 pCtx->iPosBsBuffer += iPayloadSize;
2775− pLayerBsInfo->iNalLengthInByte[*pNalIdxInLayer] = iPayloadSize;
27762777
27772778 (*pNalIdxInLayer) ++;
27782779 } else { // No Prefix NAL Unit RBSP syntax here, but need add NAL Unit Header extension
@@ -2789,7 +2790,6 @@ static inline int32_t AddPrefixNal (sWelsEncCtx* pCtx, · 10 unmodified lines
27892790 iPayloadSize = pNalLen[*pNalIdxInLayer];
27902791
27912792 pCtx->iPosBsBuffer += iPayloadSize;
2792− pLayerBsInfo->iNalLengthInByte[*pNalIdxInLayer] = iPayloadSize;
27932793
27942794 (*pNalIdxInLayer) ++;
27952795 }
@@ -2855,13 +2855,13 @@ int32_t ForceCodingIDR (sWelsEncCtx* pCtx) { · 59 unmodified lines
28552855 int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) {
28562856 SFrameBSInfo* pFbi = (SFrameBSInfo*)pDst;
28572857 SLayerBSInfo* pLayerBsInfo = &pFbi->sLayerInfo[0];
2858− int32_t iNalLen[128] = {0};
28592858 int32_t iCountNal = 0;
28602859
28612860 pLayerBsInfo->pBsBuf = pCtx->pFrameBs;
2861+ pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen;
28622862 InitBits (&pCtx->pOut->sBsWrite, pCtx->pOut->pBsBuffer, pCtx->pOut->uiSize);
28632863
2864− int32_t iReturn = WelsWriteParameterSets (pCtx, &iNalLen[0], &iCountNal);
2864+ int32_t iReturn = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal);
28652865 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
28662866
28672867 pLayerBsInfo->uiPriorityId = 0;
@@ -2870,9 +2870,6 @@ int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) { · 2 unmodified lines
28702870 pLayerBsInfo->uiQualityId = 0;
28712871 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
28722872 pLayerBsInfo->iNalCount = iCountNal;
2873− for (int32_t iNalIndex = 0; iNalIndex < iCountNal; ++ iNalIndex) {
2874− pLayerBsInfo->iNalLengthInByte[iNalIndex] = iNalLen[iNalIndex];
2875− }
28762873
28772874 pCtx->eLastNalPriority = NRI_PRI_HIGHEST;
28782875 pFbi->iLayerNum = 1;
@@ -2904,7 +2901,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 25 unmodified lines
29042901 int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame
29052902 int32_t iSpatialIdx = 0; // iIndex of spatial layers due to frame size changed in this given frame
29062903 int32_t iFrameSize = 0;
2907− int32_t iNalLen[128] = {0};
29082904 int32_t iNalIdxInLayer = 0;
29092905 int32_t iCountNal = 0;
29102906 EVideoFrameType eFrameType = videoFrameTypeInvalid;
@@ -2948,13 +2944,14 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 37 unmodified lines
29482944 pCtx->uiTemporalId = iCurTid;
29492945
29502946 pLayerBsInfo->pBsBuf = pCtx->pFrameBs ;
2947+ pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen;
29512948
29522949 if (eFrameType == videoFrameTypeIDR) {
29532950 ++ pCtx->sPSOVector.uiIdrPicId;
29542951 //if ( pSvcParam->bEnableSSEI )
29552952
29562953 // write parameter sets bitstream here
2957− pCtx->iEncoderError = WelsWriteParameterSets (pCtx, &iNalLen[0], &iCountNal);
2954+ pCtx->iEncoderError = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal);
29582955 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
29592956
29602957 pLayerBsInfo->uiPriorityId = 0;
@@ -2963,12 +2960,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2 unmodified lines
29632960 pLayerBsInfo->uiQualityId = 0;
29642961 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
29652962 pLayerBsInfo->iNalCount = iCountNal;
2966− for (int32_t iNalIndex = 0; iNalIndex < iCountNal; ++ iNalIndex) {
2967− pLayerBsInfo->iNalLengthInByte[iNalIndex] = iNalLen[iNalIndex];
2968− }
29692963
29702964 ++ pLayerBsInfo;
29712965 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
2966+ pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
29722967 ++ iLayerNum;
29732968 }
29742969
@@ -3089,7 +3084,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 114 unmodified lines
30893084 int32_t iPayloadSize = 0;
30903085
30913086 if (pCtx->bNeedPrefixNalFlag) {
3092− pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &iNalLen[0], &iNalIdxInLayer, eNalType, eNalRefIdc,
3087+ pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType, eNalRefIdc,
30933088 iPayloadSize);
30943089 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
30953090 iLayerSize += iPayloadSize;
@@ -3106,9 +3101,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 10 unmodified lines
31063101 &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt,
31073102 pCtx->iFrameBsSize - pCtx->iPosBsBuffer,
31083103 pCtx->pFrameBs + pCtx->iPosBsBuffer,
3109− &iNalLen[iNalIdxInLayer]);
3104+ &pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer]);
31103105 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
3111− iSliceSize = iNalLen[iNalIdxInLayer];
3106+ iSliceSize = pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer];
31123107
31133108 iLayerSize += iSliceSize;
31143109 pCtx->iPosBsBuffer += iSliceSize;
@@ -3117,7 +3112,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2 unmodified lines
31173112 pLayerBsInfo->uiTemporalId = iCurTid;
31183113 pLayerBsInfo->uiQualityId = 0;
31193114 pLayerBsInfo->uiPriorityId = 0;
3120− pLayerBsInfo->iNalLengthInByte[iNalIdxInLayer] = iSliceSize;
31213115 pLayerBsInfo->iNalCount = ++ iNalIdxInLayer;
31223116 }
31233117 // for dynamic slicing single threading..
@@ -3260,7 +3254,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 136 unmodified lines
32603254 int32_t iSliceSize = 0;
32613255 int32_t iPayloadSize = 0;
32623256 if (bNeedPrefix) {
3263− pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &iNalLen[0], &iNalIdxInLayer, eNalType, eNalRefIdc,
3257+ pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType, eNalRefIdc,
32643258 iPayloadSize);
32653259 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
32663260 iLayerSize += iPayloadSize;
@@ -3275,13 +3269,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 8 unmodified lines
32753269 pCtx->iEncoderError = WelsEncodeNal (&pCtx->pOut->sNalList[pCtx->pOut->iNalIndex - 1],
32763270 &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt,
32773271 pCtx->iFrameBsSize - pCtx->iPosBsBuffer,
3278− pCtx->pFrameBs + pCtx->iPosBsBuffer, &iNalLen[iNalIdxInLayer]);
3272+ pCtx->pFrameBs + pCtx->iPosBsBuffer, &pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer]);
32793273 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
3280− iSliceSize = iNalLen[iNalIdxInLayer];
3274+ iSliceSize = pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer];
32813275
32823276 pCtx->iPosBsBuffer += iSliceSize;
32833277 iLayerSize += iSliceSize;
3284− pLayerBsInfo->iNalLengthInByte[iNalIdxInLayer] = iSliceSize;
32853278
32863279 #if defined(SLICE_INFO_OUTPUT)
32873280 fprintf (stderr,
@@ -3413,10 +3406,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 125 unmodified lines
34133406 }
34143407 #endif//STAT_OUTPUT
34153408
3409+ iCountNal = pLayerBsInfo->iNalCount;
34163410 ++ iLayerNum;
34173411 ++ pLayerBsInfo;
34183412
34193413 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
3414+ pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
34203415
34213416 if (pSvcParam->iPaddingFlag && pCtx->pWelsSvcRc[pCtx->uiDependencyId].iPaddingSize > 0) {
34223417 int32_t iPaddingNalSize = 0;
@@ -3440,9 +3435,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 17 unmodified lines
34403435 pLayerBsInfo->uiQualityId = 0;
34413436 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
34423437 pLayerBsInfo->iNalCount = 1;
3443− pLayerBsInfo->iNalLengthInByte[0] = iPaddingNalSize;
3438+ pLayerBsInfo->pNalLengthInByte[0] = iPaddingNalSize;
34443439 ++ pLayerBsInfo;
34453440 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
3441+ pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + 1;
34463442 ++ iLayerNum;
34473443 }
34483444
@@ -3696,7 +3692,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 247 unmodified lines
36963692
36973693 SDqLayer* pCurLayer = pCtx->pCurDqLayer;
36983694 SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx;
3699− int32_t iNalLen[MAX_NAL_UNITS_IN_LAYER] = {0};
37003695 int32_t iNalIdxInLayer = *pNalIdxInLayer;
37013696 int32_t iSliceIdx = iStartSliceIdx;
37023697 const int32_t kiSliceStep = pCtx->iActiveThreadsNum;
@@ -3727,7 +3722,7 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 24 unmodified lines
37273722 }
37283723
37293724 if (kbNeedPrefix) {
3730− iReturn = AddPrefixNal (pCtx, pLayerBsInfo, &iNalLen[0], &iNalIdxInLayer, keNalType, keNalRefIdc, iPayloadSize);
3725+ iReturn = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, keNalType, keNalRefIdc, iPayloadSize);
37313726 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
37323727 iPartitionBsSize += iPayloadSize;
37333728 }
@@ -3741,13 +3736,12 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 7 unmodified lines
37413736 &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt,
37423737 pCtx->iFrameBsSize - pCtx->iPosBsBuffer,
37433738 pCtx->pFrameBs + pCtx->iPosBsBuffer,
3744− &iNalLen[iNalIdxInLayer]);
3739+ &pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer]);
37453740 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
3746− iSliceSize = iNalLen[iNalIdxInLayer];
3741+ iSliceSize = pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer];
37473742
37483743 pCtx->iPosBsBuffer += iSliceSize;
37493744 iPartitionBsSize += iSliceSize;
3750− pLayerBsInfo->iNalLengthInByte[iNalIdxInLayer] = iSliceSize;
37513745
37523746 #if defined(SLICE_INFO_OUTPUT)
37533747 fprintf (stderr,
codec/encoder/core/src/slice_multi_threading.cpp+3−3
@@ -548,7 +548,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 547 unmodified lines
548548 iLayerSize += pSliceBs->uiBsPos;
549549
550550 while (iNalIdx < iCountNal) {
551− pLbi->iNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx];
551+ pLbi->pNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx];
552552 ++ iNalIdx;
553553 }
554554 pLbi->iNalCount += iCountNal;
@@ -580,7 +580,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 25 unmodified lines
580580 iLayerSize += pSliceBs->uiBsPos;
581581
582582 while (iNalIdx < iCountNal) {
583− pLbi->iNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx];
583+ pLbi->pNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx];
584584 ++ iNalIdx;
585585 }
586586 pLbi->iNalCount += iCountNal;
@@ -621,7 +621,7 @@ int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFr · 34 unmodified lines
621621 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
622622 iSliceSize += iNalSize;
623623 pDst += iNalSize;
624− pLbi->iNalLengthInByte[iNalBase + iNalIdx] = iNalSize;
624+ pLbi->pNalLengthInByte[iNalBase + iNalIdx] = iNalSize;
625625
626626 ++ iNalIdx;
627627 }
codec/encoder/core/src/svc_base_layer_md.cpp+0−3
@@ -1887,9 +1887,6 @@ static inline void MergeSub16Me (const SWelsME& sSrcMe0, const SWelsME& sSrcMe1, · 1886 unmodified lines
18871887 static inline bool IsSameMv (const SMVUnitXY& sMv0, const SMVUnitXY& sMv1) {
18881888 return ((sMv0.iMvX == sMv1.iMvX) && (sMv0.iMvY == sMv1.iMvY));
18891889 }
1890−static inline int32_t Mvd (const SMVUnitXY& sMv, const SMVUnitXY& sMvp) {
1891− return (WELS_ABS (sMv.iMvX - sMvp.iMvX) + WELS_ABS (sMv.iMvY - sMvp.iMvY));
1892−}
18931890 bool TryModeMerge (SMbCache* pMbCache, SWelsMD* pWelsMd, SMB* pCurMb) {
18941891 SWelsME* pMe8x8 = & (pWelsMd->sMe.sMe8x8[0]);
18951892 const bool bSameMv16x8_0 = IsSameMv (pMe8x8[0].sMv, pMe8x8[1].sMv);
codec/encoder/core/src/svc_mode_decision.cpp+0−6
@@ -118,12 +118,6 @@ void WelsMdInterMbEnhancelayer (void* pEnc, void* pMd, SSlice* pSlice, SMB* pCur · 117 unmodified lines
118118 WelsMdSpatialelInterMbIlfmdNoilp (pEncCtx, pWelsMd, pSlice, pCurMb, kuiInterLayerRefMbType); //MD process
119119 }
120120
121−//////////////////////////
122−//
123−//SUPPORTING FUNCS
124−//
125−//////////////////////////
126−
127121 ///////////////////////
128122 // do initiation for noILP (needed by ILFMD)
129123 ////////////////////////
codec/encoder/plus/src/welsEncoderExt.cpp+1−1
@@ -483,7 +483,7 @@ int CWelsH264SVCEncoder::EncodeFrameInternal (const SSourcePicture* pSrcPic, SF · 482 unmodified lines
483483
484484 iCurLayerBits = 0;
485485 for (j = 0; j < pLayer->iNalCount; j++) {
486− iCurLayerBits += pLayer->iNalLengthInByte[j];
486+ iCurLayerBits += pLayer->pNalLengthInByte[j];
487487 }
488488 total_bits += iCurLayerBits;
489489 if (m_pFileBs != NULL)
codec/processing/src/scrolldetection/ScrollDetection.h+0−5
@@ -46,11 +46,6 @@ · 45 unmodified lines
4646
4747 WELSVP_NAMESPACE_BEGIN
4848
49−#ifdef HAVE_MMX
50−WELSVP_EXTERN_C_BEGIN
51−WELSVP_EXTERN_C_END
52−#endif
53−
5449 class CScrollDetection : public IStrategy {
5550 public:
5651 CScrollDetection (int32_t iCpuFlag) {
test/api/decode_encode_test.cpp+1−1
@@ -11,7 +11,7 @@ static void UpdateHashFromFrame(const SFrameBSInfo& info, SHA1Context* ctx) { · 10 unmodified lines
1111 const SLayerBSInfo& layerInfo = info.sLayerInfo[i];
1212 int layerSize = 0;
1313 for (int j = 0; j < layerInfo.iNalCount; ++j) {
14− layerSize += layerInfo.iNalLengthInByte[j];
14+ layerSize += layerInfo.pNalLengthInByte[j];
1515 }
1616 SHA1Input(ctx, layerInfo.pBsBuf, layerSize);
1717 }
test/api/encoder_test.cpp+1−1
@@ -7,7 +7,7 @@ static void UpdateHashFromFrame(const SFrameBSInfo& info, SHA1Context* ctx) { · 6 unmodified lines
77 const SLayerBSInfo& layerInfo = info.sLayerInfo[i];
88 int layerSize = 0;
99 for (int j = 0; j < layerInfo.iNalCount; ++j) {
10− layerSize += layerInfo.iNalLengthInByte[j];
10+ layerSize += layerInfo.pNalLengthInByte[j];
1111 }
1212 SHA1Input(ctx, layerInfo.pBsBuf, layerSize);
1313 }
test/encoder/EncUT_MotionEstimate.cpp+4−13
@@ -7,16 +7,6 @@ · 6 unmodified lines
77 #include "wels_func_ptr_def.h"
88 #include "cpu.h"
99
10−namespace WelsSVCEnc {
11− extern void SetFeatureSearchIn( SWelsFuncPtrList *pFunc, const SWelsME& sMe,
12− const SSlice *pSlice, SScreenBlockFeatureStorage* pRefFeatureStorage,
13− const int32_t kiEncStride, const int32_t kiRefStride,
14− SFeatureSearchIn* pFeatureSearchIn );
15− extern void MotionEstimateFeatureFullSearch( SFeatureSearchIn &sFeatureSearchIn,
16− const uint32_t kuiMaxSearchPoint,
17− SWelsME* pMe);
18−}
19−
2010 using namespace WelsSVCEnc;
2111
2212 void CopyTargetBlock( uint8_t* pSrcBlock, const int32_t kiBlockSize, SMVUnitXY sTargetMv, const int32_t kiRefPicStride,
@@ -377,10 +367,11 @@ TEST_F(FeatureMotionEstimateTest, TestFeatureSearch) { · 354 unmodified lines
377367 m_pScreenBlockFeatureStorage->uiSadCostThreshold[BLOCK_8x8] = UINT_MAX;//to avoid early skip
378368 uint32_t uiMaxSearchPoint = INT_MAX;
379369 SFeatureSearchIn sFeatureSearchIn = {0};
380− SetFeatureSearchIn(&sFuncList, sMe, &sSlice, m_pScreenBlockFeatureStorage,
370+ if (SetFeatureSearchIn(&sFuncList, sMe, &sSlice, m_pScreenBlockFeatureStorage,
381371 m_iMaxSearchBlock, m_iWidth,
382− &sFeatureSearchIn);
383− MotionEstimateFeatureFullSearch( sFeatureSearchIn, uiMaxSearchPoint, &sMe);
372+ &sFeatureSearchIn)) {
373+ MotionEstimateFeatureFullSearch( sFeatureSearchIn, uiMaxSearchPoint, &sMe);
374+ }
384375
385376 bool bMvMatch = sMe.sMv.iMvX==sTargetMv.iMvX && sMe.sMv.iMvY==sTargetMv.iMvY;
386377 bool bFeatureMatch =

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