Index: /branches/SHM-dev/cfg/encoder_intra_scalable.cfg
===================================================================
--- /branches/SHM-dev/cfg/encoder_intra_scalable.cfg	(revision 1321)
+++ /branches/SHM-dev/cfg/encoder_intra_scalable.cfg	(revision 1322)
@@ -44,6 +44,5 @@
 
 #=========== Deblock Filter ============
-DeblockingFilterControlPresent: 0           # Dbl control params present (0=not present, 1=present)
-LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
+LoopFilterOffsetInPPS         : 1           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1 (default) =constant params in PPS, param = base_param)
 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
 LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
Index: /branches/SHM-dev/cfg/encoder_intra_scalable10.cfg
===================================================================
--- /branches/SHM-dev/cfg/encoder_intra_scalable10.cfg	(revision 1321)
+++ /branches/SHM-dev/cfg/encoder_intra_scalable10.cfg	(revision 1322)
@@ -43,6 +43,5 @@
 
 #=========== Deblock Filter ============
-DeblockingFilterControlPresent: 0           # Dbl control params present (0=not present, 1=present)
-LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
+LoopFilterOffsetInPPS         : 1           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1 (default) =constant params in PPS, param = base_param)
 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
 LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
Index: /branches/SHM-dev/cfg/encoder_lowdelay_P_scalable.cfg
===================================================================
--- /branches/SHM-dev/cfg/encoder_lowdelay_P_scalable.cfg	(revision 1321)
+++ /branches/SHM-dev/cfg/encoder_lowdelay_P_scalable.cfg	(revision 1322)
@@ -51,6 +51,5 @@
 
 #=========== Deblock Filter ============
-DeblockingFilterControlPresent: 0           # Dbl control params present (0=not present, 1=present)
-LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
+LoopFilterOffsetInPPS         : 1           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1 (default) =constant params in PPS, param = base_param)
 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
 LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
Index: /branches/SHM-dev/cfg/encoder_lowdelay_P_scalable10.cfg
===================================================================
--- /branches/SHM-dev/cfg/encoder_lowdelay_P_scalable10.cfg	(revision 1321)
+++ /branches/SHM-dev/cfg/encoder_lowdelay_P_scalable10.cfg	(revision 1322)
@@ -51,6 +51,5 @@
 
 #=========== Deblock Filter ============
-DeblockingFilterControlPresent: 0           # Dbl control params present (0=not present, 1=present)
-LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
+LoopFilterOffsetInPPS         : 1           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1 (default) =constant params in PPS, param = base_param)
 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
 LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
Index: /branches/SHM-dev/cfg/encoder_lowdelay_scalable.cfg
===================================================================
--- /branches/SHM-dev/cfg/encoder_lowdelay_scalable.cfg	(revision 1321)
+++ /branches/SHM-dev/cfg/encoder_lowdelay_scalable.cfg	(revision 1322)
@@ -49,6 +49,5 @@
 
 #=========== Deblock Filter ============
-DeblockingFilterControlPresent: 0           # Dbl control params present (0=not present, 1=present)
-LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
+LoopFilterOffsetInPPS         : 1           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1 (default) =constant params in PPS, param = base_param)
 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
 LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
Index: /branches/SHM-dev/cfg/encoder_lowdelay_scalable10.cfg
===================================================================
--- /branches/SHM-dev/cfg/encoder_lowdelay_scalable10.cfg	(revision 1321)
+++ /branches/SHM-dev/cfg/encoder_lowdelay_scalable10.cfg	(revision 1322)
@@ -49,6 +49,5 @@
 
 #=========== Deblock Filter ============
-DeblockingFilterControlPresent: 0           # Dbl control params present (0=not present, 1=present)
-LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
+LoopFilterOffsetInPPS         : 1           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1 (default) =constant params in PPS, param = base_param)
 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
 LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
Index: /branches/SHM-dev/cfg/encoder_randomaccess_scalable.cfg
===================================================================
--- /branches/SHM-dev/cfg/encoder_randomaccess_scalable.cfg	(revision 1321)
+++ /branches/SHM-dev/cfg/encoder_randomaccess_scalable.cfg	(revision 1322)
@@ -53,6 +53,5 @@
 
 #=========== Deblock Filter ============
