Index: branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h	(revision 1332)
+++ branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h	(revision 1333)
@@ -116,7 +116,4 @@
 // ====================================================================================================================
 
-#define _SUMMARY_OUT_               0           ///< print-out PSNR results of all slices to summary.txt
-#define _SUMMARY_PIC_               0           ///< print-out PSNR results for each slice type to summary.txt
-
 #define MAX_GOP                     64          ///< max. value of hierarchical GOP size
 
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncAnalyze.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncAnalyze.h	(revision 1332)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncAnalyze.h	(revision 1333)
@@ -376,27 +376,7 @@
 
 
-  Void    printSummary(const ChromaFormat chFmt, const Bool printSequenceMSE, const BitDepths &bitDepths, Char ch='T')
+  Void    printSummary(const ChromaFormat chFmt, const Bool printSequenceMSE, const BitDepths &bitDepths, const std::string &sFilename)
   {
-    FILE* pFile = NULL;
-
-    switch( ch )
-    {
-      case 'T':
-        pFile = fopen ("summaryTotal.txt", "at");
-        break;
-      case 'I':
-        pFile = fopen ("summary_I.txt", "at");
-        break;
-      case 'P':
-        pFile = fopen ("summary_P.txt", "at");
-        break;
-      case 'B':
-        pFile = fopen ("summary_B.txt", "at");
-        break;
-      default:
-        assert(0);
-        return;
-        break;
-    }
+    FILE* pFile = fopen (sFilename.c_str(), "at");
 
     Double dFps     =   m_dFrmRate; //--CFG_KDY
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h	(revision 1332)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h	(revision 1333)
@@ -379,4 +379,7 @@
   Bool      m_bEfficientFieldIRAPEnabled;                     ///< enable to code fields in a specific, potentially more efficient, order.
   Bool      m_bHarmonizeGopFirstFieldCoupleEnabled;
+
+  std::string m_summaryOutFilename;                           ///< filename to use for producing summary output file.
+  std::string m_summaryPicFilenameBase;                       ///< Base filename to use for producing summary picture output files. The actual filenames used will have I.txt, P.txt and B.txt appended.
 
 #if SVC_EXTENSION
@@ -1021,4 +1024,9 @@
   Void      setChromaSamplingVerFilterIdc(Int i)                     { m_chromaSamplingVerFilterIdc = i;}
 
+  Void      setSummaryOutFilename(const std::string &s)              { m_summaryOutFilename = s; }
+  const std::string& getSummaryOutFilename() const                   { return m_summaryOutFilename; }
+  Void      setSummaryPicFilenameBase(const std::string &s)          { m_summaryPicFilenameBase = s; }
+  const std::string& getSummaryPicFilenameBase() const               { return m_summaryPicFilenameBase; }
+
 #if Q0189_TMVP_CONSTRAINTS
   Void  setTMVPConstraintsSEIEnabled(Int b)                  { m_TMVPConstraintsSEIEnabled = b; }
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1332)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1333)
@@ -2933,12 +2933,15 @@
   m_gcAnalyzeB.printOut('b', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
 
-#if _SUMMARY_OUT_
-  m_gcAnalyzeAll.printSummary(chFmt, printSequenceMSE, bitDepths);
-#endif
-#if _SUMMARY_PIC_
-  m_gcAnalyzeI.printSummary(chFmt, printSequenceMSE, bitDepths, 'I');
-  m_gcAnalyzeP.printSummary(chFmt, printSequenceMSE, bitDepths, 'P');
-  m_gcAnalyzeB.printSummary(chFmt, printSequenceMSE, bitDepths, 'B');
-#endif
+  if (!m_pcCfg->getSummaryOutFilename().empty())
+  {
+    m_gcAnalyzeAll.printSummary(chFmt, printSequenceMSE, bitDepths, m_pcCfg->getSummaryOutFilename());
+  }
+
+  if (!m_pcCfg->getSummaryPicFilenameBase().empty())
+  {
+    m_gcAnalyzeI.printSummary(chFmt, printSequenceMSE, bitDepths, m_pcCfg->getSummaryPicFilenameBase()+"I.txt");
+    m_gcAnalyzeP.printSummary(chFmt, printSequenceMSE, bitDepths, m_pcCfg->getSummaryPicFilenameBase()+"P.txt");
+    m_gcAnalyzeB.printSummary(chFmt, printSequenceMSE, bitDepths, m_pcCfg->getSummaryPicFilenameBase()+"B.txt");
+  }
 
   if(isField)
@@ -2952,7 +2955,8 @@
     m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
 
-#if _SUMMARY_OUT_
-    m_gcAnalyzeAll_in.printSummary(chFmt, printSequenceMSE, bitDepths);
-#endif
+    if (!m_pcCfg->getSummaryOutFilename().empty())
+    {
+      m_gcAnalyzeAll_in.printSummary(chFmt, printSequenceMSE, bitDepths, m_pcCfg->getSummaryOutFilename());
+    }
   }
 
