! * \brief make sure synchonozization picture resolution (get from slice header) among different parts (i.e, memory related and so on) * over decoder internal * ( MB coordinate and parts of data within decoder context structure ) * \param pCtx Wels decoder context * \param iMbWidth MB width * \pram iMbHeight MB height * \return 0 - successful; none 0 - somethi
| 945 | * \return 0 - successful; none 0 - something wrong |
| 946 | */ |
| 947 | int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight) { |
| 948 | int32_t iErr = ERR_NONE; |
| 949 | const int32_t kiPicWidth = kiMbWidth << 4; |
| 950 | const int32_t kiPicHeight = kiMbHeight << 4; |
| 951 | //fix Bugzilla Bug1479656 reallocate temp dec picture |
| 952 | if (pCtx->pTempDec != NULL && (pCtx->pTempDec->iWidthInPixel != kiPicWidth |
| 953 | || pCtx->pTempDec->iHeightInPixel != kiPicHeight)) { |
| 954 | FreePicture (pCtx->pTempDec, pCtx->pMemAlign); |
| 955 | pCtx->pTempDec = AllocPicture (pCtx, pCtx->pSps->iMbWidth << 4, pCtx->pSps->iMbHeight << 4); |
| 956 | } |
| 957 | bool bReallocFlag = false; |
| 958 | iErr = WelsRequestMem (pCtx, kiMbWidth, kiMbHeight, bReallocFlag); // common memory used |
| 959 | if (ERR_NONE != iErr) { |
| 960 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, |
| 961 | "SyncPictureResolutionExt()::WelsRequestMem--buffer allocated failure."); |
| 962 | pCtx->iErrorCode |= dsOutOfMemory; |
| 963 | return iErr; |
| 964 | } |
| 965 | |
| 966 | iErr = InitialDqLayersContext (pCtx, kiPicWidth, kiPicHeight); |
| 967 | if (ERR_NONE != iErr) { |
| 968 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, |
| 969 | "SyncPictureResolutionExt()::InitialDqLayersContext--buffer allocated failure."); |
| 970 | pCtx->iErrorCode |= dsOutOfMemory; |
| 971 | } |
| 972 | #if defined(MEMORY_MONITOR) |
| 973 | if (bReallocFlag) { |
| 974 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "SyncPictureResolutionExt(), overall memory usage: %llu bytes", |
| 975 | static_cast<unsigned long long> (sizeof (SWelsDecoderContext) + pCtx->pMemAlign->WelsGetMemoryUsage())); |
| 976 | } |
| 977 | #endif//MEMORY_MONITOR |
| 978 | return iErr; |
| 979 | } |
| 980 | |
| 981 | void InitDecFuncs (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { |
| 982 | WelsBlockFuncInit (&pCtx->sBlockFunc, uiCpuFlag); |
no test coverage detected