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
52#include "decode_slice.h"52#include "decode_slice.h"
53#include "error_concealment.h"53#include "error_concealment.h"
54#include "memory_align.h"54#include "memory_align.h"
55#include "wels_decoder_thread.h"
55 56
56namespace WelsDec {57namespace WelsDec {
57 58
@@ -321,12 +322,12 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 263 unmodified lines
321 322
322 pCtx->pPicBuff = NULL;323 pCtx->pPicBuff = NULL;
323 324
324 pCtx->sSpsPpsCtx.bAvcBasedFlag = true;325 //pCtx->sSpsPpsCtx.bAvcBasedFlag = true;
325 pCtx->pLastDecPicInfo->pPreviousDecodedPictureInDpb = NULL;326 pCtx->pLastDecPicInfo->pPreviousDecodedPictureInDpb = NULL;
326 pCtx->pDecoderStatistics->iAvgLumaQp = -1;327 pCtx->pDecoderStatistics->iAvgLumaQp = -1;
327 pCtx->pDecoderStatistics->iStatisticsLogInterval = 1000;328 pCtx->pDecoderStatistics->iStatisticsLogInterval = 1000;
328 pCtx->bUseScalingList = false;329 pCtx->bUseScalingList = false;
329 pCtx->sSpsPpsCtx.iSpsErrorIgnored = 0;330 /*pCtx->sSpsPpsCtx.iSpsErrorIgnored = 0;
330 pCtx->sSpsPpsCtx.iSubSpsErrorIgnored = 0;331 pCtx->sSpsPpsCtx.iSubSpsErrorIgnored = 0;
331 pCtx->sSpsPpsCtx.iPpsErrorIgnored = 0;332 pCtx->sSpsPpsCtx.iPpsErrorIgnored = 0;
332 pCtx->sSpsPpsCtx.iPPSInvalidNum = 0;333 pCtx->sSpsPpsCtx.iPPSInvalidNum = 0;
@@ -335,6 +336,7 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 2 unmodified lines
335 pCtx->sSpsPpsCtx.iSPSLastInvalidId = -1;336 pCtx->sSpsPpsCtx.iSPSLastInvalidId = -1;
336 pCtx->sSpsPpsCtx.iSubSPSInvalidNum = 0;337 pCtx->sSpsPpsCtx.iSubSPSInvalidNum = 0;
337 pCtx->sSpsPpsCtx.iSubSPSLastInvalidId = -1;338 pCtx->sSpsPpsCtx.iSubSPSLastInvalidId = -1;
339 */
338 pCtx->iFeedbackNalRefIdc = -1; //initialize340 pCtx->iFeedbackNalRefIdc = -1; //initialize
339 pCtx->pLastDecPicInfo->iPrevPicOrderCntMsb = 0;341 pCtx->pLastDecPicInfo->iPrevPicOrderCntMsb = 0;
340 pCtx->pLastDecPicInfo->iPrevPicOrderCntLsb = 0;342 pCtx->pLastDecPicInfo->iPrevPicOrderCntLsb = 0;
@@ -372,6 +374,33 @@ void WelsDecoderLastDecPicInfoDefaults (SWelsLastDecPicInfo& sLastDecPicInfo) { · 31 unmodified lines
372 sLastDecPicInfo.bLastHasMmco5 = false;374 sLastDecPicInfo.bLastHasMmco5 = false;
373}375}
374 376
377/*!
378* \brief copy SpsPps from one Ctx to another ctx for threaded code
379*/
380void 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}
375 404
376/*405/*
377 * destory_mb_blocks406 * 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