Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 4 files). Show all
Unified · Split
| @@ -273,9 +273,10 @@ void WelsFreeMem (PWelsDecoderContext pCtx) { · 272 unmodified lines | ||
| 273 | 273 | /*! |
| 274 | 274 | * \brief Open decoder |
| 275 | 275 | */ |
| 276 | −void WelsOpenDecoder (PWelsDecoderContext pCtx) { | |
| 276 | +int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) { | |
| 277 | 277 | // function pointers |
| 278 | 278 | //initial MC function pointer-- |
| 279 | + int iRet = ERR_NONE; | |
| 279 | 280 | InitMcFunc (& (pCtx->sMcFunc), pCtx->uiCpuFlag); |
| 280 | 281 | InitErrorCon (pCtx); |
| 281 | 282 | |
| @@ -286,8 +287,9 @@ void WelsOpenDecoder (PWelsDecoderContext pCtx) { · 4 unmodified lines | ||
| 286 | 287 | InitVlcTable (&pCtx->sVlcTable); |
| 287 | 288 | |
| 288 | 289 | // startup memory |
| 289 | − if (ERR_NONE != WelsInitMemory (pCtx)) | |
| 290 | − return; | |
| 290 | + iRet = WelsInitMemory (pCtx); | |
| 291 | + if (ERR_NONE != iRet) | |
| 292 | + return iRet; | |
| 291 | 293 | |
| 292 | 294 | #ifdef LONG_TERM_REF |
| 293 | 295 | pCtx->bParamSetsLostFlag = true; |
| @@ -298,6 +300,7 @@ void WelsOpenDecoder (PWelsDecoderContext pCtx) { · 4 unmodified lines | ||
| 298 | 300 | pCtx->bDecErrorConedFlag = false; //default: decoder normal status |
| 299 | 301 | pCtx->bPrintFrameErrorTraceFlag = true; |
| 300 | 302 | pCtx->iIgnoredErrorInfoPacketCount = 0; |
| 303 | + return iRet; | |
| 301 | 304 | } |
| 302 | 305 | |
| 303 | 306 | /*! |
| @@ -333,6 +336,9 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 29 unmodified lines | ||
| 333 | 336 | |
| 334 | 337 | memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam)); |
| 335 | 338 | pCtx->eOutputColorFormat = pCtx->pParam->eOutputColorFormat; |
| 339 | + int32_t iRet = DecoderSetCsp (pCtx, pCtx->pParam->eOutputColorFormat); | |
| 340 | + if (iRet) | |
| 341 | + return iRet; | |
| 336 | 342 | pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc; |
| 337 | 343 | |
| 338 | 344 | if (VIDEO_BITSTREAM_SVC == pCtx->pParam->sVideoProperty.eVideoBsType || |
| @@ -368,10 +374,7 @@ int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 29 unmodified lines | ||
| 368 | 374 | WelsDecoderDefaults (pCtx, pLogCtx); |
| 369 | 375 | |
| 370 | 376 | // open decoder |
| 371 | − WelsOpenDecoder (pCtx); | |
| 372 | − | |
| 373 | − | |
| 374 | − return ERR_NONE; | |
| 377 | + return WelsOpenDecoder (pCtx); | |
| 375 | 378 | } |
| 376 | 379 | |
| 377 | 380 | /*! |
| @@ -596,9 +599,12 @@ int32_t DecoderSetCsp (PWelsDecoderContext pCtx, const int32_t kiColorFormat) { · 218 unmodified lines | ||
| 596 | 599 | } |
| 597 | 600 | |
| 598 | 601 | //For now, support only videoFormatI420! |
| 599 | − if (kiColorFormat != (int32_t) videoFormatI420) { | |
| 602 | + if (kiColorFormat == (int32_t) videoFormatInternal) { | |
| 603 | + pCtx->pParam->eOutputColorFormat = pCtx->eOutputColorFormat = videoFormatI420; | |
| 604 | + } else if (kiColorFormat != (int32_t) videoFormatI420) { | |
| 600 | 605 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "Support I420 output only for now! Change to I420..."); |
| 601 | 606 | pCtx->pParam->eOutputColorFormat = pCtx->eOutputColorFormat = videoFormatI420; |
| 607 | + return cmUnsupportedData; | |
| 602 | 608 | } |
| 603 | 609 | |
| 604 | 610 | return 0; |