History

Merge pull request #368 from huili2/sps_buffer_modif

modify SPS, PPS buffer management and remove a build warning

volvet committed 12 years ago

Commit 33017fa2 parents 07bc7e0 e4b6fc33 files · +4 −169Browse files

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

Unified · Split

codec/decoder/core/src/decoder_core.cpp+3−106
@@ -371,100 +371,6 @@ void DecodeNalHeaderExt (PNalUnit pNal, uint8_t* pSrc) { · 370 unmodified lines
371}371}
372 372
373 373
374#ifdef MOSAIC_AVOID_BASED_ON_SPS_PPS_ID
375int32_t CheckPpsId (PWelsDecoderContext pCtx, PPps* ppPps, uint32_t uiPpsId) {
376 PPps pPpsList = pCtx->sPpsBuffer;
377 int32_t iPpsNum = pCtx->iPpsTotalNum;
378 int32_t i = 0;
379
380 if (iPpsNum <= 0) {
381 pCtx->iErrorCode |= dsNoParamSets;
382
383 WelsLog (pCtx, WELS_LOG_WARNING, "CheckPpsId():::::PPS list is empty...NO PPS!!!\n");
384 return dsNoParamSets;
385 }
386
387 while (i < iPpsNum) {
388 if (uiPpsId == pPpsList[i].iPpsId) {
389 *ppPps = &pPpsList[i];
390 break;
391 } else {
392 ++i;
393 }
394 }
395
396 if (i == iPpsNum) {
397 pCtx->iErrorCode |= dsNoParamSets;
398
399 WelsLog (pCtx, WELS_LOG_WARNING, "CheckPpsId()::::::CAN NOT find the matching from the PPS List. iPpsId:%d\n",
400 uiPpsId);
401 return dsNoParamSets;
402 }
403
404 return 0;
405}
406
407int32_t CheckSpsId (PWelsDecoderContext pCtx, PSubsetSps* ppSubsetSps, PSps* ppSps, int32_t iSpsId,
408 bool bExtensionFlag) {
409 PSps pSpsList = pCtx->sSpsBuffer;
410 PSubsetSps pSubspsList = pCtx->sSubsetSpsBuffer;
411
412 int32_t iSpsNum = pCtx->iSpsTotalNum;
413 int32_t iSubspsNum = pCtx->iSubspsTotalNum;
414 int32_t i = 0;
415
416 if (bExtensionFlag) {
417 if (iSubspsNum <= 0) {
418 pCtx->iErrorCode |= dsNoParamSets;
419
420 WelsLog (pCtx, WELS_LOG_WARNING, "CheckSpsId()::::SUBSPS list is empty....NO SUBSPS\n");
421 return dsNoParamSets;
422 }
423 while (i < iSubspsNum) {
424 if (iSpsId == pSubspsList[i].sSps.iSpsId) {
425 *ppSubsetSps = &pSubspsList[i];
426 *ppSps = &pSubspsList[i].sSps;
427 break;
428 } else {
429 ++i;
430 }
431 }
432 if (i == iSubspsNum) {
433 pCtx->iErrorCode |= dsNoParamSets;
434
435 WelsLog (pCtx, WELS_LOG_WARNING, "CheckSpsId()::::::CAN NOT find the matching from the SUBSPS List. iSpsId:%d\n",
436 iSpsId);
437 return dsNoParamSets;
438 }
439 } else {
440 if (iSpsNum <= 0) {
441 pCtx->iErrorCode |= dsNoParamSets;
442
443 WelsLog (pCtx, WELS_LOG_WARNING, "CheckSpsId()::::SPS list is empty....NO SPS\n");
444 return dsNoParamSets;
445 }
446 while (i < iSpsNum) {
447 if (iSpsId == pSpsList[i].iSpsId) {
448 *ppSubsetSps = NULL;
449 *ppSps = &pSpsList[i];
450 break;
451 } else {
452 ++i;
453 }
454 }
455 if (i == iSpsNum) {
456 pCtx->iErrorCode |= dsNoParamSets;
457
458 WelsLog (pCtx, WELS_LOG_WARNING, "CheckSpsId()::::::CAN NOT find the matching from the SPS List. iSpsId:%d\n", iSpsId);
459 return dsNoParamSets;
460 }
461 }
462
463 return 0;
464}
465
466#endif
467
468#define SLICE_HEADER_IDR_PIC_ID_MAX 65535374#define SLICE_HEADER_IDR_PIC_ID_MAX 65535
469#define SLICE_HEADER_REDUNDANT_PIC_CNT_MAX 127375#define SLICE_HEADER_REDUNDANT_PIC_CNT_MAX 127
470#define SLICE_HEADER_ALPHAC0_BETA_OFFSET_MIN -12376#define SLICE_HEADER_ALPHAC0_BETA_OFFSET_MIN -12
@@ -552,13 +458,9 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 81 unmodified lines
552 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_PPS_ID_OVERFLOW);458 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_PPS_ID_OVERFLOW);
553 }459 }
554 460
555#ifdef MOSAIC_AVOID_BASED_ON_SPS_PPS_ID461 //add check PPS available here
556 if (CheckPpsId (pCtx, &pPps, iPpsId)) {462
557 return dsNoParamSets;
558 }
559#else
560 pPps = &pCtx->sPpsBuffer[iPpsId];463 pPps = &pCtx->sPpsBuffer[iPpsId];
561#endif //MOSAIC_AVOID_BASED_ON_SPS_PPS_ID
562 464
563 if (pPps->uiNumSliceGroups == 0) {465 if (pPps->uiNumSliceGroups == 0) {
564 WelsLog (pCtx, WELS_LOG_WARNING, "non existing PPS referenced\n");466 WelsLog (pCtx, WELS_LOG_WARNING, "non existing PPS referenced\n");
@@ -570,12 +472,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 5 unmodified lines
570 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_SPS_ID_OVERFLOW);472 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_SPS_ID_OVERFLOW);
571 }473 }
572 474
475 //add check SPS available here
573 476
574#ifdef MOSAIC_AVOID_BASED_ON_SPS_PPS_ID
575 if (CheckSpsId (pCtx, &pSubsetSps, &pSps, pPps->iSpsId, kExtensionFlag)) {
576 return dsNoParamSets;
577 }
578#else
579 if (kbExtensionFlag) {477 if (kbExtensionFlag) {
580 pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId];478 pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId];
581 pSps = &pSubsetSps->sSps;479 pSps = &pSubsetSps->sSps;
@@ -583,7 +481,6 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 1 unmodified line
583 pSps = &pCtx->sSpsBuffer[pPps->iSpsId];481 pSps = &pCtx->sSpsBuffer[pPps->iSpsId];
584 }482 }
585 pCtx->pSps = pSps;483 pCtx->pSps = pSps;
586#endif //MOSAIC_AVOID_BASED_ON_SPS_PPS_ID
587 pSliceHead->iPpsId = iPpsId;484 pSliceHead->iPpsId = iPpsId;
588 pSliceHead->iSpsId = pPps->iSpsId;485 pSliceHead->iSpsId = pPps->iSpsId;
589 pSliceHead->pPps = pPps;486 pSliceHead->pPps = pPps;

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