diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp index 691ee19002bef06ca87545e4763d889abca9a395..4d73fe03bc8cc93cfded767918f5eabfb6069f2f 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp @@ -217,19 +217,25 @@ void AdaptiveLoopFilter::create( const int picWidth, const int picHeight, const // Laplacian based activity for( int i = 0; i < NUM_DIRECTIONS; i++ ) { - m_laplacian[i] = new int*[m_CLASSIFICATION_BLK_SIZE + 5]; - - for( int y = 0; y < m_CLASSIFICATION_BLK_SIZE + 5; y++ ) + if ( m_laplacian[i] == nullptr ) { - m_laplacian[i][y] = new int[m_CLASSIFICATION_BLK_SIZE + 5]; + m_laplacian[i] = new int*[m_CLASSIFICATION_BLK_SIZE + 5]; + + for( int y = 0; y < m_CLASSIFICATION_BLK_SIZE + 5; y++ ) + { + m_laplacian[i][y] = new int[m_CLASSIFICATION_BLK_SIZE + 5]; + } } } // Classification - m_classifier = new AlfClassifier*[picHeight]; - for( int i = 0; i < picHeight; i++ ) + if ( m_classifier == nullptr ) { - m_classifier[i] = new AlfClassifier[picWidth]; + m_classifier = new AlfClassifier*[picHeight]; + for( int i = 0; i < picHeight; i++ ) + { + m_classifier[i] = new AlfClassifier[picWidth]; + } } } diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index ff9d98696936e496f56118f7be3550ac5a54b736..a5fc7ebfc9ec352353dc067b5bd19d467ccbb31d 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -195,7 +195,7 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i ctx += leftCTUAddr > -1 ? ( ctbAlfFlag[leftCTUAddr] ? 1 : 0 ) : 0; ctx += aboveCTUAddr > -1 ? ( ctbAlfFlag[aboveCTUAddr] ? 1 : 0 ) : 0; - if( alfSliceParam.chromaCtbPresentFlag && compIdx ) + if( compIdx && alfSliceParam.chromaCtbPresentFlag ) { ctbAlfFlag[ctuRsAddr] = 1; }