History

second commit for threaded decoding support: Add function WelsDecodeAndConstructSlice (and add associted functions) which combines decoding->reconstructing->deblocking in single MB loop so that it allows multile frames to decode MBs in parallel.

xiaotiansf committed 7 years ago

Commit fd42f041 parent 2f5ecec22 files · +924 −190Browse files

Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 22 files). Show all

Unified · Split

codec/decoder/core/src/decoder.cpp+31−2
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 #include "decode_slice.h"
5353 #include "error_concealment.h"
5454 #include "memory_align.h"
55+#include "wels_decoder_thread.h"
5556
5657 namespace WelsDec {
5758
@@ -321,12 +322,12 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 263 unmodified lines
321322
322323 pCtx->pPicBuff = NULL;
323324
324− pCtx->sSpsPpsCtx.bAvcBasedFlag = true;
325+ //pCtx->sSpsPpsCtx.bAvcBasedFlag = true;
325326 pCtx->pLastDecPicInfo->pPreviousDecodedPictureInDpb = NULL;
326327 pCtx->pDecoderStatistics->iAvgLumaQp = -1;
327328 pCtx->pDecoderStatistics->iStatisticsLogInterval = 1000;
328329 pCtx->bUseScalingList = false;
329− pCtx->sSpsPpsCtx.iSpsErrorIgnored = 0;
330+ /*pCtx->sSpsPpsCtx.iSpsErrorIgnored = 0;
330331 pCtx->sSpsPpsCtx.iSubSpsErrorIgnored = 0;
331332 pCtx->sSpsPpsCtx.iPpsErrorIgnored = 0;
332333 pCtx->sSpsPpsCtx.iPPSInvalidNum = 0;
@@ -335,6 +336,7 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 2 unmodified lines
335336 pCtx->sSpsPpsCtx.iSPSLastInvalidId = -1;
336337 pCtx->sSpsPpsCtx.iSubSPSInvalidNum = 0;
337338 pCtx->sSpsPpsCtx.iSubSPSLastInvalidId = -1;
339+ */
338340 pCtx->iFeedbackNalRefIdc = -1; //initialize
339341 pCtx->pLastDecPicInfo->iPrevPicOrderCntMsb = 0;
340342 pCtx->pLastDecPicInfo->iPrevPicOrderCntLsb = 0;
@@ -372,6 +374,33 @@ void WelsDecoderLastDecPicInfoDefaults (SWelsLastDecPicInfo& sLastDecPicInfo) { · 31 unmodified lines
372374 sLastDecPicInfo.bLastHasMmco5 = false;
373375 }
374376
377+/*!
378+* \brief copy SpsPps from one Ctx to another ctx for threaded code
379+*/
380+void CopySpsPps (PWelsDecoderContext pFromCtx, PWelsDecoderContext pToCtx) {
381+ pToCtx->sSpsPpsCtx = pFromCtx->sSpsPpsCtx;
382+ PAccessUnit pFromCurAu = pFromCtx->pAccessUnitList;
383+ PSps pTmpLayerSps[MAX_LAYER_NUM];
384+ for (int i = 0; i < MAX_LAYER_NUM; i++) {
385+ pTmpLayerSps[i] = NULL;
386+ }
387+ // track the layer sps for the current au
388+ for (unsigned int i = pFromCurAu->uiStartPos; i <= pFromCurAu->uiEndPos; i++) {
389+ uint32_t uiDid = pFromCurAu->pNalUnitsList[i]->sNalHeaderExt.uiDependencyId;
390+ pTmpLayerSps[uiDid] = pFromCurAu->pNalUnitsList[i]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps;
391+ for (unsigned int j = 0; j < MAX_SPS_COUNT + 1; ++j) {
392+ if (&pFromCtx->sSpsPpsCtx.sSpsBuffer[j] == pTmpLayerSps[uiDid]) {
393+ pTmpLayerSps[uiDid] = &pToCtx->sSpsPpsCtx.sSpsBuffer[j];
394+ break;
395+ }
396+ }
397+ }
398+ for (int i = 0; i < MAX_LAYER_NUM; i++) {
399+ if (pTmpLayerSps[i] != NULL) {
400+ pToCtx->sSpsPpsCtx.pActiveLayerSps[i] = pTmpLayerSps[i];
401+ }
402+ }
403+}
375404
376405 /*
377406 * destory_mb_blocks

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