Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 5 files). Show all
Unified · Split
| @@ -903,9 +903,6 @@ int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) { · 902 unmodified lines | |||
| 903 | } | 903 | } |
| 904 | 904 | ||
| 905 | int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWidth, const int32_t kiMaxHeight) { | 905 | int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWidth, const int32_t kiMaxHeight) { |
| 906 | const int32_t kiPicStride = ((kiMaxWidth + 15) & 0xfffff0) + (PADDING_LENGTH << 1); | ||
| 907 | const int32_t kiPicLines = ((kiMaxHeight + 15) & 0xfffff0); | ||
| 908 | |||
| 909 | int32_t i = 0; | 906 | int32_t i = 0; |
| 910 | 907 | ||
| 911 | WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pCtx || kiMaxWidth <= 0 || kiMaxHeight <= 0)) | 908 | WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pCtx || kiMaxWidth <= 0 || kiMaxHeight <= 0)) |
| @@ -922,35 +919,11 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 10 unmodified lines | |||
| 922 | do { | 919 | do { |
| 923 | PDqLayer pDq = (PDqLayer)WelsMalloc (sizeof (SDqLayer), "PDqLayer"); | 920 | PDqLayer pDq = (PDqLayer)WelsMalloc (sizeof (SDqLayer), "PDqLayer"); |
| 924 | 921 | ||
| 925 | int32_t iPlaneIdx = 0; | ||
| 926 | |||
| 927 | if (pDq == NULL) | 922 | if (pDq == NULL) |
| 928 | return ERR_INFO_OUT_OF_MEMORY; | 923 | return ERR_INFO_OUT_OF_MEMORY; |
| 929 | 924 | ||
| 930 | memset (pDq, 0, sizeof (SDqLayer)); | 925 | memset (pDq, 0, sizeof (SDqLayer)); |
| 931 | 926 | ||
| 932 | do { | ||
| 933 | const int32_t kiHshift = iPlaneIdx ? 1 : 0; | ||
| 934 | const int32_t kiVshift = kiHshift; | ||
| 935 | const int32_t kiStride = WELS_ALIGN ((kiPicStride >> kiHshift), (16 << (1 - kiHshift))); | ||
| 936 | const int32_t kiLine = (kiPicLines + (PADDING_LENGTH << 1)) >> kiVshift; | ||
| 937 | const int32_t kiSize = kiStride * kiLine; | ||
| 938 | |||
| 939 | pCtx->pCsListXchg[i][iPlaneIdx] = (uint8_t*)WelsMalloc (kiSize * sizeof (uint8_t), "pCtx->pCsListXchg[][]"); | ||
| 940 | |||
| 941 | WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, (NULL == pCtx->pCsListXchg[i][iPlaneIdx])) | ||
| 942 | pCtx->iCsStride[iPlaneIdx] = kiStride; | ||
| 943 | |||
| 944 | |||
| 945 | pCtx->pRsListXchg[i][iPlaneIdx] = (int16_t*)WelsMalloc (kiSize * sizeof (int16_t), "pCtx->pRsListXchg[][]"); | ||
| 946 | |||
| 947 | WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY , (NULL == pCtx->pRsListXchg[i][iPlaneIdx])) | ||
| 948 | pCtx->iRsStride[iPlaneIdx] = kiStride; | ||
| 949 | |||
| 950 | ++ iPlaneIdx; | ||
| 951 | } while (iPlaneIdx < 3); | ||
| 952 | |||
| 953 | |||
| 954 | pCtx->sMb.pMbType[i] = (int8_t*)WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t), | 927 | pCtx->sMb.pMbType[i] = (int8_t*)WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t), |
| 955 | "pCtx->sMb.pMbType[]"); | 928 | "pCtx->sMb.pMbType[]"); |
| 956 | pCtx->sMb.pMv[i][0] = (int16_t (*)[16][2])WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof ( | 929 | pCtx->sMb.pMv[i][0] = (int16_t (*)[16][2])WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof ( |
| @@ -1031,34 +1004,6 @@ void UninitialDqLayersContext (PWelsDecoderContext pCtx) { · 74 unmodified lines | |||
| 1031 | continue; | 1004 | continue; |
| 1032 | } | 1005 | } |
| 1033 | 1006 | ||
| 1034 | if (pCtx->pCsListXchg[i]) { // cs picture | ||
| 1035 | j = 0; | ||
| 1036 | do { | ||
| 1037 | if (NULL != pCtx->pCsListXchg[i][j]) { | ||
| 1038 | WelsFree (pCtx->pCsListXchg[i][j], "pCtx->pCsListXchg[][]"); | ||
| 1039 | |||
| 1040 | pCtx->pCsListXchg[i][j] = NULL; | ||
| 1041 | } | ||
| 1042 | pCtx->iCsStride[j] = 0; | ||
| 1043 | ++ j; | ||
| 1044 | } while (j < 3); | ||
| 1045 | |||
| 1046 | pDq->pCsData[i] = NULL; // for safe | ||
| 1047 | pDq->iCsStride[i] = 0; | ||
| 1048 | } | ||
| 1049 | if (pCtx->pRsListXchg[i]) { | ||
| 1050 | j = 0; | ||
| 1051 | do { | ||
| 1052 | if (NULL != pCtx->pRsListXchg[i][j]) { | ||
| 1053 | WelsFree (pCtx->pRsListXchg[i][j], "pCtx->pRsListXchg[][]"); | ||
| 1054 | |||
| 1055 | pCtx->pRsListXchg[i][j] = NULL; | ||
| 1056 | } | ||
| 1057 | pCtx->iRsStride[j] = 0; | ||
| 1058 | ++ j; | ||
| 1059 | } while (j < 3); | ||
| 1060 | } | ||
| 1061 | |||
| 1062 | if (pCtx->sMb.pMbType[i]) { | 1007 | if (pCtx->sMb.pMbType[i]) { |
| 1063 | WelsFree (pCtx->sMb.pMbType[i], "pCtx->sMb.pMbType[]"); | 1008 | WelsFree (pCtx->sMb.pMbType[i], "pCtx->sMb.pMbType[]"); |
| 1064 | 1009 | ||
| @@ -1652,13 +1597,6 @@ int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, const bo · 587 unmodified lines | |||
| 1652 | 1597 | ||
| 1653 | void InitCurDqLayerData (PWelsDecoderContext pCtx, PDqLayer pCurDq) { | 1598 | void InitCurDqLayerData (PWelsDecoderContext pCtx, PDqLayer pCurDq) { |
| 1654 | if (NULL != pCtx && NULL != pCurDq) { | 1599 | if (NULL != pCtx && NULL != pCurDq) { |
| 1655 | pCurDq->pCsData[0] = pCtx->pCsListXchg[0][0]; | ||
| 1656 | pCurDq->pCsData[1] = pCtx->pCsListXchg[0][1]; | ||
| 1657 | pCurDq->pCsData[2] = pCtx->pCsListXchg[0][2]; | ||
| 1658 | pCurDq->iCsStride[0] = pCtx->iCsStride[0]; | ||
| 1659 | pCurDq->iCsStride[1] = pCtx->iCsStride[1]; | ||
| 1660 | pCurDq->iCsStride[2] = pCtx->iCsStride[2]; | ||
| 1661 | |||
| 1662 | pCurDq->pMbType = pCtx->sMb.pMbType[0]; | 1600 | pCurDq->pMbType = pCtx->sMb.pMbType[0]; |
| 1663 | pCurDq->pSliceIdc = pCtx->sMb.pSliceIdc[0]; | 1601 | pCurDq->pSliceIdc = pCtx->sMb.pSliceIdc[0]; |
| 1664 | pCurDq->pMv[0] = pCtx->sMb.pMv[0][0]; | 1602 | pCurDq->pMv[0] = pCtx->sMb.pMv[0][0]; |