-DeblockingFilterControlPresent: 0           # Dbl control params present (0=not present, 1=present)
-LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
+LoopFilterOffsetInPPS         : 1           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1 (default) =constant params in PPS, param = base_param)
 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
 LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
Index: /branches/SHM-dev/cfg/encoder_randomaccess_scalable10.cfg
===================================================================
--- /branches/SHM-dev/cfg/encoder_randomaccess_scalable10.cfg	(revision 1321)
+++ /branches/SHM-dev/cfg/encoder_randomaccess_scalable10.cfg	(revision 1322)
@@ -53,6 +53,5 @@
 
 #=========== Deblock Filter ============
-DeblockingFilterControlPresent: 0           # Dbl control params present (0=not present, 1=present)
-LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
+LoopFilterOffsetInPPS         : 1           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1 (default) =constant params in PPS, param = base_param)
 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
 LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
Index: /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1321)
+++ /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1322)
@@ -1335,8 +1335,7 @@
   // Deblocking filter parameters
   ("LoopFilterDisable",                               m_bLoopFilterDisable,                             false)
-  ("LoopFilterOffsetInPPS",                           m_loopFilterOffsetInPPS,                          false)
+  ("LoopFilterOffsetInPPS",                           m_loopFilterOffsetInPPS,                           true)
   ("LoopFilterBetaOffset_div2",                       m_loopFilterBetaOffsetDiv2,                           0)
   ("LoopFilterTcOffset_div2",                         m_loopFilterTcOffsetDiv2,                             0)
-  ("DeblockingFilterControlPresent",                  m_DeblockingFilterControlPresent,                 false)
   ("DeblockingFilterMetric",                          m_DeblockingFilterMetric,                         false)
 
@@ -3149,4 +3148,5 @@
   xConfirmPara( m_iQP <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51,    "QP exceeds supported range (-QpBDOffsety to 51)" );
 #endif
+  xConfirmPara( m_DeblockingFilterMetric && (m_bLoopFilterDisable || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is true then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
   xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,        "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
   xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,            "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
@@ -3366,5 +3366,5 @@
   Int m_iIntraPeriod = m_acLayerCfg[layerIdx].m_iIntraPeriod;
 #endif
-  if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
+  if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && (!m_bLoopFilterDisable) )
   {
     for(Int i=0; i<m_iGOPSize; i++)
@@ -3677,5 +3677,5 @@
     for(UInt layer=0; layer<m_numLayers; layer++)
     {
-      if ( (m_acLayerCfg[layer].m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
+      if ( (m_acLayerCfg[layer].m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && (!m_bLoopFilterDisable) )
       {
         for(Int i=0; i<m_iGOPSize; i++)
Index: /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 1321)
+++ /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 1322)
@@ -252,5 +252,4 @@
   Int       m_loopFilterBetaOffsetDiv2;                     ///< beta offset for deblocking filter
   Int       m_loopFilterTcOffsetDiv2;                       ///< tc offset for deblocking filter
-  Bool      m_DeblockingFilterControlPresent;                 ///< deblocking filter control present flag in PPS
   Bool      m_DeblockingFilterMetric;                         ///< blockiness metric in encoder
 
Index: /branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1321)
+++ /branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1322)
@@ -401,6 +401,5 @@
     m_acTEncTop[layer].setLoopFilterOffsetInPPS                            ( m_loopFilterOffsetInPPS );
     m_acTEncTop[layer].setLoopFilterBetaOffset                             ( m_loopFilterBetaOffsetDiv2  );
-    m_acTEncTop[layer].setLoopFilterTcOffset                               ( m_loopFilterTcOffsetDiv2    );
-    m_acTEncTop[layer].setDeblockingFilterControlPresent                   ( m_DeblockingFilterControlPresent);
+    m_acTEncTop[layer].setLoopFilterTcOffset                               ( m_loopFilterTcOffsetDiv2    );    
     m_acTEncTop[layer].setDeblockingFilterMetric                           ( m_DeblockingFilterMetric );
 
@@ -839,5 +838,4 @@
   m_cTEncTop.setLoopFilterBetaOffset                              ( m_loopFilterBetaOffsetDiv2  );
   m_cTEncTop.setLoopFilterTcOffset                                ( m_loopFilterTcOffsetDiv2    );
-  m_cTEncTop.setDeblockingFilterControlPresent                    ( m_DeblockingFilterControlPresent);
   m_cTEncTop.setDeblockingFilterMetric                            ( m_DeblockingFilterMetric );
 
Index: /branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h	(revision 1321)
+++ /branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h	(revision 1322)
@@ -162,5 +162,4 @@
   Int       m_loopFilterBetaOffsetDiv2;
   Int       m_loopFilterTcOffsetDiv2;
-  Bool      m_DeblockingFilterControlPresent;
   Bool      m_DeblockingFilterMetric;
   Bool      m_bUseSAO;
@@ -538,5 +537,4 @@
   Void      setLoopFilterBetaOffset         ( Int   i )      { m_loopFilterBetaOffsetDiv2  = i; }
   Void      setLoopFilterTcOffset           ( Int   i )      { m_loopFilterTcOffsetDiv2    = i; }
-  Void      setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; }
   Void      setDeblockingFilterMetric       ( Bool  b )      { m_DeblockingFilterMetric = b; }
 
@@ -604,5 +602,4 @@
   Int       getLoopFilterBetaOffset         ()      { return m_loopFilterBetaOffsetDiv2; }
   Int       getLoopFilterTcOffset           ()      { return m_loopFilterTcOffsetDiv2; }
-  Bool      getDeblockingFilterControlPresent()  { return  m_DeblockingFilterControlPresent; }
   Bool      getDeblockingFilterMetric       ()      { return m_DeblockingFilterMetric; }
 
Index: /branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1321)
+++ /branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1322)
@@ -1091,28 +1091,35 @@
   m_cPPS.setOutputFlagPresentFlag( false );
   m_cPPS.setSignHideFlag(getSignHideFlag());
