diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp
index e28ab94fd416dfda56b4ef2057dfa2a99948f714..e77d62d39535f6ba860c3331e6b8fadb7fba73a7 100644
--- a/source/Lib/CommonLib/LoopFilter.cpp
+++ b/source/Lib/CommonLib/LoopFilter.cpp
@@ -438,6 +438,10 @@ void LoopFilter::xSetLoopfilterParam( const CodingUnit& cu )
 
 unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const Position& localPos ) const
 {
+#if JVET_M0471_LONG_DEBLOCKING_FILTERS
+  // The boundary strength that is output by the function xGetBoundaryStrengthSingle is a multi component boundary strength that contains boundary strength for luma (bits 0 to 1), cb (bits 2 to 3) and cr (bits 4 to 5).
+#endif
+
   const Slice& sliceQ = *cu.slice;
 
   const Position& cuPosLuma = cu.lumaPos();
@@ -455,13 +459,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
   if( ( MODE_INTRA == cuP.predMode ) || ( MODE_INTRA == cuQ.predMode ) )
   {
 #if JVET_M0471_LONG_DEBLOCKING_FILTERS
-    // The boundary strength that is output by the function xGetBoundaryStrengthSingle is a temporary boundary strength that contains both info for luma and chroma, where specific chroma component information related to chroma component cbf also is included.
-    // In addition to filter a chroma component if P or Q is intra, a chroma component can also be filtered if P and Q has non-zero chroma component tu coefficents. 
-    // Both luma and chroma can be filtered with a boundary strength of 2 when the temporary boundary strength is 16 (indicating intra)
-    // Luma can be filtered with a boundary strength of 1 if the temporary boundary strength is 8, 10, 12, 14 (indicating non-zero luma coeffs), or 1, 3, 5 or 7 (indicating motion difference)
-    // Chroma Cb component can be filtered with a boundary strength of 1 if the temporary boundary strength is 4,5,6,7,12 or 14 (indicating non-zero chroma Cb coeffs)
-    // Chroma Cr component can be filtered with a boundary strength of 1 if the temporary boundary strength is 2,3,6,7,10 or 14 (indicating non-zero chroma Cr coeffs)
-    return 16;
+    return (BsSet(2, COMPONENT_Y) + BsSet(2, COMPONENT_Cb) + BsSet(2, COMPONENT_Cr));
 #else
     return 2;
 #endif
@@ -478,19 +476,19 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
   // Y
   if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Y) || TU::getCbf(tuP, COMPONENT_Y)))
   {
-      tmpBs += 8;
+    tmpBs += BsSet(1, COMPONENT_Y);
   }
   // U
   if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cb) || TU::getCbf(tuP, COMPONENT_Cb)))
   {
-    tmpBs += 4;
+    tmpBs += BsSet(1, COMPONENT_Cb);
   }
   // V
   if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cr) || TU::getCbf(tuP, COMPONENT_Cr)))
   {
-    tmpBs += 2;
+    tmpBs += BsSet(1, COMPONENT_Cr);
   }
-  if ((tmpBs >> 3) & 0x01)
+  if (BsGet(tmpBs, COMPONENT_Y) == 1)
   {
     return tmpBs;
   }
@@ -684,20 +682,7 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge
 
     uiBsAbsIdx = getRasterIdx( pos, pcv );
 #if JVET_M0471_LONG_DEBLOCKING_FILTERS
-    unsigned tmpBs = m_aapucBS[edgeDir][uiBsAbsIdx];
-
-    if ((tmpBs >> 4) & 0x01)
-    {
-      uiBs = 2;
-    }
-    else if (((tmpBs >> 3) & 0x01) || (tmpBs & 0x01))
-    {
-      uiBs = 1;
-    }
-    else
-    {
-      uiBs = 0;
-    }
+    uiBs = BsGet(m_aapucBS[edgeDir][uiBsAbsIdx], COMPONENT_Y);
 #else
     uiBs       = m_aapucBS[edgeDir][uiBsAbsIdx];
 #endif
@@ -945,9 +930,10 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
   unsigned uiNumParts =  ( edgeDir == EDGE_VER ) ? lumaSize.height / pcv.minCUHeight : lumaSize.width / pcv.minCUWidth ;
   int   uiNumPelsLuma = pcv.minCUWidth;
   unsigned uiBsAbsIdx;
-  unsigned ucBs;
 #if JVET_M0471_LONG_DEBLOCKING_FILTERS
-  bool dfChroma[2];
+  unsigned bS[2];
+#else
+  unsigned ucBs;
 #endif
 
   Pel* piTmpSrcCb = piSrcCb;
@@ -989,27 +975,15 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
 #if JVET_M0471_LONG_DEBLOCKING_FILTERS
     unsigned tmpBs = m_aapucBS[edgeDir][uiBsAbsIdx];
 
