History

use the same frame type EVideoFrameType in encoder internal

ruil2 committed 12 years ago

Commit e74f01a1 parent fc4cd8b7 files · +33 −85Browse files

Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 7 files). Show all

Unified · Split

codec/encoder/plus/src/welsEncoderExt.cpp+7−48
@@ -510,25 +510,8 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn · 509 unmodified lines
510 }510 }
511 511
512 const int32_t kiEncoderReturn = EncodeFrameInternal(kpSrcPic, pBsInfo);512 const int32_t kiEncoderReturn = EncodeFrameInternal(kpSrcPic, pBsInfo);
513 513 if(kiEncoderReturn != cmResultSuccess)
514 switch (kiEncoderReturn) {514 return kiEncoderReturn;
515 case ENC_RETURN_MEMALLOCERR:
516 WelsUninitEncoderExt (&m_pEncContext);
517 return cmMallocMemeError;
518 case ENC_RETURN_SUCCESS:
519 case ENC_RETURN_CORRECTED:
520 break;//continue processing
521 case ENC_RETURN_UNSUPPORTED_PARA:
522 return cmUnsupportedData;
523 break;
524 case ENC_RETURN_UNEXPECTED:
525 return cmUnkonwReason;
526 default:
527 WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from WelsEncoderEncodeExt()!\n", kiEncoderReturn);
528 return cmUnkonwReason;
529 }
530
531
532#ifdef REC_FRAME_COUNT515#ifdef REC_FRAME_COUNT
533 ++ m_uiCountFrameNum;516 ++ m_uiCountFrameNum;
534 WelsLog (m_pEncContext, WELS_LOG_INFO,517 WelsLog (m_pEncContext, WELS_LOG_INFO,
@@ -544,47 +527,23 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn · 9 unmodified lines
544 527
545int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFrameBSInfo* pBsInfo) {528int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFrameBSInfo* pBsInfo) {
546 if (!(pSrcPic && m_pEncContext && m_bInitialFlag) ){529 if (!(pSrcPic && m_pEncContext && m_bInitialFlag) ){
547 return videoFrameTypeInvalid;530 return cmInitParaError;
548 }531 }
549 532
550 int32_t iFrameTypeReturned = 0;
551 int32_t iFrameType = videoFrameTypeInvalid;
552 const int32_t kiEncoderReturn = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPic);533 const int32_t kiEncoderReturn = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPic);
553 534
554 if(kiEncoderReturn == ENC_RETURN_MEMALLOCERR) {535 if(kiEncoderReturn == ENC_RETURN_MEMALLOCERR) {
555 WelsUninitEncoderExt (&m_pEncContext);536 WelsUninitEncoderExt (&m_pEncContext);
556 return videoFrameTypeInvalid;537 return cmMallocMemeError;
557 }538 }
558 else if((kiEncoderReturn != ENC_RETURN_SUCCESS)&&(kiEncoderReturn == ENC_RETURN_CORRECTED)){539 else if((kiEncoderReturn != ENC_RETURN_SUCCESS)&&(kiEncoderReturn == ENC_RETURN_CORRECTED)){
559 WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from EncodeFrameInternal()!\n", kiEncoderReturn);540 WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from EncodeFrameInternal()!\n", kiEncoderReturn);
560 return videoFrameTypeInvalid;541 return cmUnkonwReason;
561 }542 }
562 543
563 iFrameTypeReturned = pBsInfo->eOutputFrameType;
564 switch (iFrameTypeReturned) {
565 case WELS_FRAME_TYPE_P:
566 iFrameType = videoFrameTypeP;
567 break;
568 case WELS_FRAME_TYPE_IDR:
569 iFrameType = videoFrameTypeIDR;
570 break;
571 case WELS_FRAME_TYPE_SKIP:
572 iFrameType = videoFrameTypeSkip;
573 break;
574 case WELS_FRAME_TYPE_I:
575 iFrameType = videoFrameTypeI;
576 break;
577 case WELS_FRAME_TYPE_AUTO:
578 case WELS_FRAME_TYPE_B: // not support B pictures
579 iFrameType = videoFrameTypeInvalid;
580 break;
581 default:
582 break;
583 }
584 pBsInfo->eOutputFrameType = iFrameType;
585 ///////////////////for test544 ///////////////////for test
586#ifdef OUTPUT_BIT_STREAM545#ifdef OUTPUT_BIT_STREAM
587 if (iFrameType != videoFrameTypeInvalid && iFrameType != videoFrameTypeSkip) {546 if (pBsInfo->eOutputFrameType != videoFrameTypeInvalid && pBsInfo->eOutputFrameType != videoFrameTypeSkip) {
588 SLayerBSInfo* pLayer = NULL;547 SLayerBSInfo* pLayer = NULL;
589 int32_t i = 0, j = 0, iCurLayerBits = 0, total_bits = 0;548 int32_t i = 0, j = 0, iCurLayerBits = 0, total_bits = 0;
590 549
@@ -629,7 +588,7 @@ int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFr · 38 unmodified lines
629 DumpSrcPicture (pSrcPicList[0]->pData[0]);588 DumpSrcPicture (pSrcPicList[0]->pData[0]);
630#endif // DUMP_SRC_PICTURE589#endif // DUMP_SRC_PICTURE
631 590
632 return kiEncoderReturn;591 return cmResultSuccess;
633 592
634}593}
635 594

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t