+
   if ( getDeblockingFilterMetric() )
   {
-    m_cPPS.setDeblockingFilterControlPresentFlag (true);
     m_cPPS.setDeblockingFilterOverrideEnabledFlag(true);
     m_cPPS.setPicDisableDeblockingFilterFlag(false);
+  }
+  else
+  {
+    m_cPPS.setDeblockingFilterOverrideEnabledFlag( !getLoopFilterOffsetInPPS() );
+    m_cPPS.setPicDisableDeblockingFilterFlag( getLoopFilterDisable() );
+  }
+
+  if (! m_cPPS.getPicDisableDeblockingFilterFlag())
+  {
+    m_cPPS.setDeblockingFilterBetaOffsetDiv2( getLoopFilterBetaOffset() );
+    m_cPPS.setDeblockingFilterTcOffsetDiv2( getLoopFilterTcOffset() );
+  }
+  else
+  {
     m_cPPS.setDeblockingFilterBetaOffsetDiv2(0);
     m_cPPS.setDeblockingFilterTcOffsetDiv2(0);
   }
-  else
-  {
-    m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );
-
-    if (m_cPPS.getDeblockingFilterControlPresentFlag())
-    {
-      m_cPPS.setDeblockingFilterOverrideEnabledFlag( !getLoopFilterOffsetInPPS() );
-      m_cPPS.setPicDisableDeblockingFilterFlag( getLoopFilterDisable() );
-    }
-  }
-
-  if (m_cPPS.getDeblockingFilterControlPresentFlag() && ! m_cPPS.getPicDisableDeblockingFilterFlag())
-  {
-    m_cPPS.setDeblockingFilterBetaOffsetDiv2( getLoopFilterBetaOffset() );
-    m_cPPS.setDeblockingFilterTcOffsetDiv2( getLoopFilterTcOffset() );
-  }
+
+  // deblockingFilterControlPresentFlag is true if any of the settings differ from the inferred values:
+  const Bool deblockingFilterControlPresentFlag = m_cPPS.getDeblockingFilterOverrideEnabledFlag() ||
+                                                  m_cPPS.getPicDisableDeblockingFilterFlag()      ||
+                                                  m_cPPS.getDeblockingFilterBetaOffsetDiv2() != 0 ||
+                                                  m_cPPS.getDeblockingFilterTcOffsetDiv2() != 0;
+
+  m_cPPS.setDeblockingFilterControlPresentFlag(deblockingFilterControlPresentFlag);
+
   m_cPPS.setLog2ParallelMergeLevelMinus2   (m_log2ParallelMergeLevelMinus2 );
   m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG);
