Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 2 files). Show all
Unified · Split
| @@ -479,8 +479,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 478 unmodified lines | |||
| 479 | int32_t iPicHeight = 0; | 479 | int32_t iPicHeight = 0; |
| 480 | int32_t iBitSize = 0; | 480 | int32_t iBitSize = 0; |
| 481 | int32_t iErr = ERR_NONE; | 481 | int32_t iErr = ERR_NONE; |
| 482 | if (kiSrcLen <= 0) | 482 | |
| 483 | return iErr; | ||
| 484 | pBs = &pCtx->sBs; // SBitStringAux instance for non VCL NALs decoding | 483 | pBs = &pCtx->sBs; // SBitStringAux instance for non VCL NALs decoding |
| 485 | iBitSize = (kiSrcLen << 3) - BsGetTrailingBits (pRbsp + kiSrcLen - 1); // convert into bit | 484 | iBitSize = (kiSrcLen << 3) - BsGetTrailingBits (pRbsp + kiSrcLen - 1); // convert into bit |
| 486 | eNalType = pCtx->sCurNalHead.eNalUnitType; | 485 | eNalType = pCtx->sCurNalHead.eNalUnitType; |
| @@ -629,6 +628,69 @@ int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStrin · 142 unmodified lines | |||
| 629 | return 0; | 628 | return 0; |
| 630 | } | 629 | } |
| 631 | 630 | ||
| 631 | // table A-1 - Level limits | ||
| 632 | static const SLevelLimits g_kSLevelLimits[17] = { | ||
| 633 | {1485, 99, 396, 64, 175, -256, 255, 2, 0x7fff}, /* level 1 */ | ||
| 634 | {1485, 99, 396, 128, 350, -256, 255, 2, 0x7fff}, /* level 1.b */ | ||
| 635 | {3000, 396, 900, 192, 500, -512, 511, 2, 0x7fff}, /* level 1.1 */ | ||
| 636 | {6000, 396, 2376, 384, 1000, -512, 511, 2, 0x7fff}, /* level 1.2 */ | ||
| 637 | {11880, 396, 2376, 768, 2000, -512, 511, 2, 0x7fff}, /* level 1.3 */ | ||
| 638 | {11880, 396, 2376, 2000, 2000, -512, 511, 2, 0x7fff}, /* level 2 */ | ||
| 639 | {19800, 792, 4752, 4000, 4000, -1024, 1023, 2, 0x7fff}, /* level 2.1 */ | ||
| 640 | {20250, 1620, 8100, 4000, 4000, -1024, 1023, 2, 0x7fff}, /* level 2.2 */ | ||
| 641 | {40500, 1620, 8100, 10000, 10000, -1024, 1023, 2, 32 }, /* level 3 */ | ||
| 642 | {108000, 3600, 18000, 14000, 14000, -2048, 2047, 4, 16}, /* level 3.1 */ | ||
| 643 | {216000, 5120, 20480, 20000, 20000, -2048, 2047, 4, 16}, /* level 3.2 */ | ||
| 644 | {245760, 8192, 32768, 20000, 25000, -2048, 2047, 4, 16}, /* level 4 */ | ||
| 645 | {245760, 8192, 32768, 50000, 62500, -2048, 2047, 2, 16}, /* level 4.1 */ | ||
| 646 | {522240, 8704, 34816, 50000, 62500, -2048, 2047, 2, 16}, /* level 4.2 */ | ||
| 647 | {589824, 22080, 110400, 135000, 135000, -2048, 2047, 2, 16}, /* level 5 */ | ||
| 648 | {983040, 36864, 184320, 240000, 240000, -2048, 2047, 2, 16}, /* level 5.1 */ | ||
| 649 | {2073600, 36864, 184320, 240000, 240000, -2048, 2047, 2, 16} /* level 5.2 */ | ||
| 650 | }; | ||
| 651 | |||
| 652 | const SLevelLimits *GetLevelLimits(int32_t iLevelIdx, bool_t bConstraint3) { | ||
| 653 | switch (iLevelIdx) { | ||
| 654 | case 10: | ||
| 655 | return &g_kSLevelLimits[0]; | ||
| 656 | case 11: | ||
| 657 | if(bConstraint3) | ||
| 658 | return &g_kSLevelLimits[1]; | ||
| 659 | else | ||
| 660 | return &g_kSLevelLimits[2]; | ||
| 661 | case 12: | ||
| 662 | return &g_kSLevelLimits[3]; | ||
| 663 | case 13: | ||
| 664 | return &g_kSLevelLimits[4]; | ||
| 665 | case 20: | ||
| 666 | return &g_kSLevelLimits[5]; | ||
| 667 | case 21: | ||
| 668 | return &g_kSLevelLimits[6]; | ||
| 669 | case 22: | ||
| 670 | return &g_kSLevelLimits[7]; | ||
| 671 | case 30: | ||
| 672 | return &g_kSLevelLimits[8]; | ||
| 673 | case 31: | ||
| 674 | return &g_kSLevelLimits[9]; | ||
| 675 | case 32: | ||
| 676 | return &g_kSLevelLimits[10]; | ||
| 677 | case 40: | ||
| 678 | return &g_kSLevelLimits[11]; | ||
| 679 | case 41: | ||
| 680 | return &g_kSLevelLimits[12]; | ||
| 681 | case 42: | ||
| 682 | return &g_kSLevelLimits[13]; | ||
| 683 | case 50: | ||
| 684 | return &g_kSLevelLimits[14]; | ||
| 685 | case 51: | ||
| 686 | return &g_kSLevelLimits[15]; | ||
| 687 | case 52: | ||
| 688 | return &g_kSLevelLimits[16]; | ||
| 689 | default: | ||
| 690 | return NULL; | ||
| 691 | } | ||
| 692 | return NULL; | ||
| 693 | } | ||
| 632 | /*! | 694 | /*! |
| 633 | ************************************************************************************* | 695 | ************************************************************************************* |
| 634 | * \brief to parse Sequence Parameter Set (SPS) | 696 | * \brief to parse Sequence Parameter Set (SPS) |
| @@ -685,7 +747,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 50 unmodified lines | |||
| 685 | bConstraintSetFlags[5] = !!BsGetOneBit (pBs); // constraint_set5_flag | 747 | bConstraintSetFlags[5] = !!BsGetOneBit (pBs); // constraint_set5_flag |
| 686 | BsGetBits (pBs, 2); // reserved_zero_2bits, equal to 0 | 748 | BsGetBits (pBs, 2); // reserved_zero_2bits, equal to 0 |
| 687 | uiLevelIdc = BsGetBits (pBs, 8); // level_idc | 749 | uiLevelIdc = BsGetBits (pBs, 8); // level_idc |
| 688 | 750 | ||
| 689 | iSpsId = BsGetUe (pBs); // seq_parameter_set_id | 751 | iSpsId = BsGetUe (pBs); // seq_parameter_set_id |
| 690 | 752 | ||
| 691 | 753 | ||
| @@ -719,7 +781,12 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 27 unmodified lines | |||
| 719 | pCtx->bSpsAvailFlags[iSpsId] = true; // added for EC, 10/28/2009 | 781 | pCtx->bSpsAvailFlags[iSpsId] = true; // added for EC, 10/28/2009 |
| 720 | #endif //MOSAIC_AVOID_BASED_ON_SPS_PPS_ID | 782 | #endif //MOSAIC_AVOID_BASED_ON_SPS_PPS_ID |
| 721 | } | 783 | } |
| 722 | 784 | const SLevelLimits *pSLevelLimits = GetLevelLimits(uiLevelIdc, bConstraintSetFlags[3]); | |
| 785 | if (NULL == pSLevelLimits) { | ||
| 786 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc); | ||
| 787 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | ||
| 788 | } | ||
| 789 | else pSps->pSLevelLimits = pSLevelLimits; | ||
| 723 | // syntax elements in default | 790 | // syntax elements in default |
| 724 | pSps->uiChromaFormatIdc = 1; | 791 | pSps->uiChromaFormatIdc = 1; |
| 725 | pSps->uiBitDepthLuma = | 792 | pSps->uiBitDepthLuma = |