Changeset 471 in SHVCSoftware for branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp
- Timestamp:
- 14 Nov 2013, 21:34:37 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r468 r471 218 218 { 219 219 in>>entry.m_refIdc[i]; 220 }221 }222 #endif223 #if EXTERNAL_USEDBYCURR_N0082224 if(entry.m_numRefPics>0){225 in>>entry.m_UseExtusedByCurrPic;226 if(entry.m_UseExtusedByCurrPic)227 {228 for ( Int i = 0; i < entry.m_numRefPics; i++ )229 {230 in>>entry.m_ExtusedByCurrPic[i];231 }232 220 } 233 221 } … … 944 932 opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry()); 945 933 } 946 #if FINAL_RPL_CHANGE_N0082947 for(Int i=1; i<MAX_GOP+1; i++) {948 std::ostringstream cOSS;949 cOSS<<"FrameEL"<<i;950 opts.addOptions()(cOSS.str(), m_acLayerCfg[1].m_GOPListLayer[i-1], GOPEntry());951 }952 #endif953 934 po::setDefaults(opts); 954 935 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); … … 1701 1682 #endif 1702 1683 1703 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082 1684 1704 1685 Bool verifiedGOP=false; 1705 #endif1706 1686 Bool errorGOP=false; 1707 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N00821708 1687 Int checkGOP=1; 1709 1688 Int numRefs = m_isField ? 2 : 1; 1710 #endif1711 1689 Int refList[MAX_NUM_REF_PICS+1]; 1712 1690 refList[0]=0; … … 1720 1698 isOK[i]=false; 1721 1699 } 1722 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N00821723 1700 Int numOK=0; 1724 #endif1725 1701 #if !SVC_EXTENSION 1726 1702 xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" ); … … 1765 1741 } 1766 1742 #endif 1767 #if FINAL_RPL_CHANGE_N0082 1768 for(UInt layer=0; layer<m_numLayers; layer++) 1769 { 1770 if (m_acLayerCfg[layer].m_GOPListLayer[0].m_POC<0) 1771 { 1772 memcpy( m_acLayerCfg[layer].m_GOPListLayer, m_GOPList, sizeof(GOPEntry)*MAX_GOP ); 1773 } 1774 errorGOP = xconfirmExtraGOP( m_acLayerCfg[layer].m_GOPListLayer ); 1775 xConfirmPara(errorGOP,"Invalid GOP structure given"); 1776 } 1777 #if TEMP_SCALABILITY_FIX 1778 if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6 && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7 && 1779 m_acLayerCfg[1].m_GOPListLayer[5].m_temporalId == 0 && m_acLayerCfg[1].m_GOPListLayer[7].m_temporalId == 0) 1780 #else 1781 //tentative for encoder 1782 if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6 && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7 ) 1783 #endif 1784 { 1785 //RA, POC5 1786 m_acLayerCfg[1].m_GOPListLayer[5].m_usedByCurrPic[2] = 0; 1787 m_acLayerCfg[1].m_GOPListLayer[5].m_refIdc[2] = 0; 1788 //RA, POC7 1789 m_acLayerCfg[1].m_GOPListLayer[7].m_usedByCurrPic[2] = 0; 1790 m_acLayerCfg[1].m_GOPListLayer[7].m_refIdc[2] = 0; 1791 } 1792 #endif 1793 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082 1743 1794 1744 m_extraRPSs=0; 1795 1745 //start looping through frames in coding order until we can verify that the GOP structure is correct. … … 1987 1937 } 1988 1938 xConfirmPara(errorGOP,"Invalid GOP structure given"); 1989 #endif 1990 #if EXTERNAL_USEDBYCURR_N0082 1991 for(UInt layer=0; layer<m_numLayers; layer++) 1992 { 1993 for (Int i=0; i< m_iGOPSize; i++){ 1994 if (m_acLayerCfg[layer].m_GOPListLayer[i].m_UseExtusedByCurrPic == 1 ) 1995 { 1996 for(Int j=0; j<m_acLayerCfg[layer].m_GOPListLayer[i].m_numRefPics; j++ ) 1997 { 1998 m_acLayerCfg[layer].m_GOPListLayer[i].m_usedByCurrPic[j] = m_acLayerCfg[layer].m_GOPListLayer[i].m_ExtusedByCurrPic[j]; 1999 m_acLayerCfg[layer].m_GOPListLayer[i].m_refIdc[j] = m_acLayerCfg[layer].m_GOPListLayer[i].m_ExtusedByCurrPic[j]; 2000 } 2001 } 2002 } 2003 } 2004 #endif 1939 2005 1940 m_maxTempLayer = 1; 2006 1941 for(Int i=0; i<m_iGOPSize; i++) … … 2620 2555 } 2621 2556 2622 #if FINAL_RPL_CHANGE_N00822623 Bool TAppEncCfg::xconfirmExtraGOP (GOPEntry * ge)2624 {2625 Bool verifiedGOP=false;2626 Bool errorGOP=false;2627 Int checkGOP=1;2628 Int numRefs = 1;2629 Int refList[MAX_NUM_REF_PICS+1];2630 refList[0]=0;2631 Bool isOK[MAX_GOP];2632 for(Int i=0; i<MAX_GOP; i++)2633 {2634 isOK[i]=false;2635 }2636 Int numOK=0;2637 2638 m_extraRPSs=0;2639 //start looping through frames in coding order until we can verify that the GOP structure is correct.2640 while(!verifiedGOP&&!errorGOP)2641 {2642 Int curGOP = (checkGOP-1)%m_iGOPSize;2643 Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + ge[curGOP].m_POC;2644 if(ge[curGOP].m_POC<0)2645 {2646 printf("\nError: found fewer Reference Picture Sets than GOPSize\n");2647 errorGOP=true;2648 }2649 else2650 {2651 //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.2652 Bool beforeI = false;2653 for(Int i = 0; i< ge[curGOP].m_numRefPics; i++)2654 {2655 Int absPOC = curPOC+ge[curGOP].m_referencePics[i];2656 if(absPOC < 0)2657 {2658 beforeI=true;2659 }2660 else2661 {2662 Bool found=false;2663 for(Int j=0; j<numRefs; j++)2664 {2665 if(refList[j]==absPOC)2666 {2667 found=true;2668 for(Int k=0; k<m_iGOPSize; k++)2669 {2670 if(absPOC%m_iGOPSize == ge[k].m_POC%m_iGOPSize)2671 {2672 if(ge[k].m_temporalId==ge[curGOP].m_temporalId)2673 {2674 ge[k].m_refPic = true;2675 }2676 ge[curGOP].m_usedByCurrPic[i]=ge[k].m_temporalId<=ge[curGOP].m_temporalId;2677 }2678 }2679 }2680 }2681 if(!found)2682 {2683 printf("\nError: ref pic %d is not available for GOP frame %d\n",ge[curGOP].m_referencePics[i],curGOP+1);2684 errorGOP=true;2685 }2686 }2687 }2688 if(!beforeI&&!errorGOP)2689 {2690 //all ref frames were present2691 if(!isOK[curGOP])2692 {2693 numOK++;2694 isOK[curGOP]=true;2695 if(numOK==m_iGOPSize)2696 {2697 verifiedGOP=true;2698 }2699 }2700 }2701 else2702 {2703 //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)2704 ge[m_iGOPSize+m_extraRPSs]=ge[curGOP];2705 Int newRefs=0;2706 for(Int i = 0; i< ge[curGOP].m_numRefPics; i++)2707 {2708 Int absPOC = curPOC+ge[curGOP].m_referencePics[i];2709 if(absPOC>=0)2710 {2711 ge[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=ge[curGOP].m_referencePics[i];2712 ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=ge[curGOP].m_usedByCurrPic[i];2713 newRefs++;2714 }2715 }2716 Int numPrefRefs = ge[curGOP].m_numRefPicsActive;2717 2718 for(Int offset = -1; offset>-checkGOP; offset--)2719 {2720 //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0.2721 Int offGOP = (checkGOP-1+offset)%m_iGOPSize;2722 Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + ge[offGOP].m_POC;2723 if(offPOC>=0&&ge[offGOP].m_temporalId<=ge[curGOP].m_temporalId)2724 {2725 Bool newRef=false;2726 for(Int i=0; i<numRefs; i++)2727 {2728 if(refList[i]==offPOC)2729 {2730 newRef=true;2731 }2732 }2733 for(Int i=0; i<newRefs; i++)2734 {2735 if(ge[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC)2736 {2737 newRef=false;2738 }2739 }2740 if(newRef)2741 {2742 Int insertPoint=newRefs;2743 //this picture can be added, find appropriate place in list and insert it.2744 if(ge[offGOP].m_temporalId==ge[curGOP].m_temporalId)2745 {2746 ge[offGOP].m_refPic = true;2747 }2748 for(Int j=0; j<newRefs; j++)2749 {2750 if(ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0)2751 {2752 insertPoint = j;2753 break;2754 }2755 }2756 Int prev = offPOC-curPOC;2757 Int prevUsed = ge[offGOP].m_temporalId<=ge[curGOP].m_temporalId;2758 for(Int j=insertPoint; j<newRefs+1; j++)2759 {2760 Int newPrev = ge[m_iGOPSize+m_extraRPSs].m_referencePics[j];2761 Int newUsed = ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j];2762 ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev;2763 ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed;2764 prevUsed=newUsed;2765 prev=newPrev;2766 }2767 newRefs++;2768 }2769 }2770 if(newRefs>=numPrefRefs)2771 {2772 break;2773 }2774 }2775 ge[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs;2776 ge[m_iGOPSize+m_extraRPSs].m_POC = curPOC;2777 if (m_extraRPSs == 0)2778 {2779 ge[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0;2780 ge[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0;2781 }2782 else2783 {2784 Int rIdx = m_iGOPSize + m_extraRPSs - 1;2785 Int refPOC = ge[rIdx].m_POC;2786 Int refPics = ge[rIdx].m_numRefPics;2787 Int newIdc=0;2788 for(Int i = 0; i<= refPics; i++)2789 {2790 Int deltaPOC = ((i != refPics)? ge[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 02791 Int absPOCref = refPOC+deltaPOC;2792 Int refIdc = 0;2793 for (Int j = 0; j < ge[m_iGOPSize+m_extraRPSs].m_numRefPics; j++)2794 {2795 if ( (absPOCref - curPOC) == ge[m_iGOPSize+m_extraRPSs].m_referencePics[j])2796 {2797 if (ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j])2798 {2799 refIdc = 1;2800 }2801 else2802 {2803 refIdc = 2;2804 }2805 }2806 }2807 ge[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc;2808 newIdc++;2809 }2810 ge[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1;2811 ge[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc;2812 ge[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - ge[m_iGOPSize+m_extraRPSs].m_POC;2813 }2814 curGOP=m_iGOPSize+m_extraRPSs;2815 m_extraRPSs++;2816 }2817 numRefs=0;2818 for(Int i = 0; i< ge[curGOP].m_numRefPics; i++)2819 {2820 Int absPOC = curPOC+ge[curGOP].m_referencePics[i];2821 if(absPOC >= 0)2822 {2823 refList[numRefs]=absPOC;2824 numRefs++;2825 }2826 }2827 refList[numRefs]=curPOC;2828 numRefs++;2829 }2830 checkGOP++;2831 }2832 2833 return errorGOP; //update2834 }2835 #endif2836 2557 #endif //SVC_EXTENSION 2837 2558 //! \}
Note: See TracChangeset for help on using the changeset viewer.