Changeset 434 in SHVCSoftware
- Timestamp:
- 11 Oct 2013, 20:27:16 (11 years ago)
- Location:
- branches/SHM-3.1-dev/source/Lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.cpp
r431 r434 842 842 } 843 843 #endif 844 #if ALIGN_TSA_STSA_PICS 845 if( m_apcSlicePilot->getLayerId() > 0 ) 846 { 847 // Check for TSA alignment 848 if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 849 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R 850 ) 851 { 852 for(Int dependentLayerIdx = 0; dependentLayerIdx < m_apcSlicePilot->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++) 853 { 854 TComList<TComPic*> *cListPic = getRefLayerDec( dependentLayerIdx )->getListPic(); 855 TComPic* refpicLayer = m_apcSlicePilot->getRefPic(*cListPic, m_apcSlicePilot->getPOC() ); 856 if( refpicLayer ) 857 { 858 assert( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 859 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R ); // TSA pictures should be aligned among depenedent layers 860 } 861 } 862 } 863 // Check for STSA alignment 864 if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 865 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R 866 ) 867 { 868 for(Int dependentLayerIdx = 0; dependentLayerIdx < m_apcSlicePilot->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++) 869 { 870 TComList<TComPic*> *cListPic = getRefLayerDec( dependentLayerIdx )->getListPic(); 871 TComPic* refpicLayer = m_apcSlicePilot->getRefPic(*cListPic, m_apcSlicePilot->getPOC() ); // STSA pictures should be aligned among dependent layers 872 if( refpicLayer ) 873 874 { 875 assert( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 876 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R ); 877 } 878 } 879 } 880 } 881 #endif 844 882 //detect lost reference picture and insert copy of earlier frame. 845 883 Int lostPoc; -
branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r431 r434 874 874 if(pcSlice->isTemporalLayerSwitchingPoint(rcListPic) || pcSlice->getSPS()->getTemporalIdNestingFlag()) 875 875 { 876 if(pcSlice->getTemporalLayerNonReferenceFlag())877 {878 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TSA_N);879 }880 else881 {882 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R);883 }884 876 #if ALIGN_TSA_STSA_PICS 885 877 if( pcSlice->getLayerId() > 0 ) 886 878 { 887 for(Int i = 0; i < pcSlice->getLayerId(); i++) 879 Bool oneRefLayerTSA = false, oneRefLayerNotTSA = false; 880 for( Int i = 0; i < pcSlice->getLayerId(); i++) 888 881 { 889 TComList<TComPic *> *cListPic = m_ppcTEncTop[i]->getListPic();890 TComPic * lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC());891 if( lowerLayerPic ) // If picture exists in Layer i882 TComList<TComPic *> *cListPic = m_ppcTEncTop[i]->getListPic(); 883 TComPic *lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC()); 884 if( lowerLayerPic && pcSlice->getVPS()->getDirectDependencyFlag(pcSlice->getLayerId(), i) ) 892 885 { 893 assert( ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ) || 894 ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R ) ); 895 // TSA pictures are aligned within an access unit. 886 if( ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ) || 887 ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R ) 888 ) 889 { 890 if(pcSlice->getTemporalLayerNonReferenceFlag() ) 891 { 892 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TSA_N); 893 } 894 else 895 { 896 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R ); 897 } 898 oneRefLayerTSA = true; 899 } 900 else 901 { 902 oneRefLayerNotTSA = true; 903 } 896 904 } 897 905 } 906 assert( !( oneRefLayerNotTSA && oneRefLayerTSA ) ); // Only one variable should be true - failure of this assert means 907 // that two independent reference layers that are not dependent on 908 // each other, but are reference for current layer have inconsistency 909 if( oneRefLayerNotTSA /*&& !oneRefLayerTSA*/ ) // No reference layer is TSA - set current as TRAIL 910 { 911 if(pcSlice->getTemporalLayerNonReferenceFlag() ) 912 { 913 pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_N ); 914 } 915 else 916 { 917 pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_R ); 918 } 919 } 920 else // This means there is no reference layer picture for current picture in this AU 921 { 922 if(pcSlice->getTemporalLayerNonReferenceFlag() ) 923 { 924 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TSA_N); 925 } 926 else 927 { 928 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R ); 929 } 930 } 931 } 932 #else 933 if(pcSlice->getTemporalLayerNonReferenceFlag()) 934 { 935 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TSA_N); 936 } 937 else 938 { 939 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R); 898 940 } 899 941 #endif … … 931 973 if(isSTSA==true) 932 974 { 975 #if ALIGN_TSA_STSA_PICS 976 if( pcSlice->getLayerId() > 0 ) 977 { 978 Bool oneRefLayerSTSA = false, oneRefLayerNotSTSA = false; 979 for( Int i = 0; i < pcSlice->getLayerId(); i++) 980 { 981 TComList<TComPic *> *cListPic = m_ppcTEncTop[i]->getListPic(); 982 TComPic *lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC()); 983 if( lowerLayerPic && pcSlice->getVPS()->getDirectDependencyFlag(pcSlice->getLayerId(), i) ) 984 { 985 if( ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ) || 986 ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R ) 987 ) 988 { 989 if(pcSlice->getTemporalLayerNonReferenceFlag() ) 990 { 991 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N); 992 } 993 else 994 { 995 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R ); 996 } 997 oneRefLayerSTSA = true; 998 } 999 else 1000 { 1001 oneRefLayerNotSTSA = true; 1002 } 1003 } 1004 } 1005 assert( !( oneRefLayerNotSTSA && oneRefLayerSTSA ) ); // Only one variable should be true - failure of this assert means 1006 // that two independent reference layers that are not dependent on 1007 // each other, but are reference for current layer have inconsistency 1008 if( oneRefLayerNotSTSA /*&& !oneRefLayerSTSA*/ ) // No reference layer is STSA - set current as TRAIL 1009 { 1010 if(pcSlice->getTemporalLayerNonReferenceFlag() ) 1011 { 1012 pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_N ); 1013 } 1014 else 1015 { 1016 pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_R ); 1017 } 1018 } 1019 else // This means there is no reference layer picture for current picture in this AU 1020 { 1021 if(pcSlice->getTemporalLayerNonReferenceFlag() ) 1022 { 1023 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N); 1024 } 1025 else 1026 { 1027 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R ); 1028 } 1029 } 1030 } 1031 #else 933 1032 if(pcSlice->getTemporalLayerNonReferenceFlag()) 934 1033 { … … 938 1037 { 939 1038 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R); 940 }941 #if ALIGN_TSA_STSA_PICS942 if( pcSlice->getLayerId() > 0 )943 {944 for(Int i = 0; i < pcSlice->getLayerId(); i++)945 {946 TComList<TComPic*> *cListPic = m_ppcTEncTop[i]->getListPic();947 TComPic* lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC() );948 if( lowerLayerPic ) // If picture exists in Layer i949 {950 assert( ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ) ||951 ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R ) );952 }953 // STSA pictures are aligned within an access unit.954 }955 1039 } 956 1040 #endif
Note: See TracChangeset for help on using the changeset viewer.