-    if ((tmpBs >> 4) & 0x01)
-    {
-        ucBs = 2;
-    }
-    else if (((tmpBs >> 2) & 0x01) || ((tmpBs >> 1) & 0x01)) // cbf_cb or cbf_cr only
-    {
-        ucBs = 1;
-    }
-    else
-    {
-        ucBs = 0;
-    }
-
-    dfChroma[0] = ((((tmpBs >> 4) & 0x01) == 1) || (((tmpBs >> 2) & 0x01) == 1)); // cb
-    dfChroma[1] = ((((tmpBs >> 4) & 0x01) == 1) || (((tmpBs >> 1) & 0x01) == 1)); // cr
+    tmpBs = m_aapucBS[edgeDir][uiBsAbsIdx];
+    bS[0] = BsGet(tmpBs, COMPONENT_Cb);
+    bS[1] = BsGet(tmpBs, COMPONENT_Cr);
 #else
     ucBs       = m_aapucBS[edgeDir][uiBsAbsIdx];
 #endif
 
 #if JVET_M0471_LONG_DEBLOCKING_FILTERS
-    if (ucBs > 0)
+    if (bS[0] > 0 || bS[1] > 0)
 #else
     if (ucBs > 1)
 #endif
@@ -1061,13 +1035,11 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
         largeBoundary = false;
       }
 
-      if ((ucBs == 2) || (largeBoundary && (ucBs == 1)))
-      {
 #endif
       for( int chromaIdx = 0; chromaIdx < 2; chromaIdx++ )
       {
 #if JVET_M0471_LONG_DEBLOCKING_FILTERS
-        if (dfChroma[chromaIdx])
+        if ((bS[chromaIdx] == 2) || (largeBoundary && (bS[chromaIdx] == 1)))
         {
 #endif
         const ClpRng& clpRng( cu.cs->slice->clpRng( ComponentID( chromaIdx + 1 )) );
@@ -1091,7 +1063,11 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
           iQP = getScaledChromaQP(iQP, sps.getChromaFormatIdc());
         }
 
+#if JVET_M0471_LONG_DEBLOCKING_FILTERS
+        const int iIndexTC = Clip3<int>(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET * (bS[chromaIdx] - 1) + (tcOffsetDiv2 << 1));
+#else
         const int iIndexTC = Clip3<int>( 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET*( ucBs - 1 ) + ( tcOffsetDiv2 << 1 ) );
+#endif
         const int iTc      = sm_tcTable[iIndexTC] * iBitdepthScale;
 
 #if JVET_M0471_LONG_DEBLOCKING_FILTERS
@@ -1139,9 +1115,6 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
         }
 #endif
       }
-#if JVET_M0471_LONG_DEBLOCKING_FILTERS
-      }// if ((ucBs == 2) || (bLBs && (ucBs == 1)))
-#endif
     }
   }
 }
@@ -1519,4 +1492,9 @@ inline int LoopFilter::xCalcDQ( Pel* piSrc, const int iOffset ) const
   return abs( piSrc[0] - 2 * piSrc[iOffset] + piSrc[iOffset * 2] );
 }
 
+#if JVET_M0471_LONG_DEBLOCKING_FILTERS
+inline unsigned LoopFilter::BsSet(unsigned val, const ComponentID compIdx) const { return (val << (compIdx << 1)); }
+inline unsigned LoopFilter::BsGet(unsigned val, const ComponentID compIdx) const { return ((val >> (compIdx << 1)) & 3); }
+#endif
+
 //! \}
diff --git a/source/Lib/CommonLib/LoopFilter.h b/source/Lib/CommonLib/LoopFilter.h
index fa3b39e7bec534e4282ebfcd61e634467ba851c7..2e251100cfe29d2a68e29dc6e9e8f400bbfe6981 100644
--- a/source/Lib/CommonLib/LoopFilter.h
+++ b/source/Lib/CommonLib/LoopFilter.h
@@ -92,6 +92,8 @@ private:
   inline void xPelFilterLuma      ( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const int iThrCut, const bool bFilterSecondP, const bool bFilterSecondQ, const ClpRng& clpRng, bool sidePisLarge = false, bool sideQisLarge = false, int maxFilterLengthP = 7, int maxFilterLengthQ = 7 ) const;
   inline void xPelFilterChroma    ( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const ClpRng& clpRng, const bool largeBoundary ) const;
   inline bool xUseStrongFiltering ( Pel* piSrc, const int iOffset, const int d, const int beta, const int tc, bool sidePisLarge = false, bool sideQisLarge = false, int maxFilterLengthP = 7, int maxFilterLengthQ = 7 ) const;//move the computation outside the function
+  inline unsigned BsSet(unsigned val, const ComponentID compIdx) const;
+  inline unsigned BsGet(unsigned val, const ComponentID compIdx) const;
 #else
   inline void xPelFilterLuma      ( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const int iThrCut, const bool bFilterSecondP, const bool bFilterSecondQ, const ClpRng& clpRng ) const;
   inline void xPelFilterChroma    ( Pel* piSrc, const int iOffset, const int tc,                const bool bPartPNoFilter, const bool bPartQNoFilter,                                                                          const ClpRng& clpRng ) const;