Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 4 files). Show all
Unified · Split
| @@ -51,6 +51,7 @@ · 50 unmodified lines | ||
| 51 | 51 | //#include "macros.h" |
| 52 | 52 | #include "decoder.h" |
| 53 | 53 | #include "decoder_core.h" |
| 54 | +#include "error_concealment.h" | |
| 54 | 55 | |
| 55 | 56 | extern "C" { |
| 56 | 57 | #include "decoder_core.h" |
| @@ -263,10 +264,17 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) { · 206 unmodified lines | ||
| 263 | 264 | |
| 264 | 265 | return cmResultSuccess; |
| 265 | 266 | } else if (eOptID == DECODER_OPTION_ERROR_CON_IDC) { // Indicate error concealment status |
| 266 | − WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, | |
| 267 | − "CWelsDecoder::SetOption for ERROR_CON_IDC not permmited! Current eErrorConMethod = %d. Value can be set in Initialize() only!", | |
| 268 | − (int32_t) m_pDecContext->eErrorConMethod); | |
| 269 | − return cmInitParaError; | |
| 267 | + if (pOption == NULL) | |
| 268 | + return cmInitParaError; | |
| 269 | + | |
| 270 | + iVal = * ((int*)pOption); // int value for error concealment idc | |
| 271 | + iVal = WELS_CLIP3 (iVal, (int32_t) ERROR_CON_DISABLE, (int32_t) ERROR_CON_SLICE_COPY); | |
| 272 | + m_pDecContext->eErrorConMethod = (ERROR_CON_IDC) iVal; | |
| 273 | + InitErrorCon (m_pDecContext); | |
| 274 | + WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | |
| 275 | + "CWelsDecoder::SetOption for ERROR_CON_IDC = %d.", iVal); | |
| 276 | + | |
| 277 | + return cmResultSuccess; | |
| 270 | 278 | } else if (eOptID == DECODER_OPTION_TRACE_LEVEL) { |
| 271 | 279 | if (m_pWelsTrace) { |
| 272 | 280 | uint32_t level = * ((uint32_t*)pOption); |
| @@ -422,11 +430,17 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 149 unmodified lines | ||
| 422 | 430 | m_pDecContext->iIgnoredErrorInfoPacketCount = 0; |
| 423 | 431 | } |
| 424 | 432 | } |
| 425 | − return (DECODING_STATE)m_pDecContext->iErrorCode; | |
| 426 | − } else { //decoding correct, but may have ECed status | |
| 427 | − if (m_pDecContext->bDecErrorConedFlag) { | |
| 433 | + if ((m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE) && (pDstInfo->iBufferStatus == 1)) { | |
| 434 | + //TODO after dec status updated | |
| 435 | + m_pDecContext->bDecErrorConedFlag = true; | |
| 428 | 436 | m_pDecContext->iErrorCode |= dsDataErrorConcealed; |
| 429 | − return dsDataErrorConcealed; | |
| 437 | + } | |
| 438 | + return (DECODING_STATE) m_pDecContext->iErrorCode; | |
| 439 | + } else { //decoding correct, but may have ECed status | |
| 440 | + if (m_pDecContext->bDecErrorConedFlag) { //TODO after dec status updated | |
| 441 | + if (m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE) //EC is on | |
| 442 | + m_pDecContext->iErrorCode |= dsDataErrorConcealed; | |
| 443 | + return (DECODING_STATE) m_pDecContext->iErrorCode; | |
| 430 | 444 | } |
| 431 | 445 | } |
| 432 | 446